@hyperbridge/sdk 1.9.6 → 2.0.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.
- package/README.md +6 -4
- package/dist/browser/index.d.ts +660 -384
- package/dist/browser/index.js +2542 -2612
- package/dist/browser/index.js.map +1 -1
- package/dist/node/index.d.ts +660 -384
- package/dist/node/index.js +2544 -2614
- package/dist/node/index.js.map +1 -1
- package/package.json +1 -1
package/dist/node/index.d.ts
CHANGED
|
@@ -13,48 +13,28 @@ export { Account as ViemAccount } from 'viem/accounts';
|
|
|
13
13
|
|
|
14
14
|
declare const _default: {
|
|
15
15
|
ABI: readonly [{
|
|
16
|
-
readonly inputs: readonly [
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
readonly name: "
|
|
22
|
-
readonly
|
|
23
|
-
|
|
24
|
-
readonly
|
|
25
|
-
readonly name: "DuplicateMessage";
|
|
26
|
-
readonly type: "error";
|
|
27
|
-
}, {
|
|
28
|
-
readonly inputs: readonly [];
|
|
29
|
-
readonly name: "HostFrozen";
|
|
30
|
-
readonly type: "error";
|
|
31
|
-
}, {
|
|
32
|
-
readonly inputs: readonly [];
|
|
33
|
-
readonly name: "InvalidMessageDestination";
|
|
34
|
-
readonly type: "error";
|
|
35
|
-
}, {
|
|
36
|
-
readonly inputs: readonly [];
|
|
37
|
-
readonly name: "InvalidProof";
|
|
38
|
-
readonly type: "error";
|
|
39
|
-
}, {
|
|
40
|
-
readonly inputs: readonly [];
|
|
41
|
-
readonly name: "MessageNotTimedOut";
|
|
42
|
-
readonly type: "error";
|
|
43
|
-
}, {
|
|
44
|
-
readonly inputs: readonly [];
|
|
45
|
-
readonly name: "MessageTimedOut";
|
|
46
|
-
readonly type: "error";
|
|
47
|
-
}, {
|
|
48
|
-
readonly inputs: readonly [];
|
|
49
|
-
readonly name: "StateCommitmentNotFound";
|
|
50
|
-
readonly type: "error";
|
|
16
|
+
readonly inputs: readonly [{
|
|
17
|
+
readonly internalType: "bytes[]";
|
|
18
|
+
readonly name: "calls";
|
|
19
|
+
readonly type: "bytes[]";
|
|
20
|
+
}];
|
|
21
|
+
readonly name: "batchCall";
|
|
22
|
+
readonly outputs: readonly [];
|
|
23
|
+
readonly stateMutability: "nonpayable";
|
|
24
|
+
readonly type: "function";
|
|
51
25
|
}, {
|
|
52
26
|
readonly inputs: readonly [];
|
|
53
|
-
readonly name: "
|
|
54
|
-
readonly
|
|
27
|
+
readonly name: "currentEpoch";
|
|
28
|
+
readonly outputs: readonly [{
|
|
29
|
+
readonly internalType: "uint256";
|
|
30
|
+
readonly name: "";
|
|
31
|
+
readonly type: "uint256";
|
|
32
|
+
}];
|
|
33
|
+
readonly stateMutability: "view";
|
|
34
|
+
readonly type: "function";
|
|
55
35
|
}, {
|
|
56
36
|
readonly inputs: readonly [{
|
|
57
|
-
readonly internalType: "contract
|
|
37
|
+
readonly internalType: "contract IHost";
|
|
58
38
|
readonly name: "host";
|
|
59
39
|
readonly type: "address";
|
|
60
40
|
}, {
|
|
@@ -68,7 +48,7 @@ declare const _default: {
|
|
|
68
48
|
readonly type: "function";
|
|
69
49
|
}, {
|
|
70
50
|
readonly inputs: readonly [{
|
|
71
|
-
readonly internalType: "contract
|
|
51
|
+
readonly internalType: "contract IHost";
|
|
72
52
|
readonly name: "host";
|
|
73
53
|
readonly type: "address";
|
|
74
54
|
}, {
|
|
@@ -137,7 +117,7 @@ declare const _default: {
|
|
|
137
117
|
readonly type: "function";
|
|
138
118
|
}, {
|
|
139
119
|
readonly inputs: readonly [{
|
|
140
|
-
readonly internalType: "contract
|
|
120
|
+
readonly internalType: "contract IHost";
|
|
141
121
|
readonly name: "host";
|
|
142
122
|
readonly type: "address";
|
|
143
123
|
}, {
|
|
@@ -216,7 +196,7 @@ declare const _default: {
|
|
|
216
196
|
readonly name: "value";
|
|
217
197
|
readonly type: "bytes";
|
|
218
198
|
}];
|
|
219
|
-
readonly internalType: "struct StorageValue[]";
|
|
199
|
+
readonly internalType: "struct MerklePatricia.StorageValue[]";
|
|
220
200
|
readonly name: "values";
|
|
221
201
|
readonly type: "tuple[]";
|
|
222
202
|
}];
|
|
@@ -227,10 +207,6 @@ declare const _default: {
|
|
|
227
207
|
readonly internalType: "uint256";
|
|
228
208
|
readonly name: "index";
|
|
229
209
|
readonly type: "uint256";
|
|
230
|
-
}, {
|
|
231
|
-
readonly internalType: "uint256";
|
|
232
|
-
readonly name: "kIndex";
|
|
233
|
-
readonly type: "uint256";
|
|
234
210
|
}];
|
|
235
211
|
readonly internalType: "struct GetResponseLeaf[]";
|
|
236
212
|
readonly name: "responses";
|
|
@@ -246,7 +222,7 @@ declare const _default: {
|
|
|
246
222
|
readonly type: "function";
|
|
247
223
|
}, {
|
|
248
224
|
readonly inputs: readonly [{
|
|
249
|
-
readonly internalType: "contract
|
|
225
|
+
readonly internalType: "contract IHost";
|
|
250
226
|
readonly name: "host";
|
|
251
227
|
readonly type: "address";
|
|
252
228
|
}, {
|
|
@@ -311,7 +287,7 @@ declare const _default: {
|
|
|
311
287
|
readonly type: "function";
|
|
312
288
|
}, {
|
|
313
289
|
readonly inputs: readonly [{
|
|
314
|
-
readonly internalType: "contract
|
|
290
|
+
readonly internalType: "contract IHost";
|
|
315
291
|
readonly name: "host";
|
|
316
292
|
readonly type: "address";
|
|
317
293
|
}, {
|
|
@@ -379,10 +355,6 @@ declare const _default: {
|
|
|
379
355
|
readonly internalType: "uint256";
|
|
380
356
|
readonly name: "index";
|
|
381
357
|
readonly type: "uint256";
|
|
382
|
-
}, {
|
|
383
|
-
readonly internalType: "uint256";
|
|
384
|
-
readonly name: "kIndex";
|
|
385
|
-
readonly type: "uint256";
|
|
386
358
|
}];
|
|
387
359
|
readonly internalType: "struct PostRequestLeaf[]";
|
|
388
360
|
readonly name: "requests";
|
|
@@ -398,7 +370,7 @@ declare const _default: {
|
|
|
398
370
|
readonly type: "function";
|
|
399
371
|
}, {
|
|
400
372
|
readonly inputs: readonly [{
|
|
401
|
-
readonly internalType: "contract
|
|
373
|
+
readonly internalType: "contract IHost";
|
|
402
374
|
readonly name: "host";
|
|
403
375
|
readonly type: "address";
|
|
404
376
|
}, {
|
|
@@ -476,7 +448,7 @@ declare const _default: {
|
|
|
476
448
|
readonly type: "function";
|
|
477
449
|
}, {
|
|
478
450
|
readonly inputs: readonly [{
|
|
479
|
-
readonly internalType: "contract
|
|
451
|
+
readonly internalType: "contract IHost";
|
|
480
452
|
readonly name: "host";
|
|
481
453
|
readonly type: "address";
|
|
482
454
|
}, {
|
|
@@ -557,10 +529,6 @@ declare const _default: {
|
|
|
557
529
|
readonly internalType: "uint256";
|
|
558
530
|
readonly name: "index";
|
|
559
531
|
readonly type: "uint256";
|
|
560
|
-
}, {
|
|
561
|
-
readonly internalType: "uint256";
|
|
562
|
-
readonly name: "kIndex";
|
|
563
|
-
readonly type: "uint256";
|
|
564
532
|
}];
|
|
565
533
|
readonly internalType: "struct PostResponseLeaf[]";
|
|
566
534
|
readonly name: "responses";
|
|
@@ -574,6 +542,20 @@ declare const _default: {
|
|
|
574
542
|
readonly outputs: readonly [];
|
|
575
543
|
readonly stateMutability: "nonpayable";
|
|
576
544
|
readonly type: "function";
|
|
545
|
+
}, {
|
|
546
|
+
readonly inputs: readonly [{
|
|
547
|
+
readonly internalType: "uint256";
|
|
548
|
+
readonly name: "authoritySetId";
|
|
549
|
+
readonly type: "uint256";
|
|
550
|
+
}];
|
|
551
|
+
readonly name: "relayerOf";
|
|
552
|
+
readonly outputs: readonly [{
|
|
553
|
+
readonly internalType: "address";
|
|
554
|
+
readonly name: "";
|
|
555
|
+
readonly type: "address";
|
|
556
|
+
}];
|
|
557
|
+
readonly stateMutability: "view";
|
|
558
|
+
readonly type: "function";
|
|
577
559
|
}, {
|
|
578
560
|
readonly inputs: readonly [{
|
|
579
561
|
readonly internalType: "bytes4";
|
|
@@ -588,6 +570,85 @@ declare const _default: {
|
|
|
588
570
|
}];
|
|
589
571
|
readonly stateMutability: "view";
|
|
590
572
|
readonly type: "function";
|
|
573
|
+
}, {
|
|
574
|
+
readonly anonymous: false;
|
|
575
|
+
readonly inputs: readonly [{
|
|
576
|
+
readonly indexed: true;
|
|
577
|
+
readonly internalType: "uint256";
|
|
578
|
+
readonly name: "authoritySetId";
|
|
579
|
+
readonly type: "uint256";
|
|
580
|
+
}, {
|
|
581
|
+
readonly indexed: true;
|
|
582
|
+
readonly internalType: "address";
|
|
583
|
+
readonly name: "relayer";
|
|
584
|
+
readonly type: "address";
|
|
585
|
+
}];
|
|
586
|
+
readonly name: "NewEpoch";
|
|
587
|
+
readonly type: "event";
|
|
588
|
+
}, {
|
|
589
|
+
readonly inputs: readonly [{
|
|
590
|
+
readonly internalType: "uint256";
|
|
591
|
+
readonly name: "index";
|
|
592
|
+
readonly type: "uint256";
|
|
593
|
+
}, {
|
|
594
|
+
readonly internalType: "bytes";
|
|
595
|
+
readonly name: "reason";
|
|
596
|
+
readonly type: "bytes";
|
|
597
|
+
}];
|
|
598
|
+
readonly name: "BatchCallFailed";
|
|
599
|
+
readonly type: "error";
|
|
600
|
+
}, {
|
|
601
|
+
readonly inputs: readonly [];
|
|
602
|
+
readonly name: "ChallengePeriodNotElapsed";
|
|
603
|
+
readonly type: "error";
|
|
604
|
+
}, {
|
|
605
|
+
readonly inputs: readonly [];
|
|
606
|
+
readonly name: "ConsensusClientExpired";
|
|
607
|
+
readonly type: "error";
|
|
608
|
+
}, {
|
|
609
|
+
readonly inputs: readonly [];
|
|
610
|
+
readonly name: "DuplicateMessage";
|
|
611
|
+
readonly type: "error";
|
|
612
|
+
}, {
|
|
613
|
+
readonly inputs: readonly [];
|
|
614
|
+
readonly name: "EmptyTree";
|
|
615
|
+
readonly type: "error";
|
|
616
|
+
}, {
|
|
617
|
+
readonly inputs: readonly [];
|
|
618
|
+
readonly name: "HostFrozen";
|
|
619
|
+
readonly type: "error";
|
|
620
|
+
}, {
|
|
621
|
+
readonly inputs: readonly [];
|
|
622
|
+
readonly name: "InvalidMessageDestination";
|
|
623
|
+
readonly type: "error";
|
|
624
|
+
}, {
|
|
625
|
+
readonly inputs: readonly [];
|
|
626
|
+
readonly name: "InvalidProof";
|
|
627
|
+
readonly type: "error";
|
|
628
|
+
}, {
|
|
629
|
+
readonly inputs: readonly [];
|
|
630
|
+
readonly name: "MessageNotTimedOut";
|
|
631
|
+
readonly type: "error";
|
|
632
|
+
}, {
|
|
633
|
+
readonly inputs: readonly [];
|
|
634
|
+
readonly name: "MessageTimedOut";
|
|
635
|
+
readonly type: "error";
|
|
636
|
+
}, {
|
|
637
|
+
readonly inputs: readonly [];
|
|
638
|
+
readonly name: "OutOfBoundsLeaves";
|
|
639
|
+
readonly type: "error";
|
|
640
|
+
}, {
|
|
641
|
+
readonly inputs: readonly [];
|
|
642
|
+
readonly name: "ProofExhausted";
|
|
643
|
+
readonly type: "error";
|
|
644
|
+
}, {
|
|
645
|
+
readonly inputs: readonly [];
|
|
646
|
+
readonly name: "StateCommitmentNotFound";
|
|
647
|
+
readonly type: "error";
|
|
648
|
+
}, {
|
|
649
|
+
readonly inputs: readonly [];
|
|
650
|
+
readonly name: "UnknownMessage";
|
|
651
|
+
readonly type: "error";
|
|
591
652
|
}];
|
|
592
653
|
};
|
|
593
654
|
|
|
@@ -638,7 +699,7 @@ declare class ChainConfigService {
|
|
|
638
699
|
getPopularTokens(chain: string): string[];
|
|
639
700
|
getIntentGatewayV2Address(chain: string): HexString;
|
|
640
701
|
getEntryPointV08Address(chain: string): HexString;
|
|
641
|
-
|
|
702
|
+
getCirclePaymasterAddress(chain: string): HexString | undefined;
|
|
642
703
|
getHyperbridgeAddress(): string;
|
|
643
704
|
/**
|
|
644
705
|
* Get the LayerZero Endpoint ID for the chain
|
|
@@ -658,6 +719,9 @@ declare class ChainConfigService {
|
|
|
658
719
|
* This represents the zero address in EVM chains.
|
|
659
720
|
*/
|
|
660
721
|
declare const DEFAULT_ADDRESS = "0x0000000000000000000000000000000000000000";
|
|
722
|
+
/**
|
|
723
|
+
* ERC-165 interface ID for IHandlerV2 (bytes4(keccak256("batchCall(bytes[])"))).
|
|
724
|
+
*/
|
|
661
725
|
/**
|
|
662
726
|
* Parameters for an EVM chain.
|
|
663
727
|
*/
|
|
@@ -724,6 +788,10 @@ declare class EvmChain implements IChain {
|
|
|
724
788
|
get bundlerUrl(): string | undefined;
|
|
725
789
|
get config(): IEvmConfig;
|
|
726
790
|
get configService(): ChainConfigService;
|
|
791
|
+
/**
|
|
792
|
+
* Returns the current authority set epoch from the HandlerV2 contract.
|
|
793
|
+
*/
|
|
794
|
+
currentEpoch(): Promise<bigint>;
|
|
727
795
|
/**
|
|
728
796
|
* Derives the key for the request receipt.
|
|
729
797
|
* @param {HexString} commitment - The commitment to derive the key from.
|
|
@@ -912,7 +980,6 @@ declare function getStateCommitmentSlot(stateMachineId: bigint, height: bigint):
|
|
|
912
980
|
* - root: The MMR root hash as a hex string
|
|
913
981
|
* - proof: An array of hex strings representing the MMR proof for the unmodified request
|
|
914
982
|
* - index: The index of the unmodified request in the MMR
|
|
915
|
-
* - kIndex: The k-index of the unmodified request in the MMR
|
|
916
983
|
* - treeSize: The number of leaves in the MMR
|
|
917
984
|
* - mmrSize: The size of the MMR in nodes
|
|
918
985
|
*/
|
|
@@ -920,7 +987,6 @@ declare function generateRootWithProof(postRequest: IPostRequest, treeSize: bigi
|
|
|
920
987
|
root: HexString;
|
|
921
988
|
proof: HexString[];
|
|
922
989
|
index: bigint;
|
|
923
|
-
kIndex: bigint;
|
|
924
990
|
treeSize: bigint;
|
|
925
991
|
mmrSize: bigint;
|
|
926
992
|
}>;
|
|
@@ -1264,10 +1330,21 @@ declare class SubstrateChain implements IChain {
|
|
|
1264
1330
|
*/
|
|
1265
1331
|
encode(message: IIsmpMessage): HexString;
|
|
1266
1332
|
/**
|
|
1267
|
-
*
|
|
1268
|
-
* @param {string} name - The name of the pallet.
|
|
1269
|
-
* @returns {number} The index of the pallet.
|
|
1333
|
+
* Queries the latest proven height for this chain from pallet-ismp.
|
|
1270
1334
|
*/
|
|
1335
|
+
queryLastProvenHeight(): Promise<bigint>;
|
|
1336
|
+
/**
|
|
1337
|
+
* Queries all consensus proofs needed to catch up from a given on-chain epoch
|
|
1338
|
+
* to the latest proven state. Returns rotation proofs (in order) to advance
|
|
1339
|
+
* the authority set, plus the final messaging proof that covers `neededHeight`.
|
|
1340
|
+
*
|
|
1341
|
+
* @param neededHeight - The Hyperbridge block height that must be covered
|
|
1342
|
+
* @param currentEpoch - The current authority set id on the destination EVM chain
|
|
1343
|
+
*/
|
|
1344
|
+
queryConsensusProofs(neededHeight: bigint, currentEpoch: bigint): Promise<{
|
|
1345
|
+
proofs: HexString[];
|
|
1346
|
+
provenHeight: bigint;
|
|
1347
|
+
} | undefined>;
|
|
1271
1348
|
private getPalletIndex;
|
|
1272
1349
|
}
|
|
1273
1350
|
/**
|
|
@@ -1704,7 +1781,11 @@ declare class PharosChain implements IChain {
|
|
|
1704
1781
|
/**
|
|
1705
1782
|
* Type representing an ISMP message.
|
|
1706
1783
|
*/
|
|
1707
|
-
type IIsmpMessage = IRequestMessage | ITimeoutPostRequestMessage | IGetResponseMessage | IGetRequestMessage;
|
|
1784
|
+
type IIsmpMessage = IRequestMessage | ITimeoutPostRequestMessage | IGetResponseMessage | IGetRequestMessage | IConsensusMessage | IBatchConsensusAndPostRequestMessage | IBatchConsensusAndGetResponseMessage;
|
|
1785
|
+
interface IConsensusMessage {
|
|
1786
|
+
kind: "Consensus";
|
|
1787
|
+
consensusProof: HexString;
|
|
1788
|
+
}
|
|
1708
1789
|
interface IRequestMessage {
|
|
1709
1790
|
/**
|
|
1710
1791
|
* The kind of message.
|
|
@@ -1787,6 +1868,20 @@ interface ITimeoutPostRequestMessage {
|
|
|
1787
1868
|
*/
|
|
1788
1869
|
proof: IProof;
|
|
1789
1870
|
}
|
|
1871
|
+
interface IBatchConsensusAndPostRequestMessage {
|
|
1872
|
+
kind: "BatchConsensusAndPostRequest";
|
|
1873
|
+
consensusProofs: HexString[];
|
|
1874
|
+
requests: IPostRequest[];
|
|
1875
|
+
proof: IProof;
|
|
1876
|
+
signer: HexString;
|
|
1877
|
+
}
|
|
1878
|
+
interface IBatchConsensusAndGetResponseMessage {
|
|
1879
|
+
kind: "BatchConsensusAndGetResponse";
|
|
1880
|
+
consensusProofs: HexString[];
|
|
1881
|
+
responses: IGetResponse[];
|
|
1882
|
+
proof: IProof;
|
|
1883
|
+
signer: HexString;
|
|
1884
|
+
}
|
|
1790
1885
|
interface IProof {
|
|
1791
1886
|
/**
|
|
1792
1887
|
* The height of the proof.
|
|
@@ -2886,7 +2981,7 @@ interface SigningAccount {
|
|
|
2886
2981
|
yParity: number;
|
|
2887
2982
|
}>;
|
|
2888
2983
|
/**
|
|
2889
|
-
* Signs an EIP-712 typed-data payload (e.g. an EIP-2612 USDC permit for the Circle
|
|
2984
|
+
* Signs an EIP-712 typed-data payload (e.g. an EIP-2612 USDC permit for the Circle Paymaster).
|
|
2890
2985
|
* The shape of `typedData` matches viem's `TypedDataDefinition` (domain + types + message).
|
|
2891
2986
|
*/
|
|
2892
2987
|
signTypedData: (typedData: unknown, chainId?: number) => Promise<HexString>;
|
|
@@ -2939,9 +3034,9 @@ interface FillOrderEstimate {
|
|
|
2939
3034
|
callGasLimit: bigint;
|
|
2940
3035
|
verificationGasLimit: bigint;
|
|
2941
3036
|
preVerificationGas: bigint;
|
|
2942
|
-
/** Paymaster verification gas limit from bundler estimate
|
|
3037
|
+
/** Paymaster verification gas limit from bundler estimate. 0n when no paymaster. */
|
|
2943
3038
|
paymasterVerificationGasLimit: bigint;
|
|
2944
|
-
/** Paymaster postOp gas limit from bundler estimate
|
|
3039
|
+
/** Paymaster postOp gas limit from bundler estimate. 0n when no paymaster. */
|
|
2945
3040
|
paymasterPostOpGasLimit: bigint;
|
|
2946
3041
|
maxFeePerGas: bigint;
|
|
2947
3042
|
maxPriorityFeePerGas: bigint;
|
|
@@ -3131,101 +3226,16 @@ type ERC7821Call = {
|
|
|
3131
3226
|
};
|
|
3132
3227
|
|
|
3133
3228
|
/**
|
|
3134
|
-
*
|
|
3135
|
-
*
|
|
3136
|
-
*
|
|
3137
|
-
* through the Hyperbridge protocol. It supports:
|
|
3138
|
-
*
|
|
3139
|
-
* - Querying state machine updates by block height or timestamp
|
|
3140
|
-
* - Retrieving request status information by transaction hash
|
|
3141
|
-
* - Monitoring request status changes through streaming interfaces
|
|
3142
|
-
* - Handling request timeout flows and related proof generation
|
|
3143
|
-
* - Tracking request finalization across source and destination chains
|
|
3144
|
-
*
|
|
3145
|
-
* The client implements automatic retries with exponential backoff for network
|
|
3146
|
-
* resilience and provides both simple query methods and advanced streaming
|
|
3147
|
-
* interfaces for real-time status tracking.
|
|
3148
|
-
*
|
|
3149
|
-
* The URLs provided in the configuration must point to archive nodes to allow the client to query for storage proofs
|
|
3150
|
-
* of potentially much older blocks. Regular nodes only store the state for recent blocks and will not be able
|
|
3151
|
-
* to provide the necessary proofs for cross-chain verification, especially in timeout scenarios.
|
|
3152
|
-
*
|
|
3153
|
-
* @example
|
|
3154
|
-
* ```typescript
|
|
3155
|
-
* const sourceChain = EvmChain.fromParams({
|
|
3156
|
-
* chainId: 1,
|
|
3157
|
-
* rpcUrl: "https://eth-rpc.com",
|
|
3158
|
-
* host: "0x87ea45..",
|
|
3159
|
-
* consensusStateId: "ETH0"
|
|
3160
|
-
* })
|
|
3161
|
-
* const destChain = EvmChain.fromParams({
|
|
3162
|
-
* chainId: 42161,
|
|
3163
|
-
* rpcUrl: "https://arb-rpc.com",
|
|
3164
|
-
* host: "0x87ea42345..",
|
|
3165
|
-
* consensusStateId: "ARB0"
|
|
3166
|
-
* })
|
|
3167
|
-
* const hyperbridgeChain = await SubstrateChain.connect({
|
|
3168
|
-
* stateMachineId: "POLKADOT-3367",
|
|
3169
|
-
* wsUrl: "ws://localhost:9944",
|
|
3170
|
-
* hasher: "Keccak",
|
|
3171
|
-
* consensusStateId: "DOT0"
|
|
3172
|
-
* })
|
|
3173
|
-
*
|
|
3174
|
-
* const client = new IndexerClient({
|
|
3175
|
-
* queryClient: queryClient,
|
|
3176
|
-
* pollInterval: 2000,
|
|
3177
|
-
* source: sourceChain,
|
|
3178
|
-
* dest: destChain,
|
|
3179
|
-
* hyperbridge: hyperbridgeChain
|
|
3180
|
-
* });
|
|
3181
|
-
*
|
|
3182
|
-
* // Query a request status
|
|
3183
|
-
* const status = await client.queryRequestWithStatus("0x1234...");
|
|
3184
|
-
*
|
|
3185
|
-
* // Stream status updates
|
|
3186
|
-
* for await (const update of client.postRequestStatusStream("0x1234...")) {
|
|
3187
|
-
* console.log(`Request status: ${update.status}`);
|
|
3188
|
-
* }
|
|
3189
|
-
* ```
|
|
3229
|
+
* Read-only indexer queries — state machine updates, post/get requests, and
|
|
3230
|
+
* response lookups. Groups the thin GraphQL wrappers that other client
|
|
3231
|
+
* sub-modules consume when building finality events and status streams.
|
|
3190
3232
|
*/
|
|
3191
|
-
declare class
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
private client;
|
|
3196
|
-
/**
|
|
3197
|
-
* Configuration for the IndexerClient including URLs, poll intervals, and chain-specific settings
|
|
3198
|
-
*/
|
|
3199
|
-
private config;
|
|
3200
|
-
private logger;
|
|
3201
|
-
/**
|
|
3202
|
-
* Default configuration for retry behavior when network requests fail
|
|
3203
|
-
* - maxRetries: Maximum number of retry attempts before failing
|
|
3204
|
-
* - backoffMs: Initial backoff time in milliseconds (doubles with each retry)
|
|
3205
|
-
*/
|
|
3206
|
-
private defaultRetryConfig;
|
|
3207
|
-
/**
|
|
3208
|
-
* Creates a new IndexerClient instance
|
|
3209
|
-
*/
|
|
3210
|
-
constructor(config: PartialClientConfig);
|
|
3211
|
-
/**
|
|
3212
|
-
* Get the source chain instance
|
|
3213
|
-
*/
|
|
3214
|
-
get source(): IChain;
|
|
3215
|
-
/**
|
|
3216
|
-
* Get the destination chain instance
|
|
3217
|
-
*/
|
|
3218
|
-
get dest(): IChain;
|
|
3219
|
-
/**
|
|
3220
|
-
* Get the hyperbridge chain instance
|
|
3221
|
-
*/
|
|
3222
|
-
get hyperbridge(): IChain;
|
|
3233
|
+
declare class Queries {
|
|
3234
|
+
private readonly ctx;
|
|
3235
|
+
private readonly logger;
|
|
3236
|
+
constructor(ctx: ClientContext);
|
|
3223
3237
|
/**
|
|
3224
3238
|
* Query for a single state machine update event greater than or equal to the given height.
|
|
3225
|
-
* @params statemachineId - ID of the state machine
|
|
3226
|
-
* @params height - Starting block height
|
|
3227
|
-
* @params chain - The identifier for the chain where the state machine update should be queried (corresponds to a stateMachineId)
|
|
3228
|
-
* @returns Closest state machine update
|
|
3229
3239
|
*/
|
|
3230
3240
|
queryStateMachineUpdateByHeight({ statemachineId, height, chain, }: {
|
|
3231
3241
|
statemachineId: string;
|
|
@@ -3234,10 +3244,6 @@ declare class IndexerClient {
|
|
|
3234
3244
|
}): Promise<StateMachineUpdate | undefined>;
|
|
3235
3245
|
/**
|
|
3236
3246
|
* Query for a single state machine update event greater than or equal to the given timestamp.
|
|
3237
|
-
* @params statemachineId - ID of the state machine
|
|
3238
|
-
* @params timestamp - Starting block timestamp
|
|
3239
|
-
* @params chain - The identifier for the chain where the state machine update should be queried (corresponds to a stateMachineId)
|
|
3240
|
-
* @returns Closest state machine update
|
|
3241
3247
|
*/
|
|
3242
3248
|
queryStateMachineUpdateByTimestamp({ statemachineId, commitmentTimestamp, chain, }: {
|
|
3243
3249
|
statemachineId: string;
|
|
@@ -3245,271 +3251,303 @@ declare class IndexerClient {
|
|
|
3245
3251
|
chain: string;
|
|
3246
3252
|
}): Promise<StateMachineUpdate | undefined>;
|
|
3247
3253
|
/**
|
|
3248
|
-
* Query for the latest state machine update height
|
|
3249
|
-
* @params statemachineId - ID of the state machine
|
|
3250
|
-
* @params chain - The identifier for the chain where the state machine update should be queried (corresponds to a stateMachineId)
|
|
3251
|
-
* @returns Latest height or undefined if no updates found
|
|
3254
|
+
* Query for the latest state machine update height.
|
|
3252
3255
|
*/
|
|
3253
3256
|
queryLatestStateMachineHeight({ statemachineId, chain, }: {
|
|
3254
3257
|
statemachineId: string;
|
|
3255
3258
|
chain: string;
|
|
3256
3259
|
}): Promise<bigint | undefined>;
|
|
3257
3260
|
/**
|
|
3258
|
-
* Queries a request by
|
|
3259
|
-
*
|
|
3260
|
-
* @param commitment_hash - Can be commitment
|
|
3261
|
-
* @returns Latest status and block metadata of the request
|
|
3261
|
+
* Queries a POST request by commitment hash.
|
|
3262
3262
|
*/
|
|
3263
|
-
queryPostRequest(
|
|
3263
|
+
queryPostRequest(commitmentHash: HexString): Promise<PostRequestWithStatus | undefined>;
|
|
3264
3264
|
/**
|
|
3265
|
-
* Queries a request by any of its associated hashes
|
|
3266
|
-
* Statuses will be one of SOURCE, HYPERBRIDGE_DELIVERED and DESTINATION
|
|
3267
|
-
* @param hash - Can be commitment, hyperbridge tx hash, source tx hash, destination tx hash, or timeout tx hash
|
|
3268
|
-
* @returns Latest status and block metadata of the request
|
|
3265
|
+
* Queries a GET request by any of its associated hashes.
|
|
3269
3266
|
*/
|
|
3270
3267
|
queryGetRequest(hash: HexString): Promise<GetRequestWithStatus | undefined>;
|
|
3271
3268
|
/**
|
|
3272
|
-
* Queries the response associated with a specific request ID and returns its commitment
|
|
3273
|
-
* @param requestId - The ID of the request to find the associated response for
|
|
3274
|
-
* @returns The response associated with the given request ID, or undefined if not found
|
|
3269
|
+
* Queries the response associated with a specific request ID and returns its commitment.
|
|
3275
3270
|
*/
|
|
3276
3271
|
queryResponseByRequestId(requestId: string): Promise<ResponseCommitmentWithValues | undefined>;
|
|
3272
|
+
}
|
|
3273
|
+
|
|
3274
|
+
/**
|
|
3275
|
+
* GET request status tracking — snapshot + streaming flows. Responses travel
|
|
3276
|
+
* back to the origin chain, so finality work happens against `source` rather
|
|
3277
|
+
* than `dest`.
|
|
3278
|
+
*/
|
|
3279
|
+
declare class GetRequestClient {
|
|
3280
|
+
private readonly ctx;
|
|
3281
|
+
private readonly queries;
|
|
3282
|
+
private readonly logger;
|
|
3283
|
+
constructor(ctx: ClientContext, queries: Queries);
|
|
3277
3284
|
/**
|
|
3278
|
-
* Enhances a request with finality events
|
|
3279
|
-
*
|
|
3280
|
-
* This method augments a request object with additional inferred status events
|
|
3281
|
-
* that represent chain finality confirmations. It adds:
|
|
3282
|
-
* - SOURCE_FINALIZED: When the source chain has finalized the request
|
|
3283
|
-
* - HYPERBRIDGE_FINALIZED: When Hyperbridge has finalized the delivery confirmation
|
|
3284
|
-
*
|
|
3285
|
-
* The method also generates appropriate calldata for submitting cross-chain proofs
|
|
3286
|
-
* when applicable.
|
|
3287
|
-
*
|
|
3288
|
-
* @param request - The request to enhance with finality events
|
|
3289
|
-
* @returns The request with finality events added
|
|
3290
|
-
* @private
|
|
3285
|
+
* Enhances a GET request with finality events (`SOURCE_FINALIZED`,
|
|
3286
|
+
* `HYPERBRIDGE_FINALIZED`).
|
|
3291
3287
|
*/
|
|
3292
|
-
|
|
3288
|
+
addGetRequestFinalityEvents(request: GetRequestWithStatus): Promise<GetRequestWithStatus>;
|
|
3293
3289
|
/**
|
|
3294
|
-
*
|
|
3295
|
-
* chain state necessary for timeout processing.
|
|
3296
|
-
*
|
|
3297
|
-
* This method enhances a request object with additional status events related to the
|
|
3298
|
-
* timeout flow, including:
|
|
3299
|
-
* - PENDING_TIMEOUT: When a request has passed its timeout timestamp
|
|
3300
|
-
* - DESTINATION_FINALIZED: When the destination chain has finalized the timeout timestamp
|
|
3301
|
-
* - HYPERBRIDGE_FINALIZED_TIMEOUT: When hyperbridge has finalized the timeout state
|
|
3302
|
-
*
|
|
3303
|
-
* The method also generates appropriate calldata for submitting timeout proofs.
|
|
3304
|
-
*
|
|
3305
|
-
* @param request - Request to fill timeout events for
|
|
3306
|
-
* @returns Request with timeout events filled in, including any proof calldata for timeout submissions
|
|
3307
|
-
* @private
|
|
3290
|
+
* Snapshot query with all inferred finality events sorted.
|
|
3308
3291
|
*/
|
|
3309
|
-
|
|
3292
|
+
queryGetRequestWithStatus(hash: HexString): Promise<GetRequestWithStatus | undefined>;
|
|
3310
3293
|
/**
|
|
3311
|
-
*
|
|
3312
|
-
*
|
|
3313
|
-
* @param hash - Commitment hash
|
|
3314
|
-
* @returns Full request data with all inferred status events, including SOURCE_FINALIZED and HYPERBRIDGE_FINALIZED
|
|
3315
|
-
* @remarks Unlike queryRequest(), this method adds derived finalization status events by querying state machine updates
|
|
3294
|
+
* Streaming status updates for a GET request. Ends when the request reaches
|
|
3295
|
+
* the destination or a timeout becomes pending.
|
|
3316
3296
|
*/
|
|
3317
|
-
|
|
3297
|
+
getRequestStatusStream(hash: HexString): AsyncGenerator<RequestStatusWithMetadata, void>;
|
|
3298
|
+
private streamInternal;
|
|
3318
3299
|
/**
|
|
3319
|
-
*
|
|
3320
|
-
*
|
|
3321
|
-
*
|
|
3322
|
-
*
|
|
3323
|
-
* @remarks Unlike queryGetRequest(), this method adds derived finalization status events by querying state machine updates
|
|
3300
|
+
* Snapshot helper: returns the `HYPERBRIDGE_FINALIZED` event with source-chain
|
|
3301
|
+
* calldata if prerequisites are met, or `undefined` if we're still waiting
|
|
3302
|
+
* for a consensus proof.
|
|
3303
|
+
* Requires the matching response to already exist in the indexer.
|
|
3324
3304
|
*/
|
|
3325
|
-
|
|
3305
|
+
private buildFinalized;
|
|
3326
3306
|
/**
|
|
3327
|
-
*
|
|
3328
|
-
*
|
|
3329
|
-
*
|
|
3330
|
-
*
|
|
3331
|
-
*
|
|
3332
|
-
*
|
|
3333
|
-
*
|
|
3334
|
-
* The method also generates appropriate calldata for submitting cross-chain proofs
|
|
3335
|
-
* when applicable.
|
|
3336
|
-
*
|
|
3337
|
-
* @param request - The GET request to enhance with finality events
|
|
3338
|
-
* @returns The request with finality events added
|
|
3339
|
-
* @private
|
|
3307
|
+
* Streaming helper: waits (via `waitOrAbort`) for the consensus proof or
|
|
3308
|
+
* state machine update, fetches the messaging proof, and returns the
|
|
3309
|
+
* finalized event. Caller has already observed `HYPERBRIDGE_DELIVERED` and
|
|
3310
|
+
* provides the index into `request.statuses` that carries it plus the
|
|
3311
|
+
* indexed response (looked up separately because GET responses live in a
|
|
3312
|
+
* different GraphQL entity from requests).
|
|
3340
3313
|
*/
|
|
3341
|
-
private
|
|
3314
|
+
private streamFinalized;
|
|
3315
|
+
}
|
|
3316
|
+
|
|
3317
|
+
/**
|
|
3318
|
+
* POST request lifecycle — snapshot status, streaming status, and the full
|
|
3319
|
+
* timeout flow (pending → destination-finalized → hyperbridge-finalized → timed-out).
|
|
3320
|
+
* Also hosts `aggregateTransactionWithCommitment`, which relays a dispatched
|
|
3321
|
+
* post request through Hyperbridge from source-chain state.
|
|
3322
|
+
*/
|
|
3323
|
+
declare class PostRequestClient {
|
|
3324
|
+
private readonly ctx;
|
|
3325
|
+
private readonly queries;
|
|
3326
|
+
private readonly logger;
|
|
3327
|
+
constructor(ctx: ClientContext, queries: Queries);
|
|
3342
3328
|
/**
|
|
3343
|
-
*
|
|
3344
|
-
*
|
|
3345
|
-
* If the stream yields TimeoutStatus.PENDING_TIMEOUT, use postRequestTimeoutStream() to begin timeout processing.
|
|
3346
|
-
* @param hash - Can be commitment, hyperbridge tx hash, source tx hash, destination tx hash, or timeout tx hash
|
|
3347
|
-
* @returns AsyncGenerator that emits status updates until a terminal state is reached
|
|
3348
|
-
* @example
|
|
3349
|
-
*
|
|
3350
|
-
* let client = new IndexerClient(config)
|
|
3351
|
-
* let stream = client.postRequestStatusStream(hash)
|
|
3352
|
-
*
|
|
3353
|
-
* // you can use a for-await-of loop
|
|
3354
|
-
* for await (const status of stream) {
|
|
3355
|
-
* console.log(status)
|
|
3356
|
-
* }
|
|
3357
|
-
*
|
|
3358
|
-
* // you can also use a while loop
|
|
3359
|
-
* while (true) {
|
|
3360
|
-
* const status = await stream.next()
|
|
3361
|
-
* if (status.done) {
|
|
3362
|
-
* break
|
|
3363
|
-
* }
|
|
3364
|
-
* console.log(status.value)
|
|
3365
|
-
* }
|
|
3366
|
-
*
|
|
3329
|
+
* Enhances a request with finality events by querying state machine updates.
|
|
3330
|
+
* Adds `SOURCE_FINALIZED` and `HYPERBRIDGE_FINALIZED` when applicable.
|
|
3367
3331
|
*/
|
|
3368
|
-
|
|
3369
|
-
timeoutStream(timeoutTimestamp: bigint, chain: IChain): AsyncGenerator<RequestStatusWithMetadata, void>;
|
|
3332
|
+
addRequestFinalityEvents(request: PostRequestWithStatus): Promise<PostRequestWithStatus>;
|
|
3370
3333
|
/**
|
|
3371
|
-
*
|
|
3372
|
-
* @param hash - Can be commitment, hyperbridge tx hash, source tx hash, destination tx hash, or timeout tx hash
|
|
3373
|
-
* @returns AsyncGenerator that emits status updates until a terminal state is reached
|
|
3334
|
+
* Snapshot query: request + all inferred finality/timeout events, sorted.
|
|
3374
3335
|
*/
|
|
3375
|
-
|
|
3376
|
-
private sleep_for;
|
|
3377
|
-
private sleep_for_interval;
|
|
3336
|
+
queryRequestWithStatus(hash: HexString): Promise<PostRequestWithStatus | undefined>;
|
|
3378
3337
|
/**
|
|
3379
|
-
*
|
|
3380
|
-
*
|
|
3381
|
-
* If the stream yields TimeoutStatus.PENDING_TIMEOUT, use postRequestTimeoutStream() to begin timeout processing.
|
|
3382
|
-
* @param hash - Can be commitment, hyperbridge tx hash, source tx hash, destination tx hash, or timeout tx hash
|
|
3383
|
-
* @returns AsyncGenerator that emits status updates until a terminal state is reached
|
|
3384
|
-
* @example
|
|
3385
|
-
*
|
|
3386
|
-
* let client = new IndexerClient(config)
|
|
3387
|
-
* let stream = client.getRequestStatusStream(hash)
|
|
3388
|
-
*
|
|
3389
|
-
* // you can use a for-await-of loop
|
|
3390
|
-
* for await (const status of stream) {
|
|
3391
|
-
* console.log(status)
|
|
3392
|
-
* }
|
|
3393
|
-
*
|
|
3394
|
-
* // you can also use a while loop
|
|
3395
|
-
* while (true) {
|
|
3396
|
-
* const status = await stream.next()
|
|
3397
|
-
* if (status.done) {
|
|
3398
|
-
* break
|
|
3399
|
-
* }
|
|
3400
|
-
* console.log(status.value)
|
|
3401
|
-
* }
|
|
3402
|
-
*
|
|
3338
|
+
* Streaming status updates for a post request. Ends when the request reaches
|
|
3339
|
+
* the destination or a timeout becomes pending.
|
|
3403
3340
|
*/
|
|
3404
|
-
|
|
3341
|
+
postRequestStatusStream(hash: HexString): AsyncGenerator<RequestStatusWithMetadata, void>;
|
|
3342
|
+
private streamStatusInternal;
|
|
3405
3343
|
/**
|
|
3406
|
-
*
|
|
3407
|
-
*
|
|
3408
|
-
*
|
|
3344
|
+
* Populates timeout-related status events (`PENDING_TIMEOUT`,
|
|
3345
|
+
* `DESTINATION_FINALIZED_TIMEOUT`, `HYPERBRIDGE_FINALIZED_TIMEOUT`) and the
|
|
3346
|
+
* accompanying timeout-proof calldata.
|
|
3409
3347
|
*/
|
|
3410
|
-
|
|
3348
|
+
addTimeoutFinalityEvents(request: PostRequestWithStatus): Promise<PostRequestWithStatus>;
|
|
3411
3349
|
/**
|
|
3412
|
-
*
|
|
3413
|
-
* @param hash - Can be commitment, hyperbridge tx hash, source tx hash, destination tx hash, or timeout tx hash
|
|
3414
|
-
* @returns AsyncGenerator that emits status updates until a terminal state is reached
|
|
3415
|
-
* @example
|
|
3416
|
-
*
|
|
3417
|
-
* let client = new IndexerClient(config)
|
|
3418
|
-
* let stream = client.postRequestTimeoutStream(hash)
|
|
3419
|
-
*
|
|
3420
|
-
* // you can use a for-await-of loop
|
|
3421
|
-
* for await (const status of stream) {
|
|
3422
|
-
* console.log(status)
|
|
3423
|
-
* }
|
|
3424
|
-
*
|
|
3425
|
-
* // you can also use a while loop
|
|
3426
|
-
* while (true) {
|
|
3427
|
-
* const status = await stream.next()
|
|
3428
|
-
* if (status.done) {
|
|
3429
|
-
* break
|
|
3430
|
-
* }
|
|
3431
|
-
* console.log(status.value)
|
|
3432
|
-
* }
|
|
3350
|
+
* Streaming status updates for a timed-out post request.
|
|
3433
3351
|
*/
|
|
3434
3352
|
postRequestTimeoutStream(hash: HexString): AsyncGenerator<PostRequestTimeoutStatus, void>;
|
|
3353
|
+
private streamTimeoutInternal;
|
|
3435
3354
|
/**
|
|
3436
|
-
*
|
|
3437
|
-
*
|
|
3438
|
-
*
|
|
3355
|
+
* Snapshot helper: returns the `HYPERBRIDGE_FINALIZED` event with relayer
|
|
3356
|
+
* calldata if prerequisites are met, or `undefined` if we're still waiting
|
|
3357
|
+
* for a consensus proof.
|
|
3439
3358
|
*/
|
|
3440
|
-
|
|
3359
|
+
private buildFinalized;
|
|
3441
3360
|
/**
|
|
3442
|
-
*
|
|
3443
|
-
*
|
|
3444
|
-
*
|
|
3445
|
-
*
|
|
3446
|
-
* @throws Last encountered error after all retries are exhausted
|
|
3447
|
-
*
|
|
3448
|
-
* @example
|
|
3449
|
-
* const result = await this.withRetry(() => this.queryStatus(hash));
|
|
3361
|
+
* Streaming helper: waits for the consensus proof, fetches the messaging
|
|
3362
|
+
* proof with retry, and returns the finalized event. Caller has already
|
|
3363
|
+
* observed `HYPERBRIDGE_DELIVERED` and provides the index into
|
|
3364
|
+
* `request.statuses` that carries it.
|
|
3450
3365
|
*/
|
|
3451
|
-
private
|
|
3366
|
+
private streamFinalized;
|
|
3452
3367
|
/**
|
|
3453
|
-
*
|
|
3454
|
-
*
|
|
3455
|
-
* @returns The order with its status if found, undefined otherwise
|
|
3368
|
+
* Retry-wrapped `hyperbridge.queryProof`. Fails after 6 retries (~2 minutes at
|
|
3369
|
+
* 2s backoff) so a hung Hyperbridge node doesn't stall the stream forever.
|
|
3456
3370
|
*/
|
|
3457
|
-
|
|
3371
|
+
private fetchProofWithRetry;
|
|
3458
3372
|
/**
|
|
3459
|
-
*
|
|
3460
|
-
*
|
|
3461
|
-
|
|
3462
|
-
|
|
3463
|
-
|
|
3373
|
+
* Relay a post-request to Hyperbridge from source-chain state, returning
|
|
3374
|
+
* the finalized Hyperbridge extrinsic receipt.
|
|
3375
|
+
*/
|
|
3376
|
+
aggregateTransactionWithCommitment(commitment: HexString): Promise<Awaited<ReturnType<SubstrateChain["submitUnsigned"]>>>;
|
|
3377
|
+
}
|
|
3378
|
+
|
|
3379
|
+
/**
|
|
3380
|
+
* Shared dependencies passed to every sub-module of {@link IsmpClient}.
|
|
3381
|
+
*
|
|
3382
|
+
* Sub-modules read their chain configuration, GraphQL client, logger, and
|
|
3383
|
+
* retry helpers off of this object rather than reaching back into the facade.
|
|
3384
|
+
*
|
|
3385
|
+
* Internal — not part of the public SDK surface.
|
|
3386
|
+
*/
|
|
3387
|
+
interface ClientContext {
|
|
3388
|
+
/** Chain configuration + indexer poll interval. `pollInterval` is guaranteed set. */
|
|
3389
|
+
config: ClientConfig & {
|
|
3390
|
+
pollInterval: number;
|
|
3391
|
+
};
|
|
3392
|
+
/** GraphQL client used to query the Hyperbridge indexer. */
|
|
3393
|
+
graphql: IndexerQueryClient;
|
|
3394
|
+
/** Structured logger (tag-scoped per sub-module). */
|
|
3395
|
+
logger: ConsolaInstance;
|
|
3396
|
+
/** Default retry config — sub-modules may override per-call. */
|
|
3397
|
+
defaultRetryConfig: RetryConfig;
|
|
3398
|
+
}
|
|
3399
|
+
/**
|
|
3400
|
+
* `IsmpClient` tracks ISMP POST/GET requests and their timeout flows across
|
|
3401
|
+
* source, Hyperbridge, and destination chains.
|
|
3402
|
+
*
|
|
3403
|
+
* The client:
|
|
3404
|
+
* - queries the Hyperbridge indexer for request status,
|
|
3405
|
+
* - augments status trails with derived finality events (`SOURCE_FINALIZED`,
|
|
3406
|
+
* `HYPERBRIDGE_FINALIZED`, timeout events),
|
|
3407
|
+
* - streams live updates while a request is in flight, and
|
|
3408
|
+
* - generates the calldata a relayer needs to finalize a request on the
|
|
3409
|
+
* counterparty chain (including the HandlerV2 batch path).
|
|
3410
|
+
*
|
|
3411
|
+
* The RPC URLs in {@link ClientConfig} must point to archive nodes — timeout
|
|
3412
|
+
* and challenge-period flows reach back into older blocks for storage proofs.
|
|
3413
|
+
*
|
|
3414
|
+
* @example
|
|
3415
|
+
* ```typescript
|
|
3416
|
+
* const client = new IsmpClient({
|
|
3417
|
+
* queryClient,
|
|
3418
|
+
* source: sourceChain,
|
|
3419
|
+
* dest: destChain,
|
|
3420
|
+
* hyperbridge: hyperbridgeChain,
|
|
3421
|
+
* pollInterval: 2000,
|
|
3422
|
+
* })
|
|
3423
|
+
*
|
|
3424
|
+
* const status = await client.queryRequestWithStatus("0x1234...")
|
|
3425
|
+
*
|
|
3426
|
+
* for await (const update of client.postRequestStatusStream("0x1234...")) {
|
|
3427
|
+
* console.log(`Request status: ${update.status}`)
|
|
3428
|
+
* }
|
|
3429
|
+
* ```
|
|
3430
|
+
*/
|
|
3431
|
+
declare class IsmpClient {
|
|
3432
|
+
/** Shared context threaded through every sub-module. */
|
|
3433
|
+
protected readonly ctx: ClientContext;
|
|
3434
|
+
/** Indexer read-only queries (state machine updates, post/get requests). */
|
|
3435
|
+
protected readonly queries: Queries;
|
|
3436
|
+
/** POST request lifecycle: snapshot + streaming status, timeout flow, aggregation. */
|
|
3437
|
+
protected readonly postRequest: PostRequestClient;
|
|
3438
|
+
/** GET request snapshot + streaming status. */
|
|
3439
|
+
protected readonly getRequest: GetRequestClient;
|
|
3440
|
+
constructor(config: PartialClientConfig);
|
|
3441
|
+
/** Source chain instance. */
|
|
3442
|
+
get source(): IChain;
|
|
3443
|
+
/** Destination chain instance. */
|
|
3444
|
+
get dest(): IChain;
|
|
3445
|
+
/** Hyperbridge chain instance. */
|
|
3446
|
+
get hyperbridge(): IChain;
|
|
3447
|
+
/**
|
|
3448
|
+
* Query for the first state machine update at or after `height` for the given
|
|
3449
|
+
* state machine on the indicated counterparty chain.
|
|
3464
3450
|
*
|
|
3465
|
-
*
|
|
3466
|
-
|
|
3451
|
+
* @returns The matching update, or `undefined` if none has been indexed yet.
|
|
3452
|
+
*/
|
|
3453
|
+
queryStateMachineUpdateByHeight(args: {
|
|
3454
|
+
/** State machine id whose commitment is being looked up (e.g. `EVM-1`). */
|
|
3455
|
+
statemachineId: string;
|
|
3456
|
+
/** Chain id where the update was applied (e.g. `POLKADOT-3367`). */
|
|
3457
|
+
chain: string;
|
|
3458
|
+
/** Lower bound on the update height. */
|
|
3459
|
+
height: number;
|
|
3460
|
+
}): Promise<StateMachineUpdate | undefined>;
|
|
3461
|
+
/**
|
|
3462
|
+
* Query for the first state machine update whose commitment timestamp is at
|
|
3463
|
+
* or after `commitmentTimestamp`. Used by timeout flows to find when a
|
|
3464
|
+
* counterparty chain finalized a state past the request's deadline.
|
|
3465
|
+
*/
|
|
3466
|
+
queryStateMachineUpdateByTimestamp(args: {
|
|
3467
|
+
statemachineId: string;
|
|
3468
|
+
commitmentTimestamp: bigint;
|
|
3469
|
+
chain: string;
|
|
3470
|
+
}): Promise<StateMachineUpdate | undefined>;
|
|
3471
|
+
/**
|
|
3472
|
+
* Returns the latest known state machine height for a given state machine,
|
|
3473
|
+
* or `undefined` if the indexer has no record yet.
|
|
3474
|
+
*/
|
|
3475
|
+
queryLatestStateMachineHeight(args: {
|
|
3476
|
+
statemachineId: string;
|
|
3477
|
+
chain: string;
|
|
3478
|
+
}): Promise<bigint | undefined>;
|
|
3479
|
+
/**
|
|
3480
|
+
* Queries a POST request by any of its associated hashes (commitment,
|
|
3481
|
+
* source/destination/hyperbridge tx hash, or timeout tx hash). Returns the
|
|
3482
|
+
* raw indexed record without derived finality events.
|
|
3483
|
+
*/
|
|
3484
|
+
queryPostRequest(commitmentHash: HexString): Promise<PostRequestWithStatus | undefined>;
|
|
3485
|
+
/**
|
|
3486
|
+
* Queries a GET request by any of its associated hashes. Returns the raw
|
|
3487
|
+
* indexed record without derived finality events.
|
|
3488
|
+
*/
|
|
3489
|
+
queryGetRequest(hash: HexString): Promise<GetRequestWithStatus | undefined>;
|
|
3490
|
+
/**
|
|
3491
|
+
* Queries the response a GET request's values come from, by the request's id.
|
|
3492
|
+
* Returns the response commitment plus the indexed storage values.
|
|
3493
|
+
*/
|
|
3494
|
+
queryResponseByRequestId(requestId: string): Promise<ResponseCommitmentWithValues | undefined>;
|
|
3495
|
+
/**
|
|
3496
|
+
* Snapshot query for a POST request: returns the indexed record with all
|
|
3497
|
+
* inferred finality and timeout events (`SOURCE_FINALIZED`,
|
|
3498
|
+
* `HYPERBRIDGE_FINALIZED`, `PENDING_TIMEOUT`, …) sorted by progress weight.
|
|
3467
3499
|
*
|
|
3468
|
-
*
|
|
3469
|
-
*
|
|
3470
|
-
|
|
3471
|
-
|
|
3500
|
+
* Unlike {@link postRequestStatusStream} this does not poll; each call
|
|
3501
|
+
* returns a fresh snapshot based on the indexer's current state.
|
|
3502
|
+
*/
|
|
3503
|
+
queryRequestWithStatus(hash: HexString): Promise<PostRequestWithStatus | undefined>;
|
|
3504
|
+
/**
|
|
3505
|
+
* Streams status updates for a POST request as it progresses through the
|
|
3506
|
+
* source → Hyperbridge → destination lifecycle. Ends when the request
|
|
3507
|
+
* reaches its destination or its timeout becomes pending.
|
|
3472
3508
|
*
|
|
3473
|
-
*
|
|
3474
|
-
*
|
|
3475
|
-
*
|
|
3476
|
-
*
|
|
3477
|
-
* break
|
|
3478
|
-
* }
|
|
3479
|
-
* console.log(status.value)
|
|
3480
|
-
* }
|
|
3509
|
+
* Yields the `HYPERBRIDGE_FINALIZED` event with relayer calldata attached —
|
|
3510
|
+
* this is the calldata a caller submits to the destination handler to
|
|
3511
|
+
* deliver the request (bundled `handleConsensus` + `handlePostRequests` via
|
|
3512
|
+
* `batchCall`).
|
|
3481
3513
|
*/
|
|
3482
|
-
|
|
3483
|
-
|
|
3484
|
-
|
|
3485
|
-
|
|
3486
|
-
|
|
3487
|
-
|
|
3488
|
-
|
|
3489
|
-
|
|
3490
|
-
|
|
3491
|
-
}, void>;
|
|
3492
|
-
tokenGatewayAssetTeleportedStatusStream(commitment: HexString): AsyncGenerator<{
|
|
3493
|
-
status: TeleportStatus;
|
|
3494
|
-
metadata: {
|
|
3495
|
-
blockHash: string;
|
|
3496
|
-
blockNumber: number;
|
|
3497
|
-
transactionHash: string;
|
|
3498
|
-
timestamp: bigint;
|
|
3499
|
-
};
|
|
3500
|
-
}, void>;
|
|
3501
|
-
private queryTokenGatewayAssetTeleported;
|
|
3514
|
+
postRequestStatusStream(hash: HexString): AsyncGenerator<RequestStatusWithMetadata, void>;
|
|
3515
|
+
/**
|
|
3516
|
+
* Streams timeout status updates for a POST request past its
|
|
3517
|
+
* `timeoutTimestamp`. Drives the `PENDING_TIMEOUT →
|
|
3518
|
+
* DESTINATION_FINALIZED_TIMEOUT → HYPERBRIDGE_FINALIZED_TIMEOUT → TIMED_OUT`
|
|
3519
|
+
* progression, submitting unsigned extrinsics to Hyperbridge where required
|
|
3520
|
+
* and yielding source-chain timeout calldata at the final step.
|
|
3521
|
+
*/
|
|
3522
|
+
postRequestTimeoutStream(hash: HexString): AsyncGenerator<PostRequestTimeoutStatus, void>;
|
|
3502
3523
|
/**
|
|
3503
|
-
*
|
|
3504
|
-
*
|
|
3505
|
-
*
|
|
3524
|
+
* Relays a POST request to Hyperbridge from source-chain state (when the
|
|
3525
|
+
* request wasn't aggregated there yet) and returns the finalized Hyperbridge
|
|
3526
|
+
* extrinsic receipt. Used to bootstrap status tracking for requests that
|
|
3527
|
+
* Hyperbridge hasn't seen.
|
|
3506
3528
|
*/
|
|
3507
3529
|
aggregateTransactionWithCommitment(commitment: HexString): Promise<Awaited<ReturnType<SubstrateChain["submitUnsigned"]>>>;
|
|
3508
|
-
|
|
3509
|
-
|
|
3510
|
-
|
|
3511
|
-
|
|
3512
|
-
|
|
3530
|
+
/**
|
|
3531
|
+
* Snapshot query for a GET request: returns the indexed record with all
|
|
3532
|
+
* inferred finality events (`SOURCE_FINALIZED`, `HYPERBRIDGE_FINALIZED`)
|
|
3533
|
+
* sorted by progress weight.
|
|
3534
|
+
*/
|
|
3535
|
+
queryGetRequestWithStatus(hash: HexString): Promise<GetRequestWithStatus | undefined>;
|
|
3536
|
+
/**
|
|
3537
|
+
* Streams status updates for a GET request. Ends when the response is
|
|
3538
|
+
* delivered back to the source chain or the request's timeout elapses.
|
|
3539
|
+
* Yields the `HYPERBRIDGE_FINALIZED` event with source-chain calldata for
|
|
3540
|
+
* submitting the response (bundled `handleConsensus` + `handleGetResponses`
|
|
3541
|
+
* via `batchCall`).
|
|
3542
|
+
*/
|
|
3543
|
+
getRequestStatusStream(hash: HexString): AsyncGenerator<RequestStatusWithMetadata, void>;
|
|
3544
|
+
/**
|
|
3545
|
+
* Low-level watcher that yields a single `PENDING_TIMEOUT` event once
|
|
3546
|
+
* `chain.timestamp()` passes `timeoutTimestamp`. Used internally by the
|
|
3547
|
+
* status streams; exposed for callers that want to race their own logic
|
|
3548
|
+
* against a request's deadline.
|
|
3549
|
+
*/
|
|
3550
|
+
timeoutStream(timeoutTimestamp: bigint, chain: IChain): AsyncGenerator<RequestStatusWithMetadata, void>;
|
|
3513
3551
|
}
|
|
3514
3552
|
interface PartialClientConfig extends Omit<ClientConfig, "pollInterval"> {
|
|
3515
3553
|
pollInterval?: number;
|
|
@@ -4174,7 +4212,7 @@ declare class IntentGateway {
|
|
|
4174
4212
|
* Defaults to `false` (source-side cancellation).
|
|
4175
4213
|
* @yields {@link CancelEvent} objects describing each cancellation stage.
|
|
4176
4214
|
*/
|
|
4177
|
-
cancelOrder(order: Order, indexerClient:
|
|
4215
|
+
cancelOrder(order: Order, indexerClient: IsmpClient, fromDest?: boolean): AsyncGenerator<CancelEvent>;
|
|
4178
4216
|
/**
|
|
4179
4217
|
* Constructs a signed `PackedUserOperation` for a solver to submit as a bid.
|
|
4180
4218
|
*
|
|
@@ -4250,6 +4288,50 @@ declare class IntentGateway {
|
|
|
4250
4288
|
* in the `_orders` mapping on the source chain.
|
|
4251
4289
|
*/
|
|
4252
4290
|
isOrderRefunded(order: Order): Promise<boolean>;
|
|
4291
|
+
/**
|
|
4292
|
+
* Optional indexer context for {@link queryOrder} / {@link orderStatusStream}.
|
|
4293
|
+
* Configured via {@link withQueryClient}; unset by default since not every
|
|
4294
|
+
* IntentGateway caller needs indexer access.
|
|
4295
|
+
*/
|
|
4296
|
+
private indexer?;
|
|
4297
|
+
/**
|
|
4298
|
+
* Attaches an indexer GraphQL client to this IntentGateway so that
|
|
4299
|
+
* {@link queryOrder} and {@link orderStatusStream} become available.
|
|
4300
|
+
* Returns `this` for chaining.
|
|
4301
|
+
*
|
|
4302
|
+
* @example
|
|
4303
|
+
* ```ts
|
|
4304
|
+
* const gateway = (await IntentGateway.create(source, dest)).withQueryClient(queryClient)
|
|
4305
|
+
* const order = await gateway.queryOrder("0x...")
|
|
4306
|
+
* ```
|
|
4307
|
+
*/
|
|
4308
|
+
withQueryClient(queryClient: IndexerQueryClient, options?: {
|
|
4309
|
+
pollInterval?: number;
|
|
4310
|
+
tracing?: boolean;
|
|
4311
|
+
}): this;
|
|
4312
|
+
private requireIndexer;
|
|
4313
|
+
/**
|
|
4314
|
+
* Queries an order by its commitment hash.
|
|
4315
|
+
*
|
|
4316
|
+
* Requires a prior call to {@link withQueryClient}.
|
|
4317
|
+
*/
|
|
4318
|
+
queryOrder(commitment: HexString): Promise<OrderWithStatus | undefined>;
|
|
4319
|
+
/**
|
|
4320
|
+
* Streams status updates for an order until it reaches a terminal state
|
|
4321
|
+
* (FILLED, REDEEMED, or REFUNDED).
|
|
4322
|
+
*
|
|
4323
|
+
* Requires a prior call to {@link withQueryClient}.
|
|
4324
|
+
*/
|
|
4325
|
+
orderStatusStream(commitment: HexString): AsyncGenerator<{
|
|
4326
|
+
status: OrderStatus;
|
|
4327
|
+
metadata: {
|
|
4328
|
+
blockHash: string;
|
|
4329
|
+
blockNumber: number;
|
|
4330
|
+
transactionHash: string;
|
|
4331
|
+
timestamp: bigint;
|
|
4332
|
+
filler?: string;
|
|
4333
|
+
};
|
|
4334
|
+
}, void>;
|
|
4253
4335
|
}
|
|
4254
4336
|
|
|
4255
4337
|
/**
|
|
@@ -4373,6 +4455,165 @@ declare const PACKED_USEROP_TYPEHASH: `0x${string}`;
|
|
|
4373
4455
|
* IntentGatewayV2 protocol.
|
|
4374
4456
|
*/
|
|
4375
4457
|
declare const DOMAIN_TYPEHASH: `0x${string}`;
|
|
4458
|
+
/**
|
|
4459
|
+
* Crypto and encoding utilities for IntentGatewayV2.
|
|
4460
|
+
*
|
|
4461
|
+
* Provides helpers for EIP-712 domain separation, UserOperation hashing,
|
|
4462
|
+
* gas-limit packing/unpacking, bundler JSON-RPC calls, and ERC-7821
|
|
4463
|
+
* batch-execute encoding and decoding. All methods are stateless with respect
|
|
4464
|
+
* to the protocol but require the shared {@link IntentGatewayContext} for the
|
|
4465
|
+
* bundler URL.
|
|
4466
|
+
*/
|
|
4467
|
+
declare class CryptoUtils {
|
|
4468
|
+
private readonly ctx;
|
|
4469
|
+
/**
|
|
4470
|
+
* @param ctx - Shared IntentsV2 context; used to access the bundler URL for
|
|
4471
|
+
* JSON-RPC calls.
|
|
4472
|
+
*/
|
|
4473
|
+
constructor(ctx: IntentGatewayContext);
|
|
4474
|
+
/**
|
|
4475
|
+
* Computes an EIP-712 domain separator for a given contract.
|
|
4476
|
+
*
|
|
4477
|
+
* @param contractName - Human-readable name of the contract (e.g. `"IntentGateway"`).
|
|
4478
|
+
* @param version - Version string (e.g. `"2"`).
|
|
4479
|
+
* @param chainId - Chain ID of the network the contract is deployed on.
|
|
4480
|
+
* @param contractAddress - Address of the verifying contract.
|
|
4481
|
+
* @returns The 32-byte domain separator as a hex string.
|
|
4482
|
+
*/
|
|
4483
|
+
static getDomainSeparator(contractName: string, version: string, chainId: bigint, contractAddress: HexString): HexString;
|
|
4484
|
+
/**
|
|
4485
|
+
* Signs a `SelectSolver` EIP-712 message with a session key.
|
|
4486
|
+
*
|
|
4487
|
+
* The session key authorises the selection of a specific solver for the
|
|
4488
|
+
* given order commitment. The resulting signature is appended to the
|
|
4489
|
+
* solver's UserOperation signature before bundle submission.
|
|
4490
|
+
*
|
|
4491
|
+
* @param commitment - The order commitment (bytes32) being fulfilled.
|
|
4492
|
+
* @param solverAddress - Address of the solver account selected to fill the order.
|
|
4493
|
+
* @param domainSeparator - EIP-712 domain separator for the IntentGatewayV2 contract.
|
|
4494
|
+
* @param privateKey - Hex-encoded private key of the session key that signs the message.
|
|
4495
|
+
* @returns The ECDSA signature as a hex string, or `null` if signing fails.
|
|
4496
|
+
*/
|
|
4497
|
+
static signSolverSelection(commitment: HexString, solverAddress: HexString, domainSeparator: HexString, privateKey: HexString): Promise<HexString | null>;
|
|
4498
|
+
/**
|
|
4499
|
+
* Computes the EIP-712 hash of a `PackedUserOperation` as defined by
|
|
4500
|
+
* ERC-4337 EntryPoint v0.8.
|
|
4501
|
+
*
|
|
4502
|
+
* @param userOp - The packed UserOperation to hash.
|
|
4503
|
+
* @param entryPoint - Address of the EntryPoint v0.8 contract.
|
|
4504
|
+
* @param chainId - Chain ID of the network on which the operation will execute.
|
|
4505
|
+
* @returns The UserOperation hash as a hex string.
|
|
4506
|
+
*/
|
|
4507
|
+
static computeUserOpHash(userOp: PackedUserOperation, entryPoint: Hex, chainId: bigint): Hex;
|
|
4508
|
+
/**
|
|
4509
|
+
* Computes the EIP-712 struct hash of a `PackedUserOperation`.
|
|
4510
|
+
*
|
|
4511
|
+
* Hashes dynamic fields (`initCode`, `callData`, `paymasterAndData`) before
|
|
4512
|
+
* ABI-encoding so the final hash is a fixed-length 32-byte value.
|
|
4513
|
+
*
|
|
4514
|
+
* @param userOp - The packed UserOperation to hash.
|
|
4515
|
+
* @returns The struct hash as a 32-byte hex string.
|
|
4516
|
+
*/
|
|
4517
|
+
static getPackedUserStructHash(userOp: PackedUserOperation): HexString;
|
|
4518
|
+
/**
|
|
4519
|
+
* Packs `verificationGasLimit` and `callGasLimit` into the ERC-4337
|
|
4520
|
+
* `accountGasLimits` bytes32 field.
|
|
4521
|
+
*
|
|
4522
|
+
* The high 16 bytes hold `verificationGasLimit` and the low 16 bytes hold
|
|
4523
|
+
* `callGasLimit`, matching the EntryPoint v0.8 packed representation.
|
|
4524
|
+
*
|
|
4525
|
+
* @param verificationGasLimit - Gas limit for the account verification step.
|
|
4526
|
+
* @param callGasLimit - Gas limit for the main execution call.
|
|
4527
|
+
* @returns A 32-byte hex string with both limits packed.
|
|
4528
|
+
*/
|
|
4529
|
+
static packGasLimits(verificationGasLimit: bigint, callGasLimit: bigint): HexString;
|
|
4530
|
+
/**
|
|
4531
|
+
* Packs `maxPriorityFeePerGas` and `maxFeePerGas` into the ERC-4337
|
|
4532
|
+
* `gasFees` bytes32 field.
|
|
4533
|
+
*
|
|
4534
|
+
* The high 16 bytes hold `maxPriorityFeePerGas` and the low 16 bytes hold
|
|
4535
|
+
* `maxFeePerGas`, matching the EntryPoint v0.8 packed representation.
|
|
4536
|
+
*
|
|
4537
|
+
* @param maxPriorityFeePerGas - Maximum tip per gas (EIP-1559).
|
|
4538
|
+
* @param maxFeePerGas - Maximum total fee per gas (EIP-1559).
|
|
4539
|
+
* @returns A 32-byte hex string with both fee values packed.
|
|
4540
|
+
*/
|
|
4541
|
+
static packGasFees(maxPriorityFeePerGas: bigint, maxFeePerGas: bigint): HexString;
|
|
4542
|
+
/**
|
|
4543
|
+
* Unpacks the `accountGasLimits` bytes32 field back into its constituent
|
|
4544
|
+
* gas limits.
|
|
4545
|
+
*
|
|
4546
|
+
* @param accountGasLimits - The packed 32-byte gas limits field from a `PackedUserOperation`.
|
|
4547
|
+
* @returns Object with `verificationGasLimit` and `callGasLimit` as bigints.
|
|
4548
|
+
*/
|
|
4549
|
+
static unpackGasLimits(accountGasLimits: HexString): {
|
|
4550
|
+
verificationGasLimit: bigint;
|
|
4551
|
+
callGasLimit: bigint;
|
|
4552
|
+
};
|
|
4553
|
+
/**
|
|
4554
|
+
* Unpacks the `gasFees` bytes32 field back into its constituent fee values.
|
|
4555
|
+
*
|
|
4556
|
+
* @param gasFees - The packed 32-byte gas fees field from a `PackedUserOperation`.
|
|
4557
|
+
* @returns Object with `maxPriorityFeePerGas` and `maxFeePerGas` as bigints.
|
|
4558
|
+
*/
|
|
4559
|
+
static unpackGasFees(gasFees: HexString): {
|
|
4560
|
+
maxPriorityFeePerGas: bigint;
|
|
4561
|
+
maxFeePerGas: bigint;
|
|
4562
|
+
};
|
|
4563
|
+
/**
|
|
4564
|
+
* Converts a packed `PackedUserOperation` into the JSON object format
|
|
4565
|
+
* expected by ERC-4337 bundler JSON-RPC endpoints.
|
|
4566
|
+
*
|
|
4567
|
+
* Unpacks `accountGasLimits` and `gasFees`, separates optional factory and
|
|
4568
|
+
* paymaster fields, and converts all numeric fields to hex strings.
|
|
4569
|
+
*
|
|
4570
|
+
* @param userOp - The packed UserOperation to convert.
|
|
4571
|
+
* @returns A plain object safe to pass as the first element of bundler RPC params.
|
|
4572
|
+
*/
|
|
4573
|
+
static prepareBundlerCall(userOp: PackedUserOperation): Record<string, unknown>;
|
|
4574
|
+
/**
|
|
4575
|
+
* Sends a JSON-RPC request to the configured ERC-4337 bundler endpoint.
|
|
4576
|
+
*
|
|
4577
|
+
* @param method - The JSON-RPC method name (one of {@link BundlerMethod}).
|
|
4578
|
+
* @param params - Array of parameters for the RPC call.
|
|
4579
|
+
* @returns Resolves with the `result` field of the bundler's JSON-RPC response,
|
|
4580
|
+
* typed as `T`.
|
|
4581
|
+
* @throws If the bundler URL is not configured or the bundler returns an error.
|
|
4582
|
+
*/
|
|
4583
|
+
sendBundler<T = unknown>(method: BundlerMethod, params?: unknown[]): Promise<T>;
|
|
4584
|
+
/**
|
|
4585
|
+
* Sends multiple JSON-RPC requests to the bundler in a single HTTP call
|
|
4586
|
+
* using JSON-RPC 2.0 batch syntax. Results are returned in the same order
|
|
4587
|
+
* as the input `requests` array.
|
|
4588
|
+
*
|
|
4589
|
+
* @throws If the bundler URL is not configured, the HTTP call fails, or any
|
|
4590
|
+
* individual response contains an error.
|
|
4591
|
+
*/
|
|
4592
|
+
sendBundlerBatch<T extends unknown[]>(requests: {
|
|
4593
|
+
method: BundlerMethod;
|
|
4594
|
+
params: unknown[];
|
|
4595
|
+
}[]): Promise<T>;
|
|
4596
|
+
/**
|
|
4597
|
+
* Encodes a list of calls into ERC-7821 `execute` calldata using
|
|
4598
|
+
* single-batch mode (`ERC7821_BATCH_MODE`).
|
|
4599
|
+
*
|
|
4600
|
+
* @param calls - Ordered list of calls to batch; each specifies a `target`
|
|
4601
|
+
* address, ETH `value`, and `data`.
|
|
4602
|
+
* @returns ABI-encoded calldata for the ERC-7821 `execute(bytes32,bytes)` function.
|
|
4603
|
+
*/
|
|
4604
|
+
encodeERC7821Execute(calls: ERC7821Call[]): HexString;
|
|
4605
|
+
/**
|
|
4606
|
+
* Decodes ERC-7821 `execute` calldata back into its constituent calls.
|
|
4607
|
+
*
|
|
4608
|
+
* Returns `null` if the calldata does not match the expected `execute`
|
|
4609
|
+
* function signature or cannot be decoded.
|
|
4610
|
+
*
|
|
4611
|
+
* @param callData - Hex-encoded calldata previously produced by
|
|
4612
|
+
* {@link encodeERC7821Execute} or an equivalent encoder.
|
|
4613
|
+
* @returns Array of decoded {@link ERC7821Call} objects, or `null` on failure.
|
|
4614
|
+
*/
|
|
4615
|
+
decodeERC7821Execute(callData: HexString): ERC7821Call[] | null;
|
|
4616
|
+
}
|
|
4376
4617
|
|
|
4377
4618
|
declare const ABI$1: readonly [{
|
|
4378
4619
|
readonly type: "constructor";
|
|
@@ -7883,6 +8124,41 @@ declare class TokenGateway {
|
|
|
7883
8124
|
* @private
|
|
7884
8125
|
*/
|
|
7885
8126
|
private convertNativeToFeeToken;
|
|
8127
|
+
/**
|
|
8128
|
+
* Optional indexer context for {@link queryAssetTeleported} /
|
|
8129
|
+
* {@link assetTeleportedStatusStream}. Configured via {@link withQueryClient}.
|
|
8130
|
+
*/
|
|
8131
|
+
private indexer?;
|
|
8132
|
+
/**
|
|
8133
|
+
* Attaches an indexer GraphQL client so {@link queryAssetTeleported} and
|
|
8134
|
+
* {@link assetTeleportedStatusStream} become available. Returns `this` for chaining.
|
|
8135
|
+
*/
|
|
8136
|
+
withQueryClient(queryClient: IndexerQueryClient, options?: {
|
|
8137
|
+
pollInterval?: number;
|
|
8138
|
+
tracing?: boolean;
|
|
8139
|
+
}): this;
|
|
8140
|
+
private requireIndexer;
|
|
8141
|
+
/**
|
|
8142
|
+
* Queries a token gateway asset-teleported event by commitment hash.
|
|
8143
|
+
*
|
|
8144
|
+
* Requires a prior call to {@link withQueryClient}.
|
|
8145
|
+
*/
|
|
8146
|
+
queryAssetTeleported(commitment: HexString): Promise<TokenGatewayAssetTeleportedWithStatus | undefined>;
|
|
8147
|
+
/**
|
|
8148
|
+
* Streams status updates for an asset-teleported event until a terminal
|
|
8149
|
+
* state (`RECEIVED` or `REFUNDED`).
|
|
8150
|
+
*
|
|
8151
|
+
* Requires a prior call to {@link withQueryClient}.
|
|
8152
|
+
*/
|
|
8153
|
+
assetTeleportedStatusStream(commitment: HexString): AsyncGenerator<{
|
|
8154
|
+
status: TeleportStatus;
|
|
8155
|
+
metadata: {
|
|
8156
|
+
blockHash: string;
|
|
8157
|
+
blockNumber: number;
|
|
8158
|
+
transactionHash: string;
|
|
8159
|
+
timestamp: bigint;
|
|
8160
|
+
};
|
|
8161
|
+
}, void>;
|
|
7886
8162
|
}
|
|
7887
8163
|
|
|
7888
8164
|
/**
|
|
@@ -8375,8 +8651,8 @@ interface ChainConfigData {
|
|
|
8375
8651
|
UniswapV4PoolManager?: `0x${string}`;
|
|
8376
8652
|
/** Uniswap V4 StateView (canonical CREATE2 address) for pool state reads via extsload */
|
|
8377
8653
|
UniswapV4StateView?: `0x${string}`;
|
|
8378
|
-
/** Circle Paymaster
|
|
8379
|
-
|
|
8654
|
+
/** Circle Paymaster contract address (USDC-based ERC-4337 paymaster) */
|
|
8655
|
+
CirclePaymaster?: `0x${string}`;
|
|
8380
8656
|
};
|
|
8381
8657
|
rpcEnvKey?: string;
|
|
8382
8658
|
defaultRpcUrl?: string;
|
|
@@ -8392,4 +8668,4 @@ declare const getChainId: (stateMachineId: string) => number | undefined;
|
|
|
8392
8668
|
declare const getViemChain: (chainId: number) => Chain | undefined;
|
|
8393
8669
|
declare const hyperbridgeAddress = "";
|
|
8394
8670
|
|
|
8395
|
-
export { ADDRESS_ZERO, type AllStatusKey, type AssetTeleported, type AssetTeleportedResponse, type BidStorageEntry, type BidSubmissionResult, type BlockMetadata, type BundlerGasEstimate, BundlerMethod, type CancelEvent, type CancelOptions, type CancelQuote, type ChainConfig, type ChainConfigData, ChainConfigService, Chains, type ClientConfig, DEFAULT_ADDRESS, DEFAULT_GRAFFITI, DOMAIN_TYPEHASH, DUMMY_PRIVATE_KEY, type DecodedOrderPlacedLog, type DecodedPostRequestEvent, type DecodedPostResponseEvent, type DispatchGet, type DispatchInfo, type DispatchPost, ERC20Method, type ERC7821Call, ERC7821_BATCH_MODE, type EstimateFillOrderParams, type EstimateGasCallData, EvmChain, type EvmChainParams, ABI as EvmHostABI, EvmLanguage, type ExecuteIntentOrderOptions, type ExecutionResult, type FillOptions, type FillOrderEstimate, type FillerBid, type FillerConfig, type GetRequestResponse, type GetRequestWithStatus, type GetResponseByRequestIdResponse, type GetResponseStorageValues, type HexString, type HostParams, HyperClientStatus, type HyperbridgeTxEvents, type IChain, type IConfig, type IEvmChain, type IEvmConfig, type IGetRequest, type IGetRequestMessage, type IGetResponse, type IGetResponseMessage, type IHyperbridgeConfig, type IIsmpMessage, type IMessage, type IPharosConfig, type IPolkadotHubConfig, type IPostRequest, type IPostResponse, type IProof, type IRequestMessage, type ISubstrateConfig, type ITimeoutPostRequestMessage,
|
|
8671
|
+
export { ADDRESS_ZERO, type AllStatusKey, type AssetTeleported, type AssetTeleportedResponse, type BidStorageEntry, type BidSubmissionResult, type BlockMetadata, type BundlerGasEstimate, BundlerMethod, type CancelEvent, type CancelOptions, type CancelQuote, type ChainConfig, type ChainConfigData, ChainConfigService, Chains, type ClientConfig, CryptoUtils, DEFAULT_ADDRESS, DEFAULT_GRAFFITI, DOMAIN_TYPEHASH, DUMMY_PRIVATE_KEY, type DecodedOrderPlacedLog, type DecodedPostRequestEvent, type DecodedPostResponseEvent, type DispatchGet, type DispatchInfo, type DispatchPost, ERC20Method, type ERC7821Call, ERC7821_BATCH_MODE, type EstimateFillOrderParams, type EstimateGasCallData, EvmChain, type EvmChainParams, ABI as EvmHostABI, EvmLanguage, type ExecuteIntentOrderOptions, type ExecutionResult, type FillOptions, type FillOrderEstimate, type FillerBid, type FillerConfig, type GetRequestResponse, type GetRequestWithStatus, type GetResponseByRequestIdResponse, type GetResponseStorageValues, type HexString, type HostParams, HyperClientStatus, type HyperbridgeTxEvents, type IBatchConsensusAndGetResponseMessage, type IBatchConsensusAndPostRequestMessage, type IChain, type IConfig, type IConsensusMessage, type IEvmChain, type IEvmConfig, type IGetRequest, type IGetRequestMessage, type IGetResponse, type IGetResponseMessage, type IHyperbridgeConfig, type IIsmpMessage, type IMessage, type IPharosConfig, type IPolkadotHubConfig, type IPostRequest, type IPostResponse, type IProof, type IRequestMessage, type ISubstrateConfig, type ITimeoutPostRequestMessage, type IndexerQueryClient, IntentGateway, type IntentGatewayContext, type IntentGatewayParams, ABI$1 as IntentGatewayV2ABI, IntentOrderStatus, type IntentOrderStatusKey, type IntentOrderStatusUpdate, IntentsCoprocessor, IsmpClient, type IsmpRequest, MOCK_ADDRESS, type NewDeployment, ORDER_V2_PARAM_TYPE, type Order, type OrderResponse, OrderStatus, OrderStatusChecker, type OrderStatusMetadata, type OrderWithStatus, PACKED_USEROP_TYPEHASH, PLACE_ORDER_SELECTOR, type PackedUserOperation, type Params, type PaymentInfo, PharosChain, type PharosChainParams, PolkadotHubChain, type PolkadotHubChainParams, type PostRequestStatus, type PostRequestTimeoutStatus, type PostRequestWithStatus, type QuoteNativeResult, 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 ResumeIntentOrderOptions, type RetryConfig, SELECT_SOLVER_TYPEHASH, STATE_COMMITMENTS_SLOT, type SelectBidResult, type SelectOptions, type SigningAccount, type StateMachineHeight, type StateMachineIdParams, type StateMachineResponse, type StateMachineUpdate, type StorageFacade, type SubmitBidOptions, SubstrateChain, Swap, TESTNET_CHAINS, type TeleportParams, TeleportStatus, TimeoutStatus, type TimeoutStatusKey, TokenGateway, type TokenGatewayAssetTeleportedResponse, type TokenGatewayAssetTeleportedWithStatus, type TokenInfo, type TokenPrice, type TokenPricesResponse, type Transaction, TronChain, type TronChainParams, USE_ETHERSCAN_CHAINS, type XcmGatewayParams, __test, adjustDecimals, bytes20ToBytes32, bytes32ToBytes20, calculateAllowanceMappingLocation, calculateBalanceMappingLocation, chainConfigs, constructRedeemEscrowRequestBody, constructRefundEscrowRequestBody, convertCodecToIGetRequest, convertCodecToIProof, convertIGetRequestToCodec, convertIProofToCodec, convertStateIdToStateMachineId, convertStateMachineEnumToString, convertStateMachineIdToEnum, createEvmChain, createQueryClient, decodeUserOpScale, encodeERC7821ExecuteBatch, encodeISMPMessage, encodeUserOpScale, encodeWithdrawalRequest, estimateGasForPost, fetchPrice, fetchSourceProof, generateRootWithProof, getChainId, getConfigByStateMachineId, getContractCallInput, getGasPriceFromEtherscan, getOrFetchStorageSlot, getOrderPlacedFromTx, getPostRequestEventFromTx, getPostResponseEventFromTx, getRequestCommitment, getStateCommitmentFieldSlot, getStateCommitmentSlot, getStorageSlot, getViemChain, hexToString, hyperbridgeAddress, maxBigInt, orderCommitment, parseStateMachineId, pharosAtlantic, pharosMainnet, polkadotAssetHubPaseo, postRequestCommitment, queryAssetTeleported, queryGetRequest, queryPostRequest, requestCommitmentKey, responseCommitmentKey, retryPromise, teleport, teleportDot, transformOrderForContract, tronChainIds, tronNile };
|