@hyperbridge/sdk 1.2.0 → 1.3.0

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;
@@ -939,9 +1523,46 @@ interface OrderResponse {
939
1523
  }>;
940
1524
  };
941
1525
  }
942
- declare class AbortSignalInternal extends Error {
943
- constructor(message: string);
944
- static isError(error: unknown): error is AbortSignalInternal;
1526
+ interface TokenPrice {
1527
+ symbol: string;
1528
+ address?: string;
1529
+ currency: string;
1530
+ price: string;
1531
+ lastUpdatedAt: bigint;
1532
+ }
1533
+ interface TokenPricesResponse {
1534
+ tokenPrices: {
1535
+ nodes: Array<{
1536
+ id: string;
1537
+ symbol: string;
1538
+ address: string;
1539
+ currency: string;
1540
+ price: string;
1541
+ lastUpdatedAt: bigint;
1542
+ }>;
1543
+ };
1544
+ }
1545
+ interface TokenRegistry {
1546
+ id: string;
1547
+ name: string;
1548
+ symbol: string;
1549
+ address?: string;
1550
+ updateFrequencySeconds: number;
1551
+ lastUpdatedAt: bigint;
1552
+ createdAt: Date;
1553
+ }
1554
+ interface TokenRegistryResponse {
1555
+ tokenRegistries: {
1556
+ nodes: Array<{
1557
+ id: string;
1558
+ name: string;
1559
+ symbol: string;
1560
+ address: string;
1561
+ updateFrequencySeconds: number;
1562
+ lastUpdatedAt: bigint;
1563
+ createdAt: string;
1564
+ }>;
1565
+ };
945
1566
  }
946
1567
 
947
1568
  declare class ChainConfigService {
@@ -968,6 +1589,8 @@ declare class ChainConfigService {
968
1589
  getUniswapV3RouterAddress(chain: string): HexString;
969
1590
  getUniswapV3FactoryAddress(chain: string): HexString;
970
1591
  getUniswapV3QuoterAddress(chain: string): HexString;
1592
+ getUniswapV4PoolManagerAddress(chain: string): HexString;
1593
+ getUniswapV4QuoterAddress(chain: string): HexString;
971
1594
  }
972
1595
 
973
1596
  /**
@@ -1214,7 +1837,10 @@ declare function estimateGasForPost(params: {
1214
1837
  sourceClient: PublicClient;
1215
1838
  hostLatestStateMachineHeight: bigint;
1216
1839
  hostAddress: HexString;
1217
- }): Promise<bigint>;
1840
+ }): Promise<{
1841
+ gas_fee: bigint;
1842
+ call_data: EstimateGasCallData;
1843
+ }>;
1218
1844
  /**
1219
1845
  * Constructs the request body for a redeem escrow operation.
1220
1846
  * This function encodes the order commitment, beneficiary address, and token inputs
@@ -1228,6 +1854,15 @@ declare function constructRedeemEscrowRequestBody(order: Order, beneficiary: Hex
1228
1854
  * @returns The USD price of the token as a number (preserves decimals)
1229
1855
  */
1230
1856
  declare function fetchTokenUsdPrice(identifier: string): Promise<number>;
1857
+ /**
1858
+ * ERC20 method signatures used for storage slot detection
1859
+ */
1860
+ declare enum ERC20Method {
1861
+ /** ERC20 balanceOf(address) method signature */
1862
+ BALANCE_OF = "0x70a08231",
1863
+ /** ERC20 allowance(address,address) method signature */
1864
+ ALLOWANCE = "0xdd62ed3e"
1865
+ }
1231
1866
  /**
1232
1867
  * Retrieves the storage slot for a contract call using debug_traceCall
1233
1868
  *
@@ -1266,6 +1901,16 @@ declare function fetchTokenUsdPrice(identifier: string): Promise<number>;
1266
1901
  * ```
1267
1902
  */
1268
1903
  declare function getStorageSlot(client: PublicClient, contractAddress: HexString, data: HexString): Promise<string>;
1904
+ /**
1905
+ * Adjusts fee amounts between different decimal precisions.
1906
+ * Handles scaling up or down based on the decimal difference.
1907
+ *
1908
+ * @param feeInFeeToken - The fee amount to adjust
1909
+ * @param fromDecimals - The current decimal precision
1910
+ * @param toDecimals - The target decimal precision
1911
+ * @returns The adjusted fee amount with the target decimal precision
1912
+ */
1913
+ declare function adjustFeeDecimals(feeInFeeToken: bigint, fromDecimals: number, toDecimals: number): bigint;
1269
1914
 
1270
1915
  interface SubstrateChainParams {
1271
1916
  ws: string;
@@ -1345,7 +1990,7 @@ declare class SubstrateChain implements IChain {
1345
1990
  latestStateMachineHeight(stateMachineId: StateMachineIdParams): Promise<bigint>;
1346
1991
  /**
1347
1992
  * Get the state machine update time for a given state machine height.
1348
- * @param {StateMachineHeight} stateMachineheight - The state machine height.
1993
+ * @param {StateMachineHeight} stateMachineHeight - The state machine height.
1349
1994
  * @returns {Promise<bigint>} The statemachine update time in seconds.
1350
1995
  */
1351
1996
  stateMachineUpdateTime(stateMachineHeight: StateMachineHeight): Promise<bigint>;
@@ -1923,13 +2568,12 @@ declare class IntentGateway {
1923
2568
  * @param tokenIn - The address of the input token
1924
2569
  * @param tokenOut - The address of the output token
1925
2570
  * @param amountOut - The desired output amount
1926
- * @returns Object containing the best protocol, required input amount, fee tier (for V3), and gas estimate
2571
+ * @returns Object containing the best protocol, required input amount, and fee tier (for V3)
1927
2572
  */
1928
2573
  findBestProtocolWithAmountOut(chain: string, tokenIn: HexString, tokenOut: HexString, amountOut: bigint): Promise<{
1929
- protocol: "v2" | "v3" | null;
2574
+ protocol: "v2" | "v3" | "v4" | null;
1930
2575
  amountIn: bigint;
1931
2576
  fee?: number;
1932
- gasEstimate?: bigint;
1933
2577
  }>;
1934
2578
  /**
1935
2579
  * Finds the best Uniswap protocol (V2 or V3) for swapping tokens given an input amount.
@@ -1939,13 +2583,12 @@ declare class IntentGateway {
1939
2583
  * @param tokenIn - The address of the input token
1940
2584
  * @param tokenOut - The address of the output token
1941
2585
  * @param amountIn - The input amount to swap
1942
- * @returns Object containing the best protocol, expected output amount, fee tier (for V3), and gas estimate
2586
+ * @returns Object containing the best protocol, expected output amount, and fee tier (for V3)
1943
2587
  */
1944
2588
  findBestProtocolWithAmountIn(chain: string, tokenIn: HexString, tokenOut: HexString, amountIn: bigint): Promise<{
1945
- protocol: "v2" | "v3" | null;
2589
+ protocol: "v2" | "v3" | "v4" | null;
1946
2590
  amountOut: bigint;
1947
2591
  fee?: number;
1948
- gasEstimate?: bigint;
1949
2592
  }>;
1950
2593
  /**
1951
2594
  * Converts gas costs to the equivalent amount in the fee token (DAI).
@@ -1958,16 +2601,6 @@ declare class IntentGateway {
1958
2601
  * @private
1959
2602
  */
1960
2603
  private convertGasToFeeToken;
1961
- /**
1962
- * Adjusts fee amounts between different decimal precisions.
1963
- * Handles scaling up or down based on the decimal difference.
1964
- *
1965
- * @param feeInFeeToken - The fee amount to adjust
1966
- * @param fromDecimals - The current decimal precision
1967
- * @param toDecimals - The target decimal precision
1968
- * @returns The adjusted fee amount with the target decimal precision
1969
- */
1970
- adjustFeeDecimals(feeInFeeToken: bigint, fromDecimals: number, toDecimals: number): bigint;
1971
2604
  /**
1972
2605
  * Checks if an order has been filled by verifying the commitment status on-chain.
1973
2606
  * Reads the storage slot corresponding to the order's commitment hash.
@@ -1976,6 +2609,20 @@ declare class IntentGateway {
1976
2609
  * @returns True if the order has been filled, false otherwise
1977
2610
  */
1978
2611
  isOrderFilled(order: Order): Promise<boolean>;
2612
+ /**
2613
+ * Returns the tick spacing for a given fee tier in Uniswap V4
2614
+ * @param fee - The fee tier in basis points
2615
+ * @returns The tick spacing value
2616
+ */
2617
+ private getTickSpacing;
2618
+ /**
2619
+ * Returns true if candidate <= reference * (1 + thresholdBps/10000)
2620
+ * @param candidate - The candidate amount to compare
2621
+ * @param reference - The reference amount
2622
+ * @param thresholdBps - The threshold in basis points
2623
+ * @returns True if candidate is within threshold of reference
2624
+ */
2625
+ private isWithinThreshold;
1979
2626
  }
1980
2627
 
1981
2628
  type HyperbridgeTxEvents = {
@@ -2137,7 +2784,9 @@ declare enum Chains {
2137
2784
  BSC_CHAPEL = "EVM-97",
2138
2785
  GNOSIS_CHIADO = "EVM-10200",
2139
2786
  HYPERBRIDGE_GARGANTUA = "KUSAMA-4009",
2140
- SEPOLIA = "EVM-11155111"
2787
+ SEPOLIA = "EVM-11155111",
2788
+ MAINNET = "EVM-1",
2789
+ BSC_MAINNET = "EVM-56"
2141
2790
  }
2142
2791
  type AddressMap = {
2143
2792
  [key: string]: {
@@ -2150,6 +2799,8 @@ declare const chainIds: {
2150
2799
  readonly "EVM-10200": 10200;
2151
2800
  readonly "KUSAMA-4009": 4009;
2152
2801
  readonly "EVM-11155111": 11155111;
2802
+ readonly "EVM-1": 1;
2803
+ readonly "EVM-56": 56;
2153
2804
  };
2154
2805
  type ChainId = typeof chainIds;
2155
2806
  declare const viemChains: Record<string, Chain>;
@@ -2157,6 +2808,8 @@ declare const WrappedNativeDecimals: {
2157
2808
  "EVM-97": number;
2158
2809
  "EVM-10200": number;
2159
2810
  "EVM-11155111": number;
2811
+ "EVM-1": number;
2812
+ "EVM-56": number;
2160
2813
  };
2161
2814
  declare const assets: {
2162
2815
  "EVM-97": {
@@ -2177,6 +2830,18 @@ declare const assets: {
2177
2830
  USDT: string;
2178
2831
  DAI: string;
2179
2832
  };
2833
+ "EVM-1": {
2834
+ WETH: string;
2835
+ DAI: string;
2836
+ USDC: string;
2837
+ USDT: string;
2838
+ };
2839
+ "EVM-56": {
2840
+ WETH: string;
2841
+ DAI: string;
2842
+ USDC: string;
2843
+ USDT: string;
2844
+ };
2180
2845
  };
2181
2846
  declare const addresses: AddressMap;
2182
2847
  declare const createRpcUrls: (env: NodeJS.ProcessEnv) => RpcMap;
@@ -2185,6 +2850,8 @@ declare const consensusStateIds: {
2185
2850
  "EVM-10200": string;
2186
2851
  "KUSAMA-4009": string;
2187
2852
  "EVM-11155111": string;
2853
+ "EVM-1": string;
2854
+ "EVM-56": string;
2188
2855
  };
2189
2856
 
2190
- 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, 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, WrappedNativeDecimals, type XcmGatewayParams, __test, addresses, 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 };
2857
+ export { ADDRESS_ZERO, 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, 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 };