import { AccessKeyWithPublicKey, BlockId, BlockReference, BlockResult, BlockChangeResult, ChangeResult, ChunkId, ChunkResult, EpochValidatorInfo, FinalExecutionOutcome, GasPrice, LightClientProof, LightClientProofRequest, NextLightClientBlockRequest, NextLightClientBlockResponse, NearProtocolConfig, NodeStatusResult, QueryResponseKind } from '@meer-js/types'; import { SignedTransaction } from '@meer-js/transactions'; import { Provider } from './provider.js'; import { ConnectionInfo } from './fetch_json.js'; import { TxExecutionStatus } from '@meer-js/types'; type RequestOptions = { /** * Number of retries before giving up on a request */ retries: number; /** * Wait until next retry in milliseconds */ wait: number; /** * Exponential back off for waiting to retry again */ backoff: number; }; /** * Client class to interact with the [NEAR RPC API](https://docs.near.org/api/rpc/introduction). * @see [https://github.com/near/nearcore/tree/master/chain/jsonrpc](https://github.com/near/nearcore/tree/master/chain/jsonrpc) */ export declare class JsonRpcProvider extends Provider { /** @hidden */ readonly connection: ConnectionInfo; /** @hidden */ readonly options: RequestOptions; /** * @param connectionInfo Connection info */ constructor(connectionInfo: ConnectionInfo, options?: Partial); /** * Gets the RPC's status * @see [https://docs.near.org/docs/develop/front-end/rpc#general-validator-status](https://docs.near.org/docs/develop/front-end/rpc#general-validator-status) */ status(): Promise; /** * Sends a signed transaction to the RPC * * @param signedTransaction The signed transaction being sent * @param waitUntil */ sendTransactionUntil(signedTransaction: SignedTransaction, waitUntil: TxExecutionStatus): Promise; /** * Sends a signed transaction to the RPC and waits until transaction is fully complete * @see [https://docs.near.org/docs/develop/front-end/rpc#send-transaction-await](https://docs.near.org/docs/develop/front-end/rpc#general-validator-status) * * @param signedTransaction The signed transaction being sent */ sendTransaction(signedTransaction: SignedTransaction): Promise; /** * Sends a signed transaction to the RPC and immediately returns transaction hash * See [docs for more info](https://docs.near.org/docs/develop/front-end/rpc#send-transaction-async) * @param signedTransaction The signed transaction being sent * @returns {Promise} */ sendTransactionAsync(signedTransaction: SignedTransaction): Promise; /** * Gets a transaction's status from the RPC * @see [https://docs.near.org/docs/develop/front-end/rpc#transaction-status](https://docs.near.org/docs/develop/front-end/rpc#general-validator-status) * * @param txHash A transaction hash as either a Uint8Array or a base58 encoded string * @param accountId The NEAR account that signed the transaction * @param waitUntil */ txStatus(txHash: Uint8Array | string, accountId: string, waitUntil?: TxExecutionStatus): Promise; private txStatusUint8Array; private txStatusString; /** * Gets a transaction's status from the RPC with receipts * See [docs for more info](https://docs.near.org/docs/develop/front-end/rpc#transaction-status-with-receipts) * @param txHash The hash of the transaction * @param accountId The NEAR account that signed the transaction * @param waitUntil * @returns {Promise} */ txStatusReceipts(txHash: Uint8Array | string, accountId: string, waitUntil?: TxExecutionStatus): Promise; /** * Query the RPC by passing an {@link "@near-js/types".provider/request.RpcQueryRequest | RpcQueryRequest } * @see [https://docs.near.org/api/rpc/contracts](https://docs.near.org/api/rpc/contracts) * * @typeParam T the shape of the returned query response */ query(...args: any[]): Promise; /** * Query for block info from the RPC * pass block_id OR finality as blockQuery, not both * @see [https://docs.near.org/api/rpc/block-chunk](https://docs.near.org/api/rpc/block-chunk) * * @param blockQuery {@link BlockReference} (passing a {@link BlockId} is deprecated) */ block(blockQuery: BlockId | BlockReference): Promise; /** * Query changes in block from the RPC * pass block_id OR finality as blockQuery, not both * @see [https://docs.near.org/api/rpc/block-chunk](https://docs.near.org/api/rpc/block-chunk) */ blockChanges(blockQuery: BlockReference): Promise; /** * Queries for details about a specific chunk appending details of receipts and transactions to the same chunk data provided by a block * @see [https://docs.near.org/api/rpc/block-chunk](https://docs.near.org/api/rpc/block-chunk) * * @param chunkId Hash of a chunk ID or shard ID */ chunk(chunkId: ChunkId): Promise; /** * Query validators of the epoch defined by the given block id. * @see [https://docs.near.org/api/rpc/network#validation-status](https://docs.near.org/api/rpc/network#validation-status) * * @param blockId Block hash or height, or null for latest. */ validators(blockId: BlockId | null): Promise; /** * Gets the protocol config at a block from RPC * * @param blockReference specifies the block to get the protocol config for */ experimental_protocolConfig(blockReference: BlockReference | { sync_checkpoint: 'genesis'; }): Promise; /** * Gets a light client execution proof for verifying execution outcomes * @see [https://github.com/nearprotocol/NEPs/blob/master/specs/ChainSpec/LightClient.md#light-client-proof](https://github.com/nearprotocol/NEPs/blob/master/specs/ChainSpec/LightClient.md#light-client-proof) */ lightClientProof(request: LightClientProofRequest): Promise; /** * Returns the next light client block as far in the future as possible from the last known hash * to still be able to validate from that hash. This will either return the last block of the * next epoch, or the last final known block. * * @see [https://github.com/near/NEPs/blob/master/specs/ChainSpec/LightClient.md#light-client-block](https://github.com/near/NEPs/blob/master/specs/ChainSpec/LightClient.md#light-client-block) */ nextLightClientBlock(request: NextLightClientBlockRequest): Promise; /** * Gets access key changes for a given array of accountIds * See [docs for more info](https://docs.near.org/docs/develop/front-end/rpc#view-access-key-changes-all) * @returns {Promise} */ accessKeyChanges(accountIdArray: string[], blockQuery: BlockReference): Promise; /** * Gets single access key changes for a given array of access keys * pass block_id OR finality as blockQuery, not both * See [docs for more info](https://docs.near.org/docs/develop/front-end/rpc#view-access-key-changes-single) * @returns {Promise} */ singleAccessKeyChanges(accessKeyArray: AccessKeyWithPublicKey[], blockQuery: BlockReference): Promise; /** * Gets account changes for a given array of accountIds * pass block_id OR finality as blockQuery, not both * See [docs for more info](https://docs.near.org/docs/develop/front-end/rpc#view-account-changes) * @returns {Promise} */ accountChanges(accountIdArray: string[], blockQuery: BlockReference): Promise; /** * Gets contract state changes for a given array of accountIds * pass block_id OR finality as blockQuery, not both * Note: If you pass a keyPrefix it must be base64 encoded * See [docs for more info](https://docs.near.org/docs/develop/front-end/rpc#view-contract-state-changes) * @returns {Promise} */ contractStateChanges(accountIdArray: string[], blockQuery: BlockReference, keyPrefix?: string): Promise; /** * Gets contract code changes for a given array of accountIds * pass block_id OR finality as blockQuery, not both * Note: Change is returned in a base64 encoded WASM file * See [docs for more info](https://docs.near.org/docs/develop/front-end/rpc#view-contract-code-changes) * @returns {Promise} */ contractCodeChanges(accountIdArray: string[], blockQuery: BlockReference): Promise; /** * Returns gas price for a specific block_height or block_hash. * @see [https://docs.near.org/api/rpc/gas](https://docs.near.org/api/rpc/gas) * * @param blockId Block hash or height, or null for latest. */ gasPrice(blockId: BlockId | null): Promise; sendJsonRpc(method: string, params: object): Promise; } export {}; //# sourceMappingURL=json-rpc-provider.d.ts.map