@matterlabs/zksync-js 0.0.23 → 0.0.25
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.js +4 -4
- package/dist/adapters/ethers/index.cjs +155 -82
- package/dist/adapters/ethers/index.cjs.map +1 -1
- package/dist/adapters/ethers/index.js +7 -7
- package/dist/adapters/ethers/resources/deposits/services/fee.d.ts +1 -0
- package/dist/adapters/ethers/resources/deposits/services/gas.d.ts +9 -2
- package/dist/adapters/ethers/sdk.cjs +155 -91
- package/dist/adapters/ethers/sdk.cjs.map +1 -1
- package/dist/adapters/ethers/sdk.js +6 -6
- package/dist/adapters/viem/client.js +4 -4
- package/dist/adapters/viem/index.cjs +182 -122
- package/dist/adapters/viem/index.cjs.map +1 -1
- package/dist/adapters/viem/index.js +7 -7
- package/dist/adapters/viem/resources/deposits/services/fee.d.ts +1 -0
- package/dist/adapters/viem/resources/deposits/services/gas.d.ts +9 -2
- package/dist/adapters/viem/sdk.cjs +182 -135
- package/dist/adapters/viem/sdk.cjs.map +1 -1
- package/dist/adapters/viem/sdk.js +6 -6
- package/dist/{chunk-4GPIHYVF.js → chunk-4ZANKNIK.js} +1 -1
- package/dist/{chunk-JJ523MOL.js → chunk-BQ2YCWV2.js} +1 -1
- package/dist/{chunk-4M7VNYGC.js → chunk-H5A6GU3D.js} +2 -2
- package/dist/{chunk-2DDJFHHD.js → chunk-JNS4XZE2.js} +1 -1
- package/dist/{chunk-WPCZNITC.js → chunk-JWN26CQ6.js} +31 -11
- package/dist/{chunk-V2TDNGI5.js → chunk-N5E4FLBF.js} +127 -74
- package/dist/{chunk-NVOFHV3A.js → chunk-NFRRRT5X.js} +155 -120
- package/dist/{chunk-URHDNDFN.js → chunk-PNTR5FTL.js} +2 -2
- package/dist/{chunk-TUN6NH5D.js → chunk-RZH7HBH3.js} +2 -2
- package/dist/{chunk-6WIAMFIW.js → chunk-YEA74D2L.js} +2 -2
- package/dist/{chunk-X2JJDQ4O.js → chunk-YGXEIOK6.js} +1 -1
- package/dist/core/index.js +3 -3
- package/dist/core/resources/deposits/gas.d.ts +11 -1
- package/dist/core/types/errors.d.ts +1 -1
- package/dist/index.js +2 -2
- package/package.json +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { createErrorHandlers, toZKsyncError, classifyReadinessFromRevert } from './chunk-
|
|
2
|
-
import { createNTVCodec, createAttributesResource, resolveCreateDepositL1GasLimit, isInteropFinalizationInfo, DEFAULT_POLL_MS, DEFAULT_TIMEOUT_MS, resolveIdsFromWaitable, parseBundleReceiptInfo, buildFinalizationInfo, parseBundleSentFromReceipt, pickInteropRoute, ZERO_HASH, toGasOverrides, clampPriorityL2GasLimit, applyPriorityL2GasLimitBuffer, buildFeeBreakdown, buildIndirectBundle, preflightIndirect, buildDirectBundle, preflightDirect, derivePriorityTxGasBreakdown, quoteL2Gas, quoteL2BaseCost, quoteL1Gas, applyL1ToL2Alias, derivePriorityBodyGasEstimateCap, assertProtocolVersion, resolveRegisteredTokenPriorityL2GasLimit, quoteL2Gas2 } from './chunk-
|
|
3
|
-
import { detectWithdrawalProtocol, buildWithdrawalFinalization, parseBundleHashFromLogs, classifyWithdrawalOutcome, phaseFromReadiness, buildWithdrawalBundle } from './chunk-
|
|
1
|
+
import { createErrorHandlers, toZKsyncError, classifyReadinessFromRevert } from './chunk-RZH7HBH3.js';
|
|
2
|
+
import { createNTVCodec, createAttributesResource, resolveCreateDepositL1GasLimit, isInteropFinalizationInfo, DEFAULT_POLL_MS, DEFAULT_TIMEOUT_MS, resolveIdsFromWaitable, parseBundleReceiptInfo, buildFinalizationInfo, parseBundleSentFromReceipt, pickInteropRoute, ZERO_HASH, toGasOverrides, clampPriorityL2GasLimit, applyPriorityL2GasLimitBuffer, buildFeeBreakdown, buildIndirectBundle, preflightIndirect, buildDirectBundle, preflightDirect, derivePriorityTxGasBreakdown, quoteL2Gas, quoteL1Fees, quoteL2BaseCost, quoteL1Gas, applyL1ToL2Alias, derivePriorityBodyGasEstimateCap, assertProtocolVersion, resolveRegisteredTokenPriorityL2GasLimit, quoteL2Gas2 } from './chunk-JWN26CQ6.js';
|
|
3
|
+
import { detectWithdrawalProtocol, buildWithdrawalFinalization, parseBundleHashFromLogs, classifyWithdrawalOutcome, phaseFromReadiness, buildWithdrawalBundle } from './chunk-BQ2YCWV2.js';
|
|
4
4
|
import { findL1MessageSentLog, messengerLogIndex, l1MessageSentSender, pickWithdrawRoute } from './chunk-OEUDZFXH.js';
|
|
5
|
-
import { IERC7786Attributes_default, isHash66, IL1Nullifier_default, IInteropHandler_default, createError, OP_WITHDRAWALS, normalizeL1Token, isAddressEq, hexEq, OP_DEPOSITS, IERC20_default, isZKsyncError, isReceiptNotFound, IL1NullifierV32_default, OP_INTEROP, IInteropRootStorage_default, IInteropCenter_default, sleep, isETH, normalizeAddrEq, IL2AssetRouter_default, L2NativeTokenVault_default, assertNever } from './chunk-
|
|
5
|
+
import { IERC7786Attributes_default, isHash66, IL1Nullifier_default, IInteropHandler_default, createError, OP_WITHDRAWALS, normalizeL1Token, isAddressEq, hexEq, OP_DEPOSITS, IERC20_default, isZKsyncError, isReceiptNotFound, IL1NullifierV32_default, OP_INTEROP, IInteropRootStorage_default, IInteropCenter_default, sleep, isETH, normalizeAddrEq, IL2AssetRouter_default, L2NativeTokenVault_default, assertNever } from './chunk-JNS4XZE2.js';
|
|
6
6
|
import { ETH_ADDRESS, TOPIC_CANONICAL_ASSIGNED, TOPIC_CANONICAL_SUCCESS, L2_BASE_TOKEN_ADDRESS, L2_NATIVE_TOKEN_VAULT_ADDRESS, L1_MESSENGER_ADDRESS, L2_INTEROP_ROOT_STORAGE_ADDRESS, BUFFER, SAFE_L1_BRIDGE_GAS, L2_ASSET_ROUTER_ADDRESS, FORMAL_ETH_ADDRESS, ZKSYNC_OS_PRIORITY_TX_TYPE } from './chunk-3IPSDGHO.js';
|
|
7
7
|
import { Interface, keccak256, AbiCoder, ethers, getBytes, Contract, NonceManager, JsonRpcProvider, getAddress, concat, hexlify, toBeArray, toBeHex, isError } from 'ethers';
|
|
8
8
|
|
|
@@ -154,8 +154,9 @@ function toCoreTx(tx) {
|
|
|
154
154
|
data: tx.data,
|
|
155
155
|
value: tx.value ? BigInt(tx.value) : void 0,
|
|
156
156
|
gasLimit: tx.gasLimit ? BigInt(tx.gasLimit) : void 0,
|
|
157
|
-
|
|
158
|
-
|
|
157
|
+
// zero fees are explicit on zero-base-fee chains; dropping them would re-fetch the market tip
|
|
158
|
+
maxFeePerGas: tx.maxFeePerGas != null ? BigInt(tx.maxFeePerGas) : void 0,
|
|
159
|
+
maxPriorityFeePerGas: tx.maxPriorityFeePerGas != null ? BigInt(tx.maxPriorityFeePerGas) : void 0
|
|
159
160
|
};
|
|
160
161
|
}
|
|
161
162
|
function ethersToGasEstimator(provider) {
|
|
@@ -230,7 +231,7 @@ var encode = (abi2, fn, args) => {
|
|
|
230
231
|
return new Interface(abi2).encodeFunctionData(fn, args);
|
|
231
232
|
};
|
|
232
233
|
async function quoteL2BaseCost2(input) {
|
|
233
|
-
const { ctx, l2GasLimit } = input;
|
|
234
|
+
const { ctx, l2GasLimit, l1GasPrice } = input;
|
|
234
235
|
const estimator = ethersToGasEstimator(ctx.client.l1);
|
|
235
236
|
return wrapAs(
|
|
236
237
|
"RPC",
|
|
@@ -241,13 +242,15 @@ async function quoteL2BaseCost2(input) {
|
|
|
241
242
|
bridgehub: ctx.bridgehub,
|
|
242
243
|
chainIdL2: ctx.chainIdL2,
|
|
243
244
|
l2GasLimit,
|
|
244
|
-
gasPerPubdata: ctx.gasPerPubdata
|
|
245
|
+
gasPerPubdata: ctx.gasPerPubdata,
|
|
246
|
+
l1GasPrice
|
|
245
247
|
}),
|
|
246
248
|
{ ctx: { chainIdL2: ctx.chainIdL2 } }
|
|
247
249
|
);
|
|
248
250
|
}
|
|
249
251
|
|
|
250
252
|
// src/adapters/ethers/resources/deposits/services/gas.ts
|
|
253
|
+
var { wrapAs: wrapAs2 } = createErrorHandlers("deposits");
|
|
251
254
|
var DEFAULT_SAFE_NONBASE_L2_GAS_LIMIT = 3000000n;
|
|
252
255
|
var ZERO_L2_TOKEN_ADDRESS = "0x0000000000000000000000000000000000000000";
|
|
253
256
|
async function estimatePriorityTxL2Gas(ctx, leg) {
|
|
@@ -258,6 +261,18 @@ async function estimatePriorityTxL2Gas(ctx, leg) {
|
|
|
258
261
|
return void 0;
|
|
259
262
|
}
|
|
260
263
|
}
|
|
264
|
+
async function quoteL1Fees2(input) {
|
|
265
|
+
const { ctx } = input;
|
|
266
|
+
return wrapAs2(
|
|
267
|
+
"RPC",
|
|
268
|
+
"deposits.fees.l1",
|
|
269
|
+
() => quoteL1Fees({
|
|
270
|
+
estimator: ethersToGasEstimator(ctx.client.l1),
|
|
271
|
+
overrides: ctx.gasOverrides
|
|
272
|
+
}),
|
|
273
|
+
{ ctx: { chainIdL2: ctx.chainIdL2 } }
|
|
274
|
+
);
|
|
275
|
+
}
|
|
261
276
|
async function quoteL1Gas2(input) {
|
|
262
277
|
const { ctx, tx, overrides, fallbackGasLimit } = input;
|
|
263
278
|
const estimator = ethersToGasEstimator(ctx.client.l1);
|
|
@@ -429,7 +444,12 @@ function routeEthDirect() {
|
|
|
429
444
|
if (!l2GasParams) {
|
|
430
445
|
throw new Error("Failed to estimate L2 gas for deposit.");
|
|
431
446
|
}
|
|
432
|
-
const
|
|
447
|
+
const l1Fees = await quoteL1Fees2({ ctx });
|
|
448
|
+
const baseCost = await quoteL2BaseCost2({
|
|
449
|
+
ctx,
|
|
450
|
+
l2GasLimit: l2GasParams.gasLimit,
|
|
451
|
+
l1GasPrice: l1Fees.maxFeePerGas
|
|
452
|
+
});
|
|
433
453
|
const mintValue = baseCost + ctx.operatorTip + l2Value;
|
|
434
454
|
const req = buildDirectRequestStruct({
|
|
435
455
|
chainId: ctx.chainIdL2,
|
|
@@ -446,7 +466,8 @@ function routeEthDirect() {
|
|
|
446
466
|
data,
|
|
447
467
|
value: mintValue,
|
|
448
468
|
from: ctx.sender,
|
|
449
|
-
...ctx.gasOverrides
|
|
469
|
+
...ctx.gasOverrides,
|
|
470
|
+
...l1Fees
|
|
450
471
|
};
|
|
451
472
|
const l1GasParams = await quoteL1Gas2({
|
|
452
473
|
ctx,
|
|
@@ -482,7 +503,7 @@ function routeEthDirect() {
|
|
|
482
503
|
}
|
|
483
504
|
};
|
|
484
505
|
}
|
|
485
|
-
var { wrapAs:
|
|
506
|
+
var { wrapAs: wrapAs3 } = createErrorHandlers("deposits");
|
|
486
507
|
var ZERO_L2_TOKEN_ADDRESS2 = "0x0000000000000000000000000000000000000000";
|
|
487
508
|
var ZERO_ASSET_ID = "0x0000000000000000000000000000000000000000000000000000000000000000";
|
|
488
509
|
var ntvCodec = createNTVCodec({
|
|
@@ -565,7 +586,7 @@ function routeErc20NonBase() {
|
|
|
565
586
|
async preflight(p, ctx) {
|
|
566
587
|
const resolved = ctx.resolvedToken ?? (ctx.tokens ? await ctx.tokens.resolve(p.token, { chain: "l1" }) : void 0);
|
|
567
588
|
const baseToken = ctx.baseTokenL1 ?? await ctx.client.baseToken(ctx.chainIdL2);
|
|
568
|
-
await
|
|
589
|
+
await wrapAs3(
|
|
569
590
|
"VALIDATION",
|
|
570
591
|
OP_DEPOSITS.nonbase.assertNonBaseToken,
|
|
571
592
|
() => {
|
|
@@ -581,7 +602,7 @@ function routeErc20NonBase() {
|
|
|
581
602
|
const baseToken = ctx.baseTokenL1 ?? await ctx.client.baseToken(ctx.chainIdL2);
|
|
582
603
|
const baseIsEth = ctx.baseIsEth ?? isETH(baseToken);
|
|
583
604
|
const receiver = p.to ?? ctx.sender;
|
|
584
|
-
const secondBridgeCalldata = await
|
|
605
|
+
const secondBridgeCalldata = await wrapAs3(
|
|
585
606
|
"INTERNAL",
|
|
586
607
|
OP_DEPOSITS.nonbase.encodeCalldata,
|
|
587
608
|
() => encodeSecondBridgeErc20DepositCalldata({
|
|
@@ -615,14 +636,19 @@ function routeErc20NonBase() {
|
|
|
615
636
|
}
|
|
616
637
|
});
|
|
617
638
|
if (!l2GasParams) throw new Error("Failed to establish L2 gas parameters.");
|
|
618
|
-
const
|
|
639
|
+
const l1Fees = await quoteL1Fees2({ ctx });
|
|
640
|
+
const baseCost = await quoteL2BaseCost2({
|
|
641
|
+
ctx,
|
|
642
|
+
l2GasLimit: l2GasParams.gasLimit,
|
|
643
|
+
l1GasPrice: l1Fees.maxFeePerGas
|
|
644
|
+
});
|
|
619
645
|
const mintValue = baseCost + ctx.operatorTip;
|
|
620
646
|
const approvals = [];
|
|
621
647
|
const steps = [];
|
|
622
648
|
const assetRouter = ctx.l1AssetRouter;
|
|
623
649
|
const nativeTokenVault = ctx.l1NativeTokenVault;
|
|
624
650
|
const erc20Deposit = new Contract(p.token, IERC20_default, l1Signer);
|
|
625
|
-
const allowanceToken = await
|
|
651
|
+
const allowanceToken = await wrapAs3(
|
|
626
652
|
"RPC",
|
|
627
653
|
OP_DEPOSITS.nonbase.allowanceToken,
|
|
628
654
|
() => erc20Deposit.allowance(ctx.sender, nativeTokenVault),
|
|
@@ -650,7 +676,7 @@ function routeErc20NonBase() {
|
|
|
650
676
|
}
|
|
651
677
|
if (!baseIsEth) {
|
|
652
678
|
const erc20Base = new Contract(baseToken, IERC20_default, l1Signer);
|
|
653
|
-
const allowanceBase = await
|
|
679
|
+
const allowanceBase = await wrapAs3(
|
|
654
680
|
"RPC",
|
|
655
681
|
OP_DEPOSITS.nonbase.allowanceBase,
|
|
656
682
|
() => erc20Base.allowance(ctx.sender, nativeTokenVault),
|
|
@@ -698,7 +724,8 @@ function routeErc20NonBase() {
|
|
|
698
724
|
data,
|
|
699
725
|
value: txValue,
|
|
700
726
|
from: ctx.sender,
|
|
701
|
-
...ctx.gasOverrides
|
|
727
|
+
...ctx.gasOverrides,
|
|
728
|
+
...l1Fees
|
|
702
729
|
};
|
|
703
730
|
const l1GasParams = await quoteL1Gas2({
|
|
704
731
|
ctx,
|
|
@@ -733,13 +760,27 @@ function routeErc20NonBase() {
|
|
|
733
760
|
}
|
|
734
761
|
};
|
|
735
762
|
}
|
|
736
|
-
var { wrapAs:
|
|
763
|
+
var { wrapAs: wrapAs4 } = createErrorHandlers("deposits");
|
|
737
764
|
var ZERO_L2_TOKEN_ADDRESS3 = "0x0000000000000000000000000000000000000000";
|
|
738
765
|
var ZERO_ASSET_ID2 = "0x0000000000000000000000000000000000000000000000000000000000000000";
|
|
739
766
|
var ntvCodec2 = createNTVCodec({
|
|
740
767
|
encode: (types, values) => AbiCoder.defaultAbiCoder().encode(types, values),
|
|
741
768
|
keccak256: (data) => keccak256(data)
|
|
742
769
|
});
|
|
770
|
+
async function encodeSecondBridgeEthDepositCalldata(input) {
|
|
771
|
+
const registeredAssetId = input.ctx.resolvedToken?.assetId;
|
|
772
|
+
const assetId = registeredAssetId && registeredAssetId.toLowerCase() !== ZERO_ASSET_ID2 ? registeredAssetId : ntvCodec2.encodeAssetId(
|
|
773
|
+
BigInt((await input.ctx.client.l1.getNetwork()).chainId),
|
|
774
|
+
L2_NATIVE_TOKEN_VAULT_ADDRESS,
|
|
775
|
+
ETH_ADDRESS
|
|
776
|
+
);
|
|
777
|
+
const transferData = encodeNativeTokenVaultTransferData(
|
|
778
|
+
input.amount,
|
|
779
|
+
input.receiver,
|
|
780
|
+
ETH_ADDRESS
|
|
781
|
+
);
|
|
782
|
+
return encodeSecondBridgeDataV1(assetId, transferData);
|
|
783
|
+
}
|
|
743
784
|
async function getPriorityGasModel2(input) {
|
|
744
785
|
try {
|
|
745
786
|
const l1AssetRouter = await input.ctx.contracts.l1AssetRouter();
|
|
@@ -795,7 +836,7 @@ function routeEthNonBase() {
|
|
|
795
836
|
return {
|
|
796
837
|
async preflight(p, ctx) {
|
|
797
838
|
const resolved = ctx.resolvedToken ?? (ctx.tokens ? await ctx.tokens.resolve(p.token, { chain: "l1" }) : void 0);
|
|
798
|
-
await
|
|
839
|
+
await wrapAs4(
|
|
799
840
|
"VALIDATION",
|
|
800
841
|
OP_DEPOSITS.ethNonBase.assertEthAsset,
|
|
801
842
|
() => {
|
|
@@ -805,7 +846,7 @@ function routeEthNonBase() {
|
|
|
805
846
|
},
|
|
806
847
|
{ ctx: { token: p.token } }
|
|
807
848
|
);
|
|
808
|
-
await
|
|
849
|
+
await wrapAs4(
|
|
809
850
|
"VALIDATION",
|
|
810
851
|
OP_DEPOSITS.ethNonBase.assertNonEthBase,
|
|
811
852
|
() => {
|
|
@@ -815,7 +856,7 @@ function routeEthNonBase() {
|
|
|
815
856
|
},
|
|
816
857
|
{ ctx: { baseIsEth: ctx.baseIsEth, chainIdL2: ctx.chainIdL2 } }
|
|
817
858
|
);
|
|
818
|
-
const ethBal = await
|
|
859
|
+
const ethBal = await wrapAs4(
|
|
819
860
|
"RPC",
|
|
820
861
|
OP_DEPOSITS.ethNonBase.ethBalance,
|
|
821
862
|
() => ctx.client.l1.getBalance(ctx.sender),
|
|
@@ -824,7 +865,7 @@ function routeEthNonBase() {
|
|
|
824
865
|
message: "Failed to read L1 ETH balance."
|
|
825
866
|
}
|
|
826
867
|
);
|
|
827
|
-
await
|
|
868
|
+
await wrapAs4(
|
|
828
869
|
"VALIDATION",
|
|
829
870
|
OP_DEPOSITS.ethNonBase.assertEthBalance,
|
|
830
871
|
() => {
|
|
@@ -859,12 +900,17 @@ function routeEthNonBase() {
|
|
|
859
900
|
undeployedGasLimit: priorityGasModel.undeployedGasLimit
|
|
860
901
|
});
|
|
861
902
|
if (!l2GasParams) throw new Error("Failed to estimate L2 gas parameters.");
|
|
862
|
-
const
|
|
903
|
+
const l1Fees = await quoteL1Fees2({ ctx });
|
|
904
|
+
const baseCost = await quoteL2BaseCost2({
|
|
905
|
+
ctx,
|
|
906
|
+
l2GasLimit: l2GasParams.gasLimit,
|
|
907
|
+
l1GasPrice: l1Fees.maxFeePerGas
|
|
908
|
+
});
|
|
863
909
|
const mintValue = baseCost + ctx.operatorTip;
|
|
864
910
|
const approvals = [];
|
|
865
911
|
const steps = [];
|
|
866
912
|
const erc20Base = new Contract(baseToken, IERC20_default, l1Signer);
|
|
867
|
-
const allowance = await
|
|
913
|
+
const allowance = await wrapAs4(
|
|
868
914
|
"RPC",
|
|
869
915
|
OP_DEPOSITS.ethNonBase.allowanceBase,
|
|
870
916
|
() => erc20Base.allowance(ctx.sender, ctx.l1NativeTokenVault),
|
|
@@ -890,13 +936,13 @@ function routeEthNonBase() {
|
|
|
890
936
|
}
|
|
891
937
|
});
|
|
892
938
|
}
|
|
893
|
-
const secondBridgeCalldata = await
|
|
939
|
+
const secondBridgeCalldata = await wrapAs4(
|
|
894
940
|
"INTERNAL",
|
|
895
941
|
OP_DEPOSITS.ethNonBase.encodeCalldata,
|
|
896
|
-
() =>
|
|
942
|
+
() => encodeSecondBridgeEthDepositCalldata({ ctx, amount: p.amount, receiver }),
|
|
897
943
|
{
|
|
898
944
|
ctx: {
|
|
899
|
-
where: "
|
|
945
|
+
where: "encodeSecondBridgeEthDepositCalldata",
|
|
900
946
|
amount: p.amount.toString(),
|
|
901
947
|
to: receiver
|
|
902
948
|
}
|
|
@@ -923,7 +969,8 @@ function routeEthNonBase() {
|
|
|
923
969
|
data,
|
|
924
970
|
value: bridgehubValue,
|
|
925
971
|
from: ctx.sender,
|
|
926
|
-
...ctx.gasOverrides
|
|
972
|
+
...ctx.gasOverrides,
|
|
973
|
+
...l1Fees
|
|
927
974
|
};
|
|
928
975
|
const l1GasParams = await quoteL1Gas2({
|
|
929
976
|
ctx,
|
|
@@ -958,13 +1005,13 @@ function routeEthNonBase() {
|
|
|
958
1005
|
}
|
|
959
1006
|
};
|
|
960
1007
|
}
|
|
961
|
-
var { wrapAs:
|
|
1008
|
+
var { wrapAs: wrapAs5 } = createErrorHandlers("deposits");
|
|
962
1009
|
var EMPTY_BYTES3 = "0x";
|
|
963
1010
|
function routeErc20Base() {
|
|
964
1011
|
return {
|
|
965
1012
|
async preflight(p, ctx) {
|
|
966
1013
|
const resolved = ctx.resolvedToken ?? (ctx.tokens ? await ctx.tokens.resolve(p.token, { chain: "l1" }) : void 0);
|
|
967
|
-
await
|
|
1014
|
+
await wrapAs5(
|
|
968
1015
|
"VALIDATION",
|
|
969
1016
|
OP_DEPOSITS.base.assertErc20Asset,
|
|
970
1017
|
() => {
|
|
@@ -975,7 +1022,7 @@ function routeErc20Base() {
|
|
|
975
1022
|
{ ctx: { token: p.token } }
|
|
976
1023
|
);
|
|
977
1024
|
const baseToken = ctx.baseTokenL1 ?? await ctx.client.baseToken(ctx.chainIdL2);
|
|
978
|
-
await
|
|
1025
|
+
await wrapAs5(
|
|
979
1026
|
"VALIDATION",
|
|
980
1027
|
OP_DEPOSITS.base.assertMatchesBase,
|
|
981
1028
|
() => {
|
|
@@ -1014,13 +1061,18 @@ function routeErc20Base() {
|
|
|
1014
1061
|
overrideGasLimit: quotedL2GasLimit
|
|
1015
1062
|
});
|
|
1016
1063
|
if (!l2GasParams) throw new Error("Failed to estimate L2 gas parameters.");
|
|
1017
|
-
const
|
|
1064
|
+
const l1Fees = await quoteL1Fees2({ ctx });
|
|
1065
|
+
const baseCost = await quoteL2BaseCost2({
|
|
1066
|
+
ctx,
|
|
1067
|
+
l2GasLimit: l2GasParams.gasLimit,
|
|
1068
|
+
l1GasPrice: l1Fees.maxFeePerGas
|
|
1069
|
+
});
|
|
1018
1070
|
const mintValue = baseCost + ctx.operatorTip + p.amount;
|
|
1019
1071
|
const approvals = [];
|
|
1020
1072
|
const steps = [];
|
|
1021
1073
|
{
|
|
1022
1074
|
const erc20 = new Contract(baseToken, IERC20_default, l1Signer);
|
|
1023
|
-
const allowance = await
|
|
1075
|
+
const allowance = await wrapAs5(
|
|
1024
1076
|
"RPC",
|
|
1025
1077
|
OP_DEPOSITS.base.allowance,
|
|
1026
1078
|
() => erc20.allowance(ctx.sender, ctx.l1NativeTokenVault),
|
|
@@ -1066,7 +1118,8 @@ function routeErc20Base() {
|
|
|
1066
1118
|
value: 0n,
|
|
1067
1119
|
// base token is ERC-20 ⇒ msg.value MUST be 0
|
|
1068
1120
|
from: ctx.sender,
|
|
1069
|
-
...ctx.gasOverrides
|
|
1121
|
+
...ctx.gasOverrides,
|
|
1122
|
+
...l1Fees
|
|
1070
1123
|
};
|
|
1071
1124
|
const l1GasParams = await quoteL1Gas2({
|
|
1072
1125
|
ctx,
|
|
@@ -1101,7 +1154,7 @@ function routeErc20Base() {
|
|
|
1101
1154
|
}
|
|
1102
1155
|
};
|
|
1103
1156
|
}
|
|
1104
|
-
var { wrapAs:
|
|
1157
|
+
var { wrapAs: wrapAs6 } = createErrorHandlers("tokens");
|
|
1105
1158
|
var abi = AbiCoder.defaultAbiCoder();
|
|
1106
1159
|
var ntvCodec3 = createNTVCodec({
|
|
1107
1160
|
encode: (types, values) => abi.encode(types, values),
|
|
@@ -1114,7 +1167,7 @@ function createTokensResource(client) {
|
|
|
1114
1167
|
let wethL2Promise = null;
|
|
1115
1168
|
async function getL1ChainId() {
|
|
1116
1169
|
if (!l2NtvL1ChainIdPromise) {
|
|
1117
|
-
l2NtvL1ChainIdPromise =
|
|
1170
|
+
l2NtvL1ChainIdPromise = wrapAs6("INTERNAL", "getL1ChainId", async () => {
|
|
1118
1171
|
const { l2NativeTokenVault } = await client.contracts();
|
|
1119
1172
|
const chainId = await l2NativeTokenVault.L1_CHAIN_ID();
|
|
1120
1173
|
return chainId;
|
|
@@ -1124,7 +1177,7 @@ function createTokensResource(client) {
|
|
|
1124
1177
|
}
|
|
1125
1178
|
async function getBaseTokenAssetId() {
|
|
1126
1179
|
if (!baseTokenAssetIdPromise) {
|
|
1127
|
-
baseTokenAssetIdPromise =
|
|
1180
|
+
baseTokenAssetIdPromise = wrapAs6("INTERNAL", "baseTokenAssetId", async () => {
|
|
1128
1181
|
const { l2NativeTokenVault } = await client.contracts();
|
|
1129
1182
|
const assetId = await l2NativeTokenVault.BASE_TOKEN_ASSET_ID();
|
|
1130
1183
|
return assetId;
|
|
@@ -1134,7 +1187,7 @@ function createTokensResource(client) {
|
|
|
1134
1187
|
}
|
|
1135
1188
|
async function getWethL1() {
|
|
1136
1189
|
if (!wethL1Promise) {
|
|
1137
|
-
wethL1Promise =
|
|
1190
|
+
wethL1Promise = wrapAs6("INTERNAL", "wethL1", async () => {
|
|
1138
1191
|
const { l1NativeTokenVault } = await client.contracts();
|
|
1139
1192
|
const weth = await l1NativeTokenVault.WETH_TOKEN();
|
|
1140
1193
|
return weth;
|
|
@@ -1144,7 +1197,7 @@ function createTokensResource(client) {
|
|
|
1144
1197
|
}
|
|
1145
1198
|
async function getWethL2() {
|
|
1146
1199
|
if (!wethL2Promise) {
|
|
1147
|
-
wethL2Promise =
|
|
1200
|
+
wethL2Promise = wrapAs6("INTERNAL", "wethL2", async () => {
|
|
1148
1201
|
const { l2NativeTokenVault } = await client.contracts();
|
|
1149
1202
|
const weth = await l2NativeTokenVault.WETH_TOKEN();
|
|
1150
1203
|
return weth;
|
|
@@ -1153,7 +1206,7 @@ function createTokensResource(client) {
|
|
|
1153
1206
|
return wethL2Promise;
|
|
1154
1207
|
}
|
|
1155
1208
|
async function toL2Address(l1Token) {
|
|
1156
|
-
return
|
|
1209
|
+
return wrapAs6("CONTRACT", "tokens.toL2Address", async () => {
|
|
1157
1210
|
const normalized = normalizeL1Token(l1Token);
|
|
1158
1211
|
const { chainId } = await client.l2.getNetwork();
|
|
1159
1212
|
const baseToken = await client.baseToken(BigInt(chainId));
|
|
@@ -1166,7 +1219,7 @@ function createTokensResource(client) {
|
|
|
1166
1219
|
});
|
|
1167
1220
|
}
|
|
1168
1221
|
async function toL1Address(l2Token) {
|
|
1169
|
-
return
|
|
1222
|
+
return wrapAs6("CONTRACT", "tokens.toL1Address", async () => {
|
|
1170
1223
|
if (isAddressEq(l2Token, ETH_ADDRESS)) {
|
|
1171
1224
|
return ETH_ADDRESS;
|
|
1172
1225
|
}
|
|
@@ -1189,7 +1242,7 @@ function createTokensResource(client) {
|
|
|
1189
1242
|
});
|
|
1190
1243
|
}
|
|
1191
1244
|
async function assetIdOfL1(l1Token) {
|
|
1192
|
-
return
|
|
1245
|
+
return wrapAs6("CONTRACT", "tokens.assetIdOfL1", async () => {
|
|
1193
1246
|
const normalized = normalizeL1Token(l1Token);
|
|
1194
1247
|
const { l1NativeTokenVault } = await client.contracts();
|
|
1195
1248
|
const assetId = await l1NativeTokenVault.assetId(normalized);
|
|
@@ -1197,28 +1250,28 @@ function createTokensResource(client) {
|
|
|
1197
1250
|
});
|
|
1198
1251
|
}
|
|
1199
1252
|
async function assetIdOfL2(l2Token) {
|
|
1200
|
-
return
|
|
1253
|
+
return wrapAs6("CONTRACT", "tokens.assetIdOfL2", async () => {
|
|
1201
1254
|
const { l2NativeTokenVault } = await client.contracts();
|
|
1202
1255
|
const assetId = await l2NativeTokenVault.assetId(l2Token);
|
|
1203
1256
|
return assetId;
|
|
1204
1257
|
});
|
|
1205
1258
|
}
|
|
1206
1259
|
async function l2TokenFromAssetId(assetId) {
|
|
1207
|
-
return
|
|
1260
|
+
return wrapAs6("CONTRACT", "tokens.l2TokenFromAssetId", async () => {
|
|
1208
1261
|
const { l2NativeTokenVault } = await client.contracts();
|
|
1209
1262
|
const tokenAddr = await l2NativeTokenVault.tokenAddress(assetId);
|
|
1210
1263
|
return tokenAddr;
|
|
1211
1264
|
});
|
|
1212
1265
|
}
|
|
1213
1266
|
async function l1TokenFromAssetId(assetId) {
|
|
1214
|
-
return
|
|
1267
|
+
return wrapAs6("CONTRACT", "tokens.l1TokenFromAssetId", async () => {
|
|
1215
1268
|
const { l1NativeTokenVault } = await client.contracts();
|
|
1216
1269
|
const tokenAddr = await l1NativeTokenVault.tokenAddress(assetId);
|
|
1217
1270
|
return tokenAddr;
|
|
1218
1271
|
});
|
|
1219
1272
|
}
|
|
1220
1273
|
async function originChainId(assetId) {
|
|
1221
|
-
return
|
|
1274
|
+
return wrapAs6("CONTRACT", "tokens.originChainId", async () => {
|
|
1222
1275
|
const { l2NativeTokenVault } = await client.contracts();
|
|
1223
1276
|
const chainId = await l2NativeTokenVault.originChainId(assetId);
|
|
1224
1277
|
return chainId;
|
|
@@ -1228,7 +1281,7 @@ function createTokensResource(client) {
|
|
|
1228
1281
|
return getBaseTokenAssetId();
|
|
1229
1282
|
}
|
|
1230
1283
|
async function isChainEthBased() {
|
|
1231
|
-
return
|
|
1284
|
+
return wrapAs6("CONTRACT", "tokens.isChainEthBased", async () => {
|
|
1232
1285
|
const baseAssetId = await getBaseTokenAssetId();
|
|
1233
1286
|
const l1ChainId = await getL1ChainId();
|
|
1234
1287
|
const ethAssetId = ntvCodec3.encodeAssetId(
|
|
@@ -1246,7 +1299,7 @@ function createTokensResource(client) {
|
|
|
1246
1299
|
return getWethL2();
|
|
1247
1300
|
}
|
|
1248
1301
|
async function computeL2BridgedAddress(args) {
|
|
1249
|
-
return
|
|
1302
|
+
return wrapAs6("CONTRACT", "tokens.computeL2BridgedAddress", async () => {
|
|
1250
1303
|
const normalized = normalizeL1Token(args.l1Token);
|
|
1251
1304
|
const { l2NativeTokenVault } = await client.contracts();
|
|
1252
1305
|
const predicted = await l2NativeTokenVault.calculateCreate2TokenAddress(
|
|
@@ -1257,7 +1310,7 @@ function createTokensResource(client) {
|
|
|
1257
1310
|
});
|
|
1258
1311
|
}
|
|
1259
1312
|
async function resolve(ref, opts) {
|
|
1260
|
-
return
|
|
1313
|
+
return wrapAs6("CONTRACT", "tokens.resolve", async () => {
|
|
1261
1314
|
let chain;
|
|
1262
1315
|
let address;
|
|
1263
1316
|
if (typeof ref === "string") {
|
|
@@ -1750,13 +1803,13 @@ function buildFeeBreakdown2(p) {
|
|
|
1750
1803
|
}
|
|
1751
1804
|
|
|
1752
1805
|
// src/adapters/ethers/resources/withdrawals/routes/eth.ts
|
|
1753
|
-
var { wrapAs:
|
|
1806
|
+
var { wrapAs: wrapAs7 } = createErrorHandlers("withdrawals");
|
|
1754
1807
|
function routeEthBase() {
|
|
1755
1808
|
return {
|
|
1756
1809
|
async build(p, ctx) {
|
|
1757
1810
|
const steps = [];
|
|
1758
1811
|
const base = await ctx.contracts.l2BaseTokenSystem();
|
|
1759
|
-
const data = await
|
|
1812
|
+
const data = await wrapAs7(
|
|
1760
1813
|
"INTERNAL",
|
|
1761
1814
|
OP_WITHDRAWALS.eth.encodeWithdraw,
|
|
1762
1815
|
() => Promise.resolve(base.interface.encodeFunctionData("withdraw", [p.to ?? ctx.sender])),
|
|
@@ -1791,7 +1844,7 @@ function routeEthBase() {
|
|
|
1791
1844
|
}
|
|
1792
1845
|
};
|
|
1793
1846
|
}
|
|
1794
|
-
var { wrapAs:
|
|
1847
|
+
var { wrapAs: wrapAs8 } = createErrorHandlers("withdrawals");
|
|
1795
1848
|
var SIG = {
|
|
1796
1849
|
withdraw: "withdraw(bytes32,bytes)"
|
|
1797
1850
|
};
|
|
@@ -1801,7 +1854,7 @@ function routeErc20NonBase2() {
|
|
|
1801
1854
|
const steps = [];
|
|
1802
1855
|
const approvals = [];
|
|
1803
1856
|
const erc20 = new Contract(p.token, IERC20_default, ctx.client.l2);
|
|
1804
|
-
const current = await
|
|
1857
|
+
const current = await wrapAs8(
|
|
1805
1858
|
"CONTRACT",
|
|
1806
1859
|
OP_WITHDRAWALS.erc20.allowance,
|
|
1807
1860
|
() => erc20.allowance(ctx.sender, ctx.l2NativeTokenVault),
|
|
@@ -1839,7 +1892,7 @@ function routeErc20NonBase2() {
|
|
|
1839
1892
|
tx: approveTx
|
|
1840
1893
|
});
|
|
1841
1894
|
}
|
|
1842
|
-
const assetId = await
|
|
1895
|
+
const assetId = await wrapAs8(
|
|
1843
1896
|
"CONTRACT",
|
|
1844
1897
|
OP_WITHDRAWALS.erc20.ensureRegistered,
|
|
1845
1898
|
async () => {
|
|
@@ -1852,7 +1905,7 @@ function routeErc20NonBase2() {
|
|
|
1852
1905
|
message: "Failed to ensure token is registered in L2NativeTokenVault."
|
|
1853
1906
|
}
|
|
1854
1907
|
);
|
|
1855
|
-
const assetData = await
|
|
1908
|
+
const assetData = await wrapAs8(
|
|
1856
1909
|
"INTERNAL",
|
|
1857
1910
|
OP_WITHDRAWALS.erc20.encodeAssetData,
|
|
1858
1911
|
() => Promise.resolve(
|
|
@@ -1864,7 +1917,7 @@ function routeErc20NonBase2() {
|
|
|
1864
1917
|
}
|
|
1865
1918
|
);
|
|
1866
1919
|
const l2ar = await ctx.contracts.l2AssetRouter();
|
|
1867
|
-
const dataWithdraw = await
|
|
1920
|
+
const dataWithdraw = await wrapAs8(
|
|
1868
1921
|
"INTERNAL",
|
|
1869
1922
|
OP_WITHDRAWALS.erc20.encodeWithdraw,
|
|
1870
1923
|
() => Promise.resolve(l2ar.interface.encodeFunctionData(SIG.withdraw, [assetId, assetData])),
|
|
@@ -1954,7 +2007,7 @@ function createEthersAttributesResource(opts = {}) {
|
|
|
1954
2007
|
}
|
|
1955
2008
|
|
|
1956
2009
|
// src/adapters/ethers/resources/withdrawals/routes/interop-bundle.ts
|
|
1957
|
-
var { wrapAs:
|
|
2010
|
+
var { wrapAs: wrapAs9 } = createErrorHandlers("withdrawals");
|
|
1958
2011
|
var attributes = createEthersAttributesResource();
|
|
1959
2012
|
function saltFor(sender, nonce) {
|
|
1960
2013
|
return keccak256(
|
|
@@ -1973,7 +2026,7 @@ function routeInteropBundle() {
|
|
|
1973
2026
|
if (isBaseToken) {
|
|
1974
2027
|
assetId = ctx.baseTokenAssetId;
|
|
1975
2028
|
} else {
|
|
1976
|
-
assetId = await
|
|
2029
|
+
assetId = await wrapAs9(
|
|
1977
2030
|
"CONTRACT",
|
|
1978
2031
|
OP_WITHDRAWALS.erc20.ensureRegistered,
|
|
1979
2032
|
async () => {
|
|
@@ -1986,7 +2039,7 @@ function routeInteropBundle() {
|
|
|
1986
2039
|
}
|
|
1987
2040
|
);
|
|
1988
2041
|
const erc20 = new Contract(p.token, IERC20_default, ctx.client.l2);
|
|
1989
|
-
const current = await
|
|
2042
|
+
const current = await wrapAs9(
|
|
1990
2043
|
"CONTRACT",
|
|
1991
2044
|
OP_WITHDRAWALS.erc20.allowance,
|
|
1992
2045
|
() => erc20.allowance(ctx.sender, ctx.l2NativeTokenVault),
|
|
@@ -2022,7 +2075,7 @@ function routeInteropBundle() {
|
|
|
2022
2075
|
});
|
|
2023
2076
|
}
|
|
2024
2077
|
}
|
|
2025
|
-
const nonce = await
|
|
2078
|
+
const nonce = await wrapAs9(
|
|
2026
2079
|
"RPC",
|
|
2027
2080
|
OP_WITHDRAWALS.prepare,
|
|
2028
2081
|
() => ctx.client.l2.getTransactionCount(ctx.sender, "pending"),
|
|
@@ -2052,7 +2105,7 @@ function routeInteropBundle() {
|
|
|
2052
2105
|
}
|
|
2053
2106
|
});
|
|
2054
2107
|
const interopCenter = await ctx.contracts.interopCenter();
|
|
2055
|
-
const data = await
|
|
2108
|
+
const data = await wrapAs9(
|
|
2056
2109
|
"INTERNAL",
|
|
2057
2110
|
OP_WITHDRAWALS.erc20.encodeWithdraw,
|
|
2058
2111
|
() => Promise.resolve(
|
|
@@ -2137,7 +2190,7 @@ function createWithdrawalProtocolService(client, override) {
|
|
|
2137
2190
|
}
|
|
2138
2191
|
|
|
2139
2192
|
// src/adapters/ethers/resources/withdrawals/services/finalization.ts
|
|
2140
|
-
var { wrapAs:
|
|
2193
|
+
var { wrapAs: wrapAs10 } = createErrorHandlers("withdrawals");
|
|
2141
2194
|
var IL1NullifierMini = [
|
|
2142
2195
|
"function isWithdrawalFinalized(uint256,uint256,uint256) view returns (bool)"
|
|
2143
2196
|
];
|
|
@@ -2147,7 +2200,7 @@ function createFinalizationServices(client, protocolService = createWithdrawalPr
|
|
|
2147
2200
|
const { l1Nullifier } = await client.ensureAddresses();
|
|
2148
2201
|
if (protocol === "legacy-withdrawal") return l1Nullifier;
|
|
2149
2202
|
const nullifier = new Contract(l1Nullifier, IL1NullifierV32_default, l1);
|
|
2150
|
-
const handler = await
|
|
2203
|
+
const handler = await wrapAs10(
|
|
2151
2204
|
"CONTRACT",
|
|
2152
2205
|
OP_WITHDRAWALS.finalize.fetchParams.receipt,
|
|
2153
2206
|
() => nullifier.l1InteropHandler(),
|
|
@@ -2159,7 +2212,7 @@ function createFinalizationServices(client, protocolService = createWithdrawalPr
|
|
|
2159
2212
|
return handler;
|
|
2160
2213
|
}
|
|
2161
2214
|
async function fetchMessageAndProof(l2TxHash) {
|
|
2162
|
-
const raw = await
|
|
2215
|
+
const raw = await wrapAs10(
|
|
2163
2216
|
"RPC",
|
|
2164
2217
|
OP_WITHDRAWALS.finalize.fetchParams.receipt,
|
|
2165
2218
|
() => client.zks.getReceiptWithL2ToL1(l2TxHash),
|
|
@@ -2176,7 +2229,7 @@ function createFinalizationServices(client, protocolService = createWithdrawalPr
|
|
|
2176
2229
|
context: { l2TxHash }
|
|
2177
2230
|
});
|
|
2178
2231
|
}
|
|
2179
|
-
const ev = await
|
|
2232
|
+
const ev = await wrapAs10(
|
|
2180
2233
|
"INTERNAL",
|
|
2181
2234
|
OP_WITHDRAWALS.finalize.fetchParams.findMessage,
|
|
2182
2235
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-explicit-any
|
|
@@ -2186,7 +2239,7 @@ function createFinalizationServices(client, protocolService = createWithdrawalPr
|
|
|
2186
2239
|
message: "Failed to locate L1MessageSent event in L2 receipt."
|
|
2187
2240
|
}
|
|
2188
2241
|
);
|
|
2189
|
-
const message = await
|
|
2242
|
+
const message = await wrapAs10(
|
|
2190
2243
|
"INTERNAL",
|
|
2191
2244
|
OP_WITHDRAWALS.finalize.fetchParams.decodeMessage,
|
|
2192
2245
|
() => Promise.resolve(AbiCoder.defaultAbiCoder().decode(["bytes"], ev.data)[0]),
|
|
@@ -2195,7 +2248,7 @@ function createFinalizationServices(client, protocolService = createWithdrawalPr
|
|
|
2195
2248
|
message: "Failed to decode withdrawal message."
|
|
2196
2249
|
}
|
|
2197
2250
|
);
|
|
2198
|
-
const idx = await
|
|
2251
|
+
const idx = await wrapAs10(
|
|
2199
2252
|
"INTERNAL",
|
|
2200
2253
|
OP_WITHDRAWALS.finalize.fetchParams.messengerIndex,
|
|
2201
2254
|
() => Promise.resolve(messengerLogIndex(raw, { index: 0, messenger: L1_MESSENGER_ADDRESS })),
|
|
@@ -2204,7 +2257,7 @@ function createFinalizationServices(client, protocolService = createWithdrawalPr
|
|
|
2204
2257
|
message: "Failed to derive messenger log index."
|
|
2205
2258
|
}
|
|
2206
2259
|
);
|
|
2207
|
-
const proof = await
|
|
2260
|
+
const proof = await wrapAs10(
|
|
2208
2261
|
"RPC",
|
|
2209
2262
|
OP_WITHDRAWALS.finalize.fetchParams.proof,
|
|
2210
2263
|
() => client.zks.getL2ToL1LogProof(l2TxHash, idx),
|
|
@@ -2213,7 +2266,7 @@ function createFinalizationServices(client, protocolService = createWithdrawalPr
|
|
|
2213
2266
|
message: "Failed to fetch L2\u2192L1 log proof."
|
|
2214
2267
|
}
|
|
2215
2268
|
);
|
|
2216
|
-
const { chainId } = await
|
|
2269
|
+
const { chainId } = await wrapAs10(
|
|
2217
2270
|
"RPC",
|
|
2218
2271
|
OP_WITHDRAWALS.finalize.fetchParams.network,
|
|
2219
2272
|
() => l2.getNetwork(),
|
|
@@ -2272,7 +2325,7 @@ function createFinalizationServices(client, protocolService = createWithdrawalPr
|
|
|
2272
2325
|
const target = await finalizationTarget(finalization.protocol);
|
|
2273
2326
|
if (finalization.protocol === "legacy-withdrawal") {
|
|
2274
2327
|
const c = new Contract(target, IL1NullifierMini, l1);
|
|
2275
|
-
const done = await
|
|
2328
|
+
const done = await wrapAs10(
|
|
2276
2329
|
"RPC",
|
|
2277
2330
|
OP_WITHDRAWALS.finalize.isFinalized,
|
|
2278
2331
|
() => c.isWithdrawalFinalized(
|
|
@@ -2290,7 +2343,7 @@ function createFinalizationServices(client, protocolService = createWithdrawalPr
|
|
|
2290
2343
|
const { bundleHash } = finalization.params;
|
|
2291
2344
|
const handler = new Contract(target, IInteropHandler_default, l1);
|
|
2292
2345
|
const status = Number(
|
|
2293
|
-
await
|
|
2346
|
+
await wrapAs10(
|
|
2294
2347
|
"RPC",
|
|
2295
2348
|
OP_WITHDRAWALS.finalize.isFinalized,
|
|
2296
2349
|
() => handler.bundleStatus(bundleHash),
|
|
@@ -2302,7 +2355,7 @@ function createFinalizationServices(client, protocolService = createWithdrawalPr
|
|
|
2302
2355
|
);
|
|
2303
2356
|
if (status !== 3 /* Unbundled */) return classifyWithdrawalOutcome(status);
|
|
2304
2357
|
const callStatus = Number(
|
|
2305
|
-
await
|
|
2358
|
+
await wrapAs10(
|
|
2306
2359
|
"RPC",
|
|
2307
2360
|
OP_WITHDRAWALS.finalize.isFinalized,
|
|
2308
2361
|
() => handler.callStatus(bundleHash, 0),
|
|
@@ -2362,7 +2415,7 @@ function createFinalizationServices(client, protocolService = createWithdrawalPr
|
|
|
2362
2415
|
async estimateFinalization(finalization) {
|
|
2363
2416
|
const target = await finalizationTarget(finalization.protocol);
|
|
2364
2417
|
const l1Signer = client.getL1Signer();
|
|
2365
|
-
const gasLimit = await
|
|
2418
|
+
const gasLimit = await wrapAs10(
|
|
2366
2419
|
"RPC",
|
|
2367
2420
|
OP_WITHDRAWALS.finalize.estimate,
|
|
2368
2421
|
() => {
|
|
@@ -2381,7 +2434,7 @@ function createFinalizationServices(client, protocolService = createWithdrawalPr
|
|
|
2381
2434
|
message: "Failed to estimate gas for withdrawal finalization."
|
|
2382
2435
|
}
|
|
2383
2436
|
);
|
|
2384
|
-
const feeData = await
|
|
2437
|
+
const feeData = await wrapAs10("RPC", OP_WITHDRAWALS.finalize.estimate, () => l1.getFeeData(), {
|
|
2385
2438
|
ctx: { where: "l1.getFeeData" },
|
|
2386
2439
|
message: "Failed to estimate fee data for withdrawal finalization."
|
|
2387
2440
|
});
|