2

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 the Pre section of the Signed Extension
  • Right?: payload: Maps to the AdditionalSigned 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.

1 Answer 1

1

extrinsic maps to the struct where the trait SignExtension is implemented. You can see it clearly comparing ChargeAssetTxPayment and its definition here

You are right about payload mapping to AdditionalSigned

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.