Skip to content

Commit

Permalink
Marko/add nom pools txs to sdks (#655)
Browse files Browse the repository at this point in the history
* Moved files and made them slimmer

* Added two mor nom pool txs

* Moved functions around

* Replaced Pramas with Options

* updated docs

* Updated Advanced Examples

* Added docs and example for nom pools
  • Loading branch information
markopoloparadox committed Sep 11, 2024
1 parent 5b8cd6a commit 8872f2d
Show file tree
Hide file tree
Showing 38 changed files with 2,337 additions and 1,365 deletions.
21 changes: 7 additions & 14 deletions avail-rust/docs/advanced-examples/extrinsic_params_sdk/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
use avail_rust::{AvailExtrinsicParamsBuilder, Data, Key, Keypair, SecretUri, SDK};
use avail_rust::{
AvailExtrinsicParamsBuilder, Data, Key, Keypair, Mortality, Nonce, Options, SecretUri, SDK,
};
use core::str::FromStr;

#[tokio::main]
Expand All @@ -21,12 +23,11 @@ async fn main() -> Result<(), String> {
let nonce = sdk.api.tx().account_nonce(&account_id).await.unwrap();
let app_id = result.event.id;

let options = AvailExtrinsicParamsBuilder::new()
.nonce(nonce)
let options = Options::new()
.nonce(Nonce::BestBlock)
.app_id(app_id.0)
.tip(1_000_000_000_000_000_000u128)
.mortal(block.header(), 400)
.build();
.mortality(Mortality::new(32, None));

let data = String::from("My Awesome Data").as_bytes().to_vec();
let data = Data { 0: data };
Expand All @@ -41,15 +42,7 @@ async fn main() -> Result<(), String> {
)
.await?;

println!(
"Who={}, DataHash={:?}",
result.event.who, result.event.data_hash
);
println!("TxData={:?}", result.tx_data.data);
println!(
"TxHash={:?}, BlockHash={:?}",
result.tx_hash, result.block_hash
);
dbg!(result);

Ok(())
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ edition = "2021"
version = "0.1.0"

[dependencies]
avail-rust = { path = "../../../." }
avail-rust = { git = "https://github.com/availproject/avail" }
tokio = { version = "1.38.0", features = ["rt-multi-thread"] }
Loading

0 comments on commit 8872f2d

Please sign in to comment.