@matterlabs/zksync-js 0.0.15 → 0.0.16
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 +83 -4
- 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 +4 -1
- package/dist/adapters/ethers/resources/interop/services/finalization/bundle.d.ts +4 -0
- package/dist/adapters/ethers/sdk.cjs +83 -4
- 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 +93 -6
- 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 +4 -1
- package/dist/adapters/viem/resources/interop/services/finalization/bundle.d.ts +4 -0
- package/dist/adapters/viem/sdk.cjs +93 -6
- 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-4PZCNTQ3.js → chunk-3KH5PCD6.js} +96 -10
- package/dist/{chunk-HGB3DOV2.js → chunk-5HG2DUYW.js} +86 -8
- package/dist/{chunk-JHRYNLZG.js → chunk-CK5UFAZK.js} +2 -2
- package/dist/{chunk-MDPX5LNW.js → chunk-JSBMIT4S.js} +1 -1
- package/dist/{chunk-65HAYKVL.js → chunk-NJK325XV.js} +2 -2
- package/dist/{chunk-K2UVKMLN.js → chunk-NLUCYVMX.js} +1 -1
- 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/types/errors.d.ts +1 -0
- package/dist/index.js +2 -2
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { createViemSdk } from '../../chunk-
|
|
2
|
-
import '../../chunk-
|
|
1
|
+
export { createViemSdk } from '../../chunk-3KH5PCD6.js';
|
|
2
|
+
import '../../chunk-NLUCYVMX.js';
|
|
3
3
|
import '../../chunk-3HHUZXSV.js';
|
|
4
|
-
import '../../chunk-
|
|
5
|
-
import '../../chunk-
|
|
6
|
-
import '../../chunk-
|
|
4
|
+
import '../../chunk-SBGBYZJM.js';
|
|
5
|
+
import '../../chunk-JSBMIT4S.js';
|
|
6
|
+
import '../../chunk-UEKFQAOS.js';
|
|
7
7
|
import '../../chunk-MT4X5FEO.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { createErrorHandlers } from './chunk-
|
|
1
|
+
import { createErrorHandlers } from './chunk-NJK325XV.js';
|
|
2
2
|
import { makeTransportFromEthers } from './chunk-BWKWWLY4.js';
|
|
3
|
-
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, createZksRpc } from './chunk-
|
|
3
|
+
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, createZksRpc } from './chunk-UEKFQAOS.js';
|
|
4
4
|
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
5
|
import { BrowserProvider, Interface, Contract } from 'ethers';
|
|
6
6
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { createNTVCodec, resolveCreateDepositL1GasLimit, isInteropFinalizationInfo, DEFAULT_POLL_MS, DEFAULT_TIMEOUT_MS, resolveIdsFromWaitable, parseBundleReceiptInfo, buildFinalizationInfo, parseBundleSentFromReceipt, createAttributesResource, pickInteropRoute, ZERO_HASH, toGasOverrides, applyPriorityL2GasLimitBuffer, buildFeeBreakdown, buildIndirectBundle, preflightIndirect, buildDirectBundle, preflightDirect, derivePriorityTxGasBreakdown, quoteL2Gas, quoteL1Gas, derivePriorityBodyGasEstimateCap, quoteL2Gas2, assertProtocolVersion } from './chunk-
|
|
1
|
+
import { createNTVCodec, resolveCreateDepositL1GasLimit, isInteropFinalizationInfo, DEFAULT_POLL_MS, DEFAULT_TIMEOUT_MS, resolveIdsFromWaitable, parseBundleReceiptInfo, buildFinalizationInfo, parseBundleSentFromReceipt, createAttributesResource, pickInteropRoute, ZERO_HASH, toGasOverrides, applyPriorityL2GasLimitBuffer, buildFeeBreakdown, buildIndirectBundle, preflightIndirect, buildDirectBundle, preflightDirect, derivePriorityTxGasBreakdown, quoteL2Gas, quoteL1Gas, derivePriorityBodyGasEstimateCap, quoteL2Gas2, assertProtocolVersion } from './chunk-NLUCYVMX.js';
|
|
2
2
|
import { findL1MessageSentLog, messengerLogIndex, pickWithdrawRoute } from './chunk-3HHUZXSV.js';
|
|
3
|
-
import { createErrorHandlers, toZKsyncError, classifyReadinessFromRevert } from './chunk-
|
|
4
|
-
import { isHash66, IL1Nullifier_default, OP_WITHDRAWALS, createError, normalizeL1Token, isAddressEq, hexEq, OP_DEPOSITS, IERC20_default, isZKsyncError, isReceiptNotFound, OP_INTEROP, IInteropHandler_default, IInteropCenter_default, sleep, IERC7786Attributes_default, IBridgehub_default, isETH, normalizeAddrEq, L2NativeTokenVault_default, IL2AssetRouter_default, IBaseToken_default,
|
|
5
|
-
import { ETH_ADDRESS, TOPIC_CANONICAL_ASSIGNED, TOPIC_CANONICAL_SUCCESS, L1_MESSENGER_ADDRESS, L2_BASE_TOKEN_ADDRESS, L2_NATIVE_TOKEN_VAULT_ADDRESS,
|
|
3
|
+
import { createErrorHandlers, toZKsyncError, classifyReadinessFromRevert } from './chunk-SBGBYZJM.js';
|
|
4
|
+
import { isHash66, IL1Nullifier_default, OP_WITHDRAWALS, createError, normalizeL1Token, isAddressEq, hexEq, OP_DEPOSITS, IERC20_default, isZKsyncError, isReceiptNotFound, OP_INTEROP, IInteropHandler_default, IInteropRootStorage_default, IInteropCenter_default, sleep, IERC7786Attributes_default, IBridgehub_default, isETH, normalizeAddrEq, L2NativeTokenVault_default, IL2AssetRouter_default, IBaseToken_default, assertNever } from './chunk-UEKFQAOS.js';
|
|
5
|
+
import { ETH_ADDRESS, TOPIC_CANONICAL_ASSIGNED, TOPIC_CANONICAL_SUCCESS, L1_MESSENGER_ADDRESS, L2_BASE_TOKEN_ADDRESS, L2_NATIVE_TOKEN_VAULT_ADDRESS, L2_INTEROP_ROOT_STORAGE_ADDRESS, BUFFER, SAFE_L1_BRIDGE_GAS, L2_ASSET_ROUTER_ADDRESS, FORMAL_ETH_ADDRESS } from './chunk-MT4X5FEO.js';
|
|
6
6
|
import { keccak256, encodeAbiParameters, toBytes, concat, decodeEventLog, decodeAbiParameters, createWalletClient, custom, encodeFunctionData, createPublicClient, http, encodeEventTopics, numberToHex, zeroAddress, getAddress, toHex } from 'viem';
|
|
7
7
|
|
|
8
8
|
// src/adapters/viem/resources/deposits/context.ts
|
|
@@ -934,7 +934,7 @@ function routeEthNonBase() {
|
|
|
934
934
|
const requestStruct = {
|
|
935
935
|
chainId: ctx.chainIdL2,
|
|
936
936
|
mintValue,
|
|
937
|
-
l2Value:
|
|
937
|
+
l2Value: 0n,
|
|
938
938
|
l2GasLimit: l2Gas.gasLimit,
|
|
939
939
|
l2GasPerPubdataByteLimit: ctx.gasPerPubdata,
|
|
940
940
|
refundRecipient: ctx.refundRecipient,
|
|
@@ -942,6 +942,7 @@ function routeEthNonBase() {
|
|
|
942
942
|
secondBridgeValue: p.amount,
|
|
943
943
|
secondBridgeCalldata
|
|
944
944
|
};
|
|
945
|
+
const bridgehubValue = p.amount;
|
|
945
946
|
let bridgeTx;
|
|
946
947
|
let calldata;
|
|
947
948
|
if (needsApprove) {
|
|
@@ -950,8 +951,7 @@ function routeEthNonBase() {
|
|
|
950
951
|
abi: IBridgehub_default,
|
|
951
952
|
functionName: "requestL2TransactionTwoBridges",
|
|
952
953
|
args: [requestStruct],
|
|
953
|
-
value:
|
|
954
|
-
// base ≠ ETH ⇒ msg.value == secondBridgeValue
|
|
954
|
+
value: bridgehubValue,
|
|
955
955
|
account: ctx.client.account
|
|
956
956
|
};
|
|
957
957
|
calldata = encodeFunctionData({
|
|
@@ -968,7 +968,7 @@ function routeEthNonBase() {
|
|
|
968
968
|
abi: IBridgehub_default,
|
|
969
969
|
functionName: "requestL2TransactionTwoBridges",
|
|
970
970
|
args: [requestStruct],
|
|
971
|
-
value:
|
|
971
|
+
value: bridgehubValue,
|
|
972
972
|
account: ctx.client.account
|
|
973
973
|
}),
|
|
974
974
|
{
|
|
@@ -986,7 +986,7 @@ function routeEthNonBase() {
|
|
|
986
986
|
const l1TxCandidate = {
|
|
987
987
|
to: ctx.bridgehub,
|
|
988
988
|
data: calldata,
|
|
989
|
-
value:
|
|
989
|
+
value: bridgehubValue,
|
|
990
990
|
from: ctx.sender,
|
|
991
991
|
...ctx.gasOverrides
|
|
992
992
|
};
|
|
@@ -3424,6 +3424,68 @@ async function executeBundle(client, dstProvider, info, opts) {
|
|
|
3424
3424
|
);
|
|
3425
3425
|
}
|
|
3426
3426
|
}
|
|
3427
|
+
async function verifyBundle(client, dstProvider, info) {
|
|
3428
|
+
const { interopHandler } = await client.ensureAddresses();
|
|
3429
|
+
const dstWallet = await wrap4(
|
|
3430
|
+
OP_INTEROP.verify,
|
|
3431
|
+
() => createWalletClient({
|
|
3432
|
+
account: client.account,
|
|
3433
|
+
transport: custom(dstProvider.transport),
|
|
3434
|
+
chain: dstProvider.chain
|
|
3435
|
+
}),
|
|
3436
|
+
{ message: "Failed to create destination wallet client for verifyBundle." }
|
|
3437
|
+
);
|
|
3438
|
+
try {
|
|
3439
|
+
const hash = await dstWallet.writeContract({
|
|
3440
|
+
address: interopHandler,
|
|
3441
|
+
abi: IInteropHandler_default,
|
|
3442
|
+
functionName: "verifyBundle",
|
|
3443
|
+
args: [info.encodedData, info.proof],
|
|
3444
|
+
account: client.account,
|
|
3445
|
+
chain: dstProvider.chain ?? null
|
|
3446
|
+
});
|
|
3447
|
+
return {
|
|
3448
|
+
hash,
|
|
3449
|
+
wait: async () => {
|
|
3450
|
+
try {
|
|
3451
|
+
const receipt = await dstProvider.waitForTransactionReceipt({ hash });
|
|
3452
|
+
if (receipt.status === "reverted") {
|
|
3453
|
+
throw createError("EXECUTION", {
|
|
3454
|
+
resource: "interop",
|
|
3455
|
+
operation: OP_INTEROP.verify,
|
|
3456
|
+
message: "Interop bundle verification reverted on destination.",
|
|
3457
|
+
context: { txHash: hash }
|
|
3458
|
+
});
|
|
3459
|
+
}
|
|
3460
|
+
return receipt;
|
|
3461
|
+
} catch (e) {
|
|
3462
|
+
if (isZKsyncError(e)) throw e;
|
|
3463
|
+
throw toZKsyncError(
|
|
3464
|
+
"EXECUTION",
|
|
3465
|
+
{
|
|
3466
|
+
resource: "interop",
|
|
3467
|
+
operation: OP_INTEROP.verify,
|
|
3468
|
+
message: "Failed while waiting for verifyBundle transaction on destination.",
|
|
3469
|
+
context: { txHash: hash }
|
|
3470
|
+
},
|
|
3471
|
+
e
|
|
3472
|
+
);
|
|
3473
|
+
}
|
|
3474
|
+
}
|
|
3475
|
+
};
|
|
3476
|
+
} catch (e) {
|
|
3477
|
+
if (isZKsyncError(e)) throw e;
|
|
3478
|
+
throw toZKsyncError(
|
|
3479
|
+
"EXECUTION",
|
|
3480
|
+
{
|
|
3481
|
+
resource: "interop",
|
|
3482
|
+
operation: OP_INTEROP.verify,
|
|
3483
|
+
message: "Failed to send verifyBundle transaction on destination chain."
|
|
3484
|
+
},
|
|
3485
|
+
e
|
|
3486
|
+
);
|
|
3487
|
+
}
|
|
3488
|
+
}
|
|
3427
3489
|
function decodeInteropBundleSent(log) {
|
|
3428
3490
|
const { args } = decodeEventLog({
|
|
3429
3491
|
abi: IInteropCenter_default,
|
|
@@ -3889,6 +3951,28 @@ function createInteropResource(client, config, tokens, contracts, attributes) {
|
|
|
3889
3951
|
}
|
|
3890
3952
|
);
|
|
3891
3953
|
const tryFinalize = (dstChain, h, opts) => toResult2(OP_INTEROP.tryFinalize, () => finalize(dstChain, h, opts));
|
|
3954
|
+
const interopGetRoot = (dstChain, rootChainId, batchNumber) => wrap6(
|
|
3955
|
+
OP_INTEROP.svc.status.getRoot,
|
|
3956
|
+
() => getInteropRoot(resolveChainRef(dstChain), rootChainId, batchNumber),
|
|
3957
|
+
{
|
|
3958
|
+
message: "Failed to get interop root from the destination chain.",
|
|
3959
|
+
ctx: { where: "interop.getInteropRoot" }
|
|
3960
|
+
}
|
|
3961
|
+
);
|
|
3962
|
+
const verifyBundle2 = (dstChain, h) => wrap6(
|
|
3963
|
+
OP_INTEROP.verify,
|
|
3964
|
+
async () => {
|
|
3965
|
+
const dstProvider = resolveChainRef(dstChain);
|
|
3966
|
+
const info = isInteropFinalizationInfo(h) ? h : await svc.wait(dstProvider, getGwProvider(), h);
|
|
3967
|
+
const result = await verifyBundle(client, dstProvider, info);
|
|
3968
|
+
await result.wait();
|
|
3969
|
+
return { bundleHash: info.bundleHash, dstExecTxHash: result.hash };
|
|
3970
|
+
},
|
|
3971
|
+
{
|
|
3972
|
+
message: "Failed to verify interop bundle on destination.",
|
|
3973
|
+
ctx: { where: "interop.verifyBundle" }
|
|
3974
|
+
}
|
|
3975
|
+
);
|
|
3892
3976
|
return {
|
|
3893
3977
|
quote,
|
|
3894
3978
|
tryQuote,
|
|
@@ -3900,7 +3984,9 @@ function createInteropResource(client, config, tokens, contracts, attributes) {
|
|
|
3900
3984
|
wait,
|
|
3901
3985
|
tryWait,
|
|
3902
3986
|
finalize,
|
|
3903
|
-
tryFinalize
|
|
3987
|
+
tryFinalize,
|
|
3988
|
+
getInteropRoot: interopGetRoot,
|
|
3989
|
+
verifyBundle: verifyBundle2
|
|
3904
3990
|
};
|
|
3905
3991
|
}
|
|
3906
3992
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { createErrorHandlers, toZKsyncError, classifyReadinessFromRevert } from './chunk-
|
|
2
|
-
import { createNTVCodec, resolveCreateDepositL1GasLimit, isInteropFinalizationInfo, DEFAULT_POLL_MS, DEFAULT_TIMEOUT_MS, resolveIdsFromWaitable, parseBundleReceiptInfo, buildFinalizationInfo, parseBundleSentFromReceipt, createAttributesResource, pickInteropRoute, ZERO_HASH, toGasOverrides, applyPriorityL2GasLimitBuffer, buildFeeBreakdown, buildIndirectBundle, preflightIndirect, buildDirectBundle, preflightDirect, derivePriorityTxGasBreakdown, quoteL2Gas, quoteL2BaseCost, quoteL1Gas, derivePriorityBodyGasEstimateCap, quoteL2Gas2, assertProtocolVersion } from './chunk-
|
|
1
|
+
import { createErrorHandlers, toZKsyncError, classifyReadinessFromRevert } from './chunk-NJK325XV.js';
|
|
2
|
+
import { createNTVCodec, resolveCreateDepositL1GasLimit, isInteropFinalizationInfo, DEFAULT_POLL_MS, DEFAULT_TIMEOUT_MS, resolveIdsFromWaitable, parseBundleReceiptInfo, buildFinalizationInfo, parseBundleSentFromReceipt, createAttributesResource, pickInteropRoute, ZERO_HASH, toGasOverrides, applyPriorityL2GasLimitBuffer, buildFeeBreakdown, buildIndirectBundle, preflightIndirect, buildDirectBundle, preflightDirect, derivePriorityTxGasBreakdown, quoteL2Gas, quoteL2BaseCost, quoteL1Gas, derivePriorityBodyGasEstimateCap, quoteL2Gas2, assertProtocolVersion } from './chunk-NLUCYVMX.js';
|
|
3
3
|
import { findL1MessageSentLog, messengerLogIndex, pickWithdrawRoute } from './chunk-3HHUZXSV.js';
|
|
4
|
-
import { isHash66, IL1Nullifier_default, OP_WITHDRAWALS, createError, normalizeL1Token, isAddressEq, hexEq, OP_DEPOSITS, IERC20_default, isZKsyncError, isReceiptNotFound, OP_INTEROP, IInteropHandler_default, IERC7786Attributes_default, IInteropCenter_default, sleep, isETH, normalizeAddrEq,
|
|
5
|
-
import { ETH_ADDRESS, TOPIC_CANONICAL_ASSIGNED, TOPIC_CANONICAL_SUCCESS, L1_MESSENGER_ADDRESS, L2_BASE_TOKEN_ADDRESS, L2_NATIVE_TOKEN_VAULT_ADDRESS,
|
|
4
|
+
import { isHash66, IL1Nullifier_default, OP_WITHDRAWALS, createError, normalizeL1Token, isAddressEq, hexEq, OP_DEPOSITS, IERC20_default, isZKsyncError, isReceiptNotFound, OP_INTEROP, IInteropHandler_default, IERC7786Attributes_default, IInteropRootStorage_default, IInteropCenter_default, sleep, isETH, normalizeAddrEq, IL2AssetRouter_default, L2NativeTokenVault_default, assertNever } from './chunk-UEKFQAOS.js';
|
|
5
|
+
import { ETH_ADDRESS, TOPIC_CANONICAL_ASSIGNED, TOPIC_CANONICAL_SUCCESS, L1_MESSENGER_ADDRESS, L2_BASE_TOKEN_ADDRESS, L2_NATIVE_TOKEN_VAULT_ADDRESS, L2_INTEROP_ROOT_STORAGE_ADDRESS, BUFFER, SAFE_L1_BRIDGE_GAS, L2_ASSET_ROUTER_ADDRESS, FORMAL_ETH_ADDRESS } from './chunk-MT4X5FEO.js';
|
|
6
6
|
import { Interface, keccak256, AbiCoder, ethers, getBytes, Contract, NonceManager, JsonRpcProvider, getAddress, concat, hexlify, toBeArray, toBeHex, isError } from 'ethers';
|
|
7
7
|
|
|
8
8
|
var I_BRIDGEHUB = new Interface([
|
|
@@ -823,7 +823,7 @@ function routeEthNonBase() {
|
|
|
823
823
|
const requestStruct = {
|
|
824
824
|
chainId: ctx.chainIdL2,
|
|
825
825
|
mintValue,
|
|
826
|
-
l2Value:
|
|
826
|
+
l2Value: 0n,
|
|
827
827
|
l2GasLimit: l2GasParams.gasLimit,
|
|
828
828
|
l2GasPerPubdataByteLimit: ctx.gasPerPubdata,
|
|
829
829
|
refundRecipient: ctx.refundRecipient,
|
|
@@ -831,6 +831,7 @@ function routeEthNonBase() {
|
|
|
831
831
|
secondBridgeValue: p.amount,
|
|
832
832
|
secondBridgeCalldata
|
|
833
833
|
};
|
|
834
|
+
const bridgehubValue = p.amount;
|
|
834
835
|
const bridgehub = await ctx.contracts.bridgehub();
|
|
835
836
|
const data = bridgehub.interface.encodeFunctionData("requestL2TransactionTwoBridges", [
|
|
836
837
|
requestStruct
|
|
@@ -838,8 +839,7 @@ function routeEthNonBase() {
|
|
|
838
839
|
const l1TxCandidate = {
|
|
839
840
|
to: ctx.bridgehub,
|
|
840
841
|
data,
|
|
841
|
-
value:
|
|
842
|
-
// base ≠ ETH ⇒ msg.value == secondBridgeValue
|
|
842
|
+
value: bridgehubValue,
|
|
843
843
|
from: ctx.sender,
|
|
844
844
|
...ctx.gasOverrides
|
|
845
845
|
};
|
|
@@ -2946,6 +2946,60 @@ async function executeBundle(client, dstProvider, info, opts) {
|
|
|
2946
2946
|
);
|
|
2947
2947
|
}
|
|
2948
2948
|
}
|
|
2949
|
+
async function verifyBundle(client, dstProvider, info) {
|
|
2950
|
+
const signer = await wrap4(OP_INTEROP.verify, () => client.signerFor(dstProvider), {
|
|
2951
|
+
message: "Failed to resolve destination signer for verifyBundle."
|
|
2952
|
+
});
|
|
2953
|
+
const { interopHandler } = await client.ensureAddresses();
|
|
2954
|
+
const handler = new Contract(interopHandler, IInteropHandler_default, signer);
|
|
2955
|
+
try {
|
|
2956
|
+
const txResponse = await handler.verifyBundle(
|
|
2957
|
+
info.encodedData,
|
|
2958
|
+
info.proof
|
|
2959
|
+
);
|
|
2960
|
+
const hash = txResponse.hash;
|
|
2961
|
+
return {
|
|
2962
|
+
hash,
|
|
2963
|
+
wait: async () => {
|
|
2964
|
+
try {
|
|
2965
|
+
const receipt = await txResponse.wait();
|
|
2966
|
+
if (!receipt || receipt.status !== 1) {
|
|
2967
|
+
throw createError("EXECUTION", {
|
|
2968
|
+
resource: "interop",
|
|
2969
|
+
operation: OP_INTEROP.verify,
|
|
2970
|
+
message: "Interop bundle verification reverted on destination.",
|
|
2971
|
+
context: { txHash: hash }
|
|
2972
|
+
});
|
|
2973
|
+
}
|
|
2974
|
+
return receipt;
|
|
2975
|
+
} catch (e) {
|
|
2976
|
+
if (isZKsyncError(e)) throw e;
|
|
2977
|
+
throw toZKsyncError(
|
|
2978
|
+
"EXECUTION",
|
|
2979
|
+
{
|
|
2980
|
+
resource: "interop",
|
|
2981
|
+
operation: OP_INTEROP.verify,
|
|
2982
|
+
message: "Failed while waiting for verifyBundle transaction on destination.",
|
|
2983
|
+
context: { txHash: hash }
|
|
2984
|
+
},
|
|
2985
|
+
e
|
|
2986
|
+
);
|
|
2987
|
+
}
|
|
2988
|
+
}
|
|
2989
|
+
};
|
|
2990
|
+
} catch (e) {
|
|
2991
|
+
if (isZKsyncError(e)) throw e;
|
|
2992
|
+
throw toZKsyncError(
|
|
2993
|
+
"EXECUTION",
|
|
2994
|
+
{
|
|
2995
|
+
resource: "interop",
|
|
2996
|
+
operation: OP_INTEROP.verify,
|
|
2997
|
+
message: "Failed to send verifyBundle transaction on destination chain."
|
|
2998
|
+
},
|
|
2999
|
+
e
|
|
3000
|
+
);
|
|
3001
|
+
}
|
|
3002
|
+
}
|
|
2949
3003
|
function decodeInteropBundleSent(centerIface, log) {
|
|
2950
3004
|
const decoded = centerIface.decodeEventLog(
|
|
2951
3005
|
"InteropBundleSent",
|
|
@@ -3392,6 +3446,28 @@ function createInteropResource(client, config, tokens, contracts, attributes) {
|
|
|
3392
3446
|
}
|
|
3393
3447
|
);
|
|
3394
3448
|
const tryFinalize = (dstChain, h, opts) => toResult2(OP_INTEROP.tryFinalize, () => finalize(dstChain, h, opts));
|
|
3449
|
+
const interopGetRoot = (dstChain, rootChainId, batchNumber) => wrap6(
|
|
3450
|
+
OP_INTEROP.svc.status.getRoot,
|
|
3451
|
+
() => getInteropRoot(resolveChainRef(dstChain), rootChainId, batchNumber),
|
|
3452
|
+
{
|
|
3453
|
+
message: "Failed to get interop root from the destination chain.",
|
|
3454
|
+
ctx: { where: "interop.getInteropRoot" }
|
|
3455
|
+
}
|
|
3456
|
+
);
|
|
3457
|
+
const verifyBundle2 = (dstChain, h) => wrap6(
|
|
3458
|
+
OP_INTEROP.verify,
|
|
3459
|
+
async () => {
|
|
3460
|
+
const dstProvider = resolveChainRef(dstChain);
|
|
3461
|
+
const info = isInteropFinalizationInfo(h) ? h : await svc.wait(dstProvider, getGwProvider(), h);
|
|
3462
|
+
const result = await verifyBundle(client, dstProvider, info);
|
|
3463
|
+
await result.wait();
|
|
3464
|
+
return { bundleHash: info.bundleHash, dstExecTxHash: result.hash };
|
|
3465
|
+
},
|
|
3466
|
+
{
|
|
3467
|
+
message: "Failed to verify interop bundle on destination.",
|
|
3468
|
+
ctx: { where: "interop.verifyBundle" }
|
|
3469
|
+
}
|
|
3470
|
+
);
|
|
3395
3471
|
return {
|
|
3396
3472
|
quote,
|
|
3397
3473
|
tryQuote,
|
|
@@ -3403,7 +3479,9 @@ function createInteropResource(client, config, tokens, contracts, attributes) {
|
|
|
3403
3479
|
wait,
|
|
3404
3480
|
tryWait,
|
|
3405
3481
|
finalize,
|
|
3406
|
-
tryFinalize
|
|
3482
|
+
tryFinalize,
|
|
3483
|
+
getInteropRoot: interopGetRoot,
|
|
3484
|
+
verifyBundle: verifyBundle2
|
|
3407
3485
|
};
|
|
3408
3486
|
}
|
|
3409
3487
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { createErrorHandlers } from './chunk-
|
|
1
|
+
import { createErrorHandlers } from './chunk-SBGBYZJM.js';
|
|
2
2
|
import { makeTransportFromViem } from './chunk-BWKWWLY4.js';
|
|
3
|
-
import { OP_CLIENT, IBridgehub_default, IL1AssetRouter_default, IL1Nullifier_default, IBaseToken_default, L2NativeTokenVault_default, IL2AssetRouter_default, L1NativeTokenVault_default, createError, createZksRpc } from './chunk-
|
|
3
|
+
import { OP_CLIENT, IBridgehub_default, IL1AssetRouter_default, IL1Nullifier_default, IBaseToken_default, L2NativeTokenVault_default, IL2AssetRouter_default, L1NativeTokenVault_default, createError, createZksRpc } from './chunk-UEKFQAOS.js';
|
|
4
4
|
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
5
|
import { getContract, createWalletClient, custom } from 'viem';
|
|
6
6
|
|
|
@@ -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-JSBMIT4S.js';
|
|
2
|
+
import { IL1Nullifier_default, IERC20_default, L1NativeTokenVault_default, L2NativeTokenVault_default, Mailbox_default, IL1ContractErrors_default, IInteropErrors_default } from './chunk-UEKFQAOS.js';
|
|
3
3
|
import { Interface } from 'ethers';
|
|
4
4
|
|
|
5
5
|
var ERROR_IFACES = [];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { isL1MessageSentLog } from './chunk-3HHUZXSV.js';
|
|
2
|
-
import { IBridgehub_default, isHash66, isBigint, isHash, assertNever, createError, OP_INTEROP, isNumber, isAddress, isHash66Array } from './chunk-
|
|
2
|
+
import { IBridgehub_default, isHash66, isBigint, isHash, assertNever, createError, OP_INTEROP, isNumber, isAddress, isHash66Array } from './chunk-UEKFQAOS.js';
|
|
3
3
|
import { BUFFER, DEFAULT_ABI_BYTES, DEFAULT_PUBDATA_BYTES, TX_MEMORY_OVERHEAD_GAS, TX_OVERHEAD_GAS, 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_SLOT_OVERHEAD_L2_GAS, PRIORITY_TX_MAX_GAS_LIMIT, L2_INTEROP_CENTER_ADDRESS, BUNDLE_IDENTIFIER } from './chunk-MT4X5FEO.js';
|
|
4
4
|
|
|
5
5
|
// src/core/resources/deposits/chains.ts
|
|
@@ -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-JSBMIT4S.js';
|
|
2
|
+
import { IL1Nullifier_default, IERC20_default, L1NativeTokenVault_default, L2NativeTokenVault_default, Mailbox_default, IL1ContractErrors_default, IInteropErrors_default } from './chunk-UEKFQAOS.js';
|
|
3
3
|
import { decodeErrorResult } from 'viem';
|
|
4
4
|
|
|
5
5
|
var ERROR_ABIS = [];
|
|
@@ -7027,6 +7027,7 @@ var OP_INTEROP = {
|
|
|
7027
7027
|
tryWait: "interop.tryWait",
|
|
7028
7028
|
finalize: "interop.finalize",
|
|
7029
7029
|
tryFinalize: "interop.tryFinalize",
|
|
7030
|
+
verify: "interop.verify",
|
|
7030
7031
|
context: {
|
|
7031
7032
|
chainTypeManager: "interop.chainTypeManager",
|
|
7032
7033
|
protocolVersion: "interop.protocolVersion"
|
package/dist/core/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { pickDepositRoute } from '../chunk-
|
|
1
|
+
export { pickDepositRoute } from '../chunk-TYYUG5GA.js';
|
|
2
2
|
export { findL1MessageSentLog, isL1MessageSentLog, messengerLogIndex, pickWithdrawRoute } from '../chunk-3HHUZXSV.js';
|
|
3
3
|
export { makeTransportFromEthers, makeTransportFromViem } from '../chunk-BWKWWLY4.js';
|
|
4
|
-
export { abi_exports as abi, factory_exports as errors, formatEnvelopePretty, hexEq, isAddress, isAddressEq, isETH, isHash, isHash66, isHash66Array, isHashArray, normalizeAddrEq, normalizeL1Token, zks_exports as zksRpc } from '../chunk-
|
|
4
|
+
export { abi_exports as abi, factory_exports as errors, formatEnvelopePretty, hexEq, isAddress, isAddressEq, isETH, isHash, isHash66, isHash66Array, isHashArray, normalizeAddrEq, normalizeL1Token, zks_exports as zksRpc } from '../chunk-UEKFQAOS.js';
|
|
5
5
|
export { ETH_ADDRESS, FORMAL_ETH_ADDRESS, L1_MESSENGER_ADDRESS, L1_SOPH_TOKEN_ADDRESS, L2_ASSET_ROUTER_ADDRESS, L2_BASE_TOKEN_ADDRESS, L2_NATIVE_TOKEN_VAULT_ADDRESS } from '../chunk-MT4X5FEO.js';
|
|
@@ -194,6 +194,7 @@ export declare const OP_INTEROP: {
|
|
|
194
194
|
readonly tryWait: "interop.tryWait";
|
|
195
195
|
readonly finalize: "interop.finalize";
|
|
196
196
|
readonly tryFinalize: "interop.tryFinalize";
|
|
197
|
+
readonly verify: "interop.verify";
|
|
197
198
|
readonly context: {
|
|
198
199
|
readonly chainTypeManager: "interop.chainTypeManager";
|
|
199
200
|
readonly protocolVersion: "interop.protocolVersion";
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { pickDepositRoute } from './chunk-
|
|
1
|
+
export { pickDepositRoute } from './chunk-TYYUG5GA.js';
|
|
2
2
|
export { findL1MessageSentLog, isL1MessageSentLog, messengerLogIndex, pickWithdrawRoute } from './chunk-3HHUZXSV.js';
|
|
3
3
|
export { makeTransportFromEthers, makeTransportFromViem } from './chunk-BWKWWLY4.js';
|
|
4
|
-
export { abi_exports as abi, factory_exports as errors, formatEnvelopePretty, hexEq, isAddress, isAddressEq, isETH, isHash, isHash66, isHash66Array, isHashArray, normalizeAddrEq, normalizeL1Token, zks_exports as zksRpc } from './chunk-
|
|
4
|
+
export { abi_exports as abi, factory_exports as errors, formatEnvelopePretty, hexEq, isAddress, isAddressEq, isETH, isHash, isHash66, isHash66Array, isHashArray, normalizeAddrEq, normalizeL1Token, zks_exports as zksRpc } from './chunk-UEKFQAOS.js';
|
|
5
5
|
export { constants_exports as constants } from './chunk-MT4X5FEO.js';
|