Skip to content

Commit

Permalink
fix: transaction none (#1271)
Browse files Browse the repository at this point in the history
  • Loading branch information
danielsimao authored Jun 7, 2023
1 parent f9afbb7 commit f6be34f
Showing 1 changed file with 1 addition and 12 deletions.
13 changes: 1 addition & 12 deletions src/utils/hooks/transaction/utils/submit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ import { TransactionResult } from '../use-transaction';

type HandleTransactionResult = { result: ISubmittableResult; unsubscribe: () => void };

let nonce: number | undefined;

const handleTransaction = async (
account: AddressOrPair,
extrinsicData: ExtrinsicData,
Expand All @@ -23,16 +21,11 @@ const handleTransaction = async (
// Extrinsic status
let isReady = false;

if (!nonce) {
const lastestNonce = await window.bridge.api.rpc.system.accountNextIndex(account.toString());
nonce = lastestNonce.toNumber();
}

return new Promise<HandleTransactionResult>((resolve, reject) => {
let unsubscribe: () => void;

(extrinsicData.extrinsic as SubmittableExtrinsic<'promise'>)
.signAndSend(account, { nonce }, callback)
.signAndSend(account, { nonce: -1 }, callback)
.then((unsub) => (unsubscribe = unsub))
.catch((error) => reject(error));

Expand All @@ -52,10 +45,6 @@ const handleTransaction = async (
resolve({ unsubscribe, result });
}
}

if (nonce) {
nonce++;
}
});
};

Expand Down

2 comments on commit f6be34f

@vercel
Copy link

@vercel vercel bot commented on f6be34f Jun 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on f6be34f Jun 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.