@matterlabs/zksync-js 0.0.13 → 0.0.14
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 +13 -4
- package/dist/adapters/ethers/client.cjs.map +1 -1
- package/dist/adapters/ethers/client.js +7 -6
- package/dist/adapters/ethers/index.cjs +501 -242
- package/dist/adapters/ethers/index.cjs.map +1 -1
- package/dist/adapters/ethers/index.js +10 -9
- package/dist/adapters/ethers/resources/deposits/routes/priority.d.ts +12 -0
- package/dist/adapters/ethers/resources/deposits/services/gas.d.ts +4 -0
- package/dist/adapters/ethers/resources/interop/index.d.ts +14 -14
- package/dist/adapters/ethers/resources/interop/resolvers.d.ts +3 -8
- package/dist/adapters/ethers/resources/interop/routes/types.d.ts +2 -1
- package/dist/adapters/ethers/resources/interop/services/erc20.d.ts +10 -0
- package/dist/adapters/ethers/resources/interop/services/fee.d.ts +12 -0
- package/dist/adapters/ethers/resources/interop/services/finalization/index.d.ts +1 -1
- package/dist/adapters/ethers/resources/interop/services/finalization/polling.d.ts +1 -1
- package/dist/adapters/ethers/resources/interop/types.d.ts +6 -14
- package/dist/adapters/ethers/sdk.cjs +912 -252
- package/dist/adapters/ethers/sdk.cjs.map +1 -1
- package/dist/adapters/ethers/sdk.d.ts +6 -1
- package/dist/adapters/ethers/sdk.js +8 -7
- package/dist/adapters/viem/client.cjs +8 -4
- package/dist/adapters/viem/client.cjs.map +1 -1
- package/dist/adapters/viem/client.js +7 -6
- package/dist/adapters/viem/index.cjs +315 -73
- package/dist/adapters/viem/index.cjs.map +1 -1
- package/dist/adapters/viem/index.js +10 -9
- package/dist/adapters/viem/resources/deposits/routes/priority.d.ts +13 -0
- package/dist/adapters/viem/resources/deposits/services/gas.d.ts +4 -0
- package/dist/adapters/viem/sdk.cjs +307 -69
- package/dist/adapters/viem/sdk.cjs.map +1 -1
- package/dist/adapters/viem/sdk.js +7 -7
- package/dist/{chunk-E3KP7XCG.js → chunk-3HHUZXSV.js} +1 -1
- package/dist/{chunk-UDBRUBEK.js → chunk-5RRJDPAJ.js} +2 -2
- package/dist/{chunk-EDWBCPO3.js → chunk-75IOOODG.js} +253 -53
- package/dist/{chunk-R5WRFPK2.js → chunk-7CAVFIMW.js} +5 -4
- package/dist/chunk-BWKWWLY4.js +9 -0
- package/dist/{chunk-4S4XDA4N.js → chunk-DYJKK5FW.js} +17 -15
- package/dist/{chunk-5L6EYUJB.js → chunk-EOBXYHTZ.js} +35 -7
- package/dist/{chunk-53MC5BR2.js → chunk-HP3EWKJL.js} +1 -1
- package/dist/{chunk-HI64OOAR.js → chunk-J47RI3G7.js} +1 -1
- package/dist/{chunk-RI73VJSH.js → chunk-JY62QO3W.js} +44 -21
- package/dist/{chunk-QQ2OR434.js → chunk-MT4X5FEO.js} +18 -2
- package/dist/{chunk-2RIARDXZ.js → chunk-OTXPSNNC.js} +5 -4
- package/dist/{chunk-5R7L5NM5.js → chunk-XDRCN4FC.js} +2 -2
- package/dist/{chunk-JHO2UQ5F.js → chunk-XKRNLFET.js} +394 -200
- package/dist/core/constants.cjs +17 -1
- package/dist/core/constants.cjs.map +1 -1
- package/dist/core/constants.d.ts +9 -1
- package/dist/core/constants.js +1 -1
- package/dist/core/index.cjs +52 -24
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.js +6 -5
- package/dist/core/internal/abis/IERC7786Attributes.d.ts +21 -11
- package/dist/core/internal/abis/IInteropCenter.d.ts +4 -0
- package/dist/core/resources/deposits/priority.d.ts +37 -0
- package/dist/core/resources/interop/attributes/bundle.d.ts +1 -0
- package/dist/core/resources/interop/attributes/resource.d.ts +1 -0
- package/dist/core/resources/interop/plan.d.ts +11 -3
- package/dist/core/rpc/types.d.ts +1 -0
- package/dist/core/rpc/zks.d.ts +5 -1
- package/dist/core/types/errors.d.ts +5 -0
- package/dist/core/types/flows/interop.d.ts +11 -18
- package/dist/index.cjs +69 -25
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +6 -5
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { createViemSdk } from '../../chunk-
|
|
2
|
-
import '../../chunk-
|
|
3
|
-
import '../../chunk-
|
|
4
|
-
import '../../chunk-
|
|
5
|
-
import '../../chunk-
|
|
6
|
-
import '../../chunk-
|
|
7
|
-
import '../../chunk-
|
|
1
|
+
export { createViemSdk } from '../../chunk-75IOOODG.js';
|
|
2
|
+
import '../../chunk-EOBXYHTZ.js';
|
|
3
|
+
import '../../chunk-3HHUZXSV.js';
|
|
4
|
+
import '../../chunk-XDRCN4FC.js';
|
|
5
|
+
import '../../chunk-HP3EWKJL.js';
|
|
6
|
+
import '../../chunk-JY62QO3W.js';
|
|
7
|
+
import '../../chunk-MT4X5FEO.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { L2_BASE_TOKEN_ADDRESS, TOPIC_L1_MESSAGE_SENT_NEW, TOPIC_L1_MESSAGE_SENT_LEG, L1_MESSENGER_ADDRESS, ETH_ADDRESS, L2_ASSET_ROUTER_ADDRESS } from './chunk-
|
|
1
|
+
import { L2_BASE_TOKEN_ADDRESS, TOPIC_L1_MESSAGE_SENT_NEW, TOPIC_L1_MESSAGE_SENT_LEG, L1_MESSENGER_ADDRESS, ETH_ADDRESS, L2_ASSET_ROUTER_ADDRESS } from './chunk-MT4X5FEO.js';
|
|
2
2
|
|
|
3
3
|
// src/core/resources/withdrawals/route.ts
|
|
4
4
|
function normalizeTokenForRouting(token) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { createErrorOps, REVERT_TO_READINESS } from './chunk-
|
|
2
|
-
import { IL1Nullifier_default, IERC20_default, L1NativeTokenVault_default, L2NativeTokenVault_default, Mailbox_default, IL1ContractErrors_default, IInteropErrors_default } from './chunk-
|
|
1
|
+
import { createErrorOps, REVERT_TO_READINESS } from './chunk-HP3EWKJL.js';
|
|
2
|
+
import { IL1Nullifier_default, IERC20_default, L1NativeTokenVault_default, L2NativeTokenVault_default, Mailbox_default, IL1ContractErrors_default, IInteropErrors_default } from './chunk-JY62QO3W.js';
|
|
3
3
|
import { Interface } from 'ethers';
|
|
4
4
|
|
|
5
5
|
var ERROR_IFACES = [];
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { createNTVCodec, toGasOverrides, buildFeeBreakdown, quoteL2Gas, quoteL1Gas, quoteL2Gas2 } from './chunk-
|
|
2
|
-
import { findL1MessageSentLog, messengerLogIndex, pickWithdrawRoute } from './chunk-
|
|
3
|
-
import { createErrorHandlers, toZKsyncError, classifyReadinessFromRevert } from './chunk-
|
|
4
|
-
import { isHash66, IL1Nullifier_default, OP_WITHDRAWALS, createError, normalizeL1Token, isAddressEq, hexEq, OP_DEPOSITS, IERC20_default, isZKsyncError, isReceiptNotFound, IBridgehub_default, isETH, normalizeAddrEq, L2NativeTokenVault_default, IL2AssetRouter_default, IBaseToken_default } from './chunk-
|
|
5
|
-
import { ETH_ADDRESS, TOPIC_CANONICAL_ASSIGNED, TOPIC_CANONICAL_SUCCESS, L1_MESSENGER_ADDRESS, L2_BASE_TOKEN_ADDRESS, L2_NATIVE_TOKEN_VAULT_ADDRESS, SAFE_L1_BRIDGE_GAS, FORMAL_ETH_ADDRESS } from './chunk-
|
|
1
|
+
import { createNTVCodec, toGasOverrides, buildFeeBreakdown, derivePriorityTxGasBreakdown, quoteL2Gas, quoteL1Gas, derivePriorityBodyGasEstimateCap, quoteL2Gas2 } from './chunk-EOBXYHTZ.js';
|
|
2
|
+
import { findL1MessageSentLog, messengerLogIndex, pickWithdrawRoute } from './chunk-3HHUZXSV.js';
|
|
3
|
+
import { createErrorHandlers, toZKsyncError, classifyReadinessFromRevert } from './chunk-XDRCN4FC.js';
|
|
4
|
+
import { isHash66, IL1Nullifier_default, OP_WITHDRAWALS, createError, normalizeL1Token, isAddressEq, hexEq, OP_DEPOSITS, IERC20_default, isZKsyncError, isReceiptNotFound, IBridgehub_default, isETH, normalizeAddrEq, L2NativeTokenVault_default, IL2AssetRouter_default, IBaseToken_default } from './chunk-JY62QO3W.js';
|
|
5
|
+
import { ETH_ADDRESS, TOPIC_CANONICAL_ASSIGNED, TOPIC_CANONICAL_SUCCESS, L1_MESSENGER_ADDRESS, L2_BASE_TOKEN_ADDRESS, L2_NATIVE_TOKEN_VAULT_ADDRESS, SAFE_L1_BRIDGE_GAS, L2_ASSET_ROUTER_ADDRESS, FORMAL_ETH_ADDRESS } from './chunk-MT4X5FEO.js';
|
|
6
6
|
import { keccak256, encodeAbiParameters, concat, decodeEventLog, decodeAbiParameters, encodeFunctionData, zeroAddress } from 'viem';
|
|
7
7
|
|
|
8
8
|
// src/adapters/viem/resources/deposits/context.ts
|
|
@@ -221,8 +221,22 @@ async function determineNonBaseL2Gas(input) {
|
|
|
221
221
|
try {
|
|
222
222
|
const l2TokenAddress = input.knownL2Token ?? (ctx.tokens ? await ctx.tokens.toL2Address(l1Token) : await (await ctx.contracts.l2NativeTokenVault()).read.l2TokenAddress([l1Token]));
|
|
223
223
|
if (l2TokenAddress === zeroAddress) {
|
|
224
|
+
if (input.undeployedGasLimit != null) {
|
|
225
|
+
return quoteL2Gas3({
|
|
226
|
+
ctx,
|
|
227
|
+
route,
|
|
228
|
+
overrideGasLimit: input.undeployedGasLimit
|
|
229
|
+
});
|
|
230
|
+
}
|
|
224
231
|
return fallbackQuote();
|
|
225
232
|
}
|
|
233
|
+
if (input.priorityFloorGasLimit != null) {
|
|
234
|
+
return quoteL2Gas3({
|
|
235
|
+
ctx,
|
|
236
|
+
route,
|
|
237
|
+
overrideGasLimit: input.priorityFloorGasLimit
|
|
238
|
+
});
|
|
239
|
+
}
|
|
226
240
|
const modelTx = {
|
|
227
241
|
to: input.modelTx?.to ?? ctx.sender,
|
|
228
242
|
from: input.modelTx?.from ?? ctx.sender,
|
|
@@ -238,8 +252,7 @@ async function determineNonBaseL2Gas(input) {
|
|
|
238
252
|
return fallbackQuote();
|
|
239
253
|
}
|
|
240
254
|
return gas;
|
|
241
|
-
} catch
|
|
242
|
-
console.warn("Failed to determine non-base deposit L2 gas; defaulting to safe gas limit.", err);
|
|
255
|
+
} catch {
|
|
243
256
|
return fallbackQuote();
|
|
244
257
|
}
|
|
245
258
|
}
|
|
@@ -256,7 +269,9 @@ async function determineEthNonBaseL2Gas(input) {
|
|
|
256
269
|
route: "eth-nonbase",
|
|
257
270
|
l1Token: input.ctx.resolvedToken?.l1 ?? FORMAL_ETH_ADDRESS,
|
|
258
271
|
knownL2Token: input.ctx.resolvedToken?.l2,
|
|
259
|
-
modelTx: input.modelTx
|
|
272
|
+
modelTx: input.modelTx,
|
|
273
|
+
priorityFloorGasLimit: input.priorityFloorGasLimit,
|
|
274
|
+
undeployedGasLimit: input.undeployedGasLimit
|
|
260
275
|
});
|
|
261
276
|
}
|
|
262
277
|
|
|
@@ -281,35 +296,92 @@ async function quoteL2BaseCost(input) {
|
|
|
281
296
|
{ ctx: { chainIdL2: ctx.chainIdL2 } }
|
|
282
297
|
);
|
|
283
298
|
}
|
|
299
|
+
var EMPTY_BYTES = "0x";
|
|
300
|
+
var ZERO_RESERVED_WORDS = [0n, 0n, 0n, 0n];
|
|
301
|
+
var L2_CANONICAL_TRANSACTION_PARAMETER = {
|
|
302
|
+
type: "tuple",
|
|
303
|
+
components: [
|
|
304
|
+
{ name: "txType", type: "uint256" },
|
|
305
|
+
{ name: "from", type: "uint256" },
|
|
306
|
+
{ name: "to", type: "uint256" },
|
|
307
|
+
{ name: "gasLimit", type: "uint256" },
|
|
308
|
+
{ name: "gasPerPubdataByteLimit", type: "uint256" },
|
|
309
|
+
{ name: "maxFeePerGas", type: "uint256" },
|
|
310
|
+
{ name: "maxPriorityFeePerGas", type: "uint256" },
|
|
311
|
+
{ name: "paymaster", type: "uint256" },
|
|
312
|
+
{ name: "nonce", type: "uint256" },
|
|
313
|
+
{ name: "value", type: "uint256" },
|
|
314
|
+
{ name: "reserved", type: "uint256[4]" },
|
|
315
|
+
{ name: "data", type: "bytes" },
|
|
316
|
+
{ name: "signature", type: "bytes" },
|
|
317
|
+
{ name: "factoryDeps", type: "uint256[]" },
|
|
318
|
+
{ name: "paymasterInput", type: "bytes" },
|
|
319
|
+
{ name: "reservedDynamic", type: "bytes" }
|
|
320
|
+
]
|
|
321
|
+
};
|
|
322
|
+
function hexByteLength(hex) {
|
|
323
|
+
return BigInt(Math.max(hex.length - 2, 0) / 2);
|
|
324
|
+
}
|
|
325
|
+
function getPriorityTxEncodedLength(input) {
|
|
326
|
+
const encoded = encodeAbiParameters(
|
|
327
|
+
[L2_CANONICAL_TRANSACTION_PARAMETER],
|
|
328
|
+
[
|
|
329
|
+
{
|
|
330
|
+
txType: 0n,
|
|
331
|
+
from: BigInt(input.sender),
|
|
332
|
+
to: BigInt(input.l2Contract),
|
|
333
|
+
gasLimit: 0n,
|
|
334
|
+
gasPerPubdataByteLimit: input.gasPerPubdata,
|
|
335
|
+
maxFeePerGas: 0n,
|
|
336
|
+
maxPriorityFeePerGas: 0n,
|
|
337
|
+
paymaster: 0n,
|
|
338
|
+
nonce: 0n,
|
|
339
|
+
value: input.l2Value,
|
|
340
|
+
reserved: ZERO_RESERVED_WORDS,
|
|
341
|
+
data: input.l2Calldata,
|
|
342
|
+
signature: EMPTY_BYTES,
|
|
343
|
+
factoryDeps: input.factoryDepsHashes ?? [],
|
|
344
|
+
paymasterInput: EMPTY_BYTES,
|
|
345
|
+
reservedDynamic: EMPTY_BYTES
|
|
346
|
+
}
|
|
347
|
+
]
|
|
348
|
+
);
|
|
349
|
+
return hexByteLength(encoded);
|
|
350
|
+
}
|
|
351
|
+
function getPriorityTxGasBreakdown(input) {
|
|
352
|
+
return derivePriorityTxGasBreakdown({
|
|
353
|
+
encodedLength: getPriorityTxEncodedLength(input),
|
|
354
|
+
gasPerPubdata: input.gasPerPubdata,
|
|
355
|
+
factoryDepsCount: BigInt(input.factoryDepsHashes?.length ?? 0)
|
|
356
|
+
});
|
|
357
|
+
}
|
|
284
358
|
|
|
285
359
|
// src/adapters/viem/resources/deposits/routes/eth.ts
|
|
286
360
|
var { wrapAs: wrapAs2 } = createErrorHandlers("deposits");
|
|
361
|
+
var EMPTY_BYTES2 = "0x";
|
|
287
362
|
function routeEthDirect() {
|
|
288
363
|
return {
|
|
289
364
|
async build(p, ctx) {
|
|
290
|
-
const
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
365
|
+
const l2Contract = p.to ?? ctx.sender;
|
|
366
|
+
const l2Value = p.amount;
|
|
367
|
+
const l2Calldata = EMPTY_BYTES2;
|
|
368
|
+
const priorityFloorBreakdown = getPriorityTxGasBreakdown({
|
|
369
|
+
sender: ctx.sender,
|
|
370
|
+
l2Contract,
|
|
371
|
+
l2Value,
|
|
372
|
+
l2Calldata,
|
|
373
|
+
gasPerPubdata: ctx.gasPerPubdata
|
|
374
|
+
});
|
|
375
|
+
const quotedL2GasLimit = ctx.l2GasLimit ?? priorityFloorBreakdown.derivedL2GasLimit;
|
|
296
376
|
const l2GasParams = await quoteL2Gas3({
|
|
297
377
|
ctx,
|
|
298
378
|
route: "eth-base",
|
|
299
|
-
|
|
300
|
-
overrideGasLimit: ctx.l2GasLimit,
|
|
301
|
-
stateOverrides: {
|
|
302
|
-
[ctx.sender]: {
|
|
303
|
-
balance: "0xffffffffffffffffffff"
|
|
304
|
-
}
|
|
305
|
-
}
|
|
379
|
+
overrideGasLimit: quotedL2GasLimit
|
|
306
380
|
});
|
|
307
381
|
if (!l2GasParams) {
|
|
308
382
|
throw new Error("Failed to estimate L2 gas for deposit.");
|
|
309
383
|
}
|
|
310
384
|
const baseCost = await quoteL2BaseCost({ ctx, l2GasLimit: l2GasParams.gasLimit });
|
|
311
|
-
const l2Contract = p.to ?? ctx.sender;
|
|
312
|
-
const l2Value = p.amount;
|
|
313
385
|
const mintValue = baseCost + ctx.operatorTip + l2Value;
|
|
314
386
|
const req = buildDirectRequestStruct({
|
|
315
387
|
chainId: ctx.chainIdL2,
|
|
@@ -378,6 +450,59 @@ function routeEthDirect() {
|
|
|
378
450
|
};
|
|
379
451
|
}
|
|
380
452
|
var { wrapAs: wrapAs3 } = createErrorHandlers("deposits");
|
|
453
|
+
var ZERO_ASSET_ID = "0x0000000000000000000000000000000000000000000000000000000000000000";
|
|
454
|
+
async function getPriorityGasModel(input) {
|
|
455
|
+
try {
|
|
456
|
+
const l1NativeTokenVault = await input.ctx.contracts.l1NativeTokenVault();
|
|
457
|
+
const l1AssetRouter = await input.ctx.contracts.l1AssetRouter();
|
|
458
|
+
const l1ChainId = BigInt(await input.ctx.client.l1.getChainId());
|
|
459
|
+
const isFirstBridge = input.ctx.resolvedToken.assetId.toLowerCase() === ZERO_ASSET_ID || input.ctx.resolvedToken.originChainId === 0n;
|
|
460
|
+
const erc20MetadataOriginChainId = isFirstBridge ? l1ChainId : input.ctx.resolvedToken.originChainId;
|
|
461
|
+
const erc20Metadata = await l1NativeTokenVault.read.getERC20Getters([
|
|
462
|
+
input.token,
|
|
463
|
+
erc20MetadataOriginChainId
|
|
464
|
+
]);
|
|
465
|
+
const bridgeMintCalldata = encodeAbiParameters(
|
|
466
|
+
[
|
|
467
|
+
{ type: "address", name: "originalCaller" },
|
|
468
|
+
{ type: "address", name: "receiver" },
|
|
469
|
+
{ type: "address", name: "originToken" },
|
|
470
|
+
{ type: "uint256", name: "amount" },
|
|
471
|
+
{ type: "bytes", name: "erc20Metadata" }
|
|
472
|
+
],
|
|
473
|
+
[input.ctx.sender, input.receiver, input.token, input.amount, erc20Metadata]
|
|
474
|
+
);
|
|
475
|
+
const l2Calldata = isFirstBridge ? encodeFunctionData({
|
|
476
|
+
abi: IL2AssetRouter_default,
|
|
477
|
+
functionName: "finalizeDeposit",
|
|
478
|
+
args: [input.ctx.sender, input.receiver, input.token, input.amount, erc20Metadata]
|
|
479
|
+
}) : await (async () => {
|
|
480
|
+
return await l1AssetRouter.read.getDepositCalldata([
|
|
481
|
+
input.ctx.sender,
|
|
482
|
+
input.ctx.resolvedToken.assetId,
|
|
483
|
+
bridgeMintCalldata
|
|
484
|
+
]);
|
|
485
|
+
})();
|
|
486
|
+
const priorityFloorBreakdown = getPriorityTxGasBreakdown({
|
|
487
|
+
sender: input.ctx.l1AssetRouter,
|
|
488
|
+
l2Contract: L2_ASSET_ROUTER_ADDRESS,
|
|
489
|
+
l2Value: 0n,
|
|
490
|
+
l2Calldata,
|
|
491
|
+
gasPerPubdata: input.ctx.gasPerPubdata
|
|
492
|
+
});
|
|
493
|
+
const model = {
|
|
494
|
+
priorityFloorGasLimit: priorityFloorBreakdown.derivedL2GasLimit
|
|
495
|
+
};
|
|
496
|
+
if (isFirstBridge || input.ctx.resolvedToken.l2.toLowerCase() === zeroAddress) {
|
|
497
|
+
model.undeployedGasLimit = derivePriorityBodyGasEstimateCap({
|
|
498
|
+
minBodyGas: priorityFloorBreakdown.minBodyGas
|
|
499
|
+
}) + priorityFloorBreakdown.overhead;
|
|
500
|
+
}
|
|
501
|
+
return model;
|
|
502
|
+
} catch {
|
|
503
|
+
return {};
|
|
504
|
+
}
|
|
505
|
+
}
|
|
381
506
|
function routeErc20NonBase() {
|
|
382
507
|
return {
|
|
383
508
|
// TODO: do we even need these validations?
|
|
@@ -408,11 +533,33 @@ function routeErc20NonBase() {
|
|
|
408
533
|
const baseToken = ctx.baseTokenL1 ?? await ctx.client.baseToken(ctx.chainIdL2);
|
|
409
534
|
const baseIsEth = ctx.baseIsEth ?? isETH(baseToken);
|
|
410
535
|
const assetRouter = ctx.l1AssetRouter;
|
|
536
|
+
const receiver = p.to ?? ctx.sender;
|
|
537
|
+
const secondBridgeCalldata = await wrapAs3(
|
|
538
|
+
"INTERNAL",
|
|
539
|
+
OP_DEPOSITS.nonbase.encodeCalldata,
|
|
540
|
+
() => Promise.resolve(encodeSecondBridgeErc20Args(p.token, p.amount, receiver)),
|
|
541
|
+
{
|
|
542
|
+
ctx: {
|
|
543
|
+
where: "encodeSecondBridgeErc20Args",
|
|
544
|
+
token: p.token,
|
|
545
|
+
amount: p.amount.toString()
|
|
546
|
+
},
|
|
547
|
+
message: "Failed to encode bridging calldata."
|
|
548
|
+
}
|
|
549
|
+
);
|
|
550
|
+
const priorityGasModel = await getPriorityGasModel({
|
|
551
|
+
ctx,
|
|
552
|
+
token: p.token,
|
|
553
|
+
amount: p.amount,
|
|
554
|
+
receiver
|
|
555
|
+
});
|
|
411
556
|
const l2Gas = await determineErc20L2Gas({
|
|
412
557
|
ctx,
|
|
413
558
|
l1Token: p.token,
|
|
559
|
+
priorityFloorGasLimit: priorityGasModel.priorityFloorGasLimit,
|
|
560
|
+
undeployedGasLimit: priorityGasModel.undeployedGasLimit,
|
|
414
561
|
modelTx: {
|
|
415
|
-
to:
|
|
562
|
+
to: receiver,
|
|
416
563
|
from: ctx.sender,
|
|
417
564
|
data: "0x",
|
|
418
565
|
value: 0n
|
|
@@ -501,19 +648,6 @@ function routeErc20NonBase() {
|
|
|
501
648
|
});
|
|
502
649
|
}
|
|
503
650
|
}
|
|
504
|
-
const secondBridgeCalldata = await wrapAs3(
|
|
505
|
-
"INTERNAL",
|
|
506
|
-
OP_DEPOSITS.nonbase.encodeCalldata,
|
|
507
|
-
() => Promise.resolve(encodeSecondBridgeErc20Args(p.token, p.amount, p.to ?? ctx.sender)),
|
|
508
|
-
{
|
|
509
|
-
ctx: {
|
|
510
|
-
where: "encodeSecondBridgeErc20Args",
|
|
511
|
-
token: p.token,
|
|
512
|
-
amount: p.amount.toString()
|
|
513
|
-
},
|
|
514
|
-
message: "Failed to encode bridging calldata."
|
|
515
|
-
}
|
|
516
|
-
);
|
|
517
651
|
const requestStruct = {
|
|
518
652
|
chainId: ctx.chainIdL2,
|
|
519
653
|
mintValue,
|
|
@@ -605,6 +739,59 @@ function routeErc20NonBase() {
|
|
|
605
739
|
};
|
|
606
740
|
}
|
|
607
741
|
var { wrapAs: wrapAs4 } = createErrorHandlers("deposits");
|
|
742
|
+
var ZERO_ASSET_ID2 = "0x0000000000000000000000000000000000000000000000000000000000000000";
|
|
743
|
+
var ntvCodec = createNTVCodec({
|
|
744
|
+
encode: (types, values) => encodeAbiParameters(
|
|
745
|
+
types.map((type, index) => ({ type, name: `arg${index}` })),
|
|
746
|
+
values
|
|
747
|
+
),
|
|
748
|
+
keccak256
|
|
749
|
+
});
|
|
750
|
+
async function getPriorityGasModel2(input) {
|
|
751
|
+
try {
|
|
752
|
+
const l1AssetRouter = await input.ctx.contracts.l1AssetRouter();
|
|
753
|
+
const l1NativeTokenVault = await input.ctx.contracts.l1NativeTokenVault();
|
|
754
|
+
const originChainId = input.ctx.resolvedToken.originChainId !== 0n ? input.ctx.resolvedToken.originChainId : BigInt(await input.ctx.client.l1.getChainId());
|
|
755
|
+
const resolvedAssetId = input.ctx.resolvedToken.assetId.toLowerCase() === ZERO_ASSET_ID2 ? ntvCodec.encodeAssetId(originChainId, L2_NATIVE_TOKEN_VAULT_ADDRESS, ETH_ADDRESS) : input.ctx.resolvedToken.assetId;
|
|
756
|
+
const erc20Metadata = await l1NativeTokenVault.read.getERC20Getters([
|
|
757
|
+
ETH_ADDRESS,
|
|
758
|
+
originChainId
|
|
759
|
+
]);
|
|
760
|
+
const bridgeMintCalldata = encodeAbiParameters(
|
|
761
|
+
[
|
|
762
|
+
{ type: "address", name: "originalCaller" },
|
|
763
|
+
{ type: "address", name: "receiver" },
|
|
764
|
+
{ type: "address", name: "originToken" },
|
|
765
|
+
{ type: "uint256", name: "amount" },
|
|
766
|
+
{ type: "bytes", name: "erc20Metadata" }
|
|
767
|
+
],
|
|
768
|
+
[input.ctx.sender, input.receiver, ETH_ADDRESS, input.amount, erc20Metadata]
|
|
769
|
+
);
|
|
770
|
+
const l2Calldata = await l1AssetRouter.read.getDepositCalldata([
|
|
771
|
+
input.ctx.sender,
|
|
772
|
+
resolvedAssetId,
|
|
773
|
+
bridgeMintCalldata
|
|
774
|
+
]);
|
|
775
|
+
const priorityFloorBreakdown = getPriorityTxGasBreakdown({
|
|
776
|
+
sender: input.ctx.l1AssetRouter,
|
|
777
|
+
l2Contract: L2_ASSET_ROUTER_ADDRESS,
|
|
778
|
+
l2Value: 0n,
|
|
779
|
+
l2Calldata,
|
|
780
|
+
gasPerPubdata: input.ctx.gasPerPubdata
|
|
781
|
+
});
|
|
782
|
+
const model = {
|
|
783
|
+
priorityFloorGasLimit: priorityFloorBreakdown.derivedL2GasLimit
|
|
784
|
+
};
|
|
785
|
+
if (input.ctx.resolvedToken.l2.toLowerCase() === zeroAddress) {
|
|
786
|
+
model.undeployedGasLimit = derivePriorityBodyGasEstimateCap({
|
|
787
|
+
minBodyGas: priorityFloorBreakdown.minBodyGas
|
|
788
|
+
}) + priorityFloorBreakdown.overhead;
|
|
789
|
+
}
|
|
790
|
+
return model;
|
|
791
|
+
} catch {
|
|
792
|
+
return {};
|
|
793
|
+
}
|
|
794
|
+
}
|
|
608
795
|
function routeEthNonBase() {
|
|
609
796
|
return {
|
|
610
797
|
// TODO: do we even need these validations?
|
|
@@ -651,15 +838,23 @@ function routeEthNonBase() {
|
|
|
651
838
|
},
|
|
652
839
|
async build(p, ctx) {
|
|
653
840
|
const baseToken = ctx.baseTokenL1 ?? await ctx.client.baseToken(ctx.chainIdL2);
|
|
841
|
+
const receiver = p.to ?? ctx.sender;
|
|
842
|
+
const priorityGasModel = await getPriorityGasModel2({
|
|
843
|
+
ctx,
|
|
844
|
+
amount: p.amount,
|
|
845
|
+
receiver
|
|
846
|
+
});
|
|
654
847
|
const l2TxModel = {
|
|
655
|
-
to:
|
|
848
|
+
to: receiver,
|
|
656
849
|
from: ctx.sender,
|
|
657
850
|
data: "0x",
|
|
658
851
|
value: 0n
|
|
659
852
|
};
|
|
660
853
|
const l2Gas = await determineEthNonBaseL2Gas({
|
|
661
854
|
ctx,
|
|
662
|
-
modelTx: l2TxModel
|
|
855
|
+
modelTx: l2TxModel,
|
|
856
|
+
priorityFloorGasLimit: priorityGasModel.priorityFloorGasLimit,
|
|
857
|
+
undeployedGasLimit: priorityGasModel.undeployedGasLimit
|
|
663
858
|
});
|
|
664
859
|
if (!l2Gas) throw new Error("Failed to estimate L2 gas parameters.");
|
|
665
860
|
const l2BaseCost = await quoteL2BaseCost({ ctx, l2GasLimit: l2Gas.gasLimit });
|
|
@@ -708,12 +903,12 @@ function routeEthNonBase() {
|
|
|
708
903
|
const secondBridgeCalldata = await wrapAs4(
|
|
709
904
|
"INTERNAL",
|
|
710
905
|
OP_DEPOSITS.ethNonBase.encodeCalldata,
|
|
711
|
-
() => Promise.resolve(encodeSecondBridgeEthArgs(p.amount,
|
|
906
|
+
() => Promise.resolve(encodeSecondBridgeEthArgs(p.amount, receiver)),
|
|
712
907
|
{
|
|
713
908
|
ctx: {
|
|
714
909
|
where: "encodeSecondBridgeEthArgs",
|
|
715
910
|
amount: p.amount.toString(),
|
|
716
|
-
to:
|
|
911
|
+
to: receiver
|
|
717
912
|
},
|
|
718
913
|
message: "Failed to encode ETH bridging calldata."
|
|
719
914
|
}
|
|
@@ -814,6 +1009,7 @@ function routeEthNonBase() {
|
|
|
814
1009
|
};
|
|
815
1010
|
}
|
|
816
1011
|
var { wrapAs: wrapAs5 } = createErrorHandlers("deposits");
|
|
1012
|
+
var EMPTY_BYTES3 = "0x";
|
|
817
1013
|
function routeErc20Base() {
|
|
818
1014
|
return {
|
|
819
1015
|
async preflight(p, ctx) {
|
|
@@ -841,17 +1037,21 @@ function routeErc20Base() {
|
|
|
841
1037
|
},
|
|
842
1038
|
async build(p, ctx) {
|
|
843
1039
|
const baseToken = ctx.baseTokenL1 ?? await ctx.client.baseToken(ctx.chainIdL2);
|
|
844
|
-
const
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
1040
|
+
const l2Contract = p.to ?? ctx.sender;
|
|
1041
|
+
const l2Value = p.amount;
|
|
1042
|
+
const l2Calldata = EMPTY_BYTES3;
|
|
1043
|
+
const priorityFloorBreakdown = getPriorityTxGasBreakdown({
|
|
1044
|
+
sender: ctx.sender,
|
|
1045
|
+
l2Contract,
|
|
1046
|
+
l2Value,
|
|
1047
|
+
l2Calldata,
|
|
1048
|
+
gasPerPubdata: ctx.gasPerPubdata
|
|
1049
|
+
});
|
|
1050
|
+
const quotedL2GasLimit = ctx.l2GasLimit ?? priorityFloorBreakdown.derivedL2GasLimit;
|
|
850
1051
|
const l2Gas = await quoteL2Gas3({
|
|
851
1052
|
ctx,
|
|
852
1053
|
route: "erc20-base",
|
|
853
|
-
|
|
854
|
-
overrideGasLimit: ctx.l2GasLimit
|
|
1054
|
+
overrideGasLimit: quotedL2GasLimit
|
|
855
1055
|
});
|
|
856
1056
|
if (!l2Gas) throw new Error("Failed to estimate L2 gas parameters.");
|
|
857
1057
|
const l2BaseCost = await quoteL2BaseCost({ ctx, l2GasLimit: l2Gas.gasLimit });
|
|
@@ -903,8 +1103,8 @@ function routeErc20Base() {
|
|
|
903
1103
|
l2GasLimit: l2Gas.gasLimit,
|
|
904
1104
|
gasPerPubdata: ctx.gasPerPubdata,
|
|
905
1105
|
refundRecipient: ctx.refundRecipient,
|
|
906
|
-
l2Contract
|
|
907
|
-
l2Value
|
|
1106
|
+
l2Contract,
|
|
1107
|
+
l2Value
|
|
908
1108
|
});
|
|
909
1109
|
let bridgeTx;
|
|
910
1110
|
let calldata;
|
|
@@ -1066,7 +1266,7 @@ async function waitForL2ExecutionFromL1Tx(l1, l2, l1TxHash) {
|
|
|
1066
1266
|
return { l2Receipt, l2TxHash };
|
|
1067
1267
|
}
|
|
1068
1268
|
var { wrapAs: wrapAs6 } = createErrorHandlers("tokens");
|
|
1069
|
-
var
|
|
1269
|
+
var ntvCodec2 = createNTVCodec({
|
|
1070
1270
|
encode: (types, values) => encodeAbiParameters(
|
|
1071
1271
|
types.map((t, i) => ({ type: t, name: `arg${i}` })),
|
|
1072
1272
|
values
|
|
@@ -1180,7 +1380,7 @@ function createTokensResource(client) {
|
|
|
1180
1380
|
return wrapAs6("CONTRACT", "tokens.isChainEthBased", async () => {
|
|
1181
1381
|
const baseAssetId = await getBaseTokenAssetId();
|
|
1182
1382
|
const l1ChainId = await getL1ChainId();
|
|
1183
|
-
const ethAssetId =
|
|
1383
|
+
const ethAssetId = ntvCodec2.encodeAssetId(
|
|
1184
1384
|
l1ChainId,
|
|
1185
1385
|
L2_NATIVE_TOKEN_VAULT_ADDRESS,
|
|
1186
1386
|
ETH_ADDRESS
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { createErrorHandlers } from './chunk-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { createErrorHandlers } from './chunk-5RRJDPAJ.js';
|
|
2
|
+
import { makeTransportFromEthers } from './chunk-BWKWWLY4.js';
|
|
3
|
+
import { createZksRpc } from './chunk-DYJKK5FW.js';
|
|
4
|
+
import { createError, OP_CLIENT, IBridgehub_default, IL1AssetRouter_default, IL1Nullifier_default, L2MessageVerification_default, IInteropHandler_default, IInteropCenter_default, IBaseToken_default, L2NativeTokenVault_default, IL2AssetRouter_default, L1NativeTokenVault_default, OP_DEPOSITS } from './chunk-JY62QO3W.js';
|
|
5
|
+
import { L2_ASSET_ROUTER_ADDRESS, L2_NATIVE_TOKEN_VAULT_ADDRESS, L2_BASE_TOKEN_ADDRESS, L2_INTEROP_CENTER_ADDRESS, L2_INTEROP_HANDLER_ADDRESS, L2_MESSAGE_VERIFICATION_ADDRESS, FORMAL_ETH_ADDRESS } from './chunk-MT4X5FEO.js';
|
|
5
6
|
import { BrowserProvider, Interface, Contract } from 'ethers';
|
|
6
7
|
|
|
7
8
|
// src/adapters/ethers/rpc.ts
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// src/core/rpc/transport.ts
|
|
2
|
+
function makeTransportFromEthers(provider) {
|
|
3
|
+
return (m, p = []) => provider.send(m, p);
|
|
4
|
+
}
|
|
5
|
+
function makeTransportFromViem(client) {
|
|
6
|
+
return (m, p = []) => client.request({ method: m, params: p });
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export { makeTransportFromEthers, makeTransportFromViem };
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { createError, isBigint, isNumber, isZKsyncError, shapeCause } from './chunk-
|
|
2
|
-
import { __export } from './chunk-
|
|
1
|
+
import { createError, isBigint, isNumber, isZKsyncError, shapeCause } from './chunk-JY62QO3W.js';
|
|
2
|
+
import { __export } from './chunk-MT4X5FEO.js';
|
|
3
3
|
|
|
4
4
|
// src/core/rpc/zks.ts
|
|
5
5
|
var zks_exports = {};
|
|
6
6
|
__export(zks_exports, {
|
|
7
|
+
ProofTarget: () => ProofTarget,
|
|
7
8
|
createZksRpc: () => createZksRpc,
|
|
8
9
|
normalizeBlockMetadata: () => normalizeBlockMetadata,
|
|
9
10
|
normalizeGenesis: () => normalizeGenesis,
|
|
@@ -27,6 +28,11 @@ async function withRpcOp(operation, message, ctx, fn) {
|
|
|
27
28
|
}
|
|
28
29
|
|
|
29
30
|
// src/core/rpc/zks.ts
|
|
31
|
+
var ProofTarget = /* @__PURE__ */ ((ProofTarget2) => {
|
|
32
|
+
ProofTarget2["L1BatchRoot"] = "l1BatchRoot";
|
|
33
|
+
ProofTarget2["MessageRoot"] = "messageRoot";
|
|
34
|
+
return ProofTarget2;
|
|
35
|
+
})(ProofTarget || {});
|
|
30
36
|
var METHODS = {
|
|
31
37
|
getBridgehub: "zks_getBridgehubContract",
|
|
32
38
|
getL2ToL1LogProof: "zks_getL2ToL1LogProof",
|
|
@@ -44,6 +50,7 @@ function normalizeProof(p) {
|
|
|
44
50
|
const raw = p ?? {};
|
|
45
51
|
const idRaw = raw?.id ?? raw?.index;
|
|
46
52
|
const bnRaw = raw?.batch_number ?? raw?.batchNumber;
|
|
53
|
+
const gwBlockNumberRaw = raw?.gatewayBlockNumber;
|
|
47
54
|
if (idRaw == null || bnRaw == null) {
|
|
48
55
|
throw createError("RPC", {
|
|
49
56
|
resource: "zksrpc",
|
|
@@ -64,7 +71,8 @@ function normalizeProof(p) {
|
|
|
64
71
|
id: toBig(idRaw),
|
|
65
72
|
batchNumber: toBig(bnRaw),
|
|
66
73
|
proof: toHexArray(raw?.proof),
|
|
67
|
-
root: raw.root
|
|
74
|
+
root: raw.root,
|
|
75
|
+
gatewayBlockNumber: gwBlockNumberRaw != null ? toBig(gwBlockNumberRaw) : void 0
|
|
68
76
|
};
|
|
69
77
|
} catch (e) {
|
|
70
78
|
if (isZKsyncError(e)) throw e;
|
|
@@ -341,13 +349,15 @@ function createZksRpc(transport) {
|
|
|
341
349
|
);
|
|
342
350
|
},
|
|
343
351
|
// Fetches a proof for an L2→L1 log emitted in the given transaction.
|
|
344
|
-
async getL2ToL1LogProof(txHash, index) {
|
|
352
|
+
async getL2ToL1LogProof(txHash, index, proofTarget) {
|
|
345
353
|
return withRpcOp(
|
|
346
354
|
"zksrpc.getL2ToL1LogProof",
|
|
347
355
|
"Failed to fetch L2\u2192L1 log proof.",
|
|
348
|
-
{ txHash, index },
|
|
356
|
+
{ txHash, index, proofTarget },
|
|
349
357
|
async () => {
|
|
350
|
-
const
|
|
358
|
+
const params = [txHash, index];
|
|
359
|
+
if (proofTarget != void 0) params.push(proofTarget);
|
|
360
|
+
const proof = await transport(METHODS.getL2ToL1LogProof, params);
|
|
351
361
|
if (!proof) {
|
|
352
362
|
throw createError("STATE", {
|
|
353
363
|
resource: "zksrpc",
|
|
@@ -404,12 +414,4 @@ function createZksRpc(transport) {
|
|
|
404
414
|
};
|
|
405
415
|
}
|
|
406
416
|
|
|
407
|
-
|
|
408
|
-
function makeTransportFromEthers(provider) {
|
|
409
|
-
return (m, p = []) => provider.send(m, p);
|
|
410
|
-
}
|
|
411
|
-
function makeTransportFromViem(client) {
|
|
412
|
-
return (m, p = []) => client.request({ method: m, params: p });
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
export { createZksRpc, makeTransportFromEthers, makeTransportFromViem, zks_exports };
|
|
417
|
+
export { createZksRpc, zks_exports };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { IBridgehub_default } from './chunk-
|
|
2
|
-
import { BUFFER, DEFAULT_ABI_BYTES, DEFAULT_PUBDATA_BYTES,
|
|
1
|
+
import { IBridgehub_default } from './chunk-JY62QO3W.js';
|
|
2
|
+
import { L1_TX_MIN_L2_GAS_BASE, L1_TX_INTRINSIC_L2_GAS, L1_TX_DELTA_544_ENCODING_BYTES, L1_TX_DELTA_FACTORY_DEPS_L2_GAS, L1_TX_INTRINSIC_PUBDATA, L1_TX_DELTA_FACTORY_DEPS_PUBDATA, TX_MEMORY_OVERHEAD_GAS, TX_SLOT_OVERHEAD_L2_GAS, PRIORITY_TX_MAX_GAS_LIMIT, BUFFER, DEFAULT_ABI_BYTES, DEFAULT_PUBDATA_BYTES, TX_OVERHEAD_GAS } from './chunk-MT4X5FEO.js';
|
|
3
3
|
|
|
4
4
|
// src/core/codec/ntv.ts
|
|
5
5
|
function createNTVCodec(deps) {
|
|
@@ -49,6 +49,36 @@ function buildFeeBreakdown(p) {
|
|
|
49
49
|
};
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
+
// src/core/resources/deposits/priority.ts
|
|
53
|
+
var PRIORITY_TX_ENCODING_STEP_BYTES = 544n;
|
|
54
|
+
var DEFAULT_PRIORITY_BODY_GAS_ESTIMATE_MULTIPLIER = 6n;
|
|
55
|
+
var maxBigInt = (a, b) => a > b ? a : b;
|
|
56
|
+
var ceilDiv = (a, b) => (a + b - 1n) / b;
|
|
57
|
+
function derivePriorityTxGasBreakdown(input) {
|
|
58
|
+
const factoryDepsCount = input.factoryDepsCount ?? 0n;
|
|
59
|
+
const minBodyGas = maxBigInt(
|
|
60
|
+
L1_TX_INTRINSIC_L2_GAS + ceilDiv(
|
|
61
|
+
input.encodedLength * L1_TX_DELTA_544_ENCODING_BYTES,
|
|
62
|
+
PRIORITY_TX_ENCODING_STEP_BYTES
|
|
63
|
+
) + factoryDepsCount * L1_TX_DELTA_FACTORY_DEPS_L2_GAS,
|
|
64
|
+
L1_TX_MIN_L2_GAS_BASE
|
|
65
|
+
) + L1_TX_INTRINSIC_PUBDATA * input.gasPerPubdata + factoryDepsCount * L1_TX_DELTA_FACTORY_DEPS_PUBDATA * input.gasPerPubdata;
|
|
66
|
+
const overhead = maxBigInt(TX_SLOT_OVERHEAD_L2_GAS, TX_MEMORY_OVERHEAD_GAS * input.encodedLength);
|
|
67
|
+
const derivedBodyGas = minBodyGas;
|
|
68
|
+
return {
|
|
69
|
+
encodedLength: input.encodedLength,
|
|
70
|
+
minBodyGas,
|
|
71
|
+
overhead,
|
|
72
|
+
derivedBodyGas,
|
|
73
|
+
derivedL2GasLimit: derivedBodyGas + overhead,
|
|
74
|
+
priorityTxMaxGasLimit: PRIORITY_TX_MAX_GAS_LIMIT,
|
|
75
|
+
priorityTxMaxGasLimitExceeded: derivedBodyGas > PRIORITY_TX_MAX_GAS_LIMIT
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
function derivePriorityBodyGasEstimateCap(input) {
|
|
79
|
+
return input.minBodyGas * (input.multiplier ?? DEFAULT_PRIORITY_BODY_GAS_ESTIMATE_MULTIPLIER);
|
|
80
|
+
}
|
|
81
|
+
|
|
52
82
|
// src/core/resources/deposits/gas.ts
|
|
53
83
|
function makeGasQuote(p) {
|
|
54
84
|
const maxPriorityFeePerGas = p.maxPriorityFeePerGas ?? 0n;
|
|
@@ -102,11 +132,10 @@ async function quoteL1Gas(input) {
|
|
|
102
132
|
const est = await estimator.estimateGas(tx);
|
|
103
133
|
const buffered = BigInt(est) * (100n + BUFFER) / 100n;
|
|
104
134
|
return makeGasQuote({ gasLimit: buffered, maxFeePerGas, maxPriorityFeePerGas });
|
|
105
|
-
} catch
|
|
135
|
+
} catch {
|
|
106
136
|
if (fallbackGasLimit != null) {
|
|
107
137
|
return makeGasQuote({ gasLimit: fallbackGasLimit, maxFeePerGas, maxPriorityFeePerGas });
|
|
108
138
|
}
|
|
109
|
-
console.warn("L1 gas estimation failed", err);
|
|
110
139
|
return void 0;
|
|
111
140
|
}
|
|
112
141
|
}
|
|
@@ -144,8 +173,7 @@ async function quoteL2Gas(input) {
|
|
|
144
173
|
maxFeePerGas,
|
|
145
174
|
gasPerPubdata: pp
|
|
146
175
|
});
|
|
147
|
-
} catch
|
|
148
|
-
console.warn("L2 gas estimation failed", err);
|
|
176
|
+
} catch {
|
|
149
177
|
return makeGasQuote({
|
|
150
178
|
gasLimit: l2GasLimit ?? 0n,
|
|
151
179
|
maxFeePerGas,
|
|
@@ -234,4 +262,4 @@ async function quoteL2Gas2(input) {
|
|
|
234
262
|
}
|
|
235
263
|
}
|
|
236
264
|
|
|
237
|
-
export { buildFeeBreakdown, createNTVCodec, quoteL1Gas, quoteL2BaseCost, quoteL2Gas, quoteL2Gas2, toGasOverrides };
|
|
265
|
+
export { buildFeeBreakdown, createNTVCodec, derivePriorityBodyGasEstimateCap, derivePriorityTxGasBreakdown, quoteL1Gas, quoteL2BaseCost, quoteL2Gas, quoteL2Gas2, toGasOverrides };
|