1

During building the block from extrinsics in block-builder I need to access individual extrinsic data, namely signer's AccointId and a nonce. I assume these data a part of SignaturePayload of the Extrinsic trait but can not find a way to get these.

pub fn build(mut self) -> Result<BuiltBlock<Block, backend::StateBackendFor<B, Block>>, Error> {
    let extrinsics = self.extrinsics.clone();
    extrinsics.into_iter().for_each(|xt| {
        // Here I'm trying to get the data from the extrinsic, something like:
        // let nonce = xt.nonce;
        // let account_id = xt.account_id;
    }

    // The rest of the build function logic
}

How can I get signer's AccountId and nonce here?

  • I can investigate further and test, but I would think that the `ensure_signed!` macro, like it's used in the [balances pallet](https://github.com/paritytech/substrate/blob/7eb671fa2532e618589c057e5ed50b06d5f9a44d/frame/balances/src/lib.rs#L262) should fit this use case. – Nuke Apr 07 '21 at 15:50
  • Can I use `ensure_signed`outside of the runtime? If so, I'm missing how to use it to get the nonce – Gleb Urvanov Apr 09 '21 at 12:28

0 Answers0