@matterlabs/zksync-js 0.0.7 → 0.0.9

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.
Files changed (105) hide show
  1. package/dist/adapters/ethers/client.cjs +1705 -259
  2. package/dist/adapters/ethers/client.cjs.map +1 -1
  3. package/dist/adapters/ethers/client.d.ts +11 -0
  4. package/dist/adapters/ethers/client.js +6 -6
  5. package/dist/adapters/ethers/index.cjs +5254 -2335
  6. package/dist/adapters/ethers/index.cjs.map +1 -1
  7. package/dist/adapters/ethers/index.d.ts +4 -0
  8. package/dist/adapters/ethers/index.js +9 -9
  9. package/dist/adapters/ethers/resources/contracts/types.d.ts +15 -0
  10. package/dist/adapters/ethers/resources/deposits/context.d.ts +3 -3
  11. package/dist/adapters/ethers/resources/deposits/services/gas.d.ts +2 -2
  12. package/dist/adapters/ethers/resources/deposits/services/verification.d.ts +1 -1
  13. package/dist/adapters/ethers/resources/interop/address.d.ts +18 -0
  14. package/dist/adapters/ethers/resources/interop/attributes/resource.d.ts +9 -0
  15. package/dist/adapters/ethers/resources/interop/context.d.ts +36 -0
  16. package/dist/adapters/ethers/resources/interop/index.d.ts +63 -0
  17. package/dist/adapters/ethers/resources/interop/resolvers.d.ts +9 -0
  18. package/dist/adapters/ethers/resources/interop/routes/direct.d.ts +2 -0
  19. package/dist/adapters/ethers/resources/interop/routes/indirect.d.ts +2 -0
  20. package/dist/adapters/ethers/resources/interop/routes/types.d.ts +13 -0
  21. package/dist/adapters/ethers/resources/interop/services/erc20.d.ts +15 -0
  22. package/dist/adapters/ethers/resources/interop/services/finalization/bundle.d.ts +15 -0
  23. package/dist/adapters/ethers/resources/interop/services/finalization/data-fetchers.d.ts +17 -0
  24. package/dist/adapters/ethers/resources/interop/services/finalization/decoders.d.ts +12 -0
  25. package/dist/adapters/ethers/resources/interop/services/finalization/index.d.ts +13 -0
  26. package/dist/adapters/ethers/resources/interop/services/finalization/polling.d.ts +7 -0
  27. package/dist/adapters/ethers/resources/interop/services/finalization/status.d.ts +5 -0
  28. package/dist/adapters/ethers/resources/interop/services/finalization/topics.d.ts +6 -0
  29. package/dist/adapters/ethers/resources/interop/services/starter-data.d.ts +6 -0
  30. package/dist/adapters/ethers/resources/interop/types.d.ts +16 -0
  31. package/dist/adapters/ethers/resources/withdrawals/context.d.ts +2 -2
  32. package/dist/adapters/ethers/sdk.cjs +3384 -931
  33. package/dist/adapters/ethers/sdk.cjs.map +1 -1
  34. package/dist/adapters/ethers/sdk.d.ts +10 -8
  35. package/dist/adapters/ethers/sdk.js +7 -7
  36. package/dist/adapters/viem/client.cjs +760 -64
  37. package/dist/adapters/viem/client.cjs.map +1 -1
  38. package/dist/adapters/viem/client.js +6 -4
  39. package/dist/adapters/viem/index.cjs +404 -276
  40. package/dist/adapters/viem/index.cjs.map +1 -1
  41. package/dist/adapters/viem/index.d.ts +1 -0
  42. package/dist/adapters/viem/index.js +9 -8
  43. package/dist/adapters/viem/resources/deposits/context.d.ts +3 -3
  44. package/dist/adapters/viem/resources/deposits/services/gas.d.ts +2 -2
  45. package/dist/adapters/viem/resources/deposits/services/verification.d.ts +1 -1
  46. package/dist/adapters/viem/resources/withdrawals/context.d.ts +2 -2
  47. package/dist/adapters/viem/sdk.cjs +84 -92
  48. package/dist/adapters/viem/sdk.cjs.map +1 -1
  49. package/dist/adapters/viem/sdk.js +6 -6
  50. package/dist/{chunk-KRIRXY74.js → chunk-5AG6B7UX.js} +38 -63
  51. package/dist/{chunk-NNFWIAVG.js → chunk-AIFHAPJC.js} +9 -3
  52. package/dist/{chunk-NCR42O6O.js → chunk-C3AGOEHR.js} +11 -1
  53. package/dist/{chunk-GIXLOHLK.js → chunk-FBKBF7YM.js} +1534 -12
  54. package/dist/{chunk-VRL6Y4YJ.js → chunk-IYEDEUXG.js} +1 -1
  55. package/dist/chunk-JNWHQJU3.js +209 -0
  56. package/dist/{chunk-7VP6742W.js → chunk-KLNFDFLA.js} +43 -32
  57. package/dist/{chunk-GNERKUWO.js → chunk-QDJOEVGJ.js} +2 -2
  58. package/dist/{chunk-EWLA4NUE.js → chunk-RRKVUW3G.js} +1377 -78
  59. package/dist/{chunk-KAMEGD6I.js → chunk-SRPKTXIF.js} +1 -1
  60. package/dist/{chunk-WY36Z6YB.js → chunk-UIXU35ZU.js} +57 -19
  61. package/dist/{chunk-P5PIWVEO.js → chunk-ZVHFVUDE.js} +14 -26
  62. package/dist/core/abi.d.ts +5 -0
  63. package/dist/core/constants.cjs +10 -0
  64. package/dist/core/constants.cjs.map +1 -1
  65. package/dist/core/constants.d.ts +10 -0
  66. package/dist/core/constants.js +1 -1
  67. package/dist/core/index.cjs +1676 -186
  68. package/dist/core/index.cjs.map +1 -1
  69. package/dist/core/index.d.ts +2 -1
  70. package/dist/core/index.js +5 -5
  71. package/dist/core/internal/abis/IERC7786Attributes.d.ts +42 -0
  72. package/dist/core/internal/abis/IInteropCenter.d.ts +211 -0
  73. package/dist/core/internal/abis/IInteropHandler.d.ts +166 -0
  74. package/dist/core/internal/abis/InteropCenter.d.ts +578 -0
  75. package/dist/core/internal/abis/InteropRootStorage.d.ts +20 -0
  76. package/dist/core/internal/abis/L2MessageVerification.d.ts +277 -0
  77. package/dist/core/resources/interop/attributes/bundle.d.ts +6 -0
  78. package/dist/core/resources/interop/attributes/call.d.ts +6 -0
  79. package/dist/core/resources/interop/attributes/index.d.ts +4 -0
  80. package/dist/core/resources/interop/attributes/resource.d.ts +12 -0
  81. package/dist/core/resources/interop/attributes/types.d.ts +4 -0
  82. package/dist/core/resources/interop/events.d.ts +7 -0
  83. package/dist/core/resources/interop/finalization.d.ts +60 -0
  84. package/dist/core/resources/interop/plan.d.ts +39 -0
  85. package/dist/core/resources/interop/route.d.ts +15 -0
  86. package/dist/core/rpc/types.d.ts +9 -0
  87. package/dist/core/types/errors.d.ts +56 -5
  88. package/dist/core/types/fees.d.ts +9 -0
  89. package/dist/core/types/flows/base.d.ts +1 -1
  90. package/dist/core/types/flows/interop.d.ts +207 -0
  91. package/dist/core/types/flows/withdrawals.d.ts +0 -8
  92. package/dist/core/types/primitives.d.ts +1 -0
  93. package/dist/core/types/transactions.d.ts +10 -0
  94. package/dist/core/utils/addr.d.ts +2 -2
  95. package/dist/core/utils/events.d.ts +12 -0
  96. package/dist/core/utils/hash.d.ts +5 -0
  97. package/dist/core/utils/index.d.ts +5 -0
  98. package/dist/core/utils/number.d.ts +2 -0
  99. package/dist/index.cjs +1686 -186
  100. package/dist/index.cjs.map +1 -1
  101. package/dist/index.d.ts +2 -1
  102. package/dist/index.js +5 -5
  103. package/package.json +6 -2
  104. package/dist/chunk-NGXRO2ZX.js +0 -142
  105. package/dist/core/resources/withdrawals/events.d.ts +0 -9
@@ -0,0 +1,277 @@
1
+ declare const L2MessageVerificationABI: readonly [{
2
+ readonly inputs: readonly [];
3
+ readonly name: "DepthMoreThanOneForRecursiveMerkleProof";
4
+ readonly type: "error";
5
+ }, {
6
+ readonly inputs: readonly [];
7
+ readonly name: "HashedLogIsDefault";
8
+ readonly type: "error";
9
+ }, {
10
+ readonly inputs: readonly [];
11
+ readonly name: "InvalidProofLengthForFinalNode";
12
+ readonly type: "error";
13
+ }, {
14
+ readonly inputs: readonly [];
15
+ readonly name: "MerkleIndexOutOfBounds";
16
+ readonly type: "error";
17
+ }, {
18
+ readonly inputs: readonly [];
19
+ readonly name: "MerklePathEmpty";
20
+ readonly type: "error";
21
+ }, {
22
+ readonly inputs: readonly [];
23
+ readonly name: "MerklePathOutOfBounds";
24
+ readonly type: "error";
25
+ }, {
26
+ readonly inputs: readonly [{
27
+ readonly internalType: "uint256";
28
+ readonly name: "metadataVersion";
29
+ readonly type: "uint256";
30
+ }];
31
+ readonly name: "UnsupportedProofMetadataVersion";
32
+ readonly type: "error";
33
+ }, {
34
+ readonly inputs: readonly [{
35
+ readonly components: readonly [{
36
+ readonly internalType: "uint256";
37
+ readonly name: "chainId";
38
+ readonly type: "uint256";
39
+ }, {
40
+ readonly internalType: "uint256";
41
+ readonly name: "l2BatchNumber";
42
+ readonly type: "uint256";
43
+ }, {
44
+ readonly internalType: "uint256";
45
+ readonly name: "l2MessageIndex";
46
+ readonly type: "uint256";
47
+ }, {
48
+ readonly internalType: "address";
49
+ readonly name: "l2Sender";
50
+ readonly type: "address";
51
+ }, {
52
+ readonly internalType: "uint16";
53
+ readonly name: "l2TxNumberInBatch";
54
+ readonly type: "uint16";
55
+ }, {
56
+ readonly internalType: "bytes";
57
+ readonly name: "message";
58
+ readonly type: "bytes";
59
+ }, {
60
+ readonly internalType: "bytes32[]";
61
+ readonly name: "merkleProof";
62
+ readonly type: "bytes32[]";
63
+ }];
64
+ readonly internalType: "struct FinalizeL1DepositParams";
65
+ readonly name: "_finalizeWithdrawalParams";
66
+ readonly type: "tuple";
67
+ }];
68
+ readonly name: "proveL1DepositParamsInclusion";
69
+ readonly outputs: readonly [{
70
+ readonly internalType: "bool";
71
+ readonly name: "success";
72
+ readonly type: "bool";
73
+ }];
74
+ readonly stateMutability: "view";
75
+ readonly type: "function";
76
+ }, {
77
+ readonly inputs: readonly [{
78
+ readonly internalType: "uint256";
79
+ readonly name: "_chainId";
80
+ readonly type: "uint256";
81
+ }, {
82
+ readonly internalType: "bytes32";
83
+ readonly name: "_l2TxHash";
84
+ readonly type: "bytes32";
85
+ }, {
86
+ readonly internalType: "uint256";
87
+ readonly name: "_l2BatchNumber";
88
+ readonly type: "uint256";
89
+ }, {
90
+ readonly internalType: "uint256";
91
+ readonly name: "_l2MessageIndex";
92
+ readonly type: "uint256";
93
+ }, {
94
+ readonly internalType: "uint16";
95
+ readonly name: "_l2TxNumberInBatch";
96
+ readonly type: "uint16";
97
+ }, {
98
+ readonly internalType: "bytes32[]";
99
+ readonly name: "_merkleProof";
100
+ readonly type: "bytes32[]";
101
+ }, {
102
+ readonly internalType: "enum TxStatus";
103
+ readonly name: "_status";
104
+ readonly type: "uint8";
105
+ }];
106
+ readonly name: "proveL1ToL2TransactionStatusShared";
107
+ readonly outputs: readonly [{
108
+ readonly internalType: "bool";
109
+ readonly name: "";
110
+ readonly type: "bool";
111
+ }];
112
+ readonly stateMutability: "view";
113
+ readonly type: "function";
114
+ }, {
115
+ readonly inputs: readonly [{
116
+ readonly internalType: "uint256";
117
+ readonly name: "_chainId";
118
+ readonly type: "uint256";
119
+ }, {
120
+ readonly internalType: "uint256";
121
+ readonly name: "_blockOrBatchNumber";
122
+ readonly type: "uint256";
123
+ }, {
124
+ readonly internalType: "uint256";
125
+ readonly name: "_leafProofMask";
126
+ readonly type: "uint256";
127
+ }, {
128
+ readonly internalType: "bytes32";
129
+ readonly name: "_leaf";
130
+ readonly type: "bytes32";
131
+ }, {
132
+ readonly internalType: "bytes32[]";
133
+ readonly name: "_proof";
134
+ readonly type: "bytes32[]";
135
+ }];
136
+ readonly name: "proveL2LeafInclusionShared";
137
+ readonly outputs: readonly [{
138
+ readonly internalType: "bool";
139
+ readonly name: "";
140
+ readonly type: "bool";
141
+ }];
142
+ readonly stateMutability: "view";
143
+ readonly type: "function";
144
+ }, {
145
+ readonly inputs: readonly [{
146
+ readonly internalType: "uint256";
147
+ readonly name: "_chainId";
148
+ readonly type: "uint256";
149
+ }, {
150
+ readonly internalType: "uint256";
151
+ readonly name: "_blockOrBatchNumber";
152
+ readonly type: "uint256";
153
+ }, {
154
+ readonly internalType: "uint256";
155
+ readonly name: "_leafProofMask";
156
+ readonly type: "uint256";
157
+ }, {
158
+ readonly internalType: "bytes32";
159
+ readonly name: "_leaf";
160
+ readonly type: "bytes32";
161
+ }, {
162
+ readonly internalType: "bytes32[]";
163
+ readonly name: "_proof";
164
+ readonly type: "bytes32[]";
165
+ }, {
166
+ readonly internalType: "uint256";
167
+ readonly name: "_depth";
168
+ readonly type: "uint256";
169
+ }];
170
+ readonly name: "proveL2LeafInclusionSharedRecursive";
171
+ readonly outputs: readonly [{
172
+ readonly internalType: "bool";
173
+ readonly name: "";
174
+ readonly type: "bool";
175
+ }];
176
+ readonly stateMutability: "view";
177
+ readonly type: "function";
178
+ }, {
179
+ readonly inputs: readonly [{
180
+ readonly internalType: "uint256";
181
+ readonly name: "_chainId";
182
+ readonly type: "uint256";
183
+ }, {
184
+ readonly internalType: "uint256";
185
+ readonly name: "_blockOrBatchNumber";
186
+ readonly type: "uint256";
187
+ }, {
188
+ readonly internalType: "uint256";
189
+ readonly name: "_index";
190
+ readonly type: "uint256";
191
+ }, {
192
+ readonly components: readonly [{
193
+ readonly internalType: "uint8";
194
+ readonly name: "l2ShardId";
195
+ readonly type: "uint8";
196
+ }, {
197
+ readonly internalType: "bool";
198
+ readonly name: "isService";
199
+ readonly type: "bool";
200
+ }, {
201
+ readonly internalType: "uint16";
202
+ readonly name: "txNumberInBatch";
203
+ readonly type: "uint16";
204
+ }, {
205
+ readonly internalType: "address";
206
+ readonly name: "sender";
207
+ readonly type: "address";
208
+ }, {
209
+ readonly internalType: "bytes32";
210
+ readonly name: "key";
211
+ readonly type: "bytes32";
212
+ }, {
213
+ readonly internalType: "bytes32";
214
+ readonly name: "value";
215
+ readonly type: "bytes32";
216
+ }];
217
+ readonly internalType: "struct L2Log";
218
+ readonly name: "_log";
219
+ readonly type: "tuple";
220
+ }, {
221
+ readonly internalType: "bytes32[]";
222
+ readonly name: "_proof";
223
+ readonly type: "bytes32[]";
224
+ }];
225
+ readonly name: "proveL2LogInclusionShared";
226
+ readonly outputs: readonly [{
227
+ readonly internalType: "bool";
228
+ readonly name: "";
229
+ readonly type: "bool";
230
+ }];
231
+ readonly stateMutability: "view";
232
+ readonly type: "function";
233
+ }, {
234
+ readonly inputs: readonly [{
235
+ readonly internalType: "uint256";
236
+ readonly name: "_chainId";
237
+ readonly type: "uint256";
238
+ }, {
239
+ readonly internalType: "uint256";
240
+ readonly name: "_blockOrBatchNumber";
241
+ readonly type: "uint256";
242
+ }, {
243
+ readonly internalType: "uint256";
244
+ readonly name: "_index";
245
+ readonly type: "uint256";
246
+ }, {
247
+ readonly components: readonly [{
248
+ readonly internalType: "uint16";
249
+ readonly name: "txNumberInBatch";
250
+ readonly type: "uint16";
251
+ }, {
252
+ readonly internalType: "address";
253
+ readonly name: "sender";
254
+ readonly type: "address";
255
+ }, {
256
+ readonly internalType: "bytes";
257
+ readonly name: "data";
258
+ readonly type: "bytes";
259
+ }];
260
+ readonly internalType: "struct L2Message";
261
+ readonly name: "_message";
262
+ readonly type: "tuple";
263
+ }, {
264
+ readonly internalType: "bytes32[]";
265
+ readonly name: "_proof";
266
+ readonly type: "bytes32[]";
267
+ }];
268
+ readonly name: "proveL2MessageInclusionShared";
269
+ readonly outputs: readonly [{
270
+ readonly internalType: "bool";
271
+ readonly name: "";
272
+ readonly type: "bool";
273
+ }];
274
+ readonly stateMutability: "view";
275
+ readonly type: "function";
276
+ }];
277
+ export default L2MessageVerificationABI;
@@ -0,0 +1,6 @@
1
+ import type { Address, Hex } from '../../../types/primitives';
2
+ import type { AttributesCodec } from './types';
3
+ export declare function createBundleAttributes(codec: AttributesCodec): {
4
+ executionAddress: (executor: Address) => Hex;
5
+ unbundlerAddress: (addr: Address) => Hex;
6
+ };
@@ -0,0 +1,6 @@
1
+ import type { Hex } from '../../../types/primitives';
2
+ import type { AttributesCodec } from './types';
3
+ export declare function createCallAttributes(codec: AttributesCodec): {
4
+ indirectCall: (messageValue: bigint) => Hex;
5
+ interopCallValue: (bridgedAmount: bigint) => Hex;
6
+ };
@@ -0,0 +1,4 @@
1
+ export * from './types';
2
+ export * from './call';
3
+ export * from './bundle';
4
+ export * from './resource';
@@ -0,0 +1,12 @@
1
+ import type { AttributesCodec } from './types';
2
+ export declare function createAttributesResource(codec: AttributesCodec): {
3
+ call: {
4
+ indirectCall: (messageValue: bigint) => import("../../..").Hex;
5
+ interopCallValue: (bridgedAmount: bigint) => import("../../..").Hex;
6
+ };
7
+ bundle: {
8
+ executionAddress: (executor: import("../../..").Address) => import("../../..").Hex;
9
+ unbundlerAddress: (addr: import("../../..").Address) => import("../../..").Hex;
10
+ };
11
+ };
12
+ export type AttributesResource = ReturnType<typeof createAttributesResource>;
@@ -0,0 +1,4 @@
1
+ import type { Hex } from '../../../types/primitives';
2
+ export interface AttributesCodec {
3
+ encode(fn: string, args: readonly unknown[]): Hex;
4
+ }
@@ -0,0 +1,7 @@
1
+ import type { Hex } from '../../types/primitives';
2
+ export type InteropTopics = {
3
+ interopBundleSent: Hex;
4
+ bundleVerified: Hex;
5
+ bundleExecuted: Hex;
6
+ bundleUnbundled: Hex;
7
+ };
@@ -0,0 +1,60 @@
1
+ import type { Address, Hex } from '../../types/primitives';
2
+ import type { InteropFinalizationInfo, InteropWaitable } from '../../types/flows/interop';
3
+ import type { Log, TxReceipt } from '../../types/transactions';
4
+ import type { ProofNormalized, ReceiptWithL2ToL1 } from '../../rpc/types';
5
+ export interface BundleReceiptInfo {
6
+ bundleHash: Hex;
7
+ dstChainId: bigint;
8
+ sourceChainId: bigint;
9
+ l1MessageData: Hex;
10
+ l2ToL1LogIndex: number;
11
+ txNumberInBatch: number;
12
+ rawReceipt: ReceiptWithL2ToL1;
13
+ }
14
+ export declare const DEFAULT_POLL_MS = 1000;
15
+ export declare const DEFAULT_TIMEOUT_MS = 300000;
16
+ interface ResolvedInteropIds {
17
+ l2SrcTxHash?: Hex;
18
+ bundleHash?: Hex;
19
+ dstExecTxHash?: Hex;
20
+ }
21
+ export declare function resolveIdsFromWaitable(input: InteropWaitable): ResolvedInteropIds;
22
+ export interface ParseBundleSentInput {
23
+ receipt: TxReceipt;
24
+ interopCenter: Address;
25
+ interopBundleSentTopic: Hex;
26
+ decodeInteropBundleSent: (log: {
27
+ data: Hex;
28
+ topics: Hex[];
29
+ }) => {
30
+ bundleHash: Hex;
31
+ sourceChainId: bigint;
32
+ destinationChainId: bigint;
33
+ };
34
+ }
35
+ export declare function parseBundleSentFromReceipt(input: ParseBundleSentInput): {
36
+ bundleHash: Hex;
37
+ dstChainId: bigint;
38
+ };
39
+ export interface ParseBundleReceiptParams {
40
+ rawReceipt: ReceiptWithL2ToL1;
41
+ interopCenter: Address;
42
+ interopBundleSentTopic: Hex;
43
+ decodeInteropBundleSent: (log: {
44
+ data: Hex;
45
+ topics: Hex[];
46
+ }) => {
47
+ bundleHash: Hex;
48
+ sourceChainId: bigint;
49
+ destinationChainId: bigint;
50
+ };
51
+ decodeL1MessageData: (log: Log) => Hex;
52
+ l2SrcTxHash: Hex;
53
+ }
54
+ export declare function parseBundleReceiptInfo(params: ParseBundleReceiptParams): BundleReceiptInfo;
55
+ export declare function getBundleEncodedData(messageData: Hex): Hex;
56
+ export declare function buildFinalizationInfo(ids: {
57
+ l2SrcTxHash: Hex;
58
+ bundleHash?: Hex;
59
+ }, bundleInfo: BundleReceiptInfo, proof: ProofNormalized, messageData: Hex): InteropFinalizationInfo;
60
+ export {};
@@ -0,0 +1,39 @@
1
+ import type { Address, Hex } from '../../types/primitives';
2
+ import type { ApprovalNeed } from '../../types/flows/base';
3
+ import type { InteropParams } from '../../types/flows/interop';
4
+ export type InteropStarter = [Hex, Hex, Hex[]];
5
+ export interface InteropBundleBuild {
6
+ dstChain: Hex;
7
+ starters: InteropStarter[];
8
+ bundleAttributes: Hex[];
9
+ approvals: ApprovalNeed[];
10
+ quoteExtras: {
11
+ totalActionValue: bigint;
12
+ bridgedTokenTotal: bigint;
13
+ };
14
+ }
15
+ export interface InteropAddressCodec {
16
+ formatChain(chainId: bigint): Hex;
17
+ formatAddress(address: Address): Hex;
18
+ }
19
+ export interface InteropBuildCtx {
20
+ dstChainId: bigint;
21
+ baseTokens: {
22
+ src: Address;
23
+ dst: Address;
24
+ };
25
+ l2AssetRouter: Address;
26
+ l2NativeTokenVault: Address;
27
+ codec: InteropAddressCodec;
28
+ }
29
+ export interface InteropAttributes {
30
+ bundleAttributes: Hex[];
31
+ callAttributes: Hex[][];
32
+ }
33
+ export interface InteropStarterData {
34
+ assetRouterPayload?: Hex;
35
+ }
36
+ export declare function preflightDirect(params: InteropParams, ctx: InteropBuildCtx): void;
37
+ export declare function buildDirectBundle(params: InteropParams, ctx: InteropBuildCtx, attrs: InteropAttributes): InteropBundleBuild;
38
+ export declare function preflightIndirect(params: InteropParams, ctx: InteropBuildCtx): void;
39
+ export declare function buildIndirectBundle(params: InteropParams, ctx: InteropBuildCtx, attrs: InteropAttributes, starterData: InteropStarterData[]): InteropBundleBuild;
@@ -0,0 +1,15 @@
1
+ import type { Address } from '../../types/primitives';
2
+ import type { InteropAction, InteropRoute } from '../../types/flows/interop';
3
+ export interface InteropCtx {
4
+ sender: Address;
5
+ srcChainId: bigint;
6
+ dstChainId: bigint;
7
+ baseTokenSrc: Address;
8
+ baseTokenDst: Address;
9
+ }
10
+ export declare function sumActionMsgValue(actions: readonly InteropAction[]): bigint;
11
+ export declare function sumErc20Amounts(actions: readonly InteropAction[]): bigint;
12
+ export declare function pickInteropRoute(args: {
13
+ actions: readonly InteropAction[];
14
+ ctx: InteropCtx;
15
+ }): InteropRoute;
@@ -8,6 +8,7 @@ export type L2ToL1Log = {
8
8
  value: Hex;
9
9
  };
10
10
  export type ReceiptWithL2ToL1 = {
11
+ transactionIndex: Hex;
11
12
  transactionHash?: Hex;
12
13
  status?: string | number;
13
14
  blockNumber?: string | number;
@@ -15,6 +16,7 @@ export type ReceiptWithL2ToL1 = {
15
16
  address: Address;
16
17
  topics: Hex[];
17
18
  data: Hex;
19
+ transactionHash: Hex;
18
20
  }>;
19
21
  l2ToL1Logs?: L2ToL1Log[];
20
22
  };
@@ -22,12 +24,19 @@ export type ProofNormalized = {
22
24
  id: bigint;
23
25
  batchNumber: bigint;
24
26
  proof: Hex[];
27
+ root: Hex;
25
28
  };
26
29
  export type GenesisContractDeployment = {
27
30
  address: Address;
28
31
  bytecode: Hex;
29
32
  };
30
33
  export type GenesisStorageEntry = {
34
+ format: 'raw';
35
+ key: Hex;
36
+ value: Hex;
37
+ } | {
38
+ format: 'pretty';
39
+ address: Address;
31
40
  key: Hex;
32
41
  value: Hex;
33
42
  };
@@ -1,6 +1,6 @@
1
- export type ErrorType = 'VALIDATION' | 'STATE' | 'EXECUTION' | 'RPC' | 'INTERNAL' | 'VERIFICATION' | 'CONTRACT';
1
+ export type ErrorType = 'VALIDATION' | 'STATE' | 'EXECUTION' | 'RPC' | 'INTERNAL' | 'VERIFICATION' | 'CONTRACT' | 'TIMEOUT';
2
2
  /** Resource surface */
3
- export type Resource = 'deposits' | 'withdrawals' | 'withdrawal-finalization' | 'tokens' | 'contracts' | 'helpers' | 'zksrpc' | 'client';
3
+ export type Resource = 'deposits' | 'withdrawals' | 'withdrawal-finalization' | 'interop' | 'tokens' | 'contracts' | 'helpers' | 'zksrpc' | 'client';
4
4
  /** Envelope we throw only for SDK-domain errors. */
5
5
  export interface ErrorEnvelope {
6
6
  /** Resource surface that raised the error. */
@@ -66,7 +66,12 @@ export declare class ZKsyncError extends Error {
66
66
  name: string;
67
67
  };
68
68
  }
69
- export declare function isZKsyncError(e: unknown): e is ZKsyncError;
69
+ export declare function isZKsyncError(e: unknown, opts?: {
70
+ type?: ErrorType;
71
+ resource?: Resource;
72
+ operation?: string;
73
+ messageIncludes?: string;
74
+ }): e is ZKsyncError;
70
75
  export declare function isReceiptNotFound(e: unknown): boolean;
71
76
  export type TryResult<T> = {
72
77
  ok: true;
@@ -75,6 +80,10 @@ export type TryResult<T> = {
75
80
  ok: false;
76
81
  error: ZKsyncError;
77
82
  };
83
+ export declare const OP_CLIENT: {
84
+ readonly ensureAddresses: "client.ensureAddresses";
85
+ readonly getSemverProtocolVersion: "client.getSemverProtocolVersion";
86
+ };
78
87
  export declare const OP_DEPOSITS: {
79
88
  readonly quote: "deposits.quote";
80
89
  readonly tryQuote: "deposits.tryQuote";
@@ -162,10 +171,8 @@ export declare const OP_WITHDRAWALS: {
162
171
  readonly messengerIndex: "withdrawals.finalize.fetchParams:messengerIndex";
163
172
  readonly proof: "withdrawals.finalize.fetchParams:proof";
164
173
  readonly network: "withdrawals.finalize.fetchParams:network";
165
- readonly ensureAddresses: "withdrawals.finalize.fetchParams:ensureAddresses";
166
174
  };
167
175
  readonly readiness: {
168
- readonly ensureAddresses: "withdrawals.finalize.readiness:ensureAddresses";
169
176
  readonly isFinalized: "withdrawals.finalize.readiness:isWithdrawalFinalized";
170
177
  readonly simulate: "withdrawals.finalize.readiness:simulate";
171
178
  };
@@ -175,3 +182,47 @@ export declare const OP_WITHDRAWALS: {
175
182
  readonly estimate: "withdrawals.finalize.estimateFinalizationFees";
176
183
  };
177
184
  };
185
+ export declare const OP_INTEROP: {
186
+ readonly quote: "interop.quote";
187
+ readonly tryQuote: "interop.tryQuote";
188
+ readonly prepare: "interop.prepare";
189
+ readonly tryPrepare: "interop.tryPrepare";
190
+ readonly create: "interop.create";
191
+ readonly tryCreate: "interop.tryCreate";
192
+ readonly status: "interop.status";
193
+ readonly wait: "interop.wait";
194
+ readonly tryWait: "interop.tryWait";
195
+ readonly finalize: "interop.finalize";
196
+ readonly tryFinalize: "interop.tryFinalize";
197
+ readonly context: {
198
+ readonly chainTypeManager: "interop.chainTypeManager";
199
+ readonly protocolVersion: "interop.protocolVersion";
200
+ };
201
+ readonly routes: {
202
+ readonly direct: {
203
+ readonly preflight: "interop.routes.direct:preflight";
204
+ readonly build: "interop.routes.direct:build";
205
+ };
206
+ readonly indirect: {
207
+ readonly preflight: "interop.routes.indirect:preflight";
208
+ readonly build: "interop.routes.indirect:build";
209
+ };
210
+ };
211
+ readonly exec: {
212
+ readonly sendStep: "interop.exec:sendStep";
213
+ readonly waitStep: "interop.exec:waitStep";
214
+ };
215
+ readonly svc: {
216
+ readonly status: {
217
+ readonly sourceReceipt: "interop.svc.status:sourceReceipt";
218
+ readonly parseSentLog: "interop.svc.status:parseSentLog";
219
+ readonly dstLogs: "interop.svc.status:dstLogs";
220
+ readonly derive: "interop.svc.status:derive";
221
+ readonly getRoot: "interop.svc.status:getRoot";
222
+ };
223
+ readonly wait: {
224
+ readonly poll: "interop.svc.wait:poll";
225
+ readonly timeout: "interop.svc.wait:timeout";
226
+ };
227
+ };
228
+ };
@@ -37,4 +37,13 @@ export type TxOverrides = {
37
37
  gasLimit: bigint;
38
38
  maxFeePerGas: bigint;
39
39
  maxPriorityFeePerGas?: bigint;
40
+ /** Optional nonce override.
41
+ * - number: use as the starting nonce directly (skip getTransactionCount). If there are multiple transactions,
42
+ * the specified number will be used as a starting nonce and incremented for each transaction.
43
+ * - 'latest' | 'pending': call getTransactionCount with the given block tag.
44
+ */
45
+ nonce?: number | 'latest' | 'pending';
40
46
  };
47
+ /** TxOverrides without the nonce field. */
48
+ export type TxGasOverrides = Omit<TxOverrides, 'nonce'>;
49
+ export declare function toGasOverrides(overrides: TxOverrides): TxGasOverrides;
@@ -23,7 +23,7 @@ export interface Plan<Tx, Route, Quote> {
23
23
  }
24
24
  /** Generic handle (returned by create()) */
25
25
  export interface Handle<TxHashMap extends Record<string, Hex>, Route, PlanT> {
26
- kind: 'deposit' | 'withdrawal';
26
+ kind: 'deposit' | 'withdrawal' | 'interop';
27
27
  route?: Route;
28
28
  stepHashes: TxHashMap;
29
29
  plan: PlanT;