Trait ExtrinsicParamsEncoder

Source
pub trait ExtrinsicParamsEncoder: 'static {
    // Provided methods
    fn encode_value_to(&self, _v: &mut Vec<u8>) { ... }
    fn encode_signer_payload_value_to(&self, v: &mut Vec<u8>) { ... }
    fn encode_implicit_to(&self, _v: &mut Vec<u8>) { ... }
    fn inject_signature(&mut self, _account_id: &dyn Any, _signature: &dyn Any) { ... }
}
Expand description

This trait is expected to be implemented for any ExtrinsicParams, and defines how to encode the “additional” and “extra” params. Both functions are optional and will encode nothing by default.

Provided Methods§

Source

fn encode_value_to(&self, _v: &mut Vec<u8>)

This is expected to SCALE encode the transaction extension data to some buffer that has been provided. This data is attached to the transaction and also (by default) attached to the signer payload which is signed to provide a signature for the transaction.

If ExtrinsicParamsEncoder::encode_signer_payload_value_to is implemented, then that will be used instead when generating a signer payload. Useful for eg the VerifySignature extension, which is send with the transaction but is not a part of the signer payload.

Source

fn encode_signer_payload_value_to(&self, v: &mut Vec<u8>)

See ExtrinsicParamsEncoder::encode_value_to. This defaults to calling that method, but if implemented will dictate what is encoded to the signer payload.

Source

fn encode_implicit_to(&self, _v: &mut Vec<u8>)

This is expected to SCALE encode the “implicit” (formally “additional”) parameters to some buffer that has been provided. These parameters are not sent along with the transaction, but are taken into account when signing it, meaning the client and node must agree on their values.

Source

fn inject_signature(&mut self, _account_id: &dyn Any, _signature: &dyn Any)

Set the signature. This happens after we have constructed the extrinsic params, and so is defined here rather than on the params, below. We need to use &dyn Any to keep this trait object safe, but can downcast in the impls.

§Panics

Implementations of this will likely try to downcast the provided account_id and signature into T::AccountId and T::Signature (where T: Config), and are free to panic if this downcasting does not succeed.

In typical usage, this is not a problem, since this method is only called internally and provided values which line up with the relevant Config. In theory though, this method can be called manually with any types, hence this warning.

Implementors§

Source§

impl ExtrinsicParamsEncoder for ChargeTransactionPayment

Source§

impl ExtrinsicParamsEncoder for CheckMetadataHash

Source§

impl ExtrinsicParamsEncoder for CheckNonce

Source§

impl ExtrinsicParamsEncoder for CheckSpecVersion

Source§

impl ExtrinsicParamsEncoder for CheckTxVersion

Source§

impl<T, A> ExtrinsicParamsEncoder for AnyOf<T, (A,)>
where T: Config, A: TransactionExtension<T>,

Source§

impl<T, A, B> ExtrinsicParamsEncoder for AnyOf<T, (A, B)>

Source§

impl<T, A, B, C> ExtrinsicParamsEncoder for AnyOf<T, (A, B, C)>

Source§

impl<T, A, B, C, D> ExtrinsicParamsEncoder for AnyOf<T, (A, B, C, D)>

Source§

impl<T, A, B, C, D, E> ExtrinsicParamsEncoder for AnyOf<T, (A, B, C, D, E)>

Source§

impl<T, A, B, C, D, E, F> ExtrinsicParamsEncoder for AnyOf<T, (A, B, C, D, E, F)>

Source§

impl<T, A, B, C, D, E, F, G> ExtrinsicParamsEncoder for AnyOf<T, (A, B, C, D, E, F, G)>

Source§

impl<T, A, B, C, D, E, F, G, H> ExtrinsicParamsEncoder for AnyOf<T, (A, B, C, D, E, F, G, H)>

Source§

impl<T, A, B, C, D, E, F, G, H, I> ExtrinsicParamsEncoder for AnyOf<T, (A, B, C, D, E, F, G, H, I)>

Source§

impl<T, A, B, C, D, E, F, G, H, I, J> ExtrinsicParamsEncoder for AnyOf<T, (A, B, C, D, E, F, G, H, I, J)>

Source§

impl<T, A, B, C, D, E, F, G, H, I, J, K> ExtrinsicParamsEncoder for AnyOf<T, (A, B, C, D, E, F, G, H, I, J, K)>

Source§

impl<T, A, B, C, D, E, F, G, H, I, J, K, L> ExtrinsicParamsEncoder for AnyOf<T, (A, B, C, D, E, F, G, H, I, J, K, L)>

Source§

impl<T, A, B, C, D, E, F, G, H, I, J, K, L, M> ExtrinsicParamsEncoder for AnyOf<T, (A, B, C, D, E, F, G, H, I, J, K, L, M)>

Source§

impl<T, A, B, C, D, E, F, G, H, I, J, K, L, M, N> ExtrinsicParamsEncoder for AnyOf<T, (A, B, C, D, E, F, G, H, I, J, K, L, M, N)>

Source§

impl<T, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O> ExtrinsicParamsEncoder for AnyOf<T, (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O)>

Source§

impl<T, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P> ExtrinsicParamsEncoder for AnyOf<T, (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P)>

Source§

impl<T, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q> ExtrinsicParamsEncoder for AnyOf<T, (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q)>

Source§

impl<T, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R> ExtrinsicParamsEncoder for AnyOf<T, (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R)>

Source§

impl<T, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S> ExtrinsicParamsEncoder for AnyOf<T, (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S)>

Source§

impl<T, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, U> ExtrinsicParamsEncoder for AnyOf<T, (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, U)>

Source§

impl<T, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, U, V> ExtrinsicParamsEncoder for AnyOf<T, (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, U, V)>

Source§

impl<T: Config> ExtrinsicParamsEncoder for ChargeAssetTxPayment<T>

Source§

impl<T: Config> ExtrinsicParamsEncoder for CheckGenesis<T>

Source§

impl<T: Config> ExtrinsicParamsEncoder for CheckMortality<T>

Source§

impl<T: Config> ExtrinsicParamsEncoder for VerifySignature<T>