fix: Update subxt 0.44 API compatibility for workspace-wide compilation
- txtesttool: Update dynamic storage API (try_fetch, Value type) - txtesttool: Add From<ExtrinsicError> for Error - omni-node-lib: Replace StorageEntryType with keys()/value_ty() API Workspace cargo check now passes successfully.
This commit is contained in:
@@ -17,3 +17,9 @@ pub enum Error {
|
||||
#[error("Mortal transaction lifetime surpassed, block number: {0}")]
|
||||
MortalLifetimeSurpassed(u64),
|
||||
}
|
||||
|
||||
impl From<subxt::error::ExtrinsicError> for Error {
|
||||
fn from(err: subxt::error::ExtrinsicError) -> Self {
|
||||
Error::Subxt(subxt::Error::from(err))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -317,12 +317,15 @@ pub async fn check_account_nonce<C: subxt::Config>(
|
||||
where
|
||||
AccountIdOf<C>: Send + Sync + AsRef<[u8]>,
|
||||
{
|
||||
let storage_query =
|
||||
subxt::dynamic::storage("System", "Account", vec![Value::from_bytes(account.clone())]);
|
||||
let result = api.storage().at_latest().await?.fetch(&storage_query).await?;
|
||||
let value = result
|
||||
.ok_or(format!("Sender account {:?} does not exist", hex::encode(account.clone())))?
|
||||
.to_value()?;
|
||||
let storage_query = subxt::dynamic::storage("System", "Account");
|
||||
let storage_at = api.storage().at_latest().await?;
|
||||
let storage_value = storage_at
|
||||
.try_fetch(storage_query, (Value::from_bytes(account.clone()),))
|
||||
.await?
|
||||
.ok_or_else(|| format!("Sender account {:?} does not exist", hex::encode(account.clone())))?;
|
||||
let value: subxt::dynamic::Value = storage_value
|
||||
.decode()
|
||||
.map_err(|e| format!("Failed to decode storage: {:?}", e))?;
|
||||
|
||||
debug!(target:LOG_TARGET,"account has free balance: {:?}", value.at("data").at("free"));
|
||||
debug!(target:LOG_TARGET,"account has nonce: {:?}", value.at("nonce"));
|
||||
|
||||
@@ -23,7 +23,7 @@ use pezsc_executor::WasmExecutor;
|
||||
use pezsc_runtime_utilities::fetch_latest_metadata_from_code_blob;
|
||||
use scale_info::{form::PortableForm, TypeDef, TypeDefPrimitive};
|
||||
use std::fmt::Display;
|
||||
use subxt_metadata::{Metadata, StorageEntryType};
|
||||
use subxt_metadata::Metadata;
|
||||
|
||||
/// Expected teyrchain system pezpallet runtime type name.
|
||||
pub const DEFAULT_TEYRCHAIN_SYSTEM_PALLET_NAME: &str = "TeyrchainSystem";
|
||||
@@ -149,11 +149,15 @@ impl MetadataInspector {
|
||||
pezpallet_metadata
|
||||
.and_then(|inner| inner.storage())
|
||||
.and_then(|inner| inner.entry_by_name("Number"))
|
||||
.and_then(|number_ty| match number_ty.entry_type() {
|
||||
StorageEntryType::Plain(ty_id) => Some(ty_id),
|
||||
_ => None,
|
||||
.and_then(|number_ty| {
|
||||
// Plain storage has no keys, Map storage has keys
|
||||
if number_ty.keys().len() == 0 {
|
||||
Some(number_ty.value_ty())
|
||||
} else {
|
||||
None
|
||||
}
|
||||
})
|
||||
.and_then(|ty_id| self.0.types().resolve(*ty_id))
|
||||
.and_then(|ty_id| self.0.types().resolve(ty_id))
|
||||
.and_then(|portable_type| BlockNumber::from_type_def(&portable_type.type_def))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user