mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-18 10:35:42 +00:00
config: Add SkipCheckIfFeeless signed extension (#1264)
* config: Add `SkipCheckIfFeeless` signed extension Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * config: Add extra extension to the default params Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * examples: Adjust signed extension example Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * config: Extend SkipCheckIfFeeless with inner signed extension Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * config: Configure SkipCheck with inner signed extension params Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * config: Implement Deafult for SkipCheckIfFeelessParams with Option Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * examples: Fix example with proper extension Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * config: Extend <T as Config>::AssetId with EncodeAsType and Clone Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * config: Add SkipCheck with AssetTx Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * config: Encode as type from metadata the inner signed extensions Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * Adjust examples Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * blocks: Use `SkipCheckIfFeeless` for decoding the tip of extensions Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * config: Decode `SkipCheckIfFeeless` with `Self` Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * tests: Adjust testing Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * config: Descriptive errors for building `SkipCheckIfFeeless` Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * config: Add docs for extra error types Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * subxt: Add extra derives to signed extensions Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * config: Use `Default::default` to simplify type init Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> --------- Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
use codec::Encode;
|
||||
use scale_encode::EncodeAsType;
|
||||
use subxt::client::OfflineClientT;
|
||||
use subxt::config::signed_extensions;
|
||||
use subxt::config::{
|
||||
@@ -11,6 +12,7 @@ pub mod runtime {}
|
||||
|
||||
// We don't need to construct this at runtime,
|
||||
// so an empty enum is appropriate:
|
||||
#[derive(EncodeAsType)]
|
||||
pub enum CustomConfig {}
|
||||
|
||||
impl Config for CustomConfig {
|
||||
@@ -32,6 +34,10 @@ impl Config for CustomConfig {
|
||||
signed_extensions::CheckMortality<Self>,
|
||||
signed_extensions::ChargeAssetTxPayment<Self>,
|
||||
signed_extensions::ChargeTransactionPayment,
|
||||
signed_extensions::SkipCheckIfFeeless<
|
||||
Self,
|
||||
signed_extensions::ChargeAssetTxPayment<Self>,
|
||||
>,
|
||||
// And add a new one of our own:
|
||||
CustomSignedExtension,
|
||||
),
|
||||
@@ -81,8 +87,8 @@ impl ExtrinsicParamsEncoder for CustomSignedExtension {
|
||||
pub fn custom(
|
||||
params: DefaultExtrinsicParamsBuilder<CustomConfig>,
|
||||
) -> <<CustomConfig as Config>::ExtrinsicParams as ExtrinsicParams<CustomConfig>>::OtherParams {
|
||||
let (a, b, c, d, e, f, g) = params.build();
|
||||
(a, b, c, d, e, f, g, ())
|
||||
let (a, b, c, d, e, f, g, h) = params.build();
|
||||
(a, b, c, d, e, f, g, h, ())
|
||||
}
|
||||
|
||||
#[tokio::main]
|
||||
|
||||
Reference in New Issue
Block a user