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

Extrinsic Params Refinement #1439

Merged
merged 6 commits into from
Mar 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
107 changes: 54 additions & 53 deletions examples/wasm-example/Cargo.lock

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

4 changes: 3 additions & 1 deletion examples/wasm-example/src/routes/signing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use subxt::ext::codec::{Decode, Encode};
use subxt::tx::SubmittableExtrinsic;
use subxt::tx::TxPayload;
use subxt::utils::{AccountId32, MultiSignature};
use subxt::config::DefaultExtrinsicParamsBuilder;

use crate::services::{extension_signature_for_extrinsic, get_accounts, polkadot, Account};
use web_sys::HtmlInputElement;
Expand Down Expand Up @@ -155,7 +156,8 @@ impl Component for SigningExamplesComponent {
return Message::Error(anyhow!("MultiSignature Decoding"));
};

let Ok(partial_signed) = api.tx().create_partial_signed_with_nonce(&remark_call, account_nonce, Default::default()) else {
let params = DefaultExtrinsicParamsBuilder::new().nonce(account_nonce).build();
let Ok(partial_signed) = api.tx().create_partial_signed_offline(&remark_call, params) else {
return Message::Error(anyhow!("PartialExtrinsic creation failed"));
};

Expand Down
7 changes: 5 additions & 2 deletions subxt/examples/rpc_legacy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,18 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
.await?;
let current_header = rpc.chain_get_header(None).await?.unwrap();

let ext_params = Params::new().mortal(&current_header, 8).build();
let ext_params = Params::new()
.mortal(&current_header, 8)
.nonce(current_nonce)
.build();

let balance_transfer = polkadot::tx()
.balances()
.transfer_allow_death(bob.public_key().into(), 1_000_000);

let ext_hash = api
.tx()
.create_signed_with_nonce(&balance_transfer, &alice, current_nonce, ext_params)?
.create_signed_offline(&balance_transfer, &alice, ext_params)?
.submit()
.await?;

Expand Down
Loading
Loading