mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-23 04:55:41 +00:00
Merge branch 'master' into update-artifacts-1737332954
This commit is contained in:
@@ -29,7 +29,7 @@ use subxt_metadata::RuntimeApiMetadata;
|
|||||||
/// true => validate (trailing args + build node connection)
|
/// true => validate (trailing args + build node connection)
|
||||||
/// validation is:
|
/// validation is:
|
||||||
/// Err => Show Error
|
/// 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:
|
/// response is:
|
||||||
/// Err => Show Error
|
/// Err => Show Error
|
||||||
/// Ok => Show the result
|
/// Ok => Show the result
|
||||||
|
|||||||
Generated
+9164
-616
File diff suppressed because it is too large
Load Diff
Generated
+697
-894
File diff suppressed because it is too large
Load Diff
@@ -202,7 +202,7 @@ struct BackgroundTaskChannels<TPlatform: PlatformRef> {
|
|||||||
struct BackgroundTaskData<TPlatform: PlatformRef, TChain> {
|
struct BackgroundTaskData<TPlatform: PlatformRef, TChain> {
|
||||||
/// A smoldot light client that can be shared.
|
/// A smoldot light client that can be shared.
|
||||||
client: SharedClient<TPlatform, TChain>,
|
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,
|
chain_id: smoldot_light::ChainId,
|
||||||
/// Know which Id to use next for new requests/subscriptions.
|
/// Know which Id to use next for new requests/subscriptions.
|
||||||
last_request_id: usize,
|
last_request_id: usize,
|
||||||
|
|||||||
@@ -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) {
|
fn collect_types(&mut self, metadata: &Metadata, id: u32) {
|
||||||
self.push_to_workset(id);
|
self.push_to_workset(id);
|
||||||
while let Some(typ) = self.work_set.pop() {
|
while let Some(typ) = self.work_set.pop() {
|
||||||
|
|||||||
@@ -427,7 +427,13 @@ impl RpcClientT for RpcClient {
|
|||||||
async {
|
async {
|
||||||
self.request(method.to_string(), params)
|
self.request(method.to_string(), params)
|
||||||
.await
|
.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()
|
.boxed()
|
||||||
}
|
}
|
||||||
@@ -449,7 +455,11 @@ impl RpcClientT for RpcClient {
|
|||||||
SubscriptionId::Str(s) => s.to_string(),
|
SubscriptionId::Str(s) => s.to_string(),
|
||||||
};
|
};
|
||||||
let stream = sub
|
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();
|
.boxed();
|
||||||
|
|
||||||
Ok(RawRpcSubscription {
|
Ok(RawRpcSubscription {
|
||||||
|
|||||||
@@ -306,23 +306,19 @@ async fn storage_balance_lock() -> Result<(), subxt::Error> {
|
|||||||
.find_first::<system::events::ExtrinsicSuccess>()?
|
.find_first::<system::events::ExtrinsicSuccess>()?
|
||||||
.expect("No ExtrinsicSuccess Event found");
|
.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()
|
.storage()
|
||||||
.at_latest()
|
.at_latest()
|
||||||
.await?
|
.await?
|
||||||
.fetch_or_default(&locks_addr)
|
.fetch_or_default(&holds_addr)
|
||||||
.await?;
|
.await?
|
||||||
|
.0;
|
||||||
|
|
||||||
assert_eq!(
|
// There is now a hold on the balance being staked
|
||||||
locks.0,
|
assert_eq!(holds.len(), 1);
|
||||||
vec![runtime_types::pallet_balances::types::BalanceLock {
|
assert_eq!(holds[0].amount, 100_000_000_000_000);
|
||||||
id: *b"staking ",
|
|
||||||
amount: 100_000_000_000_000,
|
|
||||||
reasons: runtime_types::pallet_balances::types::Reasons::All,
|
|
||||||
}]
|
|
||||||
);
|
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|||||||
Generated
+76
-1144
File diff suppressed because it is too large
Load Diff
@@ -3,12 +3,11 @@
|
|||||||
// see LICENSE for license details.
|
// see LICENSE for license details.
|
||||||
|
|
||||||
#![allow(internal_features)]
|
#![allow(internal_features)]
|
||||||
#![feature(lang_items, start)]
|
#![feature(lang_items, alloc_error_handler)]
|
||||||
#![feature(alloc_error_handler)]
|
|
||||||
#![no_std]
|
#![no_std]
|
||||||
|
#![no_main]
|
||||||
|
|
||||||
#[start]
|
pub extern "C" fn _start(_argc: isize, _argv: *const *const u8) -> isize {
|
||||||
fn start(_argc: isize, _argv: *const *const u8) -> isize {
|
|
||||||
compile_test();
|
compile_test();
|
||||||
0
|
0
|
||||||
}
|
}
|
||||||
@@ -60,11 +59,10 @@ fn compile_test() {
|
|||||||
|
|
||||||
// Subxt Core compiles:
|
// Subxt Core compiles:
|
||||||
let _era = subxt_core::utils::Era::Immortal;
|
let _era = subxt_core::utils::Era::Immortal;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[subxt_macro::subxt(
|
#[subxt_macro::subxt(
|
||||||
runtime_metadata_path = "../../artifacts/polkadot_metadata_full.scale",
|
runtime_metadata_path = "../../artifacts/polkadot_metadata_full.scale",
|
||||||
crate="::subxt_core"
|
crate = "::subxt_core"
|
||||||
)]
|
)]
|
||||||
pub mod polkadot{}
|
pub mod polkadot {}
|
||||||
|
|||||||
Reference in New Issue
Block a user