Skip to content
Snippets Groups Projects

Resolve "fix outdated transaction"

Merged Hugo Trentesaux requested to merge 22-fix-outdated-transaction into master
1 unresolved thread
1 file
+ 23
19
Compare changes
  • Side-by-side
  • Inline
+ 23
19
@@ -48,28 +48,32 @@ pub async fn submit_call<Payload: TxPayload>(
data: &Data,
payload: &Payload,
) -> Result<TxProgress, subxt::Error> {
// get account nonce manually to be based on last block and not last finalized
let nonce = data
.legacy_rpc_methods()
Please register or sign in to reply
.await
.system_account_next_index(&data.address())
.await?;
// sign and submit
match data.keypair() {
// sr25519 key pair
KeyPair::Sr25519(keypair) => {
data.client()
.tx()
.sign_and_submit_then_watch_default(
payload,
&PairSigner::<Runtime, sp_core::sr25519::Pair>::new(keypair),
)
.await
}
KeyPair::Sr25519(keypair) => data.client().tx().create_signed_with_nonce(
payload,
&PairSigner::<Runtime, sp_core::sr25519::Pair>::new(keypair),
nonce,
Default::default(),
),
// nacl key pair
KeyPair::Nacl(keypair) => {
data.client()
.tx()
.sign_and_submit_then_watch_default(
payload,
&commands::cesium::CesiumSigner::new(keypair),
)
.await
}
}
KeyPair::Nacl(keypair) => data.client().tx().create_signed_with_nonce(
payload,
&commands::cesium::CesiumSigner::new(keypair),
nonce,
Default::default(),
),
}?
.submit_and_watch()
.await
}
/// look event
Loading