Provides access to the exported methods of RPC Client and data structures where serialized response.
The RpcClient implements RPC methods according to spec. RpcClient unites implementation of ClientInformational interface related to spec and ClientPOS interface related to spec.
The configuration is flexible, and caller can provide custom configurations, the most common usage is to create RpcClient which depends on HttpHandler interface.
import { HttpHandler, RpcClient } from 'casper-js-sdk';
const rpcHandler = new HttpHandler('http://<Node Address>:7777/rpc');
const rpcCient = new RpcClient(rpcHandler);The RpcClient combines the functionalities of ClientPOS, ClientInformational, and ClientTransactional.
The ClientPOS interface includes methods related to the Proof-of-Stake functionality of the Casper network.
getLatestAuctionInfo()- Returns the latest auction information.
Returns:StateGetAuctionInfoResult
getAuctionInfoByHash(blockHash: string)-Retrieves auction information for a specific block by hash.
Returns:StateGetAuctionInfoResult
getAuctionInfoByHeight(height: number)- Retrieves auction information for a specific block by height.
Returns:StateGetAuctionInfoResult
getEraInfoLatest()- Fetches the latest era information.
Returns:ChainGetEraInfoResult
getEraInfoByBlockHeight(height: number)- Fetches era information for a specific block by height.
Returns:ChainGetEraInfoResult
getEraInfoByBlockHash(hash: string)- Fetches era information for a specific block by hash.
Returns:ChainGetEraInfoResult
getValidatorChangesInfo()- Retrieves validator status changes during an era.
Returns:InfoGetValidatorChangesResult
The ClientInformational interface provides methods for querying node-specific and network-wide information.
getLatestBalance(purseURef: string)- Retrieves the latest balance for a given purse.
Returns:StateGetBalanceResult
getBalanceByStateRootHash(purseURef: string, stateRootHash: string)- Retrieves the balance for a specific state root hash.
Returns:StateGetBalanceResult
getDeploy(hash: string)- Retrieves a deploy by its hash.
Returns:InfoGetDeployResult
getDeployFinalizedApproval(hash: string)- Retrieves a deploy with finalized approvals.
Returns:InfoGetDeployResult
getTransactionByTransactionHash(transactionHash: string)- Retrieves a transaction by its hash.
Returns:InfoGetTransactionResult
getTransactionByDeployHash(deployHash: string)- Retrieves a transaction by its deploy hash.
Returns:InfoGetTransactionResult
getDictionaryItem(stateRootHash: string | null, uref: string, key: string)- Retrieves an item from a dictionary.
Returns:StateGetDictionaryResult
getDictionaryItemByIdentifier(stateRootHash: string | null, identifier: ParamDictionaryIdentifier)- Retrieves an item using a dictionary identifier.
Returns:StateGetDictionaryResult
queryLatestGlobalState(key: string, path: string[])- Queries the latest global state.
Returns:QueryGlobalStateResult
getAccountInfoByBlockHash(blockHash: string, pub: PublicKey)- Retrieves account information using a block hash.
Returns:StateGetAccountInfo
getLatestBlock()- Retrieves the latest block.
Returns:ChainGetBlockResult
getEraSummaryLatest()- Fetches the latest era summary.
Returns:ChainGetEraSummaryResult
getStatus()- Fetches the node's current status.
Returns:InfoGetStatusResult
The ClientTransactional interface provides methods for deploying transactions to the network.
putDeploy(deploy: Deploy)- Sends a deploy to the network.
Returns:PutDeployResult
putTransactionV1(transaction: TransactionV1)- Sends a transaction (v1) to the network.
Returns:PutTransactionResult