Utility Helpers
Provider Helpers
extractBalanceFromResponse
Extracts the specific balance denomination from the ABCI response
Parameters
abciData(string | null) the base64-encoded ABCI datadenominationstring the required denomination
extractSequenceFromResponse
Extracts the account sequence from the ABCI response
Parameters
abciData(string | null) the base64-encoded ABCI data
Returns number
extractAccountNumberFromResponse
Extracts the account number from the ABCI response
Parameters
abciData(string | null) the base64-encoded ABCI data
Returns number
waitForTransaction
Waits for the transaction to be committed to a block in the chain of the specified provider. This helper does a search for incoming blocks and checks if a transaction
Parameters
providerProvider the provider instancehashstring the base64-encoded hash of the transactionfromHeightnumber the starting height for the search. If omitted, it is the latest block in the chain ( optional, defaultlatest)timeoutnumber the timeout in MS for the search (optional, default15000)
Returns Promise<Tx>
Request Helpers
newRequest
Creates a new JSON-RPC 2.0 request
Parameters
methodstring the requested methodparamsArray<string>? the requested params, if any
Returns RPCRequest
newResponse
Creates a new JSON-RPC 2.0 response
Parameters
resultResult the response result, if anyerrorRPCError the response error, if any
Returns RPCResponse<Result>
parseABCI
Parses the base64 encoded ABCI JSON into a concrete type
Parameters
datastring the base64-encoded JSON
Returns Result
stringToBase64
Converts a string into base64 representation
Parameters
strstring the raw string
Returns string
base64ToUint8Array
Converts a base64 string into a Uint8Array representation
Parameters
strstring the base64-encoded string
Returns Uint8Array
uint8ArrayToBase64
Converts a Uint8Array into base64 representation
Parameters
dataUint8Array the Uint8Array to be encoded
Returns string