subxt-historic: add support for returning the default values of storage entries (#2072)

This commit is contained in:
James Wilson
2025-09-02 11:32:09 +01:00
committed by GitHub
parent 2a498d4dda
commit abcda67fc0
8 changed files with 73 additions and 15 deletions
+6
View File
@@ -24,6 +24,12 @@ async fn main() -> Result<(), Error> {
.entry("System", "Account")?
.into_map()?;
// We can see the default value for this entry at this block, if one exists.
if let Some(default_value) = account_balances.default() {
let default_balance_info = default_value.decode::<scale_value::Value>()?;
println!(" Default balance info: {default_balance_info}");
}
// We can fetch a specific account balance by its key, like so (here I just picked a random key
// I knew to exist from iterating over storage entries):
let account_id_hex = "9a4d0faa2ba8c3cc5711852960940793acf55bf195b6eecf88fa78e961d0ce4a";