Skip to content

Commit 1d44664

Browse files
committed
added nonce to both tnxs
1 parent 8f37f7d commit 1d44664

File tree

1 file changed

+9
-2
lines changed
  • web-modal-sdk/blockchain-connection-examples/linea-modal-example/src/utils

1 file changed

+9
-2
lines changed

web-modal-sdk/blockchain-connection-examples/linea-modal-example/src/utils/viemRPC.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/* eslint-disable no-console */
22
import type { IProvider } from "@web3auth/base";
33
import { createPublicClient, createWalletClient, custom, formatEther, parseEther } from "viem";
4+
import { getTransactionCount } from "viem/actions";
45
import { lineaSepolia, mainnet, polygonAmoy, sepolia } from "viem/chains";
56

67
import { sendBundle } from "./lineaRPC";
@@ -141,11 +142,16 @@ const sendBundleTransaction = async (provider: IProvider): Promise<any> => {
141142

142143
const address = await walletClient.getAddresses();
143144

145+
const nonce = await getTransactionCount(walletClient, {
146+
address: address[0],
147+
});
148+
144149
// Prepare transaction
145150
const requestTx1 = await walletClient.prepareTransactionRequest({
151+
nonce,
146152
account: address[0],
147153
to: address[0],
148-
value: parseEther("0.0001"),
154+
value: parseEther("0.001"),
149155
});
150156

151157
// Sign transaction
@@ -154,9 +160,10 @@ const sendBundleTransaction = async (provider: IProvider): Promise<any> => {
154160

155161
// Send transaction
156162
const requestTx2 = await walletClient.prepareTransactionRequest({
163+
nonce: nonce + 1,
157164
account: address[0],
158165
to: address[0],
159-
value: parseEther("0.0004"),
166+
value: parseEther("0.004"),
160167
});
161168

162169
// Sign transaction

0 commit comments

Comments
 (0)