Request RPC via http. How to obtain transaction results and transaction time.
Is there a friend who can give me some advice? thank you very much indeed
Substrate and Polkadot Stack Exchange is a question and answer site for developers building blockchains with the Substrate SDK. It only takes a minute to sign up.
Sign up to join this communityRequest RPC via http. How to obtain transaction results and transaction time.
Is there a friend who can give me some advice? thank you very much indeed
For the extraction of the timestamp, this has been answered elsewhere, aka it would the the timestamp of the block that the extrinsic was included in.
To check the status of the execution, you need to map the extrinsic to the events.
Like everything is Substrate (extrinsics, storage, errors) this all hangs off SCALE encoding and the information in the on-chain metadata, as retrieved via state_getMetadata. The metadata explicitly defines all the indexes, arguments and types for all of these.
The steps would be -
EventRecord
, it should be ApplyExtrinsic(u32)
where the u32
is the index of the extrinsic in the blockSystem.ExtrinsicSuccess
or System.ExtrinsicFailed
DispatchError -> Module
will have the error indexes. You can map these using the error indexes from the on-chain metadataHere you have a comprehensive guide to get the required (and other related) information by using Polkadot-js API:
https://polkadot.js.org/docs/api/cookbook/blocks/
In that guide, you have a section to see all the extrinsic information and another section to determine if an extrinsic succeeded/failed.