@matterlabs/zksync-js 0.0.15 → 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/client.js +4 -4
- package/dist/adapters/ethers/index.cjs +112 -19
- package/dist/adapters/ethers/index.cjs.map +1 -1
- package/dist/adapters/ethers/index.js +6 -6
- package/dist/adapters/ethers/resources/interop/index.d.ts +7 -3
- package/dist/adapters/ethers/resources/interop/services/finalization/bundle.d.ts +6 -1
- package/dist/adapters/ethers/resources/interop/services/finalization/index.d.ts +2 -1
- package/dist/adapters/ethers/sdk.cjs +112 -19
- package/dist/adapters/ethers/sdk.cjs.map +1 -1
- package/dist/adapters/ethers/sdk.js +5 -5
- package/dist/adapters/viem/client.js +4 -4
- package/dist/adapters/viem/index.cjs +121 -21
- package/dist/adapters/viem/index.cjs.map +1 -1
- package/dist/adapters/viem/index.js +6 -6
- package/dist/adapters/viem/resources/interop/index.d.ts +7 -3
- package/dist/adapters/viem/resources/interop/services/finalization/bundle.d.ts +6 -1
- package/dist/adapters/viem/resources/interop/services/finalization/index.d.ts +2 -1
- package/dist/adapters/viem/sdk.cjs +121 -21
- package/dist/adapters/viem/sdk.cjs.map +1 -1
- package/dist/adapters/viem/sdk.js +5 -5
- package/dist/{chunk-MZBKM3GH.js → chunk-24TE2NNJ.js} +2 -2
- package/dist/{chunk-K2UVKMLN.js → chunk-6LYAENO6.js} +4 -7
- package/dist/{chunk-JHRYNLZG.js → chunk-CK5UFAZK.js} +2 -2
- package/dist/{chunk-HGB3DOV2.js → chunk-J2RPWU2R.js} +112 -17
- package/dist/{chunk-MDPX5LNW.js → chunk-JSBMIT4S.js} +1 -1
- package/dist/{chunk-65HAYKVL.js → chunk-NJK325XV.js} +2 -2
- package/dist/{chunk-4PZCNTQ3.js → chunk-ONCNOWNC.js} +121 -19
- package/dist/{chunk-YIWXIP2M.js → chunk-SBGBYZJM.js} +2 -2
- package/dist/{chunk-HVHMLAYH.js → chunk-TYYUG5GA.js} +1 -1
- package/dist/{chunk-JXR5V5YK.js → chunk-UEKFQAOS.js} +1 -0
- package/dist/core/index.js +2 -2
- package/dist/core/resources/deposits/priority.d.ts +1 -1
- package/dist/core/types/errors.d.ts +1 -0
- package/dist/index.js +2 -2
- package/package.json +1 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export { createEthersClient as createClient, createEthersClient } from '../../chunk-
|
|
2
|
-
export { buildDirectRequestStruct, createDepositsResource, createEthersSdk, createFinalizationServices, createInteropFinalizationServices, createInteropResource, createTokensResource, createWithdrawalsResource, encodeNativeTokenVaultTransferData, encodeSecondBridgeArgs, encodeSecondBridgeDataV1, encodeSecondBridgeErc20Args, encodeSecondBridgeEthArgs, getL2TransactionHashFromLogs } from '../../chunk-
|
|
3
|
-
export { classifyReadinessFromRevert, createErrorHandlers, decodeRevert, registerErrorAbi, toZKsyncError } from '../../chunk-
|
|
4
|
-
import '../../chunk-
|
|
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-J2RPWU2R.js';
|
|
3
|
+
export { classifyReadinessFromRevert, createErrorHandlers, decodeRevert, registerErrorAbi, toZKsyncError } from '../../chunk-NJK325XV.js';
|
|
4
|
+
import '../../chunk-6LYAENO6.js';
|
|
5
5
|
import '../../chunk-3HHUZXSV.js';
|
|
6
6
|
import '../../chunk-BWKWWLY4.js';
|
|
7
|
-
import '../../chunk-
|
|
8
|
-
import '../../chunk-
|
|
7
|
+
import '../../chunk-JSBMIT4S.js';
|
|
8
|
+
import '../../chunk-UEKFQAOS.js';
|
|
9
9
|
import '../../chunk-MT4X5FEO.js';
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import type { EthersClient } from '../../client';
|
|
2
|
+
import type { Hex } from '../../../../core/types/primitives';
|
|
2
3
|
import type { AttributesResource } from '../../../../core/resources/interop/attributes/resource';
|
|
3
4
|
import type { InteropRoute, InteropPlan, InteropQuote, InteropStatus, InteropFinalizationResult, InteropParams, InteropHandle, InteropWaitable, InteropFinalizationInfo } from '../../../../core/types/flows/interop';
|
|
4
5
|
import type { ContractsResource } from '../contracts';
|
|
5
6
|
import type { TokensResource } from '../../../../core/types/flows/token';
|
|
6
7
|
import type { InteropRouteStrategy } from './routes/types';
|
|
7
8
|
import type { TransactionRequest } from 'ethers';
|
|
9
|
+
import type { TxGasOverrides } from '../../../../core/types/fees';
|
|
8
10
|
import { createInteropFinalizationServices, type InteropFinalizationServices } from './services/finalization';
|
|
9
|
-
import type
|
|
11
|
+
import { type LogsQueryOptions } from './services/finalization/data-fetchers';
|
|
10
12
|
import type { ChainRef, InteropConfig } from './types';
|
|
11
13
|
export declare const ROUTES: Record<InteropRoute, InteropRouteStrategy>;
|
|
12
14
|
export interface InteropResource {
|
|
@@ -49,14 +51,16 @@ export interface InteropResource {
|
|
|
49
51
|
ok: false;
|
|
50
52
|
error: unknown;
|
|
51
53
|
}>;
|
|
52
|
-
finalize(dstChain: ChainRef, h: InteropWaitable | InteropFinalizationInfo, opts?: LogsQueryOptions): Promise<InteropFinalizationResult>;
|
|
53
|
-
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<{
|
|
54
56
|
ok: true;
|
|
55
57
|
value: InteropFinalizationResult;
|
|
56
58
|
} | {
|
|
57
59
|
ok: false;
|
|
58
60
|
error: unknown;
|
|
59
61
|
}>;
|
|
62
|
+
getInteropRoot(dstChain: ChainRef, rootChainId: bigint, batchNumber: bigint): Promise<Hex>;
|
|
63
|
+
verifyBundle(dstChain: ChainRef, h: InteropWaitable | InteropFinalizationInfo): Promise<InteropFinalizationResult>;
|
|
60
64
|
}
|
|
61
65
|
export declare function createInteropResource(client: EthersClient, config?: InteropConfig, tokens?: TokensResource, contracts?: ContractsResource, attributes?: AttributesResource): InteropResource;
|
|
62
66
|
export { createInteropFinalizationServices };
|
|
@@ -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,11 @@ 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<{
|
|
14
|
+
hash: Hex;
|
|
15
|
+
wait: () => Promise<TransactionReceipt>;
|
|
16
|
+
}>;
|
|
17
|
+
export declare function verifyBundle(client: EthersClient, dstProvider: AbstractProvider, info: InteropFinalizationInfo): Promise<{
|
|
13
18
|
hash: Hex;
|
|
14
19
|
wait: () => Promise<TransactionReceipt>;
|
|
15
20
|
}>;
|
|
@@ -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;
|
|
@@ -377,6 +377,7 @@ var OP_INTEROP = {
|
|
|
377
377
|
tryWait: "interop.tryWait",
|
|
378
378
|
finalize: "interop.finalize",
|
|
379
379
|
tryFinalize: "interop.tryFinalize",
|
|
380
|
+
verify: "interop.verify",
|
|
380
381
|
context: {
|
|
381
382
|
chainTypeManager: "interop.chainTypeManager",
|
|
382
383
|
protocolVersion: "interop.protocolVersion"
|
|
@@ -6480,8 +6481,8 @@ function buildFeeBreakdown(p) {
|
|
|
6480
6481
|
|
|
6481
6482
|
// src/core/resources/deposits/priority.ts
|
|
6482
6483
|
var PRIORITY_TX_ENCODING_STEP_BYTES = 544n;
|
|
6483
|
-
var DEFAULT_PRIORITY_BODY_GAS_ESTIMATE_MULTIPLIER =
|
|
6484
|
-
var
|
|
6484
|
+
var DEFAULT_PRIORITY_BODY_GAS_ESTIMATE_MULTIPLIER = 7n;
|
|
6485
|
+
var PRIORITY_L2_GAS_BUFFER = 40n;
|
|
6485
6486
|
var maxBigInt2 = (a, b) => a > b ? a : b;
|
|
6486
6487
|
var ceilDiv = (a, b) => (a + b - 1n) / b;
|
|
6487
6488
|
function derivePriorityTxGasBreakdown(input) {
|
|
@@ -6509,10 +6510,7 @@ function derivePriorityBodyGasEstimateCap(input) {
|
|
|
6509
6510
|
return input.minBodyGas * (input.multiplier ?? DEFAULT_PRIORITY_BODY_GAS_ESTIMATE_MULTIPLIER);
|
|
6510
6511
|
}
|
|
6511
6512
|
function applyPriorityL2GasLimitBuffer(input) {
|
|
6512
|
-
|
|
6513
|
-
return input.gasLimit;
|
|
6514
|
-
}
|
|
6515
|
-
return input.gasLimit * (100n + ERAVM_PRIORITY_L2_GAS_BUFFER) / 100n;
|
|
6513
|
+
return input.gasLimit * (100n + PRIORITY_L2_GAS_BUFFER) / 100n;
|
|
6516
6514
|
}
|
|
6517
6515
|
var EMPTY_BYTES = "0x";
|
|
6518
6516
|
var ZERO_RESERVED_WORDS = [0n, 0n, 0n, 0n];
|
|
@@ -7026,7 +7024,7 @@ function routeEthNonBase() {
|
|
|
7026
7024
|
const requestStruct = {
|
|
7027
7025
|
chainId: ctx.chainIdL2,
|
|
7028
7026
|
mintValue,
|
|
7029
|
-
l2Value:
|
|
7027
|
+
l2Value: 0n,
|
|
7030
7028
|
l2GasLimit: l2GasParams.gasLimit,
|
|
7031
7029
|
l2GasPerPubdataByteLimit: ctx.gasPerPubdata,
|
|
7032
7030
|
refundRecipient: ctx.refundRecipient,
|
|
@@ -7034,6 +7032,7 @@ function routeEthNonBase() {
|
|
|
7034
7032
|
secondBridgeValue: p.amount,
|
|
7035
7033
|
secondBridgeCalldata
|
|
7036
7034
|
};
|
|
7035
|
+
const bridgehubValue = p.amount;
|
|
7037
7036
|
const bridgehub = await ctx.contracts.bridgehub();
|
|
7038
7037
|
const data = bridgehub.interface.encodeFunctionData("requestL2TransactionTwoBridges", [
|
|
7039
7038
|
requestStruct
|
|
@@ -7041,8 +7040,7 @@ function routeEthNonBase() {
|
|
|
7041
7040
|
const l1TxCandidate = {
|
|
7042
7041
|
to: ctx.bridgehub,
|
|
7043
7042
|
data,
|
|
7044
|
-
value:
|
|
7045
|
-
// base ≠ ETH ⇒ msg.value == secondBridgeValue
|
|
7043
|
+
value: bridgehubValue,
|
|
7046
7044
|
from: ctx.sender,
|
|
7047
7045
|
...ctx.gasOverrides
|
|
7048
7046
|
};
|
|
@@ -9172,13 +9170,23 @@ function routeIndirect() {
|
|
|
9172
9170
|
// src/adapters/ethers/resources/interop/routes/direct.ts
|
|
9173
9171
|
function routeDirect() {
|
|
9174
9172
|
return {
|
|
9175
|
-
// eslint-disable-next-line @typescript-eslint/require-await
|
|
9176
9173
|
async preflight(params, ctx) {
|
|
9177
9174
|
preflightDirect(params, {
|
|
9178
9175
|
dstChainId: ctx.dstChainId,
|
|
9179
9176
|
baseTokens: ctx.baseTokens,
|
|
9180
9177
|
l2AssetRouter: ctx.l2AssetRouter,
|
|
9181
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
|
+
}
|
|
9182
9190
|
},
|
|
9183
9191
|
async build(params, ctx) {
|
|
9184
9192
|
const steps = [];
|
|
@@ -9428,7 +9436,7 @@ async function getBundleStatus(client, dstProvider, topics, bundleHash, opts) {
|
|
|
9428
9436
|
}
|
|
9429
9437
|
return { phase: "SENT" };
|
|
9430
9438
|
}
|
|
9431
|
-
async function executeBundle(client, dstProvider, info, opts) {
|
|
9439
|
+
async function executeBundle(client, dstProvider, info, opts, txOverrides) {
|
|
9432
9440
|
const { topics } = getTopics();
|
|
9433
9441
|
const { bundleHash, encodedData, proof } = info;
|
|
9434
9442
|
const dstStatus = await getBundleStatus(client, dstProvider, topics, bundleHash, opts);
|
|
@@ -9446,7 +9454,11 @@ async function executeBundle(client, dstProvider, info, opts) {
|
|
|
9446
9454
|
const { interopHandler } = await client.ensureAddresses();
|
|
9447
9455
|
const handler = new ethers.Contract(interopHandler, IInteropHandler_default, signer);
|
|
9448
9456
|
try {
|
|
9449
|
-
const txResponse = await handler.executeBundle(
|
|
9457
|
+
const txResponse = await handler.executeBundle(
|
|
9458
|
+
encodedData,
|
|
9459
|
+
proof,
|
|
9460
|
+
txOverrides ?? {}
|
|
9461
|
+
);
|
|
9450
9462
|
const hash = txResponse.hash;
|
|
9451
9463
|
return {
|
|
9452
9464
|
hash,
|
|
@@ -9489,6 +9501,60 @@ async function executeBundle(client, dstProvider, info, opts) {
|
|
|
9489
9501
|
);
|
|
9490
9502
|
}
|
|
9491
9503
|
}
|
|
9504
|
+
async function verifyBundle(client, dstProvider, info) {
|
|
9505
|
+
const signer = await wrap4(OP_INTEROP.verify, () => client.signerFor(dstProvider), {
|
|
9506
|
+
message: "Failed to resolve destination signer for verifyBundle."
|
|
9507
|
+
});
|
|
9508
|
+
const { interopHandler } = await client.ensureAddresses();
|
|
9509
|
+
const handler = new ethers.Contract(interopHandler, IInteropHandler_default, signer);
|
|
9510
|
+
try {
|
|
9511
|
+
const txResponse = await handler.verifyBundle(
|
|
9512
|
+
info.encodedData,
|
|
9513
|
+
info.proof
|
|
9514
|
+
);
|
|
9515
|
+
const hash = txResponse.hash;
|
|
9516
|
+
return {
|
|
9517
|
+
hash,
|
|
9518
|
+
wait: async () => {
|
|
9519
|
+
try {
|
|
9520
|
+
const receipt = await txResponse.wait();
|
|
9521
|
+
if (!receipt || receipt.status !== 1) {
|
|
9522
|
+
throw createError("EXECUTION", {
|
|
9523
|
+
resource: "interop",
|
|
9524
|
+
operation: OP_INTEROP.verify,
|
|
9525
|
+
message: "Interop bundle verification reverted on destination.",
|
|
9526
|
+
context: { txHash: hash }
|
|
9527
|
+
});
|
|
9528
|
+
}
|
|
9529
|
+
return receipt;
|
|
9530
|
+
} catch (e) {
|
|
9531
|
+
if (isZKsyncError(e)) throw e;
|
|
9532
|
+
throw toZKsyncError(
|
|
9533
|
+
"EXECUTION",
|
|
9534
|
+
{
|
|
9535
|
+
resource: "interop",
|
|
9536
|
+
operation: OP_INTEROP.verify,
|
|
9537
|
+
message: "Failed while waiting for verifyBundle transaction on destination.",
|
|
9538
|
+
context: { txHash: hash }
|
|
9539
|
+
},
|
|
9540
|
+
e
|
|
9541
|
+
);
|
|
9542
|
+
}
|
|
9543
|
+
}
|
|
9544
|
+
};
|
|
9545
|
+
} catch (e) {
|
|
9546
|
+
if (isZKsyncError(e)) throw e;
|
|
9547
|
+
throw toZKsyncError(
|
|
9548
|
+
"EXECUTION",
|
|
9549
|
+
{
|
|
9550
|
+
resource: "interop",
|
|
9551
|
+
operation: OP_INTEROP.verify,
|
|
9552
|
+
message: "Failed to send verifyBundle transaction on destination chain."
|
|
9553
|
+
},
|
|
9554
|
+
e
|
|
9555
|
+
);
|
|
9556
|
+
}
|
|
9557
|
+
}
|
|
9492
9558
|
|
|
9493
9559
|
// src/core/resources/interop/finalization.ts
|
|
9494
9560
|
var DEFAULT_POLL_MS = 1e3;
|
|
@@ -9840,8 +9906,8 @@ function createInteropFinalizationServices(client) {
|
|
|
9840
9906
|
wait(dstProvider, gwProvider, input, opts) {
|
|
9841
9907
|
return waitForFinalization(client, dstProvider, gwProvider, input, opts);
|
|
9842
9908
|
},
|
|
9843
|
-
async finalize(dstProvider, info, opts) {
|
|
9844
|
-
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);
|
|
9845
9911
|
await execResult.wait();
|
|
9846
9912
|
return {
|
|
9847
9913
|
bundleHash: info.bundleHash,
|
|
@@ -10051,22 +10117,47 @@ function createInteropResource(client, config, tokens, contracts, attributes) {
|
|
|
10051
10117
|
ctx: { where: "interop.wait" }
|
|
10052
10118
|
});
|
|
10053
10119
|
const tryWait = (dstChain, h, opts) => toResult2(OP_INTEROP.tryWait, () => wait(dstChain, h, opts));
|
|
10054
|
-
const finalize = (dstChain, h, opts) => wrap6(
|
|
10120
|
+
const finalize = (dstChain, h, opts, txOverrides) => wrap6(
|
|
10055
10121
|
OP_INTEROP.finalize,
|
|
10056
10122
|
async () => {
|
|
10057
10123
|
const dstProvider = resolveChainRef(dstChain);
|
|
10058
10124
|
if (isInteropFinalizationInfo(h)) {
|
|
10059
|
-
return svc.finalize(dstProvider, h, opts);
|
|
10125
|
+
return svc.finalize(dstProvider, h, opts, txOverrides);
|
|
10060
10126
|
}
|
|
10061
10127
|
const info = await svc.wait(dstProvider, getGwProvider(), h);
|
|
10062
|
-
return svc.finalize(dstProvider, info, opts);
|
|
10128
|
+
return svc.finalize(dstProvider, info, opts, txOverrides);
|
|
10063
10129
|
},
|
|
10064
10130
|
{
|
|
10065
10131
|
message: "Failed to finalize/execute interop bundle on destination.",
|
|
10066
10132
|
ctx: { where: "interop.finalize" }
|
|
10067
10133
|
}
|
|
10068
10134
|
);
|
|
10069
|
-
const tryFinalize = (dstChain, h, opts
|
|
10135
|
+
const tryFinalize = (dstChain, h, opts, txOverrides) => toResult2(
|
|
10136
|
+
OP_INTEROP.tryFinalize,
|
|
10137
|
+
() => finalize(dstChain, h, opts, txOverrides)
|
|
10138
|
+
);
|
|
10139
|
+
const interopGetRoot = (dstChain, rootChainId, batchNumber) => wrap6(
|
|
10140
|
+
OP_INTEROP.svc.status.getRoot,
|
|
10141
|
+
() => getInteropRoot(resolveChainRef(dstChain), rootChainId, batchNumber),
|
|
10142
|
+
{
|
|
10143
|
+
message: "Failed to get interop root from the destination chain.",
|
|
10144
|
+
ctx: { where: "interop.getInteropRoot" }
|
|
10145
|
+
}
|
|
10146
|
+
);
|
|
10147
|
+
const verifyBundle2 = (dstChain, h) => wrap6(
|
|
10148
|
+
OP_INTEROP.verify,
|
|
10149
|
+
async () => {
|
|
10150
|
+
const dstProvider = resolveChainRef(dstChain);
|
|
10151
|
+
const info = isInteropFinalizationInfo(h) ? h : await svc.wait(dstProvider, getGwProvider(), h);
|
|
10152
|
+
const result = await verifyBundle(client, dstProvider, info);
|
|
10153
|
+
await result.wait();
|
|
10154
|
+
return { bundleHash: info.bundleHash, dstExecTxHash: result.hash };
|
|
10155
|
+
},
|
|
10156
|
+
{
|
|
10157
|
+
message: "Failed to verify interop bundle on destination.",
|
|
10158
|
+
ctx: { where: "interop.verifyBundle" }
|
|
10159
|
+
}
|
|
10160
|
+
);
|
|
10070
10161
|
return {
|
|
10071
10162
|
quote,
|
|
10072
10163
|
tryQuote,
|
|
@@ -10078,7 +10169,9 @@ function createInteropResource(client, config, tokens, contracts, attributes) {
|
|
|
10078
10169
|
wait,
|
|
10079
10170
|
tryWait,
|
|
10080
10171
|
finalize,
|
|
10081
|
-
tryFinalize
|
|
10172
|
+
tryFinalize,
|
|
10173
|
+
getInteropRoot: interopGetRoot,
|
|
10174
|
+
verifyBundle: verifyBundle2
|
|
10082
10175
|
};
|
|
10083
10176
|
}
|
|
10084
10177
|
|