For now I have custom SignedExtension
in my substrate node:
#[derive(Encode, Decode, Clone, Eq, PartialEq, TypeInfo)]
#[scale_info(skip_type_params(T))]
pub struct CheckAccount<T> {
timestamp: u64,
_marker: PhantomData<T>,
}
In my polkadot-js-api I define this like so:
let signedExtensions = {
CheckAccount: {
extrinsic: {
timestamp: "u64",
},
payload: {},
},
};
const api = await ApiPromise.create({
...
SignedExtensions,
});
And to perform transaction I have specify extension value manually
api.tx.balances
.transfer(bob, 1000)
.signAndSend(alice, { timestamp: Date.now() })
The questing is how can I get behaviour for my custom SignedExtension
, for example like CheckNonce
have, when it automatically initialised with api and don't have to specify it manually?
Update
I want to get something like this:
api.setGetterForSignedExtension("CheckAccount", Date.now);
And then I just simply can call
api.tx.balances
.transfer(bob, 1000)
.signAndSend(Alice);
P.S.
And if this possible can custom SignedExtension be integrated with polkadot/apps to allow submit extrinsic throw polkadot ui. Now when I try do it got this error
1002: Verification Error: Runtime error: Execution failed: Runtime panicked: Bad input data provided to validate_transaction: Could not decode `RuntimeCall`, variant doesn't exist: RuntimeApi, Execution failed: Runtime panicked: Bad input data provided to validate_transaction: Could not decode `RuntimeCall`, variant doesn't exist