diff --git a/docs/cookbook/blocks.md b/docs/cookbook/blocks.md index 3cd69d8b18..b35d991389 100644 --- a/docs/cookbook/blocks.md +++ b/docs/cookbook/blocks.md @@ -53,8 +53,19 @@ const signedBlock = await this.api.rpc.chain.getBlock(); // the information for each of the contained extrinsics signedBlock.block.extrinsics.forEach((ex, index) => { - // the extrinsics are decoded by the API + // the extrinsics are decoded by the API, human-like view console.log(index, ex.toHuman()); + + const { isSigned, meta, method: { args, method, section } } = ex; + + // explicit display of name, args & documentation + console.log(`${section}.${method}(${args.map((a) => a.toString()).join(', ')})`); + console.log(meta.documentation.map((d) => d.toString()).join('\n')); + + // signer/nonce info + if (isSigned) { + console.log(`signer=${ex.signer.toString()}, nonce=${ex.nonce.toString()}`); + } }); ```