From 7d68658a675fa17378dace030274296e45dba0f2 Mon Sep 17 00:00:00 2001 From: micky Date: Mon, 10 Jun 2024 19:03:12 +0200 Subject: [PATCH] ONE MORE TEST COMMIT --- src/lib/contracts/callContract.tsx | 19 ++++++++++++++++++- src/lib/contracts/utils.ts | 3 +++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/lib/contracts/callContract.tsx b/src/lib/contracts/callContract.tsx index a71d3262b8..dc19d4d93a 100644 --- a/src/lib/contracts/callContract.tsx +++ b/src/lib/contracts/callContract.tsx @@ -47,9 +47,26 @@ export async function callContract( } if (opts.customSigners) { + const wallets: Wallet[] = []; + + // @ts-expect-error + if (!window.disableBrowserWalletRpc) { + wallets.push(wallet); + } + + // @ts-expect-error + if (!window.disablePublicRpc) { + wallets.push(opts.customSigners[0]); + } + + // @ts-expect-error + if (!window.disableFallbackRpc) { + wallets.push(opts.customSigners[1]); + } + // If we send the transaction to multiple RPCs simultaneously, // we should specify a fixed nonce to avoid possible txn duplication. - txnOpts.nonce = await getBestNonce([wallet, ...opts.customSigners]); + txnOpts.nonce = await getBestNonce(wallets); } if (opts.showPreliminaryMsg && !opts.hideSentMsg) { diff --git a/src/lib/contracts/utils.ts b/src/lib/contracts/utils.ts index 316d080a39..7a4bffd3af 100644 --- a/src/lib/contracts/utils.ts +++ b/src/lib/contracts/utils.ts @@ -59,5 +59,8 @@ export async function getBestNonce(providers: Wallet[], timeout = 3000): Promise throw new Error(`None of providers returned nonce in ${timeout} ms`); } + // eslint-disable-next-line no-console + console.log("Nonces been received: ", results); + return Math.max(...results); }