@hyperbridge/sdk 1.2.2 → 1.3.1

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.
@@ -1,10 +1,591 @@
1
1
  import { ConsolaInstance } from 'consola';
2
2
  import { GraphQLClient } from 'graphql-request';
3
- import { Hex, Log, PublicClient } from 'viem';
3
+ import { Hex, ContractFunctionArgs, Log, PublicClient } from 'viem';
4
4
  import { ApiPromise } from '@polkadot/api';
5
5
  import { SignerOptions } from '@polkadot/api/types';
6
6
  import { Chain } from 'viem/chains';
7
7
 
8
+ declare const _default: {
9
+ ABI: readonly [{
10
+ readonly inputs: readonly [];
11
+ readonly name: "ChallengePeriodNotElapsed";
12
+ readonly type: "error";
13
+ }, {
14
+ readonly inputs: readonly [];
15
+ readonly name: "ConsensusClientExpired";
16
+ readonly type: "error";
17
+ }, {
18
+ readonly inputs: readonly [];
19
+ readonly name: "DuplicateMessage";
20
+ readonly type: "error";
21
+ }, {
22
+ readonly inputs: readonly [];
23
+ readonly name: "HostFrozen";
24
+ readonly type: "error";
25
+ }, {
26
+ readonly inputs: readonly [];
27
+ readonly name: "InvalidMessageDestination";
28
+ readonly type: "error";
29
+ }, {
30
+ readonly inputs: readonly [];
31
+ readonly name: "InvalidProof";
32
+ readonly type: "error";
33
+ }, {
34
+ readonly inputs: readonly [];
35
+ readonly name: "MessageNotTimedOut";
36
+ readonly type: "error";
37
+ }, {
38
+ readonly inputs: readonly [];
39
+ readonly name: "MessageTimedOut";
40
+ readonly type: "error";
41
+ }, {
42
+ readonly inputs: readonly [];
43
+ readonly name: "StateCommitmentNotFound";
44
+ readonly type: "error";
45
+ }, {
46
+ readonly inputs: readonly [];
47
+ readonly name: "UnknownMessage";
48
+ readonly type: "error";
49
+ }, {
50
+ readonly inputs: readonly [{
51
+ readonly internalType: "contract IIsmpHost";
52
+ readonly name: "host";
53
+ readonly type: "address";
54
+ }, {
55
+ readonly internalType: "bytes";
56
+ readonly name: "proof";
57
+ readonly type: "bytes";
58
+ }];
59
+ readonly name: "handleConsensus";
60
+ readonly outputs: readonly [];
61
+ readonly stateMutability: "nonpayable";
62
+ readonly type: "function";
63
+ }, {
64
+ readonly inputs: readonly [{
65
+ readonly internalType: "contract IIsmpHost";
66
+ readonly name: "host";
67
+ readonly type: "address";
68
+ }, {
69
+ readonly components: readonly [{
70
+ readonly components: readonly [{
71
+ readonly internalType: "bytes";
72
+ readonly name: "source";
73
+ readonly type: "bytes";
74
+ }, {
75
+ readonly internalType: "bytes";
76
+ readonly name: "dest";
77
+ readonly type: "bytes";
78
+ }, {
79
+ readonly internalType: "uint64";
80
+ readonly name: "nonce";
81
+ readonly type: "uint64";
82
+ }, {
83
+ readonly internalType: "address";
84
+ readonly name: "from";
85
+ readonly type: "address";
86
+ }, {
87
+ readonly internalType: "uint64";
88
+ readonly name: "timeoutTimestamp";
89
+ readonly type: "uint64";
90
+ }, {
91
+ readonly internalType: "bytes[]";
92
+ readonly name: "keys";
93
+ readonly type: "bytes[]";
94
+ }, {
95
+ readonly internalType: "uint64";
96
+ readonly name: "height";
97
+ readonly type: "uint64";
98
+ }, {
99
+ readonly internalType: "bytes";
100
+ readonly name: "context";
101
+ readonly type: "bytes";
102
+ }];
103
+ readonly internalType: "struct GetRequest[]";
104
+ readonly name: "timeouts";
105
+ readonly type: "tuple[]";
106
+ }, {
107
+ readonly components: readonly [{
108
+ readonly internalType: "uint256";
109
+ readonly name: "stateMachineId";
110
+ readonly type: "uint256";
111
+ }, {
112
+ readonly internalType: "uint256";
113
+ readonly name: "height";
114
+ readonly type: "uint256";
115
+ }];
116
+ readonly internalType: "struct StateMachineHeight";
117
+ readonly name: "height";
118
+ readonly type: "tuple";
119
+ }, {
120
+ readonly internalType: "bytes[]";
121
+ readonly name: "proof";
122
+ readonly type: "bytes[]";
123
+ }];
124
+ readonly internalType: "struct GetTimeoutMessage";
125
+ readonly name: "message";
126
+ readonly type: "tuple";
127
+ }];
128
+ readonly name: "handleGetRequestTimeouts";
129
+ readonly outputs: readonly [];
130
+ readonly stateMutability: "nonpayable";
131
+ readonly type: "function";
132
+ }, {
133
+ readonly inputs: readonly [{
134
+ readonly internalType: "contract IIsmpHost";
135
+ readonly name: "host";
136
+ readonly type: "address";
137
+ }, {
138
+ readonly components: readonly [{
139
+ readonly components: readonly [{
140
+ readonly components: readonly [{
141
+ readonly internalType: "uint256";
142
+ readonly name: "stateMachineId";
143
+ readonly type: "uint256";
144
+ }, {
145
+ readonly internalType: "uint256";
146
+ readonly name: "height";
147
+ readonly type: "uint256";
148
+ }];
149
+ readonly internalType: "struct StateMachineHeight";
150
+ readonly name: "height";
151
+ readonly type: "tuple";
152
+ }, {
153
+ readonly internalType: "bytes32[]";
154
+ readonly name: "multiproof";
155
+ readonly type: "bytes32[]";
156
+ }, {
157
+ readonly internalType: "uint256";
158
+ readonly name: "leafCount";
159
+ readonly type: "uint256";
160
+ }];
161
+ readonly internalType: "struct Proof";
162
+ readonly name: "proof";
163
+ readonly type: "tuple";
164
+ }, {
165
+ readonly components: readonly [{
166
+ readonly components: readonly [{
167
+ readonly components: readonly [{
168
+ readonly internalType: "bytes";
169
+ readonly name: "source";
170
+ readonly type: "bytes";
171
+ }, {
172
+ readonly internalType: "bytes";
173
+ readonly name: "dest";
174
+ readonly type: "bytes";
175
+ }, {
176
+ readonly internalType: "uint64";
177
+ readonly name: "nonce";
178
+ readonly type: "uint64";
179
+ }, {
180
+ readonly internalType: "address";
181
+ readonly name: "from";
182
+ readonly type: "address";
183
+ }, {
184
+ readonly internalType: "uint64";
185
+ readonly name: "timeoutTimestamp";
186
+ readonly type: "uint64";
187
+ }, {
188
+ readonly internalType: "bytes[]";
189
+ readonly name: "keys";
190
+ readonly type: "bytes[]";
191
+ }, {
192
+ readonly internalType: "uint64";
193
+ readonly name: "height";
194
+ readonly type: "uint64";
195
+ }, {
196
+ readonly internalType: "bytes";
197
+ readonly name: "context";
198
+ readonly type: "bytes";
199
+ }];
200
+ readonly internalType: "struct GetRequest";
201
+ readonly name: "request";
202
+ readonly type: "tuple";
203
+ }, {
204
+ readonly components: readonly [{
205
+ readonly internalType: "bytes";
206
+ readonly name: "key";
207
+ readonly type: "bytes";
208
+ }, {
209
+ readonly internalType: "bytes";
210
+ readonly name: "value";
211
+ readonly type: "bytes";
212
+ }];
213
+ readonly internalType: "struct StorageValue[]";
214
+ readonly name: "values";
215
+ readonly type: "tuple[]";
216
+ }];
217
+ readonly internalType: "struct GetResponse";
218
+ readonly name: "response";
219
+ readonly type: "tuple";
220
+ }, {
221
+ readonly internalType: "uint256";
222
+ readonly name: "index";
223
+ readonly type: "uint256";
224
+ }, {
225
+ readonly internalType: "uint256";
226
+ readonly name: "kIndex";
227
+ readonly type: "uint256";
228
+ }];
229
+ readonly internalType: "struct GetResponseLeaf[]";
230
+ readonly name: "responses";
231
+ readonly type: "tuple[]";
232
+ }];
233
+ readonly internalType: "struct GetResponseMessage";
234
+ readonly name: "message";
235
+ readonly type: "tuple";
236
+ }];
237
+ readonly name: "handleGetResponses";
238
+ readonly outputs: readonly [];
239
+ readonly stateMutability: "nonpayable";
240
+ readonly type: "function";
241
+ }, {
242
+ readonly inputs: readonly [{
243
+ readonly internalType: "contract IIsmpHost";
244
+ readonly name: "host";
245
+ readonly type: "address";
246
+ }, {
247
+ readonly components: readonly [{
248
+ readonly components: readonly [{
249
+ readonly internalType: "bytes";
250
+ readonly name: "source";
251
+ readonly type: "bytes";
252
+ }, {
253
+ readonly internalType: "bytes";
254
+ readonly name: "dest";
255
+ readonly type: "bytes";
256
+ }, {
257
+ readonly internalType: "uint64";
258
+ readonly name: "nonce";
259
+ readonly type: "uint64";
260
+ }, {
261
+ readonly internalType: "bytes";
262
+ readonly name: "from";
263
+ readonly type: "bytes";
264
+ }, {
265
+ readonly internalType: "bytes";
266
+ readonly name: "to";
267
+ readonly type: "bytes";
268
+ }, {
269
+ readonly internalType: "uint64";
270
+ readonly name: "timeoutTimestamp";
271
+ readonly type: "uint64";
272
+ }, {
273
+ readonly internalType: "bytes";
274
+ readonly name: "body";
275
+ readonly type: "bytes";
276
+ }];
277
+ readonly internalType: "struct PostRequest[]";
278
+ readonly name: "timeouts";
279
+ readonly type: "tuple[]";
280
+ }, {
281
+ readonly components: readonly [{
282
+ readonly internalType: "uint256";
283
+ readonly name: "stateMachineId";
284
+ readonly type: "uint256";
285
+ }, {
286
+ readonly internalType: "uint256";
287
+ readonly name: "height";
288
+ readonly type: "uint256";
289
+ }];
290
+ readonly internalType: "struct StateMachineHeight";
291
+ readonly name: "height";
292
+ readonly type: "tuple";
293
+ }, {
294
+ readonly internalType: "bytes[]";
295
+ readonly name: "proof";
296
+ readonly type: "bytes[]";
297
+ }];
298
+ readonly internalType: "struct PostRequestTimeoutMessage";
299
+ readonly name: "message";
300
+ readonly type: "tuple";
301
+ }];
302
+ readonly name: "handlePostRequestTimeouts";
303
+ readonly outputs: readonly [];
304
+ readonly stateMutability: "nonpayable";
305
+ readonly type: "function";
306
+ }, {
307
+ readonly inputs: readonly [{
308
+ readonly internalType: "contract IIsmpHost";
309
+ readonly name: "host";
310
+ readonly type: "address";
311
+ }, {
312
+ readonly components: readonly [{
313
+ readonly components: readonly [{
314
+ readonly components: readonly [{
315
+ readonly internalType: "uint256";
316
+ readonly name: "stateMachineId";
317
+ readonly type: "uint256";
318
+ }, {
319
+ readonly internalType: "uint256";
320
+ readonly name: "height";
321
+ readonly type: "uint256";
322
+ }];
323
+ readonly internalType: "struct StateMachineHeight";
324
+ readonly name: "height";
325
+ readonly type: "tuple";
326
+ }, {
327
+ readonly internalType: "bytes32[]";
328
+ readonly name: "multiproof";
329
+ readonly type: "bytes32[]";
330
+ }, {
331
+ readonly internalType: "uint256";
332
+ readonly name: "leafCount";
333
+ readonly type: "uint256";
334
+ }];
335
+ readonly internalType: "struct Proof";
336
+ readonly name: "proof";
337
+ readonly type: "tuple";
338
+ }, {
339
+ readonly components: readonly [{
340
+ readonly components: readonly [{
341
+ readonly internalType: "bytes";
342
+ readonly name: "source";
343
+ readonly type: "bytes";
344
+ }, {
345
+ readonly internalType: "bytes";
346
+ readonly name: "dest";
347
+ readonly type: "bytes";
348
+ }, {
349
+ readonly internalType: "uint64";
350
+ readonly name: "nonce";
351
+ readonly type: "uint64";
352
+ }, {
353
+ readonly internalType: "bytes";
354
+ readonly name: "from";
355
+ readonly type: "bytes";
356
+ }, {
357
+ readonly internalType: "bytes";
358
+ readonly name: "to";
359
+ readonly type: "bytes";
360
+ }, {
361
+ readonly internalType: "uint64";
362
+ readonly name: "timeoutTimestamp";
363
+ readonly type: "uint64";
364
+ }, {
365
+ readonly internalType: "bytes";
366
+ readonly name: "body";
367
+ readonly type: "bytes";
368
+ }];
369
+ readonly internalType: "struct PostRequest";
370
+ readonly name: "request";
371
+ readonly type: "tuple";
372
+ }, {
373
+ readonly internalType: "uint256";
374
+ readonly name: "index";
375
+ readonly type: "uint256";
376
+ }, {
377
+ readonly internalType: "uint256";
378
+ readonly name: "kIndex";
379
+ readonly type: "uint256";
380
+ }];
381
+ readonly internalType: "struct PostRequestLeaf[]";
382
+ readonly name: "requests";
383
+ readonly type: "tuple[]";
384
+ }];
385
+ readonly internalType: "struct PostRequestMessage";
386
+ readonly name: "request";
387
+ readonly type: "tuple";
388
+ }];
389
+ readonly name: "handlePostRequests";
390
+ readonly outputs: readonly [];
391
+ readonly stateMutability: "nonpayable";
392
+ readonly type: "function";
393
+ }, {
394
+ readonly inputs: readonly [{
395
+ readonly internalType: "contract IIsmpHost";
396
+ readonly name: "host";
397
+ readonly type: "address";
398
+ }, {
399
+ readonly components: readonly [{
400
+ readonly components: readonly [{
401
+ readonly components: readonly [{
402
+ readonly internalType: "bytes";
403
+ readonly name: "source";
404
+ readonly type: "bytes";
405
+ }, {
406
+ readonly internalType: "bytes";
407
+ readonly name: "dest";
408
+ readonly type: "bytes";
409
+ }, {
410
+ readonly internalType: "uint64";
411
+ readonly name: "nonce";
412
+ readonly type: "uint64";
413
+ }, {
414
+ readonly internalType: "bytes";
415
+ readonly name: "from";
416
+ readonly type: "bytes";
417
+ }, {
418
+ readonly internalType: "bytes";
419
+ readonly name: "to";
420
+ readonly type: "bytes";
421
+ }, {
422
+ readonly internalType: "uint64";
423
+ readonly name: "timeoutTimestamp";
424
+ readonly type: "uint64";
425
+ }, {
426
+ readonly internalType: "bytes";
427
+ readonly name: "body";
428
+ readonly type: "bytes";
429
+ }];
430
+ readonly internalType: "struct PostRequest";
431
+ readonly name: "request";
432
+ readonly type: "tuple";
433
+ }, {
434
+ readonly internalType: "bytes";
435
+ readonly name: "response";
436
+ readonly type: "bytes";
437
+ }, {
438
+ readonly internalType: "uint64";
439
+ readonly name: "timeoutTimestamp";
440
+ readonly type: "uint64";
441
+ }];
442
+ readonly internalType: "struct PostResponse[]";
443
+ readonly name: "timeouts";
444
+ readonly type: "tuple[]";
445
+ }, {
446
+ readonly components: readonly [{
447
+ readonly internalType: "uint256";
448
+ readonly name: "stateMachineId";
449
+ readonly type: "uint256";
450
+ }, {
451
+ readonly internalType: "uint256";
452
+ readonly name: "height";
453
+ readonly type: "uint256";
454
+ }];
455
+ readonly internalType: "struct StateMachineHeight";
456
+ readonly name: "height";
457
+ readonly type: "tuple";
458
+ }, {
459
+ readonly internalType: "bytes[]";
460
+ readonly name: "proof";
461
+ readonly type: "bytes[]";
462
+ }];
463
+ readonly internalType: "struct PostResponseTimeoutMessage";
464
+ readonly name: "message";
465
+ readonly type: "tuple";
466
+ }];
467
+ readonly name: "handlePostResponseTimeouts";
468
+ readonly outputs: readonly [];
469
+ readonly stateMutability: "nonpayable";
470
+ readonly type: "function";
471
+ }, {
472
+ readonly inputs: readonly [{
473
+ readonly internalType: "contract IIsmpHost";
474
+ readonly name: "host";
475
+ readonly type: "address";
476
+ }, {
477
+ readonly components: readonly [{
478
+ readonly components: readonly [{
479
+ readonly components: readonly [{
480
+ readonly internalType: "uint256";
481
+ readonly name: "stateMachineId";
482
+ readonly type: "uint256";
483
+ }, {
484
+ readonly internalType: "uint256";
485
+ readonly name: "height";
486
+ readonly type: "uint256";
487
+ }];
488
+ readonly internalType: "struct StateMachineHeight";
489
+ readonly name: "height";
490
+ readonly type: "tuple";
491
+ }, {
492
+ readonly internalType: "bytes32[]";
493
+ readonly name: "multiproof";
494
+ readonly type: "bytes32[]";
495
+ }, {
496
+ readonly internalType: "uint256";
497
+ readonly name: "leafCount";
498
+ readonly type: "uint256";
499
+ }];
500
+ readonly internalType: "struct Proof";
501
+ readonly name: "proof";
502
+ readonly type: "tuple";
503
+ }, {
504
+ readonly components: readonly [{
505
+ readonly components: readonly [{
506
+ readonly components: readonly [{
507
+ readonly internalType: "bytes";
508
+ readonly name: "source";
509
+ readonly type: "bytes";
510
+ }, {
511
+ readonly internalType: "bytes";
512
+ readonly name: "dest";
513
+ readonly type: "bytes";
514
+ }, {
515
+ readonly internalType: "uint64";
516
+ readonly name: "nonce";
517
+ readonly type: "uint64";
518
+ }, {
519
+ readonly internalType: "bytes";
520
+ readonly name: "from";
521
+ readonly type: "bytes";
522
+ }, {
523
+ readonly internalType: "bytes";
524
+ readonly name: "to";
525
+ readonly type: "bytes";
526
+ }, {
527
+ readonly internalType: "uint64";
528
+ readonly name: "timeoutTimestamp";
529
+ readonly type: "uint64";
530
+ }, {
531
+ readonly internalType: "bytes";
532
+ readonly name: "body";
533
+ readonly type: "bytes";
534
+ }];
535
+ readonly internalType: "struct PostRequest";
536
+ readonly name: "request";
537
+ readonly type: "tuple";
538
+ }, {
539
+ readonly internalType: "bytes";
540
+ readonly name: "response";
541
+ readonly type: "bytes";
542
+ }, {
543
+ readonly internalType: "uint64";
544
+ readonly name: "timeoutTimestamp";
545
+ readonly type: "uint64";
546
+ }];
547
+ readonly internalType: "struct PostResponse";
548
+ readonly name: "response";
549
+ readonly type: "tuple";
550
+ }, {
551
+ readonly internalType: "uint256";
552
+ readonly name: "index";
553
+ readonly type: "uint256";
554
+ }, {
555
+ readonly internalType: "uint256";
556
+ readonly name: "kIndex";
557
+ readonly type: "uint256";
558
+ }];
559
+ readonly internalType: "struct PostResponseLeaf[]";
560
+ readonly name: "responses";
561
+ readonly type: "tuple[]";
562
+ }];
563
+ readonly internalType: "struct PostResponseMessage";
564
+ readonly name: "response";
565
+ readonly type: "tuple";
566
+ }];
567
+ readonly name: "handlePostResponses";
568
+ readonly outputs: readonly [];
569
+ readonly stateMutability: "nonpayable";
570
+ readonly type: "function";
571
+ }, {
572
+ readonly inputs: readonly [{
573
+ readonly internalType: "bytes4";
574
+ readonly name: "interfaceId";
575
+ readonly type: "bytes4";
576
+ }];
577
+ readonly name: "supportsInterface";
578
+ readonly outputs: readonly [{
579
+ readonly internalType: "bool";
580
+ readonly name: "";
581
+ readonly type: "bool";
582
+ }];
583
+ readonly stateMutability: "view";
584
+ readonly type: "function";
585
+ }];
586
+ };
587
+
588
+ type EstimateGasCallData = ContractFunctionArgs<typeof _default.ABI, "nonpayable" | "payable", "handlePostRequests">;
8
589
  type HexString = `0x${string}`;
9
590
  interface IConfig {
10
591
  source: IEvmConfig | ISubstrateConfig;
@@ -73,6 +654,9 @@ interface ClientConfig {
73
654
  }
74
655
  interface RetryConfig {
75
656
  maxRetries: number;
657
+ /**
658
+ * @description The initial backoff time in milliseconds before the first retry attempt.
659
+ */
76
660
  backoffMs: number;
77
661
  logMessage?: string;
78
662
  logger?: ConsolaInstance;
@@ -980,10 +1564,6 @@ interface TokenRegistryResponse {
980
1564
  }>;
981
1565
  };
982
1566
  }
983
- declare class AbortSignalInternal extends Error {
984
- constructor(message: string);
985
- static isError(error: unknown): error is AbortSignalInternal;
986
- }
987
1567
 
988
1568
  declare class ChainConfigService {
989
1569
  private rpcUrls;
@@ -1119,9 +1699,12 @@ declare class EvmChain implements IChain {
1119
1699
  *
1120
1700
  * @param request - The post request to estimate gas for
1121
1701
  * @param paraId - The ID of the parachain (Hyperbridge) that will process the request
1122
- * @returns The estimated gas amount in gas units
1702
+ * @returns The estimated gas amount in gas units and the generated calldata
1123
1703
  */
1124
- estimateGas(request: IPostRequest): Promise<bigint>;
1704
+ estimateGas(request: IPostRequest): Promise<{
1705
+ gas: bigint;
1706
+ postRequestCalldata: HexString;
1707
+ }>;
1125
1708
  /**
1126
1709
  * Gets the fee token address and decimals for the chain.
1127
1710
  * This function gets the fee token address and decimals for the chain.
@@ -1224,6 +1807,7 @@ type IStateMachine = {
1224
1807
 
1225
1808
  declare const ADDRESS_ZERO: HexString;
1226
1809
  declare const DUMMY_PRIVATE_KEY: HexString;
1810
+ declare const DEFAULT_GRAFFITI: HexString;
1227
1811
  /**
1228
1812
  * Calculates the commitment hash for a post request.
1229
1813
  * @param post The post request to calculate the commitment hash for.
@@ -1257,7 +1841,10 @@ declare function estimateGasForPost(params: {
1257
1841
  sourceClient: PublicClient;
1258
1842
  hostLatestStateMachineHeight: bigint;
1259
1843
  hostAddress: HexString;
1260
- }): Promise<bigint>;
1844
+ }): Promise<{
1845
+ gas_fee: bigint;
1846
+ call_data: EstimateGasCallData;
1847
+ }>;
1261
1848
  /**
1262
1849
  * Constructs the request body for a redeem escrow operation.
1263
1850
  * This function encodes the order commitment, beneficiary address, and token inputs
@@ -1407,7 +1994,7 @@ declare class SubstrateChain implements IChain {
1407
1994
  latestStateMachineHeight(stateMachineId: StateMachineIdParams): Promise<bigint>;
1408
1995
  /**
1409
1996
  * Get the state machine update time for a given state machine height.
1410
- * @param {StateMachineHeight} stateMachineheight - The state machine height.
1997
+ * @param {StateMachineHeight} stateMachineHeight - The state machine height.
1411
1998
  * @returns {Promise<bigint>} The statemachine update time in seconds.
1412
1999
  */
1413
2000
  stateMachineUpdateTime(stateMachineHeight: StateMachineHeight): Promise<bigint>;
@@ -1974,18 +2561,45 @@ declare class IntentGateway {
1974
2561
  * protocol fees, and swap operations.
1975
2562
  *
1976
2563
  * @param order - The order to estimate fill costs for
1977
- * @returns The estimated total cost in the source chain's fee token
2564
+ * @returns An object containing the estimated cost in both fee token and native token, plus the post request calldata
1978
2565
  */
1979
- estimateFillOrder(order: Order): Promise<bigint>;
2566
+ estimateFillOrder(order: Order): Promise<{
2567
+ feeTokenAmount: bigint;
2568
+ nativeTokenAmount: bigint;
2569
+ postRequestCalldata: HexString;
2570
+ }>;
1980
2571
  /**
1981
- * Finds the best Uniswap protocol (V2 or V3) for swapping tokens given a desired output amount.
2572
+ * Converts fee token amounts back to the equivalent amount in native token.
2573
+ * Uses USD pricing to convert between fee token amounts and native token costs.
2574
+ *
2575
+ * @param feeTokenAmount - The amount in fee token (DAI)
2576
+ * @param publicClient - The client for the chain to get native token info
2577
+ * @param feeTokenDecimals - The decimal places of the fee token
2578
+ * @returns The fee token amount converted to native token amount
2579
+ * @private
2580
+ */
2581
+ private convertFeeTokenToNative;
2582
+ /**
2583
+ * Converts gas costs to the equivalent amount in the fee token (DAI).
2584
+ * Uses USD pricing to convert between native token gas costs and fee token amounts.
2585
+ *
2586
+ * @param gasEstimate - The estimated gas units
2587
+ * @param publicClient - The client for the chain to get gas prices
2588
+ * @param targetDecimals - The decimal places of the target fee token
2589
+ * @returns The gas cost converted to fee token amount
2590
+ * @private
2591
+ */
2592
+ private convertGasToFeeToken;
2593
+ quoteNative(postRequest: IPostRequest, fee: bigint): Promise<bigint>;
2594
+ /**
2595
+ * Finds the best Uniswap protocol (V2, V3, or V4) for swapping tokens given a desired output amount.
1982
2596
  * Compares liquidity and pricing across different protocols and fee tiers.
1983
2597
  *
1984
2598
  * @param chain - The chain identifier where the swap will occur
1985
2599
  * @param tokenIn - The address of the input token
1986
2600
  * @param tokenOut - The address of the output token
1987
2601
  * @param amountOut - The desired output amount
1988
- * @returns Object containing the best protocol, required input amount, and fee tier (for V3)
2602
+ * @returns Object containing the best protocol, required input amount, and fee tier (for V3/V4)
1989
2603
  */
1990
2604
  findBestProtocolWithAmountOut(chain: string, tokenIn: HexString, tokenOut: HexString, amountOut: bigint): Promise<{
1991
2605
  protocol: "v2" | "v3" | "v4" | null;
@@ -1993,31 +2607,20 @@ declare class IntentGateway {
1993
2607
  fee?: number;
1994
2608
  }>;
1995
2609
  /**
1996
- * Finds the best Uniswap protocol (V2 or V3) for swapping tokens given an input amount.
2610
+ * Finds the best Uniswap protocol (V2, V3, or V4) for swapping tokens given an input amount.
1997
2611
  * Compares liquidity and pricing across different protocols and fee tiers.
1998
2612
  *
1999
2613
  * @param chain - The chain identifier where the swap will occur
2000
2614
  * @param tokenIn - The address of the input token
2001
2615
  * @param tokenOut - The address of the output token
2002
2616
  * @param amountIn - The input amount to swap
2003
- * @returns Object containing the best protocol, expected output amount, and fee tier (for V3)
2617
+ * @returns Object containing the best protocol, expected output amount, and fee tier (for V3/V4)
2004
2618
  */
2005
2619
  findBestProtocolWithAmountIn(chain: string, tokenIn: HexString, tokenOut: HexString, amountIn: bigint): Promise<{
2006
2620
  protocol: "v2" | "v3" | "v4" | null;
2007
2621
  amountOut: bigint;
2008
2622
  fee?: number;
2009
2623
  }>;
2010
- /**
2011
- * Converts gas costs to the equivalent amount in the fee token (DAI).
2012
- * Uses USD pricing to convert between native token gas costs and fee token amounts.
2013
- *
2014
- * @param gasEstimate - The estimated gas units
2015
- * @param publicClient - The client for the chain to get gas prices
2016
- * @param targetDecimals - The decimal places of the target fee token
2017
- * @returns The gas cost converted to fee token amount
2018
- * @private
2019
- */
2020
- private convertGasToFeeToken;
2021
2624
  /**
2022
2625
  * Checks if an order has been filled by verifying the commitment status on-chain.
2023
2626
  * Reads the storage slot corresponding to the order's commitment hash.
@@ -2203,7 +2806,9 @@ declare enum Chains {
2203
2806
  HYPERBRIDGE_GARGANTUA = "KUSAMA-4009",
2204
2807
  SEPOLIA = "EVM-11155111",
2205
2808
  MAINNET = "EVM-1",
2206
- BSC_MAINNET = "EVM-56"
2809
+ BSC_MAINNET = "EVM-56",
2810
+ ARBITRUM_MAINNET = "EVM-42161",
2811
+ BASE_MAINNET = "EVM-8453"
2207
2812
  }
2208
2813
  type AddressMap = {
2209
2814
  [key: string]: {
@@ -2218,6 +2823,8 @@ declare const chainIds: {
2218
2823
  readonly "EVM-11155111": 11155111;
2219
2824
  readonly "EVM-1": 1;
2220
2825
  readonly "EVM-56": 56;
2826
+ readonly "EVM-42161": 42161;
2827
+ readonly "EVM-8453": 8453;
2221
2828
  };
2222
2829
  type ChainId = typeof chainIds;
2223
2830
  declare const viemChains: Record<string, Chain>;
@@ -2227,6 +2834,8 @@ declare const WrappedNativeDecimals: {
2227
2834
  "EVM-11155111": number;
2228
2835
  "EVM-1": number;
2229
2836
  "EVM-56": number;
2837
+ "EVM-42161": number;
2838
+ "EVM-8453": number;
2230
2839
  };
2231
2840
  declare const assets: {
2232
2841
  "EVM-97": {
@@ -2259,6 +2868,18 @@ declare const assets: {
2259
2868
  USDC: string;
2260
2869
  USDT: string;
2261
2870
  };
2871
+ "EVM-42161": {
2872
+ WETH: string;
2873
+ DAI: string;
2874
+ USDC: string;
2875
+ USDT: string;
2876
+ };
2877
+ "EVM-8453": {
2878
+ WETH: string;
2879
+ DAI: string;
2880
+ USDC: string;
2881
+ USDT: string;
2882
+ };
2262
2883
  };
2263
2884
  declare const addresses: AddressMap;
2264
2885
  declare const createRpcUrls: (env: NodeJS.ProcessEnv) => RpcMap;
@@ -2269,6 +2890,8 @@ declare const consensusStateIds: {
2269
2890
  "EVM-11155111": string;
2270
2891
  "EVM-1": string;
2271
2892
  "EVM-56": string;
2893
+ "EVM-42161": string;
2894
+ "EVM-8453": string;
2272
2895
  };
2273
2896
 
2274
- export { ADDRESS_ZERO, AbortSignalInternal, type AllStatusKey, type AssetTeleported, type AssetTeleportedResponse, type BlockMetadata, type CancelOptions, type ChainConfig, ChainConfigService, type ChainId, Chains, type ClientConfig, DEFAULT_ADDRESS, DUMMY_PRIVATE_KEY, type DecodedOrderPlacedLog, type DispatchGet, type DispatchPost, ERC20Method, EvmChain, type EvmChainParams, type ExecutionResult, type FillOptions, type FillerConfig, type GetRequestResponse, type GetRequestWithStatus, type GetResponseByRequestIdResponse, type GetResponseStorageValues, type HexString, type HostParams, HyperClientStatus, type HyperbridgeTxEvents, type IChain, type IConfig, type IEvmConfig, type IGetRequest, type IGetRequestMessage, type IGetResponse, type IGetResponseMessage, type IHyperbridgeConfig, type IIsmpMessage, type IMessage, type IPostRequest, type IPostResponse, type IProof, type IRequestMessage, type ISubstrateConfig, type ITimeoutPostRequestMessage, IndexerClient, type IndexerQueryClient, IntentGateway, type IntentGatewayParams, type IsmpRequest, type NewDeployment, type Order, type OrderResponse, OrderStatus, type OrderStatusMetadata, type OrderWithStatus, type Params, type PaymentInfo, type PostRequestStatus, type PostRequestTimeoutStatus, type PostRequestWithStatus, REQUEST_COMMITMENTS_SLOT, REQUEST_RECEIPTS_SLOT, RESPONSE_COMMITMENTS_SLOT, RESPONSE_RECEIPTS_SLOT, type RequestBody, type RequestCommitment, RequestKind, type RequestResponse, RequestStatus, type RequestStatusKey, type RequestStatusWithMetadata, type ResponseCommitmentWithValues, type RetryConfig, STATE_COMMITMENTS_SLOT, type StateMachineHeight, type StateMachineIdParams, type StateMachineResponse, type StateMachineUpdate, SubstrateChain, type SubstrateChainParams, TeleportStatus, TimeoutStatus, type TimeoutStatusKey, type TokenGatewayAssetTeleportedResponse, type TokenGatewayAssetTeleportedWithStatus, type TokenInfo, type TokenPrice, type TokenPricesResponse, type TokenRegistry, type TokenRegistryResponse, WrappedNativeDecimals, type XcmGatewayParams, __test, addresses, adjustFeeDecimals, assets, bytes20ToBytes32, bytes32ToBytes20, chainIds, consensusStateIds, constructRedeemEscrowRequestBody, convertStateMachineIdToEnum, createQueryClient, createRpcUrls, encodeISMPMessage, estimateGasForPost, fetchTokenUsdPrice, generateRootWithProof, getChain, getRequestCommitment, getStateCommitmentFieldSlot, getStateCommitmentSlot, getStorageSlot, hexToString, orderCommitment, postRequestCommitment, queryGetRequest, queryPostRequest, teleport, teleportDot, viemChains };
2897
+ export { ADDRESS_ZERO, type AllStatusKey, type AssetTeleported, type AssetTeleportedResponse, type BlockMetadata, type CancelOptions, type ChainConfig, ChainConfigService, type ChainId, Chains, type ClientConfig, DEFAULT_ADDRESS, DEFAULT_GRAFFITI, DUMMY_PRIVATE_KEY, type DecodedOrderPlacedLog, type DispatchGet, type DispatchPost, ERC20Method, type EstimateGasCallData, EvmChain, type EvmChainParams, type ExecutionResult, type FillOptions, type FillerConfig, type GetRequestResponse, type GetRequestWithStatus, type GetResponseByRequestIdResponse, type GetResponseStorageValues, type HexString, type HostParams, HyperClientStatus, type HyperbridgeTxEvents, type IChain, type IConfig, type IEvmConfig, type IGetRequest, type IGetRequestMessage, type IGetResponse, type IGetResponseMessage, type IHyperbridgeConfig, type IIsmpMessage, type IMessage, type IPostRequest, type IPostResponse, type IProof, type IRequestMessage, type ISubstrateConfig, type ITimeoutPostRequestMessage, IndexerClient, type IndexerQueryClient, IntentGateway, type IntentGatewayParams, type IsmpRequest, type NewDeployment, type Order, type OrderResponse, OrderStatus, type OrderStatusMetadata, type OrderWithStatus, type Params, type PaymentInfo, type PostRequestStatus, type PostRequestTimeoutStatus, type PostRequestWithStatus, REQUEST_COMMITMENTS_SLOT, REQUEST_RECEIPTS_SLOT, RESPONSE_COMMITMENTS_SLOT, RESPONSE_RECEIPTS_SLOT, type RequestBody, type RequestCommitment, RequestKind, type RequestResponse, RequestStatus, type RequestStatusKey, type RequestStatusWithMetadata, type ResponseCommitmentWithValues, type RetryConfig, STATE_COMMITMENTS_SLOT, type StateMachineHeight, type StateMachineIdParams, type StateMachineResponse, type StateMachineUpdate, SubstrateChain, type SubstrateChainParams, TeleportStatus, TimeoutStatus, type TimeoutStatusKey, type TokenGatewayAssetTeleportedResponse, type TokenGatewayAssetTeleportedWithStatus, type TokenInfo, type TokenPrice, type TokenPricesResponse, type TokenRegistry, type TokenRegistryResponse, WrappedNativeDecimals, type XcmGatewayParams, __test, addresses, adjustFeeDecimals, assets, bytes20ToBytes32, bytes32ToBytes20, chainIds, consensusStateIds, constructRedeemEscrowRequestBody, convertStateMachineIdToEnum, createQueryClient, createRpcUrls, encodeISMPMessage, estimateGasForPost, fetchTokenUsdPrice, generateRootWithProof, getChain, getRequestCommitment, getStateCommitmentFieldSlot, getStateCommitmentSlot, getStorageSlot, hexToString, orderCommitment, postRequestCommitment, queryGetRequest, queryPostRequest, teleport, teleportDot, viemChains };