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:
2025-12-19 21:38:01 +03:00
parent a15cc1d76c
commit a2bc2cd671
3 changed files with 24 additions and 11 deletions
+6
View File
@@ -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"));