Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamic storage iter example no longer works #1517

Closed
aurexav opened this issue Apr 5, 2024 · 3 comments · Fixed by #1522
Closed

Dynamic storage iter example no longer works #1517

aurexav opened this issue Apr 5, 2024 · 3 comments · Fixed by #1522

Comments

@aurexav
Copy link

aurexav commented Apr 5, 2024

Always get Error: StorageAddress(TooManyBytes) with wss://rpc.polkadot.io.

use subxt::{config::polkadot::H256, OnlineClient, PolkadotConfig};

let api = <OnlineClient<PolkadotConfig>>::from_url("wss://rpc.polkadot.io").await?;
let storage_query = subxt::dynamic::storage("System", "Account", Vec::new());
let mut results = api.storage().at_latest().await?.iter(storage_query).await?;

while let Some(r) = results.next().await {
	match r {
		Ok(kv) => {
			println!("Keys decoded: {:?}", kv.keys);
			println!("Key: {}", array_bytes::bytes2hex("0x", &kv.key_bytes));
			println!("Value: {:?}", kv.value.to_value()?);
		},
		Err(e) => println!("Error: {e:?}"),
	}
}
@aurexav aurexav changed the title Dynamic iter example no longer works Dynamic storage iter example no longer works Apr 5, 2024
@aurexav
Copy link
Author

aurexav commented Apr 7, 2024

Relate to #1419.

@jsdw
Copy link
Collaborator

jsdw commented Apr 8, 2024

Thanks for raising the issue! We'll look into this.

@jsdw
Copy link
Collaborator

jsdw commented Apr 9, 2024

Just to add to the closed PR; we think that this is all fixed now and have done a patch release of Subxt, so updating your lockfile or Subxt version will hopefully fix the issue for you; we'd love to know either way :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants