Skip to content

Commit

Permalink
A0-4251: Support executing readonly contract calls at a given block i…
Browse files Browse the repository at this point in the history
…n aleph client (#1679)

# Description

Add a possibility to execute read-only contract call at a given block
hash, similarly as in
polkascan/py-substrate-interface@298c35c.

E2e test run:
https://github.com/Cardinal-Cryptography/aleph-node/actions/runs/8664362669


## Type of change

Please delete options that are not relevant.

- New feature (non-breaking change which adds functionality)

# Checklist:

<!-- delete when not applicable to your PR -->

- I have added tests
- I have made corresponding changes to the existing documentation
- I have created new documentation
- I have bumped aleph-client version if relevant
  • Loading branch information
ggawryal authored Apr 22, 2024
1 parent 2a630c2 commit 3533192
Show file tree
Hide file tree
Showing 13 changed files with 315 additions and 141 deletions.
2 changes: 1 addition & 1 deletion aleph-client/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion aleph-client/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "aleph_client"
version = "3.13.0"
version = "3.14.0"
edition = "2021"
authors = ["Cardinal"]
documentation = "https://docs.rs/aleph_client"
Expand Down
14 changes: 7 additions & 7 deletions aleph-client/src/aleph_zero.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1982,9 +1982,9 @@ pub mod api {
.hash();
runtime_metadata_hash
== [
129u8, 73u8, 18u8, 89u8, 210u8, 235u8, 7u8, 3u8, 129u8, 129u8, 29u8, 138u8, 74u8,
244u8, 76u8, 191u8, 250u8, 90u8, 146u8, 240u8, 112u8, 108u8, 18u8, 204u8, 45u8,
173u8, 154u8, 15u8, 217u8, 19u8, 68u8, 99u8,
168u8, 45u8, 34u8, 180u8, 15u8, 198u8, 195u8, 94u8, 185u8, 186u8, 175u8, 22u8,
25u8, 103u8, 4u8, 51u8, 38u8, 113u8, 76u8, 98u8, 201u8, 223u8, 80u8, 32u8, 39u8,
11u8, 176u8, 247u8, 172u8, 235u8, 72u8, 171u8,
]
}
pub mod system {
Expand Down Expand Up @@ -9147,10 +9147,10 @@ pub mod api {
"NextAuthorities",
vec![],
[
168u8, 56u8, 208u8, 207u8, 106u8, 51u8, 50u8, 57u8, 201u8, 86u8, 133u8,
93u8, 11u8, 243u8, 93u8, 77u8, 255u8, 163u8, 166u8, 116u8, 213u8,
232u8, 224u8, 204u8, 254u8, 196u8, 33u8, 12u8, 162u8, 107u8, 100u8,
231u8,
88u8, 232u8, 148u8, 12u8, 95u8, 135u8, 116u8, 72u8, 113u8, 140u8, 45u8,
103u8, 56u8, 19u8, 149u8, 114u8, 82u8, 188u8, 121u8, 184u8, 104u8,
254u8, 228u8, 185u8, 4u8, 151u8, 251u8, 63u8, 189u8, 76u8, 173u8,
101u8,
],
)
}
Expand Down
6 changes: 3 additions & 3 deletions aleph-client/src/contract/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ pub struct ContractEvent {
/// # async fn example(conn: Connection, signed_conn: SignedConnection, address: AccountId, path: &str) -> Result<()> {
/// let contract = ContractInstance::new(address, path)?;
///
/// let tx_info = contract.contract_exec0(&signed_conn, "some_method").await?;
/// let tx_info = contract.exec0(&signed_conn, "some_method", Default::default()).await?;
///
/// println!("Received events {:?}", get_contract_events(&conn, &contract, tx_info).await);
///
Expand Down Expand Up @@ -110,8 +110,8 @@ pub async fn get_contract_events(
/// };
/// let join = tokio::spawn(listen());
///
/// contract1.contract_exec0(&signed_conn, "some_method").await?;
/// contract2.contract_exec0(&signed_conn, "some_other_method").await?;
/// contract1.exec0(&signed_conn, "some_method", Default::default()).await?;
/// contract2.exec0(&signed_conn, "some_other_method", Default::default()).await?;
///
/// println!("Received event {:?}", rx.next().await);
///
Expand Down
Loading

0 comments on commit 3533192

Please sign in to comment.