mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-24 20:37:58 +00:00
Update to 2024 edition (#2001)
* Update to 2024 edition * Update to 2024 edition; fmt, use<> and remove refs * async functions
This commit is contained in:
@@ -12,8 +12,8 @@ use crate::utils::node_runtime;
|
||||
#[cfg(fullclient)]
|
||||
use subxt::{
|
||||
config::{
|
||||
transaction_extensions::{ChargeAssetTxPayment, CheckMortality, CheckNonce},
|
||||
DefaultExtrinsicParamsBuilder, SubstrateConfig,
|
||||
transaction_extensions::{ChargeAssetTxPayment, CheckMortality, CheckNonce},
|
||||
},
|
||||
utils::Era,
|
||||
};
|
||||
@@ -213,15 +213,19 @@ async fn fetch_block_and_decode_extrinsic_details() {
|
||||
assert_eq!(extrinsics.block_hash(), block_hash);
|
||||
|
||||
// `.has` should work and find a transfer call.
|
||||
assert!(extrinsics
|
||||
.has::<node_runtime::balances::calls::types::TransferAllowDeath>()
|
||||
.unwrap());
|
||||
assert!(
|
||||
extrinsics
|
||||
.has::<node_runtime::balances::calls::types::TransferAllowDeath>()
|
||||
.unwrap()
|
||||
);
|
||||
|
||||
// `.find_first` should similarly work to find the transfer call:
|
||||
assert!(extrinsics
|
||||
.find_first::<node_runtime::balances::calls::types::TransferAllowDeath>()
|
||||
.unwrap()
|
||||
.is_some());
|
||||
assert!(
|
||||
extrinsics
|
||||
.find_first::<node_runtime::balances::calls::types::TransferAllowDeath>()
|
||||
.unwrap()
|
||||
.is_some()
|
||||
);
|
||||
|
||||
let block_extrinsics = extrinsics.iter().collect::<Vec<_>>();
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
use crate::{
|
||||
subxt_test, test_context,
|
||||
utils::{node_runtime, TestNodeProcess},
|
||||
utils::{TestNodeProcess, node_runtime},
|
||||
};
|
||||
use codec::Encode;
|
||||
use futures::{Stream, StreamExt};
|
||||
@@ -110,7 +110,9 @@ async fn archive_v1_finalized_height() {
|
||||
// if the height we fetch has grown by more than 1.
|
||||
if let Some(last) = last_block_height {
|
||||
if archive_block_height != last && archive_block_height != last + 1 {
|
||||
panic!("Archive block height should increase 1 at a time, but jumped from {last} to {archive_block_height}");
|
||||
panic!(
|
||||
"Archive block height should increase 1 at a time, but jumped from {last} to {archive_block_height}"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ async fn storage_fetch_raw_keys() {
|
||||
.fetch_raw_keys(addr.to_root_bytes())
|
||||
.await
|
||||
.unwrap()
|
||||
.filter_map(|r| async move { r.ok() })
|
||||
.filter_map(async |r| r.ok())
|
||||
.count()
|
||||
.await;
|
||||
|
||||
@@ -65,7 +65,7 @@ async fn storage_iter() {
|
||||
.iter(addr)
|
||||
.await
|
||||
.unwrap()
|
||||
.filter_map(|r| async move { r.ok() })
|
||||
.filter_map(async |r| r.ok())
|
||||
.count()
|
||||
.await;
|
||||
|
||||
@@ -150,7 +150,7 @@ async fn transaction_validation() {
|
||||
#[subxt_test]
|
||||
async fn validation_fails() {
|
||||
use std::str::FromStr;
|
||||
use subxt_signer::{sr25519::Keypair, SecretUri};
|
||||
use subxt_signer::{SecretUri, sr25519::Keypair};
|
||||
|
||||
let ctx = test_context().await;
|
||||
let api = ctx.client();
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
use codec::Decode;
|
||||
use regex::Regex;
|
||||
use subxt_codegen::{syn, CodegenBuilder};
|
||||
use subxt_codegen::{CodegenBuilder, syn};
|
||||
use subxt_metadata::Metadata;
|
||||
|
||||
fn load_test_metadata() -> Metadata {
|
||||
|
||||
@@ -3,20 +3,21 @@
|
||||
// see LICENSE for license details.
|
||||
|
||||
use crate::{
|
||||
TestClient, TestConfig, TestContext,
|
||||
node_runtime::{
|
||||
self,
|
||||
contracts::events,
|
||||
runtime_types::{pallet_contracts::wasm::Determinism, sp_weights::weight_v2::Weight},
|
||||
system,
|
||||
},
|
||||
subxt_test, test_context, TestClient, TestConfig, TestContext,
|
||||
subxt_test, test_context,
|
||||
};
|
||||
use subxt::ext::futures::StreamExt;
|
||||
use subxt::{
|
||||
Error,
|
||||
config::{Config, HashFor},
|
||||
tx::TxProgress,
|
||||
utils::MultiAddress,
|
||||
Error,
|
||||
};
|
||||
use subxt_signer::sr25519::{self, dev};
|
||||
|
||||
|
||||
@@ -16,8 +16,8 @@ use crate::{
|
||||
use assert_matches::assert_matches;
|
||||
use subxt::error::{DispatchError, Error};
|
||||
use subxt_signer::{
|
||||
sr25519::{self, dev},
|
||||
SecretUri,
|
||||
sr25519::{self, dev},
|
||||
};
|
||||
|
||||
/// Helper function to generate a crypto pair from seed
|
||||
|
||||
@@ -2,19 +2,20 @@
|
||||
// This file is dual-licensed as Apache-2.0 or GPL-3.0.
|
||||
// see LICENSE for license details.
|
||||
|
||||
use crate::{node_runtime, subxt_test, test_context, TestContext};
|
||||
use crate::{TestContext, node_runtime, subxt_test, test_context};
|
||||
use codec::Decode;
|
||||
use frame_metadata::{
|
||||
RuntimeMetadata, RuntimeMetadataPrefixed,
|
||||
v15::{
|
||||
CustomMetadata, ExtrinsicMetadata, OuterEnums, PalletCallMetadata, PalletMetadata,
|
||||
PalletStorageMetadata, RuntimeMetadataV15, StorageEntryMetadata, StorageEntryModifier,
|
||||
StorageEntryType,
|
||||
},
|
||||
RuntimeMetadata, RuntimeMetadataPrefixed,
|
||||
};
|
||||
use scale_info::{
|
||||
Path, Type, TypeInfo,
|
||||
build::{Fields, Variants},
|
||||
meta_type, Path, Type, TypeInfo,
|
||||
meta_type,
|
||||
};
|
||||
use subxt::{Metadata, OfflineClient, OnlineClient, SubstrateConfig};
|
||||
|
||||
@@ -147,10 +148,12 @@ async fn constant_values_are_not_validated() {
|
||||
let deposit_addr = node_runtime::constants().balances().existential_deposit();
|
||||
|
||||
// Retrieve existential deposit to validate it and confirm that it's OK.
|
||||
assert!(api_from_original_metadata
|
||||
.constants()
|
||||
.at(&deposit_addr)
|
||||
.is_ok());
|
||||
assert!(
|
||||
api_from_original_metadata
|
||||
.constants()
|
||||
.at(&deposit_addr)
|
||||
.is_ok()
|
||||
);
|
||||
|
||||
// Modify the metadata.
|
||||
let existential = v15_metadata
|
||||
@@ -175,10 +178,12 @@ async fn constant_values_are_not_validated() {
|
||||
assert!(node_runtime::is_codegen_valid_for(
|
||||
&api_from_modified_metadata.metadata()
|
||||
));
|
||||
assert!(api_from_modified_metadata
|
||||
.constants()
|
||||
.at(&deposit_addr)
|
||||
.is_ok());
|
||||
assert!(
|
||||
api_from_modified_metadata
|
||||
.constants()
|
||||
.at(&deposit_addr)
|
||||
.is_ok()
|
||||
);
|
||||
}
|
||||
|
||||
#[subxt_test]
|
||||
|
||||
Reference in New Issue
Block a user