Polkadot/api has a way to detail signed extensions and I want to understand (so I can use it for our own custom signed extension) what the extrinsic and payload parameters map to.
Here's an example using some of the built in signed extensions (From: substrate.ts)
const api = await ApiPromise.create({
signedExtensions: {
CheckMortality: {
extrinsic: {
era: 'ExtrinsicEra'
},
payload: {
blockHash: 'Hash'
}
},
CheckNonce: {
extrinsic: {
nonce: 'Compact<Index>'
},
payload: {}
}
});
These should both map to parts of the transaction format: https://docs.substrate.io/reference/transaction-format/#signed-extensions
My semi-wrong understanding currently:
- Wrong:
extrinsic
: Maps to thePre
section of the Signed Extension - Right?:
payload
: Maps to theAdditionalSigned
section of the Signed Extension
This doesn't quite work as check_nonce.rs has Pre = ();
So how do I know that CheckNonce
needs extrinsic: { nonce }
for Polkadotjs or that CheckMortality
needs extrinsic: { era }
?
Nothing really appears to map to the Pre
section of a signed extension, so also not sure how to tell polkadot/api about additional information there.