Merge branch 'master' into update-artifacts-1737332954

This commit is contained in:
Niklas Adolfsson
2025-01-26 18:24:51 +01:00
committed by GitHub
9 changed files with 9965 additions and 2678 deletions
+1 -1
View File
@@ -29,7 +29,7 @@ use subxt_metadata::RuntimeApiMetadata;
/// true => validate (trailing args + build node connection)
/// validation is:
/// Err => Show Error
/// Ok => Make a runtime api call witht the provided args.
/// Ok => Make a runtime api call with the provided args.
/// response is:
/// Err => Show Error
/// Ok => Show the result
+9164 -616
View File
File diff suppressed because it is too large Load Diff
+697 -894
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -202,7 +202,7 @@ struct BackgroundTaskChannels<TPlatform: PlatformRef> {
struct BackgroundTaskData<TPlatform: PlatformRef, TChain> {
/// A smoldot light client that can be shared.
client: SharedClient<TPlatform, TChain>,
/// Knowing the chain ID helps with debugging, but isn't overwise necessary.
/// Knowing the chain ID helps with debugging, but isn't otherwise necessary.
chain_id: smoldot_light::ChainId,
/// Know which Id to use next for new requests/subscriptions.
last_request_id: usize,
+1 -1
View File
@@ -44,7 +44,7 @@ impl TypeSet {
}
}
/// This function will deeply traverse the inital type and it's dependencies to collect the relevant type_ids
/// This function will deeply traverse the initial type and it's dependencies to collect the relevant type_ids
fn collect_types(&mut self, metadata: &Metadata, id: u32) {
self.push_to_workset(id);
while let Some(typ) = self.work_set.pop() {
@@ -427,7 +427,13 @@ impl RpcClientT for RpcClient {
async {
self.request(method.to_string(), params)
.await
.map_err(|e| SubxtRpcError::DisconnectedWillReconnect(e.to_string()))
.map_err(|e| match e {
Error::DisconnectedWillReconnect(e) => {
SubxtRpcError::DisconnectedWillReconnect(e.to_string())
}
Error::Dropped => SubxtRpcError::ClientError(Box::new(e)),
Error::RpcError(e) => SubxtRpcError::ClientError(Box::new(e)),
})
}
.boxed()
}
@@ -449,7 +455,11 @@ impl RpcClientT for RpcClient {
SubscriptionId::Str(s) => s.to_string(),
};
let stream = sub
.map_err(|e| SubxtRpcError::DisconnectedWillReconnect(e.to_string()))
// NOTE: The stream emits only one error `DisconnectWillReconnect if the connection was lost
// and safe to wrap it in a `SubxtRpcError::DisconnectWillReconnect` here
.map_err(|e: DisconnectedWillReconnect| {
SubxtRpcError::DisconnectedWillReconnect(e.to_string())
})
.boxed();
Ok(RawRpcSubscription {
@@ -306,23 +306,19 @@ async fn storage_balance_lock() -> Result<(), subxt::Error> {
.find_first::<system::events::ExtrinsicSuccess>()?
.expect("No ExtrinsicSuccess Event found");
let locks_addr = node_runtime::storage().balances().locks(bob);
let holds_addr = node_runtime::storage().balances().holds(bob);
let locks = api
let holds = api
.storage()
.at_latest()
.await?
.fetch_or_default(&locks_addr)
.await?;
.fetch_or_default(&holds_addr)
.await?
.0;
assert_eq!(
locks.0,
vec![runtime_types::pallet_balances::types::BalanceLock {
id: *b"staking ",
amount: 100_000_000_000_000,
reasons: runtime_types::pallet_balances::types::Reasons::All,
}]
);
// There is now a hold on the balance being staked
assert_eq!(holds.len(), 1);
assert_eq!(holds[0].amount, 100_000_000_000_000);
Ok(())
}
+76 -1144
View File
File diff suppressed because it is too large Load Diff
+5 -7
View File
@@ -3,12 +3,11 @@
// see LICENSE for license details.
#![allow(internal_features)]
#![feature(lang_items, start)]
#![feature(alloc_error_handler)]
#![feature(lang_items, alloc_error_handler)]
#![no_std]
#![no_main]
#[start]
fn start(_argc: isize, _argv: *const *const u8) -> isize {
pub extern "C" fn _start(_argc: isize, _argv: *const *const u8) -> isize {
compile_test();
0
}
@@ -60,11 +59,10 @@ fn compile_test() {
// Subxt Core compiles:
let _era = subxt_core::utils::Era::Immortal;
}
#[subxt_macro::subxt(
runtime_metadata_path = "../../artifacts/polkadot_metadata_full.scale",
crate="::subxt_core"
crate = "::subxt_core"
)]
pub mod polkadot{}
pub mod polkadot {}