ROOT
token?Since ROOT token is a security token, it's managed by the balances
pallet. To transfer ROOT tokens, use the following snippet:
Note: ROOT token has 6 decimals.
XRP
or any other fungible tokens?XRP and any other non-default fungible tokens are managed by the assets
pallet, separate from the balances
pallet. That also means you need to provide the asset ID when you want to transfer any of these tokens.
Tip: To retrieve a list of available tokens and their asset IDs, checkout Tokens section in our Block Explorer.
To create your NFT collection, call the nft.createCollection()
extrinsic with the following parameters:
Caution: The royaltiesSchedule
is in permill (parts per million) scaling, so if you want a 10% royalty, that would be 100,000
(as 100_000 / 1_000_000 = 0.1
).
Once your collection is created, the collection owner can call the nft.mint()
method on the collection contract to start minting additional tokens so long as the max issuance has not been reached:
The example below shows how to subscribe to new blocks. It displays the block number every time a new block is seen by the node you are connected to.
A block hash refers to the hash over the header, the extrinsic hash refers to the hash of the encoded extrinsic. Since all objects returned by the API implement the .hash => Hash
getter, we can simply use this to view the actual hash.
The block author is encoded inside the consensus logs for the block. To extract it, you need to decode the log (which the API does do) and then map the index of the validator to the list of session validators. This extraction is however available on the API derive for new head subscriptions, which returns an extended header with the author populated (assuming that the digest logs are known).
For a single header only, the derives also contain a getHeader
, which once again returns a header extended with the author:
The transactions are included in a signed block as part of the extrinsics - some of these will be unsigned and generated by the block author and some of these may be submitted from external sources and be signed (some palettes use unsigned transactions, so signed/unsigned is not an indication of origin). To retrieve the block and display the transaction information, we can do the following:
In the above example, .toHuman()
is used to format the extrinsic into a human-readable representation. You can inspect/extract specific fields from the decoded extrinsic as required. For instance ex.method.section
would return the pallet that executed this transaction.
While the blocks contain the extrinsics, the system event storage will include the events and the details needed to allow for a mapping between them. For events, the phase
is an enum that would be isApplyExtrinsic
with the index in the cases where it refers to an extrinsic in a block. This index maps through the order of the extrinsics as found.
To perform a mapping between the two, we need information from from both sources, as per the example below.
The code below extends the above example, where extrinsics are mapped to their blocks. In this example, we will specifically look for specific extrinsic events—namely, the system.ExtrinsicSuccess
and system.ExtrinsicFailed
events. The same logic can be applied to inspect any other type of expected event.