@matterlabs/zksync-js 0.0.16 → 0.0.17
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/index.cjs +29 -15
- package/dist/adapters/ethers/index.cjs.map +1 -1
- package/dist/adapters/ethers/index.js +2 -2
- package/dist/adapters/ethers/resources/interop/index.d.ts +3 -2
- package/dist/adapters/ethers/resources/interop/services/finalization/bundle.d.ts +2 -1
- package/dist/adapters/ethers/resources/interop/services/finalization/index.d.ts +2 -1
- package/dist/adapters/ethers/sdk.cjs +29 -15
- package/dist/adapters/ethers/sdk.cjs.map +1 -1
- package/dist/adapters/ethers/sdk.js +2 -2
- package/dist/adapters/viem/index.cjs +28 -15
- package/dist/adapters/viem/index.cjs.map +1 -1
- package/dist/adapters/viem/index.js +2 -2
- package/dist/adapters/viem/resources/interop/index.d.ts +3 -2
- package/dist/adapters/viem/resources/interop/services/finalization/bundle.d.ts +2 -1
- package/dist/adapters/viem/resources/interop/services/finalization/index.d.ts +2 -1
- package/dist/adapters/viem/sdk.cjs +28 -15
- package/dist/adapters/viem/sdk.cjs.map +1 -1
- package/dist/adapters/viem/sdk.js +2 -2
- package/dist/{chunk-NLUCYVMX.js → chunk-6LYAENO6.js} +3 -6
- package/dist/{chunk-5HG2DUYW.js → chunk-J2RPWU2R.js} +27 -10
- package/dist/{chunk-3KH5PCD6.js → chunk-ONCNOWNC.js} +26 -10
- package/dist/core/resources/deposits/priority.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { createEthersClient as createClient, createEthersClient } from '../../chunk-24TE2NNJ.js';
|
|
2
|
-
export { buildDirectRequestStruct, createDepositsResource, createEthersSdk, createFinalizationServices, createInteropFinalizationServices, createInteropResource, createTokensResource, createWithdrawalsResource, encodeNativeTokenVaultTransferData, encodeSecondBridgeArgs, encodeSecondBridgeDataV1, encodeSecondBridgeErc20Args, encodeSecondBridgeEthArgs, getL2TransactionHashFromLogs } from '../../chunk-
|
|
2
|
+
export { buildDirectRequestStruct, createDepositsResource, createEthersSdk, createFinalizationServices, createInteropFinalizationServices, createInteropResource, createTokensResource, createWithdrawalsResource, encodeNativeTokenVaultTransferData, encodeSecondBridgeArgs, encodeSecondBridgeDataV1, encodeSecondBridgeErc20Args, encodeSecondBridgeEthArgs, getL2TransactionHashFromLogs } from '../../chunk-J2RPWU2R.js';
|
|
3
3
|
export { classifyReadinessFromRevert, createErrorHandlers, decodeRevert, registerErrorAbi, toZKsyncError } from '../../chunk-NJK325XV.js';
|
|
4
|
-
import '../../chunk-
|
|
4
|
+
import '../../chunk-6LYAENO6.js';
|
|
5
5
|
import '../../chunk-3HHUZXSV.js';
|
|
6
6
|
import '../../chunk-BWKWWLY4.js';
|
|
7
7
|
import '../../chunk-JSBMIT4S.js';
|
|
@@ -6,6 +6,7 @@ import type { ContractsResource } from '../contracts';
|
|
|
6
6
|
import type { TokensResource } from '../../../../core/types/flows/token';
|
|
7
7
|
import type { InteropRouteStrategy } from './routes/types';
|
|
8
8
|
import type { TransactionRequest } from 'ethers';
|
|
9
|
+
import type { TxGasOverrides } from '../../../../core/types/fees';
|
|
9
10
|
import { createInteropFinalizationServices, type InteropFinalizationServices } from './services/finalization';
|
|
10
11
|
import { type LogsQueryOptions } from './services/finalization/data-fetchers';
|
|
11
12
|
import type { ChainRef, InteropConfig } from './types';
|
|
@@ -50,8 +51,8 @@ export interface InteropResource {
|
|
|
50
51
|
ok: false;
|
|
51
52
|
error: unknown;
|
|
52
53
|
}>;
|
|
53
|
-
finalize(dstChain: ChainRef, h: InteropWaitable | InteropFinalizationInfo, opts?: LogsQueryOptions): Promise<InteropFinalizationResult>;
|
|
54
|
-
tryFinalize(dstChain: ChainRef, h: InteropWaitable | InteropFinalizationInfo, opts?: LogsQueryOptions): Promise<{
|
|
54
|
+
finalize(dstChain: ChainRef, h: InteropWaitable | InteropFinalizationInfo, opts?: LogsQueryOptions, txOverrides?: TxGasOverrides): Promise<InteropFinalizationResult>;
|
|
55
|
+
tryFinalize(dstChain: ChainRef, h: InteropWaitable | InteropFinalizationInfo, opts?: LogsQueryOptions, txOverrides?: TxGasOverrides): Promise<{
|
|
55
56
|
ok: true;
|
|
56
57
|
value: InteropFinalizationResult;
|
|
57
58
|
} | {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type AbstractProvider, type TransactionReceipt } from 'ethers';
|
|
2
2
|
import type { Hex } from '../../../../../../core/types/primitives';
|
|
3
3
|
import type { InteropFinalizationInfo } from '../../../../../../core/types/flows/interop';
|
|
4
|
+
import type { TxGasOverrides } from '../../../../../../core/types/fees';
|
|
4
5
|
import type { EthersClient } from '../../../../client';
|
|
5
6
|
import type { InteropPhase } from '../../../../../../core/types/flows/interop';
|
|
6
7
|
import type { InteropTopics } from '../../../../../../core/resources/interop/events';
|
|
@@ -9,7 +10,7 @@ export declare function getBundleStatus(client: EthersClient, dstProvider: Abstr
|
|
|
9
10
|
phase: InteropPhase;
|
|
10
11
|
dstExecTxHash?: Hex;
|
|
11
12
|
}>;
|
|
12
|
-
export declare function executeBundle(client: EthersClient, dstProvider: AbstractProvider, info: InteropFinalizationInfo, opts?: LogsQueryOptions): Promise<{
|
|
13
|
+
export declare function executeBundle(client: EthersClient, dstProvider: AbstractProvider, info: InteropFinalizationInfo, opts?: LogsQueryOptions, txOverrides?: TxGasOverrides): Promise<{
|
|
13
14
|
hash: Hex;
|
|
14
15
|
wait: () => Promise<TransactionReceipt>;
|
|
15
16
|
}>;
|
|
@@ -2,12 +2,13 @@ import type { AbstractProvider } from 'ethers';
|
|
|
2
2
|
import type { InteropStatus, InteropWaitable, InteropFinalizationInfo, InteropFinalizationResult } from '../../../../../../core/types/flows/interop';
|
|
3
3
|
import type { EthersClient } from '../../../../client';
|
|
4
4
|
import type { LogsQueryOptions } from './data-fetchers';
|
|
5
|
+
import type { TxGasOverrides } from '../../../../../../core/types/fees';
|
|
5
6
|
export interface InteropFinalizationServices {
|
|
6
7
|
status(dstProvider: AbstractProvider, input: InteropWaitable, opts?: LogsQueryOptions): Promise<InteropStatus>;
|
|
7
8
|
wait(dstProvider: AbstractProvider, gwProvider: AbstractProvider, input: InteropWaitable, opts?: {
|
|
8
9
|
pollMs?: number;
|
|
9
10
|
timeoutMs?: number;
|
|
10
11
|
}): Promise<InteropFinalizationInfo>;
|
|
11
|
-
finalize(dstProvider: AbstractProvider, info: InteropFinalizationInfo, opts?: LogsQueryOptions): Promise<InteropFinalizationResult>;
|
|
12
|
+
finalize(dstProvider: AbstractProvider, info: InteropFinalizationInfo, opts?: LogsQueryOptions, txOverrides?: TxGasOverrides): Promise<InteropFinalizationResult>;
|
|
12
13
|
}
|
|
13
14
|
export declare function createInteropFinalizationServices(client: EthersClient): InteropFinalizationServices;
|
|
@@ -6481,8 +6481,8 @@ function buildFeeBreakdown(p) {
|
|
|
6481
6481
|
|
|
6482
6482
|
// src/core/resources/deposits/priority.ts
|
|
6483
6483
|
var PRIORITY_TX_ENCODING_STEP_BYTES = 544n;
|
|
6484
|
-
var DEFAULT_PRIORITY_BODY_GAS_ESTIMATE_MULTIPLIER =
|
|
6485
|
-
var
|
|
6484
|
+
var DEFAULT_PRIORITY_BODY_GAS_ESTIMATE_MULTIPLIER = 7n;
|
|
6485
|
+
var PRIORITY_L2_GAS_BUFFER = 40n;
|
|
6486
6486
|
var maxBigInt2 = (a, b) => a > b ? a : b;
|
|
6487
6487
|
var ceilDiv = (a, b) => (a + b - 1n) / b;
|
|
6488
6488
|
function derivePriorityTxGasBreakdown(input) {
|
|
@@ -6510,10 +6510,7 @@ function derivePriorityBodyGasEstimateCap(input) {
|
|
|
6510
6510
|
return input.minBodyGas * (input.multiplier ?? DEFAULT_PRIORITY_BODY_GAS_ESTIMATE_MULTIPLIER);
|
|
6511
6511
|
}
|
|
6512
6512
|
function applyPriorityL2GasLimitBuffer(input) {
|
|
6513
|
-
|
|
6514
|
-
return input.gasLimit;
|
|
6515
|
-
}
|
|
6516
|
-
return input.gasLimit * (100n + ERAVM_PRIORITY_L2_GAS_BUFFER) / 100n;
|
|
6513
|
+
return input.gasLimit * (100n + PRIORITY_L2_GAS_BUFFER) / 100n;
|
|
6517
6514
|
}
|
|
6518
6515
|
var EMPTY_BYTES = "0x";
|
|
6519
6516
|
var ZERO_RESERVED_WORDS = [0n, 0n, 0n, 0n];
|
|
@@ -9173,13 +9170,23 @@ function routeIndirect() {
|
|
|
9173
9170
|
// src/adapters/ethers/resources/interop/routes/direct.ts
|
|
9174
9171
|
function routeDirect() {
|
|
9175
9172
|
return {
|
|
9176
|
-
// eslint-disable-next-line @typescript-eslint/require-await
|
|
9177
9173
|
async preflight(params, ctx) {
|
|
9178
9174
|
preflightDirect(params, {
|
|
9179
9175
|
dstChainId: ctx.dstChainId,
|
|
9180
9176
|
baseTokens: ctx.baseTokens,
|
|
9181
9177
|
l2AssetRouter: ctx.l2AssetRouter,
|
|
9182
9178
|
l2NativeTokenVault: ctx.l2NativeTokenVault});
|
|
9179
|
+
for (const action of params.actions) {
|
|
9180
|
+
const code = await ctx.dstProvider.getCode(action.to);
|
|
9181
|
+
if (!code || code === "0x") {
|
|
9182
|
+
throw createError("VALIDATION", {
|
|
9183
|
+
resource: "interop",
|
|
9184
|
+
operation: OP_INTEROP.routes.direct.preflight,
|
|
9185
|
+
message: `Destination address ${action.to} is not a contract on the destination chain. The receiver must be a contract that implements the IERC7786Recipient interface (receiveMessage).`,
|
|
9186
|
+
context: { to: action.to, action: action.type }
|
|
9187
|
+
});
|
|
9188
|
+
}
|
|
9189
|
+
}
|
|
9183
9190
|
},
|
|
9184
9191
|
async build(params, ctx) {
|
|
9185
9192
|
const steps = [];
|
|
@@ -9429,7 +9436,7 @@ async function getBundleStatus(client, dstProvider, topics, bundleHash, opts) {
|
|
|
9429
9436
|
}
|
|
9430
9437
|
return { phase: "SENT" };
|
|
9431
9438
|
}
|
|
9432
|
-
async function executeBundle(client, dstProvider, info, opts) {
|
|
9439
|
+
async function executeBundle(client, dstProvider, info, opts, txOverrides) {
|
|
9433
9440
|
const { topics } = getTopics();
|
|
9434
9441
|
const { bundleHash, encodedData, proof } = info;
|
|
9435
9442
|
const dstStatus = await getBundleStatus(client, dstProvider, topics, bundleHash, opts);
|
|
@@ -9447,7 +9454,11 @@ async function executeBundle(client, dstProvider, info, opts) {
|
|
|
9447
9454
|
const { interopHandler } = await client.ensureAddresses();
|
|
9448
9455
|
const handler = new ethers.Contract(interopHandler, IInteropHandler_default, signer);
|
|
9449
9456
|
try {
|
|
9450
|
-
const txResponse = await handler.executeBundle(
|
|
9457
|
+
const txResponse = await handler.executeBundle(
|
|
9458
|
+
encodedData,
|
|
9459
|
+
proof,
|
|
9460
|
+
txOverrides ?? {}
|
|
9461
|
+
);
|
|
9451
9462
|
const hash = txResponse.hash;
|
|
9452
9463
|
return {
|
|
9453
9464
|
hash,
|
|
@@ -9895,8 +9906,8 @@ function createInteropFinalizationServices(client) {
|
|
|
9895
9906
|
wait(dstProvider, gwProvider, input, opts) {
|
|
9896
9907
|
return waitForFinalization(client, dstProvider, gwProvider, input, opts);
|
|
9897
9908
|
},
|
|
9898
|
-
async finalize(dstProvider, info, opts) {
|
|
9899
|
-
const execResult = await executeBundle(client, dstProvider, info, opts);
|
|
9909
|
+
async finalize(dstProvider, info, opts, txOverrides) {
|
|
9910
|
+
const execResult = await executeBundle(client, dstProvider, info, opts, txOverrides);
|
|
9900
9911
|
await execResult.wait();
|
|
9901
9912
|
return {
|
|
9902
9913
|
bundleHash: info.bundleHash,
|
|
@@ -10106,22 +10117,25 @@ function createInteropResource(client, config, tokens, contracts, attributes) {
|
|
|
10106
10117
|
ctx: { where: "interop.wait" }
|
|
10107
10118
|
});
|
|
10108
10119
|
const tryWait = (dstChain, h, opts) => toResult2(OP_INTEROP.tryWait, () => wait(dstChain, h, opts));
|
|
10109
|
-
const finalize = (dstChain, h, opts) => wrap6(
|
|
10120
|
+
const finalize = (dstChain, h, opts, txOverrides) => wrap6(
|
|
10110
10121
|
OP_INTEROP.finalize,
|
|
10111
10122
|
async () => {
|
|
10112
10123
|
const dstProvider = resolveChainRef(dstChain);
|
|
10113
10124
|
if (isInteropFinalizationInfo(h)) {
|
|
10114
|
-
return svc.finalize(dstProvider, h, opts);
|
|
10125
|
+
return svc.finalize(dstProvider, h, opts, txOverrides);
|
|
10115
10126
|
}
|
|
10116
10127
|
const info = await svc.wait(dstProvider, getGwProvider(), h);
|
|
10117
|
-
return svc.finalize(dstProvider, info, opts);
|
|
10128
|
+
return svc.finalize(dstProvider, info, opts, txOverrides);
|
|
10118
10129
|
},
|
|
10119
10130
|
{
|
|
10120
10131
|
message: "Failed to finalize/execute interop bundle on destination.",
|
|
10121
10132
|
ctx: { where: "interop.finalize" }
|
|
10122
10133
|
}
|
|
10123
10134
|
);
|
|
10124
|
-
const tryFinalize = (dstChain, h, opts
|
|
10135
|
+
const tryFinalize = (dstChain, h, opts, txOverrides) => toResult2(
|
|
10136
|
+
OP_INTEROP.tryFinalize,
|
|
10137
|
+
() => finalize(dstChain, h, opts, txOverrides)
|
|
10138
|
+
);
|
|
10125
10139
|
const interopGetRoot = (dstChain, rootChainId, batchNumber) => wrap6(
|
|
10126
10140
|
OP_INTEROP.svc.status.getRoot,
|
|
10127
10141
|
() => getInteropRoot(resolveChainRef(dstChain), rootChainId, batchNumber),
|