import { IClient, IHandler } from './client'; import { ChainGetBlockResult, ChainGetBlockTransfersResult, ChainGetEraInfoResult, ChainGetEraSummaryResult, ChainGetStateRootHashResult, InfoGetChainspecResult, InfoGetDeployResult, InfoGetPeerResult, InfoGetRewardResult, InfoGetStatusResult, InfoGetTransactionResult, InfoGetValidatorChangesResult, PutDeployResult, PutTransactionResult, QueryBalanceDetailsResult, QueryBalanceResult, QueryGlobalStateResult, StateGetAccountInfo, StateGetAuctionInfoResult, StateGetAuctionInfoV1Result, StateGetAuctionInfoV2Result, StateGetBalanceResult, StateGetDictionaryResult, StateGetEntityResult, StateGetItemResult } from './response'; import { AccountIdentifier, EntityIdentifier, ParamBlockIdentifier, ParamDictionaryIdentifier, PurseIdentifier } from './request'; import { Deploy, PublicKey, Transaction } from '../types'; export declare class RpcClient implements IClient { private handler; constructor(handler: IHandler); getDeploy(hash: string): Promise; getDeployFinalizedApproval(hash: string): Promise; getTransactionByTransactionHash(transactionHash: string): Promise; getTransactionByDeployHash(deployHash: string): Promise; getTransactionFinalizedApprovalByTransactionHash(transactionHash: string): Promise; getTransactionFinalizedApprovalByDeployHash(deployHash: string): Promise; /** * ⚠️ Deprecated: `getStateItem` is deprecated and will be removed in a future release. * * Use `queryLatestGlobalState`, `queryGlobalStateByBlockHash`, * `queryGlobalStateByBlockHeight`, or `queryGlobalStateByStateHash` instead. * * Reason: The newer Global State Query API provides more consistent behavior * across block identifiers and supports both stored values and typed keys. * * @deprecated Use Global State Query methods instead. */ getStateItem(stateRootHash: string | null, key: string, path: string[]): Promise; queryLatestGlobalState(key: string, path: string[]): Promise; queryGlobalStateByBlockHash(blockHash: string, key: string, path: string[]): Promise; queryGlobalStateByBlockHeight(blockHeight: number, key: string, path: string[]): Promise; queryGlobalStateByStateHash(stateRootHash: string | null, key: string, path: string[]): Promise; getLatestEntity(entityIdentifier: EntityIdentifier): Promise; getEntityByBlockHash(entityIdentifier: EntityIdentifier, hash: string): Promise; getEntityByBlockHeight(entityIdentifier: EntityIdentifier, height: number): Promise; getAccountInfoByBlockHash(blockHash: string, pub: PublicKey): Promise; getAccountInfoByBlockHeight(blockHeight: number, pub: PublicKey): Promise; getAccountInfo(blockIdentifier: ParamBlockIdentifier | null, accountIdentifier: AccountIdentifier): Promise; getDictionaryItem(stateRootHash: string | null, uref: string, key: string): Promise; getDictionaryItemByIdentifier(stateRootHash: string | null, identifier: ParamDictionaryIdentifier): Promise; getLatestBalance(purseURef: string): Promise; getBalanceByStateRootHash(purseURef: string, stateRootHash: string): Promise; getEraInfoLatest(): Promise; getEraInfoByBlockHeight(height: number): Promise; getEraInfoByBlockHash(hash: string): Promise; getLatestBlock(): Promise; getBlockByHash(hash: string): Promise; getBlockByHeight(height: number): Promise; getLatestBlockTransfers(): Promise; getBlockTransfersByHash(blockHash: string): Promise; getBlockTransfersByHeight(height: number): Promise; getEraSummaryLatest(): Promise; getEraSummaryByHash(blockHash: string): Promise; getEraSummaryByHeight(height: number): Promise; getLatestAuctionInfo(): Promise; getLatestAuctionInfoV1(): Promise; getLatestAuctionInfoV2(): Promise; getAuctionInfoByHash(blockHash: string): Promise; getAuctionInfoV1ByHash(blockHash: string): Promise; getAuctionInfoV2ByHash(blockHash: string): Promise; getAuctionInfoByHeight(height: number): Promise; getAuctionInfoV1ByHeight(height: number): Promise; getAuctionInfoV2ByHeight(height: number): Promise; getStateRootHashLatest(): Promise; getStateRootHashByHash(blockHash: string): Promise; getStateRootHashByHeight(height: number): Promise; getValidatorChangesInfo(): Promise; getStatus(): Promise; getPeers(): Promise; putDeploy(deploy: Deploy): Promise; putTransaction(transaction: Transaction): Promise; queryLatestBalance(identifier: PurseIdentifier): Promise; queryBalanceByBlockHeight(purseIdentifier: PurseIdentifier, height: number): Promise; queryBalanceByBlockHash(purseIdentifier: PurseIdentifier, blockHash: string): Promise; queryBalanceByStateRootHash(purseIdentifier: PurseIdentifier, stateRootHash: string): Promise; queryLatestBalanceDetails(purseIdentifier: PurseIdentifier): Promise; queryBalanceDetailsByStateRootHash(purseIdentifier: PurseIdentifier, stateRootHash: string): Promise; queryBalanceDetailsByBlockHeight(purseIdentifier: PurseIdentifier, height: number): Promise; queryBalanceDetailsByBlockHash(purseIdentifier: PurseIdentifier, blockHash: string): Promise; getChainspec(): Promise; getValidatorRewardByEraID(validator: PublicKey, eraID: number): Promise; getValidatorRewardByBlockHash(validator: PublicKey, blockHash: string): Promise; getValidatorRewardByBlockHeight(validator: PublicKey, height: number): Promise; getDelegatorRewardByEraID(validator: PublicKey, delegator: PublicKey, eraID: number): Promise; getDelegatorRewardByBlockHash(validator: PublicKey, delegator: PublicKey, blockHash: string): Promise; getDelegatorRewardByBlockHeight(validator: PublicKey, delegator: PublicKey, height: number): Promise; getLatestValidatorReward(validator: PublicKey): Promise; getLatestDelegatorReward(validator: PublicKey, delegator: PublicKey): Promise; /** * Waits for a transaction to be confirmed within a given timeout period. * Implements a retry mechanism to handle transient errors from the getInfo function. * * @template T - The expected return type of the transaction info. * @param getInfo - A function that fetches transaction info based on its hash. * @param hash - The transaction hash to monitor. * @param timeout - The maximum time (in milliseconds) to wait for confirmation. * @param maxRetries - The maximum number of retries for transient errors. * @param retryDelay - The delay (in milliseconds) between retry attempts. * @returns A promise that resolves with the transaction info if confirmed, otherwise rejects on timeout or persistent errors. * @throws {Error} If the timeout is reached before confirmation or if getInfo fails consistently beyond the allowed retries. */ private waitForConfirmation; /** * Waits for a transaction to be confirmed on-chain. * @param transaction - The transaction instance. * @param timeout - Optional timeout in milliseconds (default: 6000ms). * @returns A promise that resolves to `InfoGetTransactionResult` if successful. * @throws An error if the transaction times out. */ waitForTransaction(transaction: Transaction, timeout?: number): Promise; /** * Waits for a deploy to be confirmed on-chain. * @param deploy - The deploy instance. * @param timeout - Optional timeout in milliseconds (default: 60000ms). * @returns A promise that resolves to `InfoGetDeployResult` if successful. * @throws An error if the deploy times out. */ waitForDeploy(deploy: Deploy, timeout?: number): Promise; private parseResponse; private processRequest; }