mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-25 11:47:56 +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:
@@ -5,7 +5,9 @@
|
||||
use crate::{test_context, utils::node_runtime};
|
||||
use codec::{Compact, Encode};
|
||||
use futures::StreamExt;
|
||||
use subxt::config::signed_extensions::{ChargeAssetTxPayment, CheckMortality, CheckNonce};
|
||||
use subxt::config::signed_extensions::{
|
||||
ChargeAssetTxPayment, CheckMortality, CheckNonce, SkipCheckIfFeeless,
|
||||
};
|
||||
use subxt::config::DefaultExtrinsicParamsBuilder;
|
||||
use subxt::config::SubstrateConfig;
|
||||
use subxt::utils::Era;
|
||||
@@ -276,13 +278,15 @@ async fn decode_signed_extensions_from_blocks() {
|
||||
|
||||
let transaction1 = submit_transfer_extrinsic_and_get_it_back!(1234);
|
||||
let extensions1 = transaction1.signed_extensions().unwrap();
|
||||
|
||||
let nonce1 = extensions1.nonce().unwrap();
|
||||
let nonce1_static = extensions1.find::<CheckNonce>().unwrap().unwrap().0;
|
||||
let tip1 = extensions1.tip().unwrap();
|
||||
let tip1_static: u128 = extensions1
|
||||
.find::<ChargeAssetTxPayment<SubstrateConfig>>()
|
||||
.find::<SkipCheckIfFeeless<SubstrateConfig, ChargeAssetTxPayment<SubstrateConfig>>>()
|
||||
.unwrap()
|
||||
.unwrap()
|
||||
.inner_signed_extension()
|
||||
.tip();
|
||||
|
||||
let transaction2 = submit_transfer_extrinsic_and_get_it_back!(5678);
|
||||
@@ -291,9 +295,10 @@ async fn decode_signed_extensions_from_blocks() {
|
||||
let nonce2_static = extensions2.find::<CheckNonce>().unwrap().unwrap().0;
|
||||
let tip2 = extensions2.tip().unwrap();
|
||||
let tip2_static: u128 = extensions2
|
||||
.find::<ChargeAssetTxPayment<SubstrateConfig>>()
|
||||
.find::<SkipCheckIfFeeless<SubstrateConfig, ChargeAssetTxPayment<SubstrateConfig>>>()
|
||||
.unwrap()
|
||||
.unwrap()
|
||||
.inner_signed_extension()
|
||||
.tip();
|
||||
|
||||
assert_eq!(nonce1, 0);
|
||||
@@ -313,7 +318,7 @@ async fn decode_signed_extensions_from_blocks() {
|
||||
"CheckMortality",
|
||||
"CheckNonce",
|
||||
"CheckWeight",
|
||||
"ChargeAssetTxPayment",
|
||||
"SkipCheckIfFeeless",
|
||||
];
|
||||
|
||||
assert_eq!(extensions1.iter().count(), expected_signed_extensions.len());
|
||||
|
||||
Reference in New Issue
Block a user