From 08ca86d2acd58f41e4fd86869409b863a47d5c0d Mon Sep 17 00:00:00 2001 From: rappix Date: Tue, 6 Aug 2024 02:11:09 +0200 Subject: [PATCH] change nonce management --- src/utils/chain.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/utils/chain.ts b/src/utils/chain.ts index 6eeefed..f5cecd0 100644 --- a/src/utils/chain.ts +++ b/src/utils/chain.ts @@ -91,11 +91,14 @@ export async function submitExtrinsic( }; return resolve(response); } + + const nonce = await polkadotApi.rpc.system.accountNextIndex(account.address); + // @ts-ignore await polkadotApi.tx[pallet][call](...params) .signAndSend( account, - { nonce: -1 }, + { nonce: nonce }, ({ status, events = [], dispatchError }) => { if (dispatchError) { // for module errors, we have the section indexed, lookup