@matterlabs/zksync-js 0.0.8 → 0.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapters/ethers/client.cjs +1640 -236
- package/dist/adapters/ethers/client.cjs.map +1 -1
- package/dist/adapters/ethers/client.d.ts +11 -0
- package/dist/adapters/ethers/client.js +5 -5
- package/dist/adapters/ethers/index.cjs +4395 -1525
- package/dist/adapters/ethers/index.cjs.map +1 -1
- package/dist/adapters/ethers/index.d.ts +4 -0
- package/dist/adapters/ethers/index.js +8 -8
- package/dist/adapters/ethers/resources/contracts/types.d.ts +15 -0
- package/dist/adapters/ethers/resources/deposits/context.d.ts +3 -3
- package/dist/adapters/ethers/resources/deposits/services/gas.d.ts +2 -2
- package/dist/adapters/ethers/resources/deposits/services/verification.d.ts +1 -1
- package/dist/adapters/ethers/resources/interop/address.d.ts +18 -0
- package/dist/adapters/ethers/resources/interop/attributes/resource.d.ts +9 -0
- package/dist/adapters/ethers/resources/interop/context.d.ts +36 -0
- package/dist/adapters/ethers/resources/interop/index.d.ts +63 -0
- package/dist/adapters/ethers/resources/interop/resolvers.d.ts +9 -0
- package/dist/adapters/ethers/resources/interop/routes/direct.d.ts +2 -0
- package/dist/adapters/ethers/resources/interop/routes/indirect.d.ts +2 -0
- package/dist/adapters/ethers/resources/interop/routes/types.d.ts +13 -0
- package/dist/adapters/ethers/resources/interop/services/erc20.d.ts +15 -0
- package/dist/adapters/ethers/resources/interop/services/finalization/bundle.d.ts +15 -0
- package/dist/adapters/ethers/resources/interop/services/finalization/data-fetchers.d.ts +17 -0
- package/dist/adapters/ethers/resources/interop/services/finalization/decoders.d.ts +12 -0
- package/dist/adapters/ethers/resources/interop/services/finalization/index.d.ts +13 -0
- package/dist/adapters/ethers/resources/interop/services/finalization/polling.d.ts +7 -0
- package/dist/adapters/ethers/resources/interop/services/finalization/status.d.ts +5 -0
- package/dist/adapters/ethers/resources/interop/services/finalization/topics.d.ts +6 -0
- package/dist/adapters/ethers/resources/interop/services/starter-data.d.ts +6 -0
- package/dist/adapters/ethers/resources/interop/types.d.ts +16 -0
- package/dist/adapters/ethers/resources/withdrawals/context.d.ts +2 -2
- package/dist/adapters/ethers/sdk.cjs +3357 -917
- package/dist/adapters/ethers/sdk.cjs.map +1 -1
- package/dist/adapters/ethers/sdk.d.ts +10 -8
- package/dist/adapters/ethers/sdk.js +6 -6
- package/dist/adapters/viem/client.cjs +685 -31
- package/dist/adapters/viem/client.cjs.map +1 -1
- package/dist/adapters/viem/client.js +5 -3
- package/dist/adapters/viem/index.cjs +282 -203
- package/dist/adapters/viem/index.cjs.map +1 -1
- package/dist/adapters/viem/index.d.ts +1 -0
- package/dist/adapters/viem/index.js +8 -7
- package/dist/adapters/viem/resources/deposits/context.d.ts +3 -3
- package/dist/adapters/viem/resources/deposits/services/gas.d.ts +2 -2
- package/dist/adapters/viem/resources/deposits/services/verification.d.ts +1 -1
- package/dist/adapters/viem/resources/withdrawals/context.d.ts +2 -2
- package/dist/adapters/viem/sdk.cjs +39 -58
- package/dist/adapters/viem/sdk.cjs.map +1 -1
- package/dist/adapters/viem/sdk.js +5 -5
- package/dist/{chunk-LNIEQ7AN.js → chunk-5AG6B7UX.js} +36 -60
- package/dist/{chunk-NODVRI3E.js → chunk-AIFHAPJC.js} +8 -2
- package/dist/{chunk-3GFCAGGI.js → chunk-FBKBF7YM.js} +1533 -1434
- package/dist/{chunk-L343N56B.js → chunk-IYEDEUXG.js} +1 -1
- package/dist/chunk-JNWHQJU3.js +209 -0
- package/dist/{chunk-ODMBZ2VX.js → chunk-KLNFDFLA.js} +42 -31
- package/dist/{chunk-NVULC4JB.js → chunk-QDJOEVGJ.js} +2 -2
- package/dist/{chunk-63DNJXS3.js → chunk-RRKVUW3G.js} +1375 -75
- package/dist/{chunk-5V2JRM5J.js → chunk-SRPKTXIF.js} +1 -1
- package/dist/{chunk-SHQQI3UD.js → chunk-UIXU35ZU.js} +1 -1
- package/dist/{chunk-QZVYN3YA.js → chunk-ZVHFVUDE.js} +2 -37
- package/dist/core/index.cjs +3 -2
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.js +4 -4
- package/dist/core/resources/interop/attributes/types.d.ts +0 -2
- package/dist/core/resources/interop/finalization.d.ts +0 -1
- package/dist/core/types/errors.d.ts +15 -5
- package/dist/core/types/fees.d.ts +9 -0
- package/dist/core/types/flows/interop.d.ts +12 -36
- package/dist/core/types/primitives.d.ts +1 -0
- package/dist/index.cjs +3 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +4 -4
- package/package.json +1 -1
- package/dist/chunk-FGXRG2JS.js +0 -142
|
@@ -4,6 +4,7 @@ export * from './sdk';
|
|
|
4
4
|
export * from './resources/utils';
|
|
5
5
|
export { createDepositsResource } from './resources/deposits';
|
|
6
6
|
export type { DepositsResource } from './resources/deposits';
|
|
7
|
+
export { getL2TransactionHashFromLogs } from './resources/deposits/services/verification';
|
|
7
8
|
export { createWithdrawalsResource } from './resources/withdrawals';
|
|
8
9
|
export { createFinalizationServices } from './resources/withdrawals';
|
|
9
10
|
export type { WithdrawalsResource, FinalizationServices } from './resources/withdrawals';
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
export { buildDirectRequestStruct, classifyReadinessFromRevert, createContractsResource, createDepositsResource, createErrorHandlers, createFinalizationServices, createTokensResource, createViemSdk, createWithdrawalsResource, decodeRevert, encodeNativeTokenVaultTransferData, encodeSecondBridgeArgs, encodeSecondBridgeDataV1, encodeSecondBridgeErc20Args, encodeSecondBridgeEthArgs, registerErrorAbi, toZKsyncError } from '../../chunk-
|
|
2
|
-
import '../../chunk-
|
|
3
|
-
import '../../chunk-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import '../../chunk-
|
|
7
|
-
import '../../chunk-
|
|
1
|
+
export { buildDirectRequestStruct, classifyReadinessFromRevert, createContractsResource, createDepositsResource, createErrorHandlers, createFinalizationServices, createTokensResource, createViemSdk, createWithdrawalsResource, decodeRevert, encodeNativeTokenVaultTransferData, encodeSecondBridgeArgs, encodeSecondBridgeDataV1, encodeSecondBridgeErc20Args, encodeSecondBridgeEthArgs, getL2TransactionHashFromLogs, registerErrorAbi, toZKsyncError } from '../../chunk-5AG6B7UX.js';
|
|
2
|
+
import '../../chunk-AIFHAPJC.js';
|
|
3
|
+
import '../../chunk-ZVHFVUDE.js';
|
|
4
|
+
export { createViemClient as createClient, createViemClient } from '../../chunk-KLNFDFLA.js';
|
|
5
|
+
import '../../chunk-UIXU35ZU.js';
|
|
6
|
+
import '../../chunk-QDJOEVGJ.js';
|
|
7
|
+
import '../../chunk-SRPKTXIF.js';
|
|
8
|
+
import '../../chunk-FBKBF7YM.js';
|
|
8
9
|
import '../../chunk-C3AGOEHR.js';
|
|
@@ -2,7 +2,7 @@ import type { ViemClient } from '../../client';
|
|
|
2
2
|
import type { Address, Hex } from '../../../../core/types/primitives';
|
|
3
3
|
import type { DepositParams, DepositRoute } from '../../../../core/types/flows/deposits';
|
|
4
4
|
import type { CommonCtx } from '../../../../core/types/flows/base';
|
|
5
|
-
import type
|
|
5
|
+
import { type TxGasOverrides } from '../../../../core/types/fees';
|
|
6
6
|
import type { ResolvedToken, TokensResource } from '../../../../core/types/flows/token';
|
|
7
7
|
import type { ContractsResource } from '../contracts';
|
|
8
8
|
export interface BuildCtx extends CommonCtx {
|
|
@@ -14,7 +14,7 @@ export interface BuildCtx extends CommonCtx {
|
|
|
14
14
|
baseTokenL1: Address;
|
|
15
15
|
baseIsEth: boolean;
|
|
16
16
|
l1AssetRouter: Address;
|
|
17
|
-
gasOverrides?:
|
|
17
|
+
gasOverrides?: TxGasOverrides;
|
|
18
18
|
l2GasLimit?: bigint;
|
|
19
19
|
gasPerPubdata: bigint;
|
|
20
20
|
operatorTip: bigint;
|
|
@@ -33,7 +33,7 @@ export declare function commonCtx(p: DepositParams, client: ViemClient, tokens:
|
|
|
33
33
|
bridgehub: `0x${string}`;
|
|
34
34
|
chainIdL2: bigint;
|
|
35
35
|
sender: `0x${string}`;
|
|
36
|
-
gasOverrides:
|
|
36
|
+
gasOverrides: TxGasOverrides | undefined;
|
|
37
37
|
l2GasLimit: bigint | undefined;
|
|
38
38
|
gasPerPubdata: bigint;
|
|
39
39
|
operatorTip: bigint;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { type TransactionRequest } from 'viem';
|
|
2
2
|
import type { BuildCtx } from '../context';
|
|
3
3
|
import type { DepositRoute } from '../../../../../core/types/flows/deposits';
|
|
4
|
-
import type {
|
|
4
|
+
import type { TxGasOverrides } from '../../../../../core/types/fees';
|
|
5
5
|
import type { Address } from '../../../../../core/types/primitives';
|
|
6
6
|
import { type GasQuote } from '../../../../../core/resources/deposits/gas';
|
|
7
7
|
export type { GasQuote };
|
|
8
8
|
export type QuoteL1GasInput = {
|
|
9
9
|
ctx: BuildCtx;
|
|
10
10
|
tx: TransactionRequest;
|
|
11
|
-
overrides?:
|
|
11
|
+
overrides?: TxGasOverrides;
|
|
12
12
|
fallbackGasLimit?: bigint;
|
|
13
13
|
};
|
|
14
14
|
export type QuoteL2GasInput = {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { PublicClient, TransactionReceipt, Log } from 'viem';
|
|
2
2
|
import type { Hex } from '../../../../../core/types/primitives';
|
|
3
|
-
export declare function
|
|
3
|
+
export declare function getL2TransactionHashFromLogs(logs: ReadonlyArray<Log>): Hex | null;
|
|
4
4
|
export declare function waitForL2ExecutionFromL1Tx(l1: PublicClient, l2: PublicClient, l1TxHash: Hex): Promise<{
|
|
5
5
|
l2Receipt: TransactionReceipt;
|
|
6
6
|
l2TxHash: Hex;
|
|
@@ -2,7 +2,7 @@ import type { ViemClient } from '../../client';
|
|
|
2
2
|
import type { Address } from '../../../../core/types/primitives';
|
|
3
3
|
import { type WithdrawParams, type WithdrawRoute } from '../../../../core/types/flows/withdrawals';
|
|
4
4
|
import type { CommonCtx } from '../../../../core/types/flows/base';
|
|
5
|
-
import type
|
|
5
|
+
import { type TxGasOverrides } from '../../../../core/types/fees';
|
|
6
6
|
import type { Hex } from '../../../../core/types/primitives';
|
|
7
7
|
import type { ResolvedToken, TokensResource } from '../../../../core/types/flows/token';
|
|
8
8
|
import type { ContractsResource } from '../contracts';
|
|
@@ -20,7 +20,7 @@ export interface BuildCtx extends CommonCtx {
|
|
|
20
20
|
l2AssetRouter: Address;
|
|
21
21
|
l2NativeTokenVault: Address;
|
|
22
22
|
l2BaseTokenSystem: Address;
|
|
23
|
-
gasOverrides?:
|
|
23
|
+
gasOverrides?: TxGasOverrides;
|
|
24
24
|
}
|
|
25
25
|
export declare function commonCtx(p: WithdrawParams, client: ViemClient, tokens: TokensResource, contracts: ContractsResource): Promise<BuildCtx & {
|
|
26
26
|
route: WithdrawRoute;
|
|
@@ -3646,6 +3646,12 @@ var MailboxABI = [
|
|
|
3646
3646
|
];
|
|
3647
3647
|
var Mailbox_default = MailboxABI;
|
|
3648
3648
|
|
|
3649
|
+
// src/core/types/fees.ts
|
|
3650
|
+
function toGasOverrides(overrides) {
|
|
3651
|
+
const { nonce: _, ...gas } = overrides;
|
|
3652
|
+
return gas;
|
|
3653
|
+
}
|
|
3654
|
+
|
|
3649
3655
|
// src/adapters/viem/resources/deposits/context.ts
|
|
3650
3656
|
async function commonCtx(p, client, tokens, contracts) {
|
|
3651
3657
|
const { bridgehub, l1AssetRouter } = await contracts.addresses();
|
|
@@ -3680,7 +3686,7 @@ async function commonCtx(p, client, tokens, contracts) {
|
|
|
3680
3686
|
bridgehub,
|
|
3681
3687
|
chainIdL2: BigInt(chainId),
|
|
3682
3688
|
sender,
|
|
3683
|
-
gasOverrides: p.l1TxOverrides,
|
|
3689
|
+
gasOverrides: p.l1TxOverrides ? toGasOverrides(p.l1TxOverrides) : void 0,
|
|
3684
3690
|
l2GasLimit: p.l2GasLimit,
|
|
3685
3691
|
gasPerPubdata,
|
|
3686
3692
|
operatorTip,
|
|
@@ -3912,12 +3918,13 @@ if (kInspect) {
|
|
|
3912
3918
|
enumerable: false
|
|
3913
3919
|
});
|
|
3914
3920
|
}
|
|
3915
|
-
function isZKsyncError(e) {
|
|
3921
|
+
function isZKsyncError(e, opts) {
|
|
3916
3922
|
if (!e || typeof e !== "object") return false;
|
|
3917
3923
|
const maybe = e;
|
|
3918
3924
|
if (!("envelope" in maybe)) return false;
|
|
3919
3925
|
const envelope = maybe.envelope;
|
|
3920
|
-
|
|
3926
|
+
if (typeof envelope?.type !== "string" || typeof envelope?.message !== "string") return false;
|
|
3927
|
+
return true;
|
|
3921
3928
|
}
|
|
3922
3929
|
function isReceiptNotFound(e) {
|
|
3923
3930
|
const chain = [];
|
|
@@ -4040,11 +4047,9 @@ var OP_WITHDRAWALS = {
|
|
|
4040
4047
|
rawReceipt: "withdrawals.finalize.fetchParams:rawReceipt",
|
|
4041
4048
|
messengerIndex: "withdrawals.finalize.fetchParams:messengerIndex",
|
|
4042
4049
|
proof: "withdrawals.finalize.fetchParams:proof",
|
|
4043
|
-
network: "withdrawals.finalize.fetchParams:network"
|
|
4044
|
-
ensureAddresses: "withdrawals.finalize.fetchParams:ensureAddresses"
|
|
4050
|
+
network: "withdrawals.finalize.fetchParams:network"
|
|
4045
4051
|
},
|
|
4046
4052
|
readiness: {
|
|
4047
|
-
ensureAddresses: "withdrawals.finalize.readiness:ensureAddresses",
|
|
4048
4053
|
isFinalized: "withdrawals.finalize.readiness:isWithdrawalFinalized",
|
|
4049
4054
|
simulate: "withdrawals.finalize.readiness:simulate"
|
|
4050
4055
|
},
|
|
@@ -5291,7 +5296,7 @@ var I_BRIDGEHUB_NEW_PRIORITY_REQUEST = {
|
|
|
5291
5296
|
{ name: "data", type: "bytes", indexed: false }
|
|
5292
5297
|
]
|
|
5293
5298
|
};
|
|
5294
|
-
function
|
|
5299
|
+
function getL2TransactionHashFromLogs(logs) {
|
|
5295
5300
|
for (const lg of logs) {
|
|
5296
5301
|
try {
|
|
5297
5302
|
const parsed = viem.decodeEventLog({
|
|
@@ -5323,7 +5328,7 @@ function extractL2TxHashFromL1Logs(logs) {
|
|
|
5323
5328
|
async function waitForL2ExecutionFromL1Tx(l1, l2, l1TxHash) {
|
|
5324
5329
|
const l1Receipt = await l1.waitForTransactionReceipt({ hash: l1TxHash });
|
|
5325
5330
|
if (!l1Receipt) throw new Error("No L1 receipt found");
|
|
5326
|
-
const l2TxHash =
|
|
5331
|
+
const l2TxHash = getL2TransactionHashFromLogs(l1Receipt.logs);
|
|
5327
5332
|
if (!l2TxHash) {
|
|
5328
5333
|
throw createError("VERIFICATION", {
|
|
5329
5334
|
message: "Failed to extract L2 transaction hash from L1 logs",
|
|
@@ -5686,7 +5691,13 @@ function createDepositsResource(client, tokens, contracts) {
|
|
|
5686
5691
|
const plan = await prepare(p);
|
|
5687
5692
|
const stepHashes = {};
|
|
5688
5693
|
const from = client.account.address;
|
|
5689
|
-
let next
|
|
5694
|
+
let next;
|
|
5695
|
+
if (typeof p.l1TxOverrides?.nonce === "number") {
|
|
5696
|
+
next = p.l1TxOverrides.nonce;
|
|
5697
|
+
} else {
|
|
5698
|
+
const blockTag = p.l1TxOverrides?.nonce ?? "latest";
|
|
5699
|
+
next = await client.l1.getTransactionCount({ address: from, blockTag });
|
|
5700
|
+
}
|
|
5690
5701
|
for (const step of plan.steps) {
|
|
5691
5702
|
if (step.kind === "approve") {
|
|
5692
5703
|
try {
|
|
@@ -5833,14 +5844,14 @@ function createDepositsResource(client, tokens, contracts) {
|
|
|
5833
5844
|
if (!l1Rcpt) return { phase: "L1_PENDING", l1TxHash };
|
|
5834
5845
|
let l2TxHash;
|
|
5835
5846
|
try {
|
|
5836
|
-
l2TxHash =
|
|
5847
|
+
l2TxHash = getL2TransactionHashFromLogs(l1Rcpt.logs) ?? void 0;
|
|
5837
5848
|
} catch (e) {
|
|
5838
5849
|
throw toZKsyncError(
|
|
5839
5850
|
"INTERNAL",
|
|
5840
5851
|
{
|
|
5841
5852
|
resource: "deposits",
|
|
5842
|
-
operation: "deposits.status.
|
|
5843
|
-
context: { where: "
|
|
5853
|
+
operation: "deposits.status.getL2TransactionHashFromLogs",
|
|
5854
|
+
context: { where: "getL2TransactionHashFromLogs", l1TxHash },
|
|
5844
5855
|
message: "Failed to derive L2 transaction hash from L1 logs."
|
|
5845
5856
|
},
|
|
5846
5857
|
e
|
|
@@ -5989,7 +6000,7 @@ async function commonCtx2(p, client, tokens, contracts) {
|
|
|
5989
6000
|
l2NativeTokenVault,
|
|
5990
6001
|
l2BaseTokenSystem,
|
|
5991
6002
|
baseIsEth,
|
|
5992
|
-
gasOverrides: p.l2TxOverrides
|
|
6003
|
+
gasOverrides: p.l2TxOverrides ? toGasOverrides(p.l2TxOverrides) : void 0
|
|
5993
6004
|
};
|
|
5994
6005
|
}
|
|
5995
6006
|
|
|
@@ -6439,27 +6450,11 @@ function createFinalizationServices(client) {
|
|
|
6439
6450
|
message,
|
|
6440
6451
|
merkleProof: proof.proof
|
|
6441
6452
|
};
|
|
6442
|
-
const { l1Nullifier } = await
|
|
6443
|
-
"INTERNAL",
|
|
6444
|
-
OP_WITHDRAWALS.finalize.fetchParams.ensureAddresses,
|
|
6445
|
-
() => client.ensureAddresses(),
|
|
6446
|
-
{
|
|
6447
|
-
ctx: { where: "ensureAddresses" },
|
|
6448
|
-
message: "Failed to ensure L1 Nullifier address."
|
|
6449
|
-
}
|
|
6450
|
-
);
|
|
6453
|
+
const { l1Nullifier } = await client.ensureAddresses();
|
|
6451
6454
|
return { params, nullifier: l1Nullifier };
|
|
6452
6455
|
},
|
|
6453
6456
|
async simulateFinalizeReadiness(params) {
|
|
6454
|
-
const { l1Nullifier } = await
|
|
6455
|
-
"INTERNAL",
|
|
6456
|
-
OP_WITHDRAWALS.finalize.readiness.ensureAddresses,
|
|
6457
|
-
() => client.ensureAddresses(),
|
|
6458
|
-
{
|
|
6459
|
-
ctx: { where: "ensureAddresses" },
|
|
6460
|
-
message: "Failed to ensure L1 Nullifier address."
|
|
6461
|
-
}
|
|
6462
|
-
);
|
|
6457
|
+
const { l1Nullifier } = await client.ensureAddresses();
|
|
6463
6458
|
const done = await (async () => {
|
|
6464
6459
|
try {
|
|
6465
6460
|
const result = await wrapAs9(
|
|
@@ -6496,15 +6491,7 @@ function createFinalizationServices(client) {
|
|
|
6496
6491
|
}
|
|
6497
6492
|
},
|
|
6498
6493
|
async isWithdrawalFinalized(key) {
|
|
6499
|
-
const { l1Nullifier } = await
|
|
6500
|
-
"INTERNAL",
|
|
6501
|
-
OP_WITHDRAWALS.finalize.fetchParams.ensureAddresses,
|
|
6502
|
-
() => client.ensureAddresses(),
|
|
6503
|
-
{
|
|
6504
|
-
ctx: { where: "ensureAddresses" },
|
|
6505
|
-
message: "Failed to ensure L1 Nullifier address."
|
|
6506
|
-
}
|
|
6507
|
-
);
|
|
6494
|
+
const { l1Nullifier } = await client.ensureAddresses();
|
|
6508
6495
|
return await wrapAs9(
|
|
6509
6496
|
"RPC",
|
|
6510
6497
|
OP_WITHDRAWALS.finalize.isFinalized,
|
|
@@ -6521,15 +6508,7 @@ function createFinalizationServices(client) {
|
|
|
6521
6508
|
);
|
|
6522
6509
|
},
|
|
6523
6510
|
async estimateFinalization(params) {
|
|
6524
|
-
const { l1Nullifier } = await
|
|
6525
|
-
"INTERNAL",
|
|
6526
|
-
OP_WITHDRAWALS.finalize.estimate,
|
|
6527
|
-
() => client.ensureAddresses(),
|
|
6528
|
-
{
|
|
6529
|
-
ctx: { where: "ensureAddresses" },
|
|
6530
|
-
message: "Failed to ensure L1 Nullifier address."
|
|
6531
|
-
}
|
|
6532
|
-
);
|
|
6511
|
+
const { l1Nullifier } = await client.ensureAddresses();
|
|
6533
6512
|
const gasLimit = await wrapAs9(
|
|
6534
6513
|
"RPC",
|
|
6535
6514
|
OP_WITHDRAWALS.finalize.estimate,
|
|
@@ -6592,15 +6571,7 @@ function createFinalizationServices(client) {
|
|
|
6592
6571
|
};
|
|
6593
6572
|
},
|
|
6594
6573
|
async finalizeDeposit(params) {
|
|
6595
|
-
const { l1Nullifier } = await
|
|
6596
|
-
"INTERNAL",
|
|
6597
|
-
OP_WITHDRAWALS.finalize.fetchParams.ensureAddresses,
|
|
6598
|
-
() => client.ensureAddresses(),
|
|
6599
|
-
{
|
|
6600
|
-
ctx: { where: "ensureAddresses" },
|
|
6601
|
-
message: "Failed to ensure L1 Nullifier address."
|
|
6602
|
-
}
|
|
6603
|
-
);
|
|
6574
|
+
const { l1Nullifier } = await client.ensureAddresses();
|
|
6604
6575
|
try {
|
|
6605
6576
|
const hash = await client.l1Wallet.writeContract({
|
|
6606
6577
|
address: l1Nullifier,
|
|
@@ -6701,6 +6672,14 @@ function createWithdrawalsResource(client, tokens, contracts) {
|
|
|
6701
6672
|
const plan = await prepare(p);
|
|
6702
6673
|
const stepHashes = {};
|
|
6703
6674
|
const l2Wallet = client.getL2Wallet();
|
|
6675
|
+
const from = client.account.address;
|
|
6676
|
+
let next;
|
|
6677
|
+
if (typeof p.l2TxOverrides?.nonce === "number") {
|
|
6678
|
+
next = p.l2TxOverrides.nonce;
|
|
6679
|
+
} else {
|
|
6680
|
+
const blockTag = p.l2TxOverrides?.nonce ?? "pending";
|
|
6681
|
+
next = await client.l2.getTransactionCount({ address: from, blockTag });
|
|
6682
|
+
}
|
|
6704
6683
|
for (const step of plan.steps) {
|
|
6705
6684
|
if (p.l2TxOverrides) {
|
|
6706
6685
|
const overrides = p.l2TxOverrides;
|
|
@@ -6734,6 +6713,7 @@ function createWithdrawalsResource(client, tokens, contracts) {
|
|
|
6734
6713
|
maxFeePerGas: step.tx.maxFeePerGas,
|
|
6735
6714
|
maxPriorityFeePerGas: step.tx.maxPriorityFeePerGas
|
|
6736
6715
|
} : {};
|
|
6716
|
+
const nonce = next++;
|
|
6737
6717
|
const baseReq = {
|
|
6738
6718
|
address: step.tx.address,
|
|
6739
6719
|
abi: step.tx.abi,
|
|
@@ -6741,6 +6721,7 @@ function createWithdrawalsResource(client, tokens, contracts) {
|
|
|
6741
6721
|
args: step.tx.args ?? [],
|
|
6742
6722
|
account: step.tx.account ?? l2Wallet.account ?? client.account,
|
|
6743
6723
|
gas: step.tx.gas,
|
|
6724
|
+
nonce,
|
|
6744
6725
|
...fee1559,
|
|
6745
6726
|
...step.tx.dataSuffix ? { dataSuffix: step.tx.dataSuffix } : {},
|
|
6746
6727
|
...step.tx.chain ? { chain: step.tx.chain } : {}
|