Skip to content
Open
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
3 changes: 2 additions & 1 deletion src/components/send/sendForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,8 @@ async function proceed() {
nonce = Number(
await getNonceForArcanaSponsorship(scwInstance.scwAddress, rpc_url)
);
if (nonce > 15) {
console.log(nonce, "nonce");
if (nonce >= 15) {
await authStore.provider.request({
method: "_arcana_switchAccountType",
params: {
Expand Down
8 changes: 6 additions & 2 deletions src/utils/getNonceForArcanaSponsorship.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ async function getNonceForArcanaSponsorship(
address: string,
rpcUrl: string
): Promise<ethers.BigNumberish> {
const provider = new WebSocketProvider(rpcUrl);

const c = new ethers.Contract(
VITE_APP_CONTRACT_ADDRESS_FOR_NONCE,
[
Expand Down Expand Up @@ -35,10 +37,12 @@ async function getNonceForArcanaSponsorship(
type: "function",
},
],
new WebSocketProvider(rpcUrl)
provider
);

return await c.getNonce(address, 0);
const nonce = await c.getNonce(address, 0);
await provider.destroy();
return nonce;
}

export default getNonceForArcanaSponsorship;