From 58fd6543d6f45c4840c4525e62706cb1d18cad30 Mon Sep 17 00:00:00 2001 From: Tadeo hepperle Date: Tue, 24 Oct 2023 13:50:01 +0200 Subject: [PATCH] support both ChargeTransactionPayment and ChargeAssetTxPayment --- subxt/src/blocks/extrinsic_types.rs | 6 +++++- testing/integration-tests/src/full_client/blocks/mod.rs | 2 -- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/subxt/src/blocks/extrinsic_types.rs b/subxt/src/blocks/extrinsic_types.rs index 3ca0f1b50b..543577b8f0 100644 --- a/subxt/src/blocks/extrinsic_types.rs +++ b/subxt/src/blocks/extrinsic_types.rs @@ -668,7 +668,11 @@ impl<'a> ExtrinsicSignedExtensions<'a> { /// The tip of an extrinsic, extracted from the ChargeTransactionPayment signed extension. pub fn tip(&self) -> Option { - let tip = self.find("ChargeAssetTxPayment")?; + let tip = self + .find("ChargeTransactionPayment") + .or_else(|| self.find("ChargeAssetTxPayment"))?; + // Note: ChargeAssetTxPayment might have addition information in it (asset_id). + // But both should start with a compact encoded u128, so this decoding is fine. let tip = Compact::::decode(&mut tip.bytes()).ok()?.0; Some(tip) } diff --git a/testing/integration-tests/src/full_client/blocks/mod.rs b/testing/integration-tests/src/full_client/blocks/mod.rs index c9278aa0c4..209f76bef2 100644 --- a/testing/integration-tests/src/full_client/blocks/mod.rs +++ b/testing/integration-tests/src/full_client/blocks/mod.rs @@ -2,12 +2,10 @@ // This file is dual-licensed as Apache-2.0 or GPL-3.0. // see LICENSE for license details. - use crate::{test_context, utils::node_runtime}; use codec::{Compact, Encode}; use futures::StreamExt; - use subxt::config::DefaultExtrinsicParamsBuilder; use subxt_metadata::Metadata; use subxt_signer::sr25519::dev;