@snowbridge/base-types 1.0.5-alpha.1 → 1.0.6

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.
@@ -0,0 +1,634 @@
1
+ export type QuoteExactOutputSingleParamsStruct = {
2
+ tokenIn: string;
3
+ tokenOut: string;
4
+ amount: bigint;
5
+ fee: number;
6
+ sqrtPriceLimitX96: bigint | number;
7
+ };
8
+
9
+ export type DepositParamsStruct = {
10
+ inputToken: string;
11
+ outputToken: string;
12
+ inputAmount: bigint;
13
+ outputAmount: bigint;
14
+ destinationChainId: bigint;
15
+ fillDeadlineBuffer: bigint;
16
+ };
17
+
18
+ export type SendParamsStruct = {
19
+ xcm: Uint8Array;
20
+ assets: any[];
21
+ claimer: Uint8Array;
22
+ executionFee: bigint;
23
+ relayerFee: bigint;
24
+ };
25
+
26
+ export type SwapParamsStruct = {
27
+ inputAmount: bigint;
28
+ router: string;
29
+ callData: string;
30
+ };
31
+
32
+ export type IGatewayV1 = {
33
+ quoteSendTokenFee(
34
+ token: string,
35
+ destinationChain: number,
36
+ destinationFee: bigint,
37
+ ): Promise<bigint>;
38
+ operatingMode(): Promise<bigint>;
39
+ channelNoncesOf(channelId: string): Promise<[bigint, bigint]>;
40
+ channelOperatingModeOf(channelId: string): Promise<bigint>;
41
+ agentOf(agentID: string): Promise<string>;
42
+ };
43
+
44
+ export type IGatewayV2 = {
45
+ operatingMode(): Promise<bigint>;
46
+ v2_outboundNonce(): Promise<bigint>;
47
+ isTokenRegistered(token: string): Promise<boolean>;
48
+ agentOf(agentID: string): Promise<string>;
49
+ };
50
+
51
+ export type BeefyClient = {
52
+ latestBeefyBlock(): Promise<bigint>;
53
+ };
54
+
55
+ export type ISwapQuoter = {
56
+ quoteExactOutputSingle: {
57
+ staticCall(
58
+ params: QuoteExactOutputSingleParamsStruct,
59
+ ): Promise<readonly [bigint, ...any[]]>;
60
+ };
61
+ };
62
+
63
+ export type IERC20 = {
64
+ balanceOf(account: string): Promise<bigint>;
65
+ allowance(owner: string, spender: string): Promise<bigint>;
66
+ };
67
+
68
+ export const IGATEWAY_V1_ABI = [
69
+ {
70
+ type: "function",
71
+ name: "agentOf",
72
+ inputs: [{ name: "agentID", type: "bytes32", internalType: "bytes32" }],
73
+ outputs: [{ name: "", type: "address", internalType: "address" }],
74
+ stateMutability: "view",
75
+ },
76
+ {
77
+ type: "function",
78
+ name: "channelNoncesOf",
79
+ inputs: [{ name: "channelID", type: "bytes32", internalType: "ChannelID" }],
80
+ outputs: [
81
+ { name: "", type: "uint64", internalType: "uint64" },
82
+ { name: "", type: "uint64", internalType: "uint64" },
83
+ ],
84
+ stateMutability: "view",
85
+ },
86
+ {
87
+ type: "function",
88
+ name: "channelOperatingModeOf",
89
+ inputs: [{ name: "channelID", type: "bytes32", internalType: "ChannelID" }],
90
+ outputs: [{ name: "", type: "uint8", internalType: "enum OperatingMode" }],
91
+ stateMutability: "view",
92
+ },
93
+ {
94
+ type: "function",
95
+ name: "operatingMode",
96
+ inputs: [],
97
+ outputs: [{ name: "", type: "uint8", internalType: "enum OperatingMode" }],
98
+ stateMutability: "view",
99
+ },
100
+ {
101
+ type: "function",
102
+ name: "quoteSendTokenFee",
103
+ inputs: [
104
+ { name: "token", type: "address", internalType: "address" },
105
+ {
106
+ name: "destinationChain",
107
+ type: "uint32",
108
+ internalType: "ParaID",
109
+ },
110
+ { name: "destinationFee", type: "uint128", internalType: "uint128" },
111
+ ],
112
+ outputs: [{ name: "", type: "uint256", internalType: "uint256" }],
113
+ stateMutability: "view",
114
+ },
115
+ {
116
+ type: "function",
117
+ name: "sendToken",
118
+ inputs: [
119
+ { name: "token", type: "address", internalType: "address" },
120
+ {
121
+ name: "destinationChain",
122
+ type: "uint32",
123
+ internalType: "ParaID",
124
+ },
125
+ {
126
+ name: "destinationAddress",
127
+ type: "tuple",
128
+ internalType: "struct MultiAddress",
129
+ components: [
130
+ { name: "kind", type: "uint8", internalType: "enum Kind" },
131
+ { name: "data", type: "bytes", internalType: "bytes" },
132
+ ],
133
+ },
134
+ { name: "destinationFee", type: "uint128", internalType: "uint128" },
135
+ { name: "amount", type: "uint128", internalType: "uint128" },
136
+ ],
137
+ outputs: [],
138
+ stateMutability: "payable",
139
+ },
140
+ {
141
+ type: "event",
142
+ name: "OutboundMessageAccepted",
143
+ inputs: [
144
+ {
145
+ name: "channelID",
146
+ type: "bytes32",
147
+ indexed: true,
148
+ internalType: "ChannelID",
149
+ },
150
+ {
151
+ name: "nonce",
152
+ type: "uint64",
153
+ indexed: false,
154
+ internalType: "uint64",
155
+ },
156
+ {
157
+ name: "messageID",
158
+ type: "bytes32",
159
+ indexed: true,
160
+ internalType: "bytes32",
161
+ },
162
+ {
163
+ name: "payload",
164
+ type: "bytes",
165
+ indexed: false,
166
+ internalType: "bytes",
167
+ },
168
+ ],
169
+ anonymous: false,
170
+ },
171
+ ] as const;
172
+
173
+ export const IGATEWAY_V2_ABI = [
174
+ {
175
+ type: "function",
176
+ name: "agentOf",
177
+ inputs: [{ name: "agentID", type: "bytes32", internalType: "bytes32" }],
178
+ outputs: [{ name: "", type: "address", internalType: "address" }],
179
+ stateMutability: "view",
180
+ },
181
+ {
182
+ type: "function",
183
+ name: "isTokenRegistered",
184
+ inputs: [{ name: "token", type: "address", internalType: "address" }],
185
+ outputs: [{ name: "", type: "bool", internalType: "bool" }],
186
+ stateMutability: "view",
187
+ },
188
+ {
189
+ type: "function",
190
+ name: "operatingMode",
191
+ inputs: [],
192
+ outputs: [{ name: "", type: "uint8", internalType: "enum OperatingMode" }],
193
+ stateMutability: "view",
194
+ },
195
+ {
196
+ type: "function",
197
+ name: "v2_createAgent",
198
+ inputs: [{ name: "id", type: "bytes32", internalType: "bytes32" }],
199
+ outputs: [],
200
+ stateMutability: "nonpayable",
201
+ },
202
+ {
203
+ type: "function",
204
+ name: "v2_outboundNonce",
205
+ inputs: [],
206
+ outputs: [{ name: "", type: "uint64", internalType: "uint64" }],
207
+ stateMutability: "view",
208
+ },
209
+ {
210
+ type: "function",
211
+ name: "v2_registerToken",
212
+ inputs: [
213
+ { name: "token", type: "address", internalType: "address" },
214
+ { name: "network", type: "uint8", internalType: "uint8" },
215
+ { name: "executionFee", type: "uint128", internalType: "uint128" },
216
+ { name: "relayerFee", type: "uint128", internalType: "uint128" },
217
+ ],
218
+ outputs: [],
219
+ stateMutability: "payable",
220
+ },
221
+ {
222
+ type: "function",
223
+ name: "v2_sendMessage",
224
+ inputs: [
225
+ { name: "xcm", type: "bytes", internalType: "bytes" },
226
+ { name: "assets", type: "bytes[]", internalType: "bytes[]" },
227
+ { name: "claimer", type: "bytes", internalType: "bytes" },
228
+ { name: "executionFee", type: "uint128", internalType: "uint128" },
229
+ { name: "relayerFee", type: "uint128", internalType: "uint128" },
230
+ ],
231
+ outputs: [],
232
+ stateMutability: "payable",
233
+ },
234
+ {
235
+ type: "event",
236
+ name: "OutboundMessageAccepted",
237
+ inputs: [
238
+ {
239
+ name: "nonce",
240
+ type: "uint64",
241
+ indexed: false,
242
+ internalType: "uint64",
243
+ },
244
+ {
245
+ name: "payload",
246
+ type: "tuple",
247
+ indexed: false,
248
+ internalType: "struct Payload",
249
+ components: [
250
+ { name: "origin", type: "address", internalType: "address" },
251
+ {
252
+ name: "assets",
253
+ type: "tuple[]",
254
+ internalType: "struct Asset[]",
255
+ components: [
256
+ { name: "kind", type: "uint8", internalType: "uint8" },
257
+ { name: "data", type: "bytes", internalType: "bytes" },
258
+ ],
259
+ },
260
+ {
261
+ name: "xcm",
262
+ type: "tuple",
263
+ internalType: "struct Xcm",
264
+ components: [
265
+ { name: "kind", type: "uint8", internalType: "uint8" },
266
+ { name: "data", type: "bytes", internalType: "bytes" },
267
+ ],
268
+ },
269
+ { name: "claimer", type: "bytes", internalType: "bytes" },
270
+ { name: "value", type: "uint128", internalType: "uint128" },
271
+ {
272
+ name: "executionFee",
273
+ type: "uint128",
274
+ internalType: "uint128",
275
+ },
276
+ { name: "relayerFee", type: "uint128", internalType: "uint128" },
277
+ ],
278
+ },
279
+ ],
280
+ anonymous: false,
281
+ },
282
+ ] as const;
283
+
284
+ export const IERC20_ABI = [
285
+ {
286
+ type: "function",
287
+ name: "allowance",
288
+ inputs: [
289
+ { name: "owner", type: "address", internalType: "address" },
290
+ { name: "spender", type: "address", internalType: "address" },
291
+ ],
292
+ outputs: [{ name: "", type: "uint256", internalType: "uint256" }],
293
+ stateMutability: "view",
294
+ },
295
+ {
296
+ type: "function",
297
+ name: "approve",
298
+ inputs: [
299
+ { name: "spender", type: "address", internalType: "address" },
300
+ { name: "amount", type: "uint256", internalType: "uint256" },
301
+ ],
302
+ outputs: [{ name: "", type: "bool", internalType: "bool" }],
303
+ stateMutability: "nonpayable",
304
+ },
305
+ {
306
+ type: "function",
307
+ name: "balanceOf",
308
+ inputs: [{ name: "account", type: "address", internalType: "address" }],
309
+ outputs: [{ name: "", type: "uint256", internalType: "uint256" }],
310
+ stateMutability: "view",
311
+ },
312
+ ] as const;
313
+
314
+ export const BEEFY_CLIENT_ABI = [
315
+ {
316
+ type: "function",
317
+ name: "latestBeefyBlock",
318
+ inputs: [],
319
+ outputs: [{ name: "", type: "uint64", internalType: "uint64" }],
320
+ stateMutability: "view",
321
+ },
322
+ ] as const;
323
+
324
+ export const SWAP_QUOTER_ABI = [
325
+ {
326
+ type: "function",
327
+ name: "quoteExactOutputSingle",
328
+ inputs: [
329
+ {
330
+ name: "params",
331
+ type: "tuple",
332
+ internalType: "struct ISwapQuoter.QuoteExactOutputSingleParams",
333
+ components: [
334
+ { name: "tokenIn", type: "address", internalType: "address" },
335
+ { name: "tokenOut", type: "address", internalType: "address" },
336
+ { name: "amount", type: "uint256", internalType: "uint256" },
337
+ { name: "fee", type: "uint24", internalType: "uint24" },
338
+ {
339
+ name: "sqrtPriceLimitX96",
340
+ type: "uint160",
341
+ internalType: "uint160",
342
+ },
343
+ ],
344
+ },
345
+ ],
346
+ outputs: [
347
+ { name: "amountIn", type: "uint256", internalType: "uint256" },
348
+ {
349
+ name: "sqrtPriceX96After",
350
+ type: "uint160",
351
+ internalType: "uint160",
352
+ },
353
+ {
354
+ name: "initializedTicksCrossed",
355
+ type: "uint32",
356
+ internalType: "uint32",
357
+ },
358
+ { name: "gasEstimate", type: "uint256", internalType: "uint256" },
359
+ ],
360
+ stateMutability: "nonpayable",
361
+ },
362
+ ] as const;
363
+
364
+ export const SWAP_ROUTER_ABI = [
365
+ {
366
+ type: "function",
367
+ name: "exactOutputSingle",
368
+ inputs: [
369
+ {
370
+ name: "params",
371
+ type: "tuple",
372
+ internalType: "struct ISwapRouter.ExactOutputSingleParams",
373
+ components: [
374
+ { name: "tokenIn", type: "address", internalType: "address" },
375
+ { name: "tokenOut", type: "address", internalType: "address" },
376
+ { name: "fee", type: "uint24", internalType: "uint24" },
377
+ { name: "recipient", type: "address", internalType: "address" },
378
+ { name: "deadline", type: "uint256", internalType: "uint256" },
379
+ { name: "amountOut", type: "uint256", internalType: "uint256" },
380
+ {
381
+ name: "amountInMaximum",
382
+ type: "uint256",
383
+ internalType: "uint256",
384
+ },
385
+ {
386
+ name: "sqrtPriceLimitX96",
387
+ type: "uint160",
388
+ internalType: "uint160",
389
+ },
390
+ ],
391
+ },
392
+ ],
393
+ outputs: [{ name: "amountIn", type: "uint256", internalType: "uint256" }],
394
+ stateMutability: "nonpayable",
395
+ },
396
+ ] as const;
397
+
398
+ export const SWAP_LEGACY_ROUTER_ABI = [
399
+ {
400
+ type: "function",
401
+ name: "exactOutputSingle",
402
+ inputs: [
403
+ {
404
+ name: "params",
405
+ type: "tuple",
406
+ internalType: "struct ISwapLegacyRouter.ExactOutputSingleParams",
407
+ components: [
408
+ { name: "tokenIn", type: "address", internalType: "address" },
409
+ { name: "tokenOut", type: "address", internalType: "address" },
410
+ { name: "fee", type: "uint24", internalType: "uint24" },
411
+ { name: "recipient", type: "address", internalType: "address" },
412
+ { name: "amountOut", type: "uint256", internalType: "uint256" },
413
+ {
414
+ name: "amountInMaximum",
415
+ type: "uint256",
416
+ internalType: "uint256",
417
+ },
418
+ {
419
+ name: "sqrtPriceLimitX96",
420
+ type: "uint160",
421
+ internalType: "uint160",
422
+ },
423
+ ],
424
+ },
425
+ ],
426
+ outputs: [{ name: "amountIn", type: "uint256", internalType: "uint256" }],
427
+ stateMutability: "nonpayable",
428
+ },
429
+ ] as const;
430
+
431
+ export const SNOWBRIDGE_L1_ADAPTOR_ABI = [
432
+ {
433
+ type: "function",
434
+ name: "depositNativeEther",
435
+ inputs: [
436
+ {
437
+ name: "params",
438
+ type: "tuple",
439
+ internalType: "struct DepositParams",
440
+ components: [
441
+ { name: "inputToken", type: "address", internalType: "address" },
442
+ { name: "outputToken", type: "address", internalType: "address" },
443
+ { name: "inputAmount", type: "uint256", internalType: "uint256" },
444
+ { name: "outputAmount", type: "uint256", internalType: "uint256" },
445
+ {
446
+ name: "destinationChainId",
447
+ type: "uint256",
448
+ internalType: "uint256",
449
+ },
450
+ {
451
+ name: "fillDeadlineBuffer",
452
+ type: "uint32",
453
+ internalType: "uint32",
454
+ },
455
+ ],
456
+ },
457
+ { name: "recipient", type: "address", internalType: "address" },
458
+ { name: "topic", type: "bytes32", internalType: "bytes32" },
459
+ ],
460
+ outputs: [],
461
+ stateMutability: "nonpayable",
462
+ },
463
+ {
464
+ type: "function",
465
+ name: "depositToken",
466
+ inputs: [
467
+ {
468
+ name: "params",
469
+ type: "tuple",
470
+ internalType: "struct DepositParams",
471
+ components: [
472
+ { name: "inputToken", type: "address", internalType: "address" },
473
+ { name: "outputToken", type: "address", internalType: "address" },
474
+ { name: "inputAmount", type: "uint256", internalType: "uint256" },
475
+ { name: "outputAmount", type: "uint256", internalType: "uint256" },
476
+ {
477
+ name: "destinationChainId",
478
+ type: "uint256",
479
+ internalType: "uint256",
480
+ },
481
+ {
482
+ name: "fillDeadlineBuffer",
483
+ type: "uint32",
484
+ internalType: "uint32",
485
+ },
486
+ ],
487
+ },
488
+ { name: "recipient", type: "address", internalType: "address" },
489
+ { name: "topic", type: "bytes32", internalType: "bytes32" },
490
+ ],
491
+ outputs: [],
492
+ stateMutability: "nonpayable",
493
+ },
494
+ ] as const;
495
+
496
+ export const SNOWBRIDGE_L2_ADAPTOR_ABI = [
497
+ {
498
+ type: "function",
499
+ name: "sendEtherAndCall",
500
+ inputs: [
501
+ {
502
+ name: "params",
503
+ type: "tuple",
504
+ internalType: "struct DepositParams",
505
+ components: [
506
+ { name: "inputToken", type: "address", internalType: "address" },
507
+ { name: "outputToken", type: "address", internalType: "address" },
508
+ { name: "inputAmount", type: "uint256", internalType: "uint256" },
509
+ { name: "outputAmount", type: "uint256", internalType: "uint256" },
510
+ {
511
+ name: "destinationChainId",
512
+ type: "uint256",
513
+ internalType: "uint256",
514
+ },
515
+ {
516
+ name: "fillDeadlineBuffer",
517
+ type: "uint32",
518
+ internalType: "uint32",
519
+ },
520
+ ],
521
+ },
522
+ {
523
+ name: "sendParams",
524
+ type: "tuple",
525
+ internalType: "struct SendParams",
526
+ components: [
527
+ { name: "xcm", type: "bytes", internalType: "bytes" },
528
+ { name: "assets", type: "bytes[]", internalType: "bytes[]" },
529
+ { name: "claimer", type: "bytes", internalType: "bytes" },
530
+ { name: "executionFee", type: "uint128", internalType: "uint128" },
531
+ { name: "relayerFee", type: "uint128", internalType: "uint128" },
532
+ ],
533
+ },
534
+ { name: "recipient", type: "address", internalType: "address" },
535
+ { name: "topic", type: "bytes32", internalType: "bytes32" },
536
+ ],
537
+ outputs: [],
538
+ stateMutability: "payable",
539
+ },
540
+ {
541
+ type: "function",
542
+ name: "sendTokenAndCall",
543
+ inputs: [
544
+ {
545
+ name: "params",
546
+ type: "tuple",
547
+ internalType: "struct DepositParams",
548
+ components: [
549
+ { name: "inputToken", type: "address", internalType: "address" },
550
+ { name: "outputToken", type: "address", internalType: "address" },
551
+ { name: "inputAmount", type: "uint256", internalType: "uint256" },
552
+ { name: "outputAmount", type: "uint256", internalType: "uint256" },
553
+ {
554
+ name: "destinationChainId",
555
+ type: "uint256",
556
+ internalType: "uint256",
557
+ },
558
+ {
559
+ name: "fillDeadlineBuffer",
560
+ type: "uint32",
561
+ internalType: "uint32",
562
+ },
563
+ ],
564
+ },
565
+ {
566
+ name: "swapParams",
567
+ type: "tuple",
568
+ internalType: "struct SwapParams",
569
+ components: [
570
+ { name: "inputAmount", type: "uint256", internalType: "uint256" },
571
+ { name: "router", type: "address", internalType: "address" },
572
+ { name: "callData", type: "bytes", internalType: "bytes" },
573
+ ],
574
+ },
575
+ {
576
+ name: "sendParams",
577
+ type: "tuple",
578
+ internalType: "struct SendParams",
579
+ components: [
580
+ { name: "xcm", type: "bytes", internalType: "bytes" },
581
+ { name: "assets", type: "bytes[]", internalType: "bytes[]" },
582
+ { name: "claimer", type: "bytes", internalType: "bytes" },
583
+ { name: "executionFee", type: "uint128", internalType: "uint128" },
584
+ { name: "relayerFee", type: "uint128", internalType: "uint128" },
585
+ ],
586
+ },
587
+ { name: "recipient", type: "address", internalType: "address" },
588
+ { name: "topic", type: "bytes32", internalType: "bytes32" },
589
+ ],
590
+ outputs: [],
591
+ stateMutability: "nonpayable",
592
+ },
593
+ ] as const;
594
+
595
+ export const MOONBEAM_PALLET_XCM_PRECOMPILE_ABI = [
596
+ {
597
+ inputs: [
598
+ {
599
+ components: [
600
+ { internalType: "uint8", name: "parents", type: "uint8" },
601
+ { internalType: "bytes[]", name: "interior", type: "bytes[]" },
602
+ ],
603
+ internalType: "struct XCM.Location",
604
+ name: "dest",
605
+ type: "tuple",
606
+ },
607
+ {
608
+ components: [
609
+ { internalType: "address", name: "asset", type: "address" },
610
+ { internalType: "uint256", name: "amount", type: "uint256" },
611
+ ],
612
+ internalType: "struct XCM.AssetAddressInfo[]",
613
+ name: "assets",
614
+ type: "tuple[]",
615
+ },
616
+ {
617
+ internalType: "enum XCM.TransferType",
618
+ name: "assetsTransferType",
619
+ type: "uint8",
620
+ },
621
+ { internalType: "uint8", name: "remoteFeesIdIndex", type: "uint8" },
622
+ {
623
+ internalType: "enum XCM.TransferType",
624
+ name: "feesTransferType",
625
+ type: "uint8",
626
+ },
627
+ { internalType: "bytes", name: "customXcmOnDest", type: "bytes" },
628
+ ],
629
+ name: "transferAssetsUsingTypeAndThenAddress",
630
+ outputs: [],
631
+ stateMutability: "nonpayable",
632
+ type: "function",
633
+ },
634
+ ] as const;