@hyperbridge/sdk 1.9.6 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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
- readonly name: "ChallengePeriodNotElapsed";
18
- readonly type: "error";
19
- }, {
20
- readonly inputs: readonly [];
21
- readonly name: "ConsensusClientExpired";
22
- readonly type: "error";
23
- }, {
24
- readonly inputs: 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: "UnknownMessage";
54
- readonly type: "error";
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 IIsmpHost";
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 IIsmpHost";
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 IIsmpHost";
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 IIsmpHost";
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 IIsmpHost";
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 IIsmpHost";
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 IIsmpHost";
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
- getCirclePaymasterV08Address(chain: string): HexString | undefined;
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
  }>;
@@ -989,6 +1055,14 @@ declare function postRequestCommitment(post: IPostRequest): {
989
1055
  declare function bytes32ToBytes20(bytes32Address: string): HexString;
990
1056
  declare function bytes20ToBytes32(bytes20Address: string): HexString;
991
1057
  declare function hexToString(hex: string): string;
1058
+ declare function normalizeStateMachineId(stateMachineId: string): string;
1059
+ declare function normalizeEvmChainId(chainId: number | string): {
1060
+ chainId: number;
1061
+ stateMachineId: string;
1062
+ };
1063
+ declare function encodeStateMachineId(stateMachineId: string): HexString;
1064
+ declare function normalizeAddressForEvmBytes32(address: string): HexString;
1065
+ declare function normalizeAddressForStateMachine(address: string, stateMachineId: string): HexString;
992
1066
  /**
993
1067
  * Retries a promise-returning operation with exponential backoff.
994
1068
  * This function will attempt to execute the operation up to maxRetries times,
@@ -1264,10 +1338,21 @@ declare class SubstrateChain implements IChain {
1264
1338
  */
1265
1339
  encode(message: IIsmpMessage): HexString;
1266
1340
  /**
1267
- * Returns the index of a pallet by its name, by looking up the pallets in the runtime metadata.
1268
- * @param {string} name - The name of the pallet.
1269
- * @returns {number} The index of the pallet.
1341
+ * Queries the latest proven height for this chain from pallet-ismp.
1342
+ */
1343
+ queryLastProvenHeight(): Promise<bigint>;
1344
+ /**
1345
+ * Queries all consensus proofs needed to catch up from a given on-chain epoch
1346
+ * to the latest proven state. Returns rotation proofs (in order) to advance
1347
+ * the authority set, plus the final messaging proof that covers `neededHeight`.
1348
+ *
1349
+ * @param neededHeight - The Hyperbridge block height that must be covered
1350
+ * @param currentEpoch - The current authority set id on the destination EVM chain
1270
1351
  */
1352
+ queryConsensusProofs(neededHeight: bigint, currentEpoch: bigint): Promise<{
1353
+ proofs: HexString[];
1354
+ provenHeight: bigint;
1355
+ } | undefined>;
1271
1356
  private getPalletIndex;
1272
1357
  }
1273
1358
  /**
@@ -1704,7 +1789,11 @@ declare class PharosChain implements IChain {
1704
1789
  /**
1705
1790
  * Type representing an ISMP message.
1706
1791
  */
1707
- type IIsmpMessage = IRequestMessage | ITimeoutPostRequestMessage | IGetResponseMessage | IGetRequestMessage;
1792
+ type IIsmpMessage = IRequestMessage | ITimeoutPostRequestMessage | IGetResponseMessage | IGetRequestMessage | IConsensusMessage | IBatchConsensusAndPostRequestMessage | IBatchConsensusAndGetResponseMessage;
1793
+ interface IConsensusMessage {
1794
+ kind: "Consensus";
1795
+ consensusProof: HexString;
1796
+ }
1708
1797
  interface IRequestMessage {
1709
1798
  /**
1710
1799
  * The kind of message.
@@ -1787,6 +1876,20 @@ interface ITimeoutPostRequestMessage {
1787
1876
  */
1788
1877
  proof: IProof;
1789
1878
  }
1879
+ interface IBatchConsensusAndPostRequestMessage {
1880
+ kind: "BatchConsensusAndPostRequest";
1881
+ consensusProofs: HexString[];
1882
+ requests: IPostRequest[];
1883
+ proof: IProof;
1884
+ signer: HexString;
1885
+ }
1886
+ interface IBatchConsensusAndGetResponseMessage {
1887
+ kind: "BatchConsensusAndGetResponse";
1888
+ consensusProofs: HexString[];
1889
+ responses: IGetResponse[];
1890
+ proof: IProof;
1891
+ signer: HexString;
1892
+ }
1790
1893
  interface IProof {
1791
1894
  /**
1792
1895
  * The height of the proof.
@@ -1863,6 +1966,8 @@ interface IEvmChain extends IChain {
1863
1966
 
1864
1967
  type EstimateGasCallData = ContractFunctionArgs<typeof _default.ABI, "nonpayable" | "payable", "handlePostRequests">;
1865
1968
  type HexString = `0x${string}`;
1969
+ type StateMachineId = string;
1970
+ type BytesLikeHex = HexString;
1866
1971
  interface IConfig {
1867
1972
  source: IEvmConfig | ISubstrateConfig | IPolkadotHubConfig | IPharosConfig;
1868
1973
  dest: IEvmConfig | ISubstrateConfig | IPolkadotHubConfig | IPharosConfig;
@@ -2317,10 +2422,13 @@ interface ChainConfig {
2317
2422
  */
2318
2423
  interface TokenInfo {
2319
2424
  /**
2320
- * The address of the ERC20 token
2321
- * address(0) is used as a sentinel for the native token
2425
+ * The token identifier as either:
2426
+ * - a standard 20-byte EVM address (`0xabc...`)
2427
+ * - an already padded 32-byte value (`0x000...abc...`)
2428
+ *
2429
+ * `address(0)` / `bytes32(0)` is used as a sentinel for the native token.
2322
2430
  */
2323
- token: HexString;
2431
+ token: BytesLikeHex;
2324
2432
  /**
2325
2433
  * The amount of the token
2326
2434
  */
@@ -2839,7 +2947,8 @@ interface StorageFacade {
2839
2947
  delete(key: string): Promise<void>;
2840
2948
  }
2841
2949
  interface PaymentInfo {
2842
- beneficiary: HexString;
2950
+ /** Accepts a standard 20-byte address; the SDK pads to bytes32 internally when needed. */
2951
+ beneficiary: BytesLikeHex;
2843
2952
  assets: TokenInfo[];
2844
2953
  call: HexString;
2845
2954
  }
@@ -2850,8 +2959,10 @@ interface DispatchInfo {
2850
2959
  interface Order {
2851
2960
  id?: string;
2852
2961
  user: HexString;
2853
- source: HexString;
2854
- destination: HexString;
2962
+ /** Accepts either `"EVM-1"` style IDs or their hex-encoded form. */
2963
+ source: StateMachineId;
2964
+ /** Accepts either `"EVM-42161"` style IDs or their hex-encoded form. */
2965
+ destination: StateMachineId;
2855
2966
  deadline: bigint;
2856
2967
  nonce: bigint;
2857
2968
  fees: bigint;
@@ -2860,6 +2971,10 @@ interface Order {
2860
2971
  inputs: TokenInfo[];
2861
2972
  output: PaymentInfo;
2862
2973
  }
2974
+ interface CancelOrderOptions {
2975
+ /** Where to initiate the cancel from. Defaults to `"source"`. */
2976
+ from?: "source" | "destination";
2977
+ }
2863
2978
  interface FillOptions {
2864
2979
  relayerFee: bigint;
2865
2980
  nativeDispatchFee: bigint;
@@ -2886,7 +3001,7 @@ interface SigningAccount {
2886
3001
  yParity: number;
2887
3002
  }>;
2888
3003
  /**
2889
- * Signs an EIP-712 typed-data payload (e.g. an EIP-2612 USDC permit for the Circle paymaster).
3004
+ * Signs an EIP-712 typed-data payload (e.g. an EIP-2612 USDC permit for the Circle Paymaster).
2890
3005
  * The shape of `typedData` matches viem's `TypedDataDefinition` (domain + types + message).
2891
3006
  */
2892
3007
  signTypedData: (typedData: unknown, chainId?: number) => Promise<HexString>;
@@ -2939,9 +3054,9 @@ interface FillOrderEstimate {
2939
3054
  callGasLimit: bigint;
2940
3055
  verificationGasLimit: bigint;
2941
3056
  preVerificationGas: bigint;
2942
- /** Paymaster verification gas limit from bundler estimate, or Circle's cap if absent. 0n when no paymaster. */
3057
+ /** Paymaster verification gas limit from bundler estimate. 0n when no paymaster. */
2943
3058
  paymasterVerificationGasLimit: bigint;
2944
- /** Paymaster postOp gas limit from bundler estimate, or Circle's cap if absent. 0n when no paymaster. */
3059
+ /** Paymaster postOp gas limit from bundler estimate. 0n when no paymaster. */
2945
3060
  paymasterPostOpGasLimit: bigint;
2946
3061
  maxFeePerGas: bigint;
2947
3062
  maxPriorityFeePerGas: bigint;
@@ -3131,101 +3246,16 @@ type ERC7821Call = {
3131
3246
  };
3132
3247
 
3133
3248
  /**
3134
- * IndexerClient provides methods for interacting with the Hyperbridge indexer.
3135
- *
3136
- * This client facilitates querying and tracking cross-chain requests and their status
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
- * ```
3249
+ * Read-only indexer queries state machine updates, post/get requests, and
3250
+ * response lookups. Groups the thin GraphQL wrappers that other client
3251
+ * sub-modules consume when building finality events and status streams.
3190
3252
  */
3191
- declare class IndexerClient {
3192
- /**
3193
- * GraphQL client used for making requests to the indexer
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;
3253
+ declare class Queries {
3254
+ private readonly ctx;
3255
+ private readonly logger;
3256
+ constructor(ctx: ClientContext);
3223
3257
  /**
3224
3258
  * 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
3259
  */
3230
3260
  queryStateMachineUpdateByHeight({ statemachineId, height, chain, }: {
3231
3261
  statemachineId: string;
@@ -3234,10 +3264,6 @@ declare class IndexerClient {
3234
3264
  }): Promise<StateMachineUpdate | undefined>;
3235
3265
  /**
3236
3266
  * 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
3267
  */
3242
3268
  queryStateMachineUpdateByTimestamp({ statemachineId, commitmentTimestamp, chain, }: {
3243
3269
  statemachineId: string;
@@ -3245,271 +3271,303 @@ declare class IndexerClient {
3245
3271
  chain: string;
3246
3272
  }): Promise<StateMachineUpdate | undefined>;
3247
3273
  /**
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
3274
+ * Query for the latest state machine update height.
3252
3275
  */
3253
3276
  queryLatestStateMachineHeight({ statemachineId, chain, }: {
3254
3277
  statemachineId: string;
3255
3278
  chain: string;
3256
3279
  }): Promise<bigint | undefined>;
3257
3280
  /**
3258
- * Queries a request by CommitmentHash
3259
- *
3260
- * @param commitment_hash - Can be commitment
3261
- * @returns Latest status and block metadata of the request
3281
+ * Queries a POST request by commitment hash.
3262
3282
  */
3263
- queryPostRequest(commitment_hash: HexString): Promise<PostRequestWithStatus | undefined>;
3283
+ queryPostRequest(commitmentHash: HexString): Promise<PostRequestWithStatus | undefined>;
3264
3284
  /**
3265
- * Queries a request by any of its associated hashes and returns it alongside its statuses
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
3285
+ * Queries a GET request by any of its associated hashes.
3269
3286
  */
3270
3287
  queryGetRequest(hash: HexString): Promise<GetRequestWithStatus | undefined>;
3271
3288
  /**
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
3289
+ * Queries the response associated with a specific request ID and returns its commitment.
3275
3290
  */
3276
3291
  queryResponseByRequestId(requestId: string): Promise<ResponseCommitmentWithValues | undefined>;
3292
+ }
3293
+
3294
+ /**
3295
+ * GET request status tracking — snapshot + streaming flows. Responses travel
3296
+ * back to the origin chain, so finality work happens against `source` rather
3297
+ * than `dest`.
3298
+ */
3299
+ declare class GetRequestClient {
3300
+ private readonly ctx;
3301
+ private readonly queries;
3302
+ private readonly logger;
3303
+ constructor(ctx: ClientContext, queries: Queries);
3277
3304
  /**
3278
- * Enhances a request with finality events by querying state machine updates.
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
3305
+ * Enhances a GET request with finality events (`SOURCE_FINALIZED`,
3306
+ * `HYPERBRIDGE_FINALIZED`).
3291
3307
  */
3292
- private addRequestFinalityEvents;
3308
+ addGetRequestFinalityEvents(request: GetRequestWithStatus): Promise<GetRequestWithStatus>;
3293
3309
  /**
3294
- * Adds timeout finality events to a request by querying for relevant timeout proofs and
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
3310
+ * Snapshot query with all inferred finality events sorted.
3308
3311
  */
3309
- private addTimeoutFinalityEvents;
3312
+ queryGetRequestWithStatus(hash: HexString): Promise<GetRequestWithStatus | undefined>;
3310
3313
  /**
3311
- * Queries a request returns it alongside its statuses,
3312
- * including any finalization events.
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
3314
+ * Streaming status updates for a GET request. Ends when the request reaches
3315
+ * the destination or a timeout becomes pending.
3316
3316
  */
3317
- queryRequestWithStatus(hash: HexString): Promise<PostRequestWithStatus | undefined>;
3317
+ getRequestStatusStream(hash: HexString): AsyncGenerator<RequestStatusWithMetadata, void>;
3318
+ private streamInternal;
3318
3319
  /**
3319
- * Queries a GET request and returns it alongside its statuses,
3320
- * including any finalization events.
3321
- * @param hash - Can be commitment, hyperbridge tx hash, source tx hash, destination tx hash, or timeout tx hash
3322
- * @returns Full GET request data with all inferred status events, including SOURCE_FINALIZED and HYPERBRIDGE_FINALIZED
3323
- * @remarks Unlike queryGetRequest(), this method adds derived finalization status events by querying state machine updates
3320
+ * Snapshot helper: returns the `HYPERBRIDGE_FINALIZED` event with source-chain
3321
+ * calldata if prerequisites are met, or `undefined` if we're still waiting
3322
+ * for a consensus proof.
3323
+ * Requires the matching response to already exist in the indexer.
3324
3324
  */
3325
- queryGetRequestWithStatus(hash: HexString): Promise<GetRequestWithStatus | undefined>;
3325
+ private buildFinalized;
3326
3326
  /**
3327
- * Enhances a GET request with finality events by querying state machine updates.
3328
- *
3329
- * This method augments a GET request object with additional inferred status events
3330
- * that represent chain finality confirmations. It adds:
3331
- * - SOURCE_FINALIZED: When the source chain has finalized the request
3332
- * - HYPERBRIDGE_FINALIZED: When Hyperbridge has finalized the delivery confirmation and response is ready
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
3327
+ * Streaming helper: waits (via `waitOrAbort`) for the consensus proof or
3328
+ * state machine update, fetches the messaging proof, and returns the
3329
+ * finalized event. Caller has already observed `HYPERBRIDGE_DELIVERED` and
3330
+ * provides the index into `request.statuses` that carries it plus the
3331
+ * indexed response (looked up separately because GET responses live in a
3332
+ * different GraphQL entity from requests).
3340
3333
  */
3341
- private addGetRequestFinalityEvents;
3334
+ private streamFinalized;
3335
+ }
3336
+
3337
+ /**
3338
+ * POST request lifecycle — snapshot status, streaming status, and the full
3339
+ * timeout flow (pending → destination-finalized → hyperbridge-finalized → timed-out).
3340
+ * Also hosts `aggregateTransactionWithCommitment`, which relays a dispatched
3341
+ * post request through Hyperbridge from source-chain state.
3342
+ */
3343
+ declare class PostRequestClient {
3344
+ private readonly ctx;
3345
+ private readonly queries;
3346
+ private readonly logger;
3347
+ constructor(ctx: ClientContext, queries: Queries);
3342
3348
  /**
3343
- * Create a Stream of status updates for a post request.
3344
- * Stream ends when either the request reaches the destination or times out.
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
- *
3349
+ * Enhances a request with finality events by querying state machine updates.
3350
+ * Adds `SOURCE_FINALIZED` and `HYPERBRIDGE_FINALIZED` when applicable.
3367
3351
  */
3368
- postRequestStatusStream(hash: HexString): AsyncGenerator<RequestStatusWithMetadata, void>;
3369
- timeoutStream(timeoutTimestamp: bigint, chain: IChain): AsyncGenerator<RequestStatusWithMetadata, void>;
3352
+ addRequestFinalityEvents(request: PostRequestWithStatus): Promise<PostRequestWithStatus>;
3370
3353
  /**
3371
- * Create a Stream of status updates
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
3354
+ * Snapshot query: request + all inferred finality/timeout events, sorted.
3374
3355
  */
3375
- private postRequestStatusStreamInternal;
3376
- private sleep_for;
3377
- private sleep_for_interval;
3356
+ queryRequestWithStatus(hash: HexString): Promise<PostRequestWithStatus | undefined>;
3378
3357
  /**
3379
- * Create a Stream of status updates for a get request.
3380
- * Stream ends when either the request reaches the destination or times out.
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
- *
3358
+ * Streaming status updates for a post request. Ends when the request reaches
3359
+ * the destination or a timeout becomes pending.
3403
3360
  */
3404
- getRequestStatusStream(hash: HexString): AsyncGenerator<RequestStatusWithMetadata, void>;
3361
+ postRequestStatusStream(hash: HexString): AsyncGenerator<RequestStatusWithMetadata, void>;
3362
+ private streamStatusInternal;
3405
3363
  /**
3406
- * Create a Stream of status updates
3407
- * @param hash - Can be commitment, hyperbridge tx hash, source tx hash, destination tx hash, or timeout tx hash
3408
- * @returns AsyncGenerator that emits status updates until a terminal state is reached
3364
+ * Populates timeout-related status events (`PENDING_TIMEOUT`,
3365
+ * `DESTINATION_FINALIZED_TIMEOUT`, `HYPERBRIDGE_FINALIZED_TIMEOUT`) and the
3366
+ * accompanying timeout-proof calldata.
3409
3367
  */
3410
- private getRequestStatusStreamInternal;
3368
+ addTimeoutFinalityEvents(request: PostRequestWithStatus): Promise<PostRequestWithStatus>;
3411
3369
  /**
3412
- * Create a Stream of status updates for a timed out post request.
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
- * }
3370
+ * Streaming status updates for a timed-out post request.
3433
3371
  */
3434
3372
  postRequestTimeoutStream(hash: HexString): AsyncGenerator<PostRequestTimeoutStatus, void>;
3373
+ private streamTimeoutInternal;
3435
3374
  /**
3436
- * Create a Stream of status updates for a timed out post request.
3437
- * @param hash - Can be commitment, hyperbridge tx hash, source tx hash, destination tx hash, or timeout tx hash
3438
- * @returns AsyncGenerator that emits status updates until a terminal state is reached
3375
+ * Snapshot helper: returns the `HYPERBRIDGE_FINALIZED` event with relayer
3376
+ * calldata if prerequisites are met, or `undefined` if we're still waiting
3377
+ * for a consensus proof.
3439
3378
  */
3440
- postRequestTimeoutStreamInternal(hash: HexString, signal: AbortSignal): AsyncGenerator<PostRequestTimeoutStatus, void>;
3379
+ private buildFinalized;
3441
3380
  /**
3442
- * Executes an async operation with exponential backoff retry
3443
- * @param operation - Async function to execute
3444
- * @param retryConfig - Optional retry configuration
3445
- * @returns Result of the operation
3446
- * @throws Last encountered error after all retries are exhausted
3447
- *
3448
- * @example
3449
- * const result = await this.withRetry(() => this.queryStatus(hash));
3381
+ * Streaming helper: waits for the consensus proof, fetches the messaging
3382
+ * proof with retry, and returns the finalized event. Caller has already
3383
+ * observed `HYPERBRIDGE_DELIVERED` and provides the index into
3384
+ * `request.statuses` that carries it.
3450
3385
  */
3451
- private withRetry;
3386
+ private streamFinalized;
3452
3387
  /**
3453
- * Query for an order by its commitment hash
3454
- * @param commitment - The commitment hash of the order
3455
- * @returns The order with its status if found, undefined otherwise
3388
+ * Retry-wrapped `hyperbridge.queryProof`. Fails after 6 retries (~2 minutes at
3389
+ * 2s backoff) so a hung Hyperbridge node doesn't stall the stream forever.
3456
3390
  */
3457
- queryOrder(commitment: HexString): Promise<OrderWithStatus | undefined>;
3391
+ private fetchProofWithRetry;
3458
3392
  /**
3459
- * Create a Stream of status updates for an order.
3460
- * Stream ends when the order reaches a terminal state (FILLED, REDEEMED, or REFUNDED).
3461
- * @param commitment - The commitment hash of the order
3462
- * @returns AsyncGenerator that emits status updates until a terminal state is reached
3463
- * @example
3393
+ * Relay a post-request to Hyperbridge from source-chain state, returning
3394
+ * the finalized Hyperbridge extrinsic receipt.
3395
+ */
3396
+ aggregateTransactionWithCommitment(commitment: HexString): Promise<Awaited<ReturnType<SubstrateChain["submitUnsigned"]>>>;
3397
+ }
3398
+
3399
+ /**
3400
+ * Shared dependencies passed to every sub-module of {@link IsmpClient}.
3401
+ *
3402
+ * Sub-modules read their chain configuration, GraphQL client, logger, and
3403
+ * retry helpers off of this object rather than reaching back into the facade.
3404
+ *
3405
+ * Internal — not part of the public SDK surface.
3406
+ */
3407
+ interface ClientContext {
3408
+ /** Chain configuration + indexer poll interval. `pollInterval` is guaranteed set. */
3409
+ config: ClientConfig & {
3410
+ pollInterval: number;
3411
+ };
3412
+ /** GraphQL client used to query the Hyperbridge indexer. */
3413
+ graphql: IndexerQueryClient;
3414
+ /** Structured logger (tag-scoped per sub-module). */
3415
+ logger: ConsolaInstance;
3416
+ /** Default retry config — sub-modules may override per-call. */
3417
+ defaultRetryConfig: RetryConfig;
3418
+ }
3419
+ /**
3420
+ * `IsmpClient` tracks ISMP POST/GET requests and their timeout flows across
3421
+ * source, Hyperbridge, and destination chains.
3422
+ *
3423
+ * The client:
3424
+ * - queries the Hyperbridge indexer for request status,
3425
+ * - augments status trails with derived finality events (`SOURCE_FINALIZED`,
3426
+ * `HYPERBRIDGE_FINALIZED`, timeout events),
3427
+ * - streams live updates while a request is in flight, and
3428
+ * - generates the calldata a relayer needs to finalize a request on the
3429
+ * counterparty chain (including the HandlerV2 batch path).
3430
+ *
3431
+ * The RPC URLs in {@link ClientConfig} must point to archive nodes — timeout
3432
+ * and challenge-period flows reach back into older blocks for storage proofs.
3433
+ *
3434
+ * @example
3435
+ * ```typescript
3436
+ * const client = new IsmpClient({
3437
+ * queryClient,
3438
+ * source: sourceChain,
3439
+ * dest: destChain,
3440
+ * hyperbridge: hyperbridgeChain,
3441
+ * pollInterval: 2000,
3442
+ * })
3443
+ *
3444
+ * const status = await client.queryRequestWithStatus("0x1234...")
3445
+ *
3446
+ * for await (const update of client.postRequestStatusStream("0x1234...")) {
3447
+ * console.log(`Request status: ${update.status}`)
3448
+ * }
3449
+ * ```
3450
+ */
3451
+ declare class IsmpClient {
3452
+ /** Shared context threaded through every sub-module. */
3453
+ protected readonly ctx: ClientContext;
3454
+ /** Indexer read-only queries (state machine updates, post/get requests). */
3455
+ protected readonly queries: Queries;
3456
+ /** POST request lifecycle: snapshot + streaming status, timeout flow, aggregation. */
3457
+ protected readonly postRequest: PostRequestClient;
3458
+ /** GET request snapshot + streaming status. */
3459
+ protected readonly getRequest: GetRequestClient;
3460
+ constructor(config: PartialClientConfig);
3461
+ /** Source chain instance. */
3462
+ get source(): IChain;
3463
+ /** Destination chain instance. */
3464
+ get dest(): IChain;
3465
+ /** Hyperbridge chain instance. */
3466
+ get hyperbridge(): IChain;
3467
+ /**
3468
+ * Query for the first state machine update at or after `height` for the given
3469
+ * state machine on the indicated counterparty chain.
3464
3470
  *
3465
- * let client = new IndexerClient(config)
3466
- * let stream = client.orderStatusStream(commitment)
3471
+ * @returns The matching update, or `undefined` if none has been indexed yet.
3472
+ */
3473
+ queryStateMachineUpdateByHeight(args: {
3474
+ /** State machine id whose commitment is being looked up (e.g. `EVM-1`). */
3475
+ statemachineId: string;
3476
+ /** Chain id where the update was applied (e.g. `POLKADOT-3367`). */
3477
+ chain: string;
3478
+ /** Lower bound on the update height. */
3479
+ height: number;
3480
+ }): Promise<StateMachineUpdate | undefined>;
3481
+ /**
3482
+ * Query for the first state machine update whose commitment timestamp is at
3483
+ * or after `commitmentTimestamp`. Used by timeout flows to find when a
3484
+ * counterparty chain finalized a state past the request's deadline.
3485
+ */
3486
+ queryStateMachineUpdateByTimestamp(args: {
3487
+ statemachineId: string;
3488
+ commitmentTimestamp: bigint;
3489
+ chain: string;
3490
+ }): Promise<StateMachineUpdate | undefined>;
3491
+ /**
3492
+ * Returns the latest known state machine height for a given state machine,
3493
+ * or `undefined` if the indexer has no record yet.
3494
+ */
3495
+ queryLatestStateMachineHeight(args: {
3496
+ statemachineId: string;
3497
+ chain: string;
3498
+ }): Promise<bigint | undefined>;
3499
+ /**
3500
+ * Queries a POST request by any of its associated hashes (commitment,
3501
+ * source/destination/hyperbridge tx hash, or timeout tx hash). Returns the
3502
+ * raw indexed record without derived finality events.
3503
+ */
3504
+ queryPostRequest(commitmentHash: HexString): Promise<PostRequestWithStatus | undefined>;
3505
+ /**
3506
+ * Queries a GET request by any of its associated hashes. Returns the raw
3507
+ * indexed record without derived finality events.
3508
+ */
3509
+ queryGetRequest(hash: HexString): Promise<GetRequestWithStatus | undefined>;
3510
+ /**
3511
+ * Queries the response a GET request's values come from, by the request's id.
3512
+ * Returns the response commitment plus the indexed storage values.
3513
+ */
3514
+ queryResponseByRequestId(requestId: string): Promise<ResponseCommitmentWithValues | undefined>;
3515
+ /**
3516
+ * Snapshot query for a POST request: returns the indexed record with all
3517
+ * inferred finality and timeout events (`SOURCE_FINALIZED`,
3518
+ * `HYPERBRIDGE_FINALIZED`, `PENDING_TIMEOUT`, …) sorted by progress weight.
3467
3519
  *
3468
- * // you can use a for-await-of loop
3469
- * for await (const status of stream) {
3470
- * console.log(status)
3471
- * }
3520
+ * Unlike {@link postRequestStatusStream} this does not poll; each call
3521
+ * returns a fresh snapshot based on the indexer's current state.
3522
+ */
3523
+ queryRequestWithStatus(hash: HexString): Promise<PostRequestWithStatus | undefined>;
3524
+ /**
3525
+ * Streams status updates for a POST request as it progresses through the
3526
+ * source → Hyperbridge → destination lifecycle. Ends when the request
3527
+ * reaches its destination or its timeout becomes pending.
3472
3528
  *
3473
- * // you can also use a while loop
3474
- * while (true) {
3475
- * const status = await stream.next()
3476
- * if (status.done) {
3477
- * break
3478
- * }
3479
- * console.log(status.value)
3480
- * }
3529
+ * Yields the `HYPERBRIDGE_FINALIZED` event with relayer calldata attached —
3530
+ * this is the calldata a caller submits to the destination handler to
3531
+ * deliver the request (bundled `handleConsensus` + `handlePostRequests` via
3532
+ * `batchCall`).
3481
3533
  */
3482
- orderStatusStream(commitment: HexString): AsyncGenerator<{
3483
- status: OrderStatus;
3484
- metadata: {
3485
- blockHash: string;
3486
- blockNumber: number;
3487
- transactionHash: string;
3488
- timestamp: bigint;
3489
- filler?: string;
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;
3534
+ postRequestStatusStream(hash: HexString): AsyncGenerator<RequestStatusWithMetadata, void>;
3535
+ /**
3536
+ * Streams timeout status updates for a POST request past its
3537
+ * `timeoutTimestamp`. Drives the `PENDING_TIMEOUT →
3538
+ * DESTINATION_FINALIZED_TIMEOUT → HYPERBRIDGE_FINALIZED_TIMEOUT → TIMED_OUT`
3539
+ * progression, submitting unsigned extrinsics to Hyperbridge where required
3540
+ * and yielding source-chain timeout calldata at the final step.
3541
+ */
3542
+ postRequestTimeoutStream(hash: HexString): AsyncGenerator<PostRequestTimeoutStatus, void>;
3502
3543
  /**
3503
- * Aggregate transactions with commitment.
3504
- * @param commitment
3505
- * @returns an object containing the transaction hash, block hash, block number, timestamp.
3544
+ * Relays a POST request to Hyperbridge from source-chain state (when the
3545
+ * request wasn't aggregated there yet) and returns the finalized Hyperbridge
3546
+ * extrinsic receipt. Used to bootstrap status tracking for requests that
3547
+ * Hyperbridge hasn't seen.
3506
3548
  */
3507
3549
  aggregateTransactionWithCommitment(commitment: HexString): Promise<Awaited<ReturnType<SubstrateChain["submitUnsigned"]>>>;
3508
- waitOrAbort<T>(params: {
3509
- signal: AbortSignal;
3510
- promise: () => Promise<T>;
3511
- predicate?: (a: T) => boolean;
3512
- }): Promise<NonNullable<T>>;
3550
+ /**
3551
+ * Snapshot query for a GET request: returns the indexed record with all
3552
+ * inferred finality events (`SOURCE_FINALIZED`, `HYPERBRIDGE_FINALIZED`)
3553
+ * sorted by progress weight.
3554
+ */
3555
+ queryGetRequestWithStatus(hash: HexString): Promise<GetRequestWithStatus | undefined>;
3556
+ /**
3557
+ * Streams status updates for a GET request. Ends when the response is
3558
+ * delivered back to the source chain or the request's timeout elapses.
3559
+ * Yields the `HYPERBRIDGE_FINALIZED` event with source-chain calldata for
3560
+ * submitting the response (bundled `handleConsensus` + `handleGetResponses`
3561
+ * via `batchCall`).
3562
+ */
3563
+ getRequestStatusStream(hash: HexString): AsyncGenerator<RequestStatusWithMetadata, void>;
3564
+ /**
3565
+ * Low-level watcher that yields a single `PENDING_TIMEOUT` event once
3566
+ * `chain.timestamp()` passes `timeoutTimestamp`. Used internally by the
3567
+ * status streams; exposed for callers that want to race their own logic
3568
+ * against a request's deadline.
3569
+ */
3570
+ timeoutStream(timeoutTimestamp: bigint, chain: IChain): AsyncGenerator<RequestStatusWithMetadata, void>;
3513
3571
  }
3514
3572
  interface PartialClientConfig extends Omit<ClientConfig, "pollInterval"> {
3515
3573
  pollInterval?: number;
@@ -3560,9 +3618,89 @@ declare function queryGetRequest(params: {
3560
3618
  queryClient: IndexerQueryClient;
3561
3619
  }): Promise<GetRequestWithStatus | undefined>;
3562
3620
 
3621
+ type UniswapProtocol = "v2" | "v3" | "v4";
3622
+ type UniswapTradeType = "EXACT_INPUT" | "EXACT_OUTPUT";
3623
+ /**
3624
+ * Token metadata required for Uniswap quoting.
3625
+ */
3626
+ interface UniswapQuoteToken {
3627
+ /** Token contract address. Use ADDRESS_ZERO for the native asset. */
3628
+ address: HexString;
3629
+ /** Token decimals used by the integrating app when formatting quote amounts. */
3630
+ decimals: number;
3631
+ /** Optional display symbol, returned unchanged in quote responses. */
3632
+ symbol?: string;
3633
+ /** EVM chain ID where this token exists. */
3634
+ chainId: number;
3635
+ }
3636
+ /**
3637
+ * Parameters for quoting a Uniswap swap through the SDK.
3638
+ *
3639
+ * Provide `amountIn` when `tradeType` is `EXACT_INPUT`, or `amountOut` when
3640
+ * `tradeType` is `EXACT_OUTPUT`. RPC clients are derived from SDK chain config.
3641
+ */
3642
+ interface QuoteUniswapParams {
3643
+ /** Numeric EVM chain ID or state machine ID, for example `8453` or `EVM-8453`. */
3644
+ chainId: number | string;
3645
+ /** Token the user pays with. */
3646
+ tokenIn: UniswapQuoteToken;
3647
+ /** Token the user receives. */
3648
+ tokenOut: UniswapQuoteToken;
3649
+ /** Exact input amount, required for `EXACT_INPUT`. */
3650
+ amountIn?: bigint;
3651
+ /** Exact output amount, required for `EXACT_OUTPUT`. */
3652
+ amountOut?: bigint;
3653
+ /** Whether to quote by fixed input or fixed output. */
3654
+ tradeType: UniswapTradeType;
3655
+ /** Protocols to check. Defaults to all supported protocols: v2, v3, and v4. */
3656
+ protocols?: UniswapProtocol[];
3657
+ /** Slippage tolerance in basis points, only used when `recipient` is provided. */
3658
+ slippageBps?: number;
3659
+ /** Optional recipient. When set, executable transaction calldata is included. */
3660
+ recipient?: HexString;
3661
+ }
3662
+ /**
3663
+ * Normalized quote returned by every Uniswap protocol adapter.
3664
+ */
3665
+ interface UniswapQuote {
3666
+ /** Protocol that produced this quote. */
3667
+ protocol: UniswapProtocol;
3668
+ /** Quote direction used to calculate the amounts. */
3669
+ tradeType: UniswapTradeType;
3670
+ /** Numeric EVM chain ID. */
3671
+ chainId: number;
3672
+ /** Token the user pays with. */
3673
+ tokenIn: UniswapQuoteToken;
3674
+ /** Token the user receives. */
3675
+ tokenOut: UniswapQuoteToken;
3676
+ /** Input amount required for this quote. */
3677
+ amountIn: bigint;
3678
+ /** Output amount returned by this quote. */
3679
+ amountOut: bigint;
3680
+ /** Winning fee tier for concentrated-liquidity protocols. */
3681
+ fee?: number;
3682
+ /** Token path used by the quote. */
3683
+ route: {
3684
+ tokens: HexString[];
3685
+ };
3686
+ /** Executable transactions, included only when `recipient` is supplied. */
3687
+ transactions?: Transaction[];
3688
+ }
3689
+ /**
3690
+ * Quote result containing the best quote and all successful protocol candidates.
3691
+ */
3692
+ interface QuoteUniswapResult {
3693
+ /** Best quote by highest output for exact input, or lowest input for exact output. */
3694
+ bestQuote: UniswapQuote | null;
3695
+ /** All successful protocol quotes considered by the SDK. */
3696
+ quotes: UniswapQuote[];
3697
+ }
3698
+
3563
3699
  declare class Swap {
3564
3700
  private chainConfigService;
3701
+ private uniswapQuoteEngine;
3565
3702
  constructor();
3703
+ quoteUniswap(params: QuoteUniswapParams): Promise<QuoteUniswapResult>;
3566
3704
  /**
3567
3705
  * Gets V2 quote for exact output swap.
3568
3706
  */
@@ -3712,6 +3850,7 @@ declare class Swap {
3712
3850
  */
3713
3851
  private getTickSpacing;
3714
3852
  }
3853
+ declare function quoteUniswap(params: QuoteUniswapParams): Promise<QuoteUniswapResult>;
3715
3854
 
3716
3855
  type StorageDriverKey = "node" | "localstorage" | "indexeddb" | "memory";
3717
3856
  interface CancellationStorageOptions {
@@ -4157,11 +4296,13 @@ declare class IntentGateway {
4157
4296
  * Delegates to {@link OrderCanceller.quoteCancelOrder}.
4158
4297
  *
4159
4298
  * @param order - The order to quote cancellation for.
4160
- * @param fromDest - If `true`, quotes the destination-initiated cancellation fee.
4299
+ * @param options - Choose the initiation side. Defaults to source-side cancellation.
4161
4300
  * @returns `{ nativeValue }` — native token amount (wei) to send as `value`;
4162
4301
  * `{ relayerFee }` — relayer incentive denominated in the chain's fee token.
4163
4302
  */
4164
- quoteCancelOrder(order: Order, fromDest?: boolean): Promise<CancelQuote>;
4303
+ quoteCancelOrder(order: Order, options?: CancelOrderOptions): Promise<CancelQuote>;
4304
+ quoteCancelOrderFromSource(order: Order): Promise<CancelQuote>;
4305
+ quoteCancelOrderFromDest(order: Order): Promise<CancelQuote>;
4165
4306
  /**
4166
4307
  * Async generator that cancels an order and streams status events until
4167
4308
  * cancellation is complete.
@@ -4170,11 +4311,12 @@ declare class IntentGateway {
4170
4311
  *
4171
4312
  * @param order - The order to cancel.
4172
4313
  * @param indexerClient - Indexer client used for ISMP request status streaming.
4173
- * @param fromDest - If `true`, initiates cancellation from the destination chain.
4174
- * Defaults to `false` (source-side cancellation).
4314
+ * @param options - Choose the initiation side. Defaults to source-side cancellation.
4175
4315
  * @yields {@link CancelEvent} objects describing each cancellation stage.
4176
4316
  */
4177
- cancelOrder(order: Order, indexerClient: IndexerClient, fromDest?: boolean): AsyncGenerator<CancelEvent>;
4317
+ cancelOrder(order: Order, indexerClient: IsmpClient, options?: CancelOrderOptions): AsyncGenerator<CancelEvent>;
4318
+ cancelOrderFromSource(order: Order, indexerClient: IsmpClient): AsyncGenerator<CancelEvent>;
4319
+ cancelOrderFromDest(order: Order, indexerClient: IsmpClient): AsyncGenerator<CancelEvent>;
4178
4320
  /**
4179
4321
  * Constructs a signed `PackedUserOperation` for a solver to submit as a bid.
4180
4322
  *
@@ -4250,6 +4392,50 @@ declare class IntentGateway {
4250
4392
  * in the `_orders` mapping on the source chain.
4251
4393
  */
4252
4394
  isOrderRefunded(order: Order): Promise<boolean>;
4395
+ /**
4396
+ * Optional indexer context for {@link queryOrder} / {@link orderStatusStream}.
4397
+ * Configured via {@link withQueryClient}; unset by default since not every
4398
+ * IntentGateway caller needs indexer access.
4399
+ */
4400
+ private indexer?;
4401
+ /**
4402
+ * Attaches an indexer GraphQL client to this IntentGateway so that
4403
+ * {@link queryOrder} and {@link orderStatusStream} become available.
4404
+ * Returns `this` for chaining.
4405
+ *
4406
+ * @example
4407
+ * ```ts
4408
+ * const gateway = (await IntentGateway.create(source, dest)).withQueryClient(queryClient)
4409
+ * const order = await gateway.queryOrder("0x...")
4410
+ * ```
4411
+ */
4412
+ withQueryClient(queryClient: IndexerQueryClient, options?: {
4413
+ pollInterval?: number;
4414
+ tracing?: boolean;
4415
+ }): this;
4416
+ private requireIndexer;
4417
+ /**
4418
+ * Queries an order by its commitment hash.
4419
+ *
4420
+ * Requires a prior call to {@link withQueryClient}.
4421
+ */
4422
+ queryOrder(commitment: HexString): Promise<OrderWithStatus | undefined>;
4423
+ /**
4424
+ * Streams status updates for an order until it reaches a terminal state
4425
+ * (FILLED, REDEEMED, or REFUNDED).
4426
+ *
4427
+ * Requires a prior call to {@link withQueryClient}.
4428
+ */
4429
+ orderStatusStream(commitment: HexString): AsyncGenerator<{
4430
+ status: OrderStatus;
4431
+ metadata: {
4432
+ blockHash: string;
4433
+ blockNumber: number;
4434
+ transactionHash: string;
4435
+ timestamp: bigint;
4436
+ filler?: string;
4437
+ };
4438
+ }, void>;
4253
4439
  }
4254
4440
 
4255
4441
  /**
@@ -4289,6 +4475,10 @@ declare class OrderStatusChecker {
4289
4475
  isOrderRefunded(order: Order): Promise<boolean>;
4290
4476
  }
4291
4477
 
4478
+ type ContractOrder = Omit<Order, "id" | "source" | "destination"> & {
4479
+ source: HexString;
4480
+ destination: HexString;
4481
+ };
4292
4482
  /**
4293
4483
  * Encodes a list of calls into ERC-7821 `execute` function calldata using
4294
4484
  * single-batch mode.
@@ -4327,8 +4517,8 @@ declare function fetchSourceProof(commitment: HexString, source: IEvmChain, sour
4327
4517
  * - `id` is removed (not part of the on-chain struct).
4328
4518
  * - `source` and `destination` are hex-encoded if currently plain string
4329
4519
  * state-machine IDs.
4330
- * - `inputs[i].token`, `output.beneficiary`, `output.assets[i].token`, and
4331
- * `predispatch.assets[i].token` are left-padded from 20-byte addresses to
4520
+ * - `user`, `inputs[i].token`, `output.beneficiary`, `output.assets[i].token`,
4521
+ * and `predispatch.assets[i].token` are left-padded from 20-byte addresses to
4332
4522
  * 32-byte values (`0x000…addr`) via {@link bytes20ToBytes32}, matching the
4333
4523
  * `bytes32(uint256(uint160(addr)))` encoding the contract uses when casting
4334
4524
  * these fields back to `address`. Values already at 32 bytes are unchanged.
@@ -4336,7 +4526,7 @@ declare function fetchSourceProof(commitment: HexString, source: IEvmChain, sour
4336
4526
  * @param order - The SDK-level order to transform.
4337
4527
  * @returns A contract-compatible order struct without `id`.
4338
4528
  */
4339
- declare function transformOrderForContract(order: Order): Omit<Order, "id">;
4529
+ declare function transformOrderForContract(order: Order): ContractOrder;
4340
4530
  /**
4341
4531
  * Calculates the commitment hash for an order by ABI-encoding the
4342
4532
  * contract-normalised form of the order and hashing it.
@@ -4373,6 +4563,165 @@ declare const PACKED_USEROP_TYPEHASH: `0x${string}`;
4373
4563
  * IntentGatewayV2 protocol.
4374
4564
  */
4375
4565
  declare const DOMAIN_TYPEHASH: `0x${string}`;
4566
+ /**
4567
+ * Crypto and encoding utilities for IntentGatewayV2.
4568
+ *
4569
+ * Provides helpers for EIP-712 domain separation, UserOperation hashing,
4570
+ * gas-limit packing/unpacking, bundler JSON-RPC calls, and ERC-7821
4571
+ * batch-execute encoding and decoding. All methods are stateless with respect
4572
+ * to the protocol but require the shared {@link IntentGatewayContext} for the
4573
+ * bundler URL.
4574
+ */
4575
+ declare class CryptoUtils {
4576
+ private readonly ctx;
4577
+ /**
4578
+ * @param ctx - Shared IntentsV2 context; used to access the bundler URL for
4579
+ * JSON-RPC calls.
4580
+ */
4581
+ constructor(ctx: IntentGatewayContext);
4582
+ /**
4583
+ * Computes an EIP-712 domain separator for a given contract.
4584
+ *
4585
+ * @param contractName - Human-readable name of the contract (e.g. `"IntentGateway"`).
4586
+ * @param version - Version string (e.g. `"2"`).
4587
+ * @param chainId - Chain ID of the network the contract is deployed on.
4588
+ * @param contractAddress - Address of the verifying contract.
4589
+ * @returns The 32-byte domain separator as a hex string.
4590
+ */
4591
+ static getDomainSeparator(contractName: string, version: string, chainId: bigint, contractAddress: HexString): HexString;
4592
+ /**
4593
+ * Signs a `SelectSolver` EIP-712 message with a session key.
4594
+ *
4595
+ * The session key authorises the selection of a specific solver for the
4596
+ * given order commitment. The resulting signature is appended to the
4597
+ * solver's UserOperation signature before bundle submission.
4598
+ *
4599
+ * @param commitment - The order commitment (bytes32) being fulfilled.
4600
+ * @param solverAddress - Address of the solver account selected to fill the order.
4601
+ * @param domainSeparator - EIP-712 domain separator for the IntentGatewayV2 contract.
4602
+ * @param privateKey - Hex-encoded private key of the session key that signs the message.
4603
+ * @returns The ECDSA signature as a hex string, or `null` if signing fails.
4604
+ */
4605
+ static signSolverSelection(commitment: HexString, solverAddress: HexString, domainSeparator: HexString, privateKey: HexString): Promise<HexString | null>;
4606
+ /**
4607
+ * Computes the EIP-712 hash of a `PackedUserOperation` as defined by
4608
+ * ERC-4337 EntryPoint v0.8.
4609
+ *
4610
+ * @param userOp - The packed UserOperation to hash.
4611
+ * @param entryPoint - Address of the EntryPoint v0.8 contract.
4612
+ * @param chainId - Chain ID of the network on which the operation will execute.
4613
+ * @returns The UserOperation hash as a hex string.
4614
+ */
4615
+ static computeUserOpHash(userOp: PackedUserOperation, entryPoint: Hex, chainId: bigint): Hex;
4616
+ /**
4617
+ * Computes the EIP-712 struct hash of a `PackedUserOperation`.
4618
+ *
4619
+ * Hashes dynamic fields (`initCode`, `callData`, `paymasterAndData`) before
4620
+ * ABI-encoding so the final hash is a fixed-length 32-byte value.
4621
+ *
4622
+ * @param userOp - The packed UserOperation to hash.
4623
+ * @returns The struct hash as a 32-byte hex string.
4624
+ */
4625
+ static getPackedUserStructHash(userOp: PackedUserOperation): HexString;
4626
+ /**
4627
+ * Packs `verificationGasLimit` and `callGasLimit` into the ERC-4337
4628
+ * `accountGasLimits` bytes32 field.
4629
+ *
4630
+ * The high 16 bytes hold `verificationGasLimit` and the low 16 bytes hold
4631
+ * `callGasLimit`, matching the EntryPoint v0.8 packed representation.
4632
+ *
4633
+ * @param verificationGasLimit - Gas limit for the account verification step.
4634
+ * @param callGasLimit - Gas limit for the main execution call.
4635
+ * @returns A 32-byte hex string with both limits packed.
4636
+ */
4637
+ static packGasLimits(verificationGasLimit: bigint, callGasLimit: bigint): HexString;
4638
+ /**
4639
+ * Packs `maxPriorityFeePerGas` and `maxFeePerGas` into the ERC-4337
4640
+ * `gasFees` bytes32 field.
4641
+ *
4642
+ * The high 16 bytes hold `maxPriorityFeePerGas` and the low 16 bytes hold
4643
+ * `maxFeePerGas`, matching the EntryPoint v0.8 packed representation.
4644
+ *
4645
+ * @param maxPriorityFeePerGas - Maximum tip per gas (EIP-1559).
4646
+ * @param maxFeePerGas - Maximum total fee per gas (EIP-1559).
4647
+ * @returns A 32-byte hex string with both fee values packed.
4648
+ */
4649
+ static packGasFees(maxPriorityFeePerGas: bigint, maxFeePerGas: bigint): HexString;
4650
+ /**
4651
+ * Unpacks the `accountGasLimits` bytes32 field back into its constituent
4652
+ * gas limits.
4653
+ *
4654
+ * @param accountGasLimits - The packed 32-byte gas limits field from a `PackedUserOperation`.
4655
+ * @returns Object with `verificationGasLimit` and `callGasLimit` as bigints.
4656
+ */
4657
+ static unpackGasLimits(accountGasLimits: HexString): {
4658
+ verificationGasLimit: bigint;
4659
+ callGasLimit: bigint;
4660
+ };
4661
+ /**
4662
+ * Unpacks the `gasFees` bytes32 field back into its constituent fee values.
4663
+ *
4664
+ * @param gasFees - The packed 32-byte gas fees field from a `PackedUserOperation`.
4665
+ * @returns Object with `maxPriorityFeePerGas` and `maxFeePerGas` as bigints.
4666
+ */
4667
+ static unpackGasFees(gasFees: HexString): {
4668
+ maxPriorityFeePerGas: bigint;
4669
+ maxFeePerGas: bigint;
4670
+ };
4671
+ /**
4672
+ * Converts a packed `PackedUserOperation` into the JSON object format
4673
+ * expected by ERC-4337 bundler JSON-RPC endpoints.
4674
+ *
4675
+ * Unpacks `accountGasLimits` and `gasFees`, separates optional factory and
4676
+ * paymaster fields, and converts all numeric fields to hex strings.
4677
+ *
4678
+ * @param userOp - The packed UserOperation to convert.
4679
+ * @returns A plain object safe to pass as the first element of bundler RPC params.
4680
+ */
4681
+ static prepareBundlerCall(userOp: PackedUserOperation): Record<string, unknown>;
4682
+ /**
4683
+ * Sends a JSON-RPC request to the configured ERC-4337 bundler endpoint.
4684
+ *
4685
+ * @param method - The JSON-RPC method name (one of {@link BundlerMethod}).
4686
+ * @param params - Array of parameters for the RPC call.
4687
+ * @returns Resolves with the `result` field of the bundler's JSON-RPC response,
4688
+ * typed as `T`.
4689
+ * @throws If the bundler URL is not configured or the bundler returns an error.
4690
+ */
4691
+ sendBundler<T = unknown>(method: BundlerMethod, params?: unknown[]): Promise<T>;
4692
+ /**
4693
+ * Sends multiple JSON-RPC requests to the bundler in a single HTTP call
4694
+ * using JSON-RPC 2.0 batch syntax. Results are returned in the same order
4695
+ * as the input `requests` array.
4696
+ *
4697
+ * @throws If the bundler URL is not configured, the HTTP call fails, or any
4698
+ * individual response contains an error.
4699
+ */
4700
+ sendBundlerBatch<T extends unknown[]>(requests: {
4701
+ method: BundlerMethod;
4702
+ params: unknown[];
4703
+ }[]): Promise<T>;
4704
+ /**
4705
+ * Encodes a list of calls into ERC-7821 `execute` calldata using
4706
+ * single-batch mode (`ERC7821_BATCH_MODE`).
4707
+ *
4708
+ * @param calls - Ordered list of calls to batch; each specifies a `target`
4709
+ * address, ETH `value`, and `data`.
4710
+ * @returns ABI-encoded calldata for the ERC-7821 `execute(bytes32,bytes)` function.
4711
+ */
4712
+ encodeERC7821Execute(calls: ERC7821Call[]): HexString;
4713
+ /**
4714
+ * Decodes ERC-7821 `execute` calldata back into its constituent calls.
4715
+ *
4716
+ * Returns `null` if the calldata does not match the expected `execute`
4717
+ * function signature or cannot be decoded.
4718
+ *
4719
+ * @param callData - Hex-encoded calldata previously produced by
4720
+ * {@link encodeERC7821Execute} or an equivalent encoder.
4721
+ * @returns Array of decoded {@link ERC7821Call} objects, or `null` on failure.
4722
+ */
4723
+ decodeERC7821Execute(callData: HexString): ERC7821Call[] | null;
4724
+ }
4376
4725
 
4377
4726
  declare const ABI$1: readonly [{
4378
4727
  readonly type: "constructor";
@@ -7786,7 +8135,7 @@ interface TeleportParams {
7786
8135
  assetId: HexString;
7787
8136
  /** Redeem ERC20 on the destination? */
7788
8137
  redeem: boolean;
7789
- /** Recipient address */
8138
+ /** Recipient address. For EVM destinations, plain 20-byte addresses are accepted and padded internally. */
7790
8139
  to: HexString;
7791
8140
  /** Recipient state machine */
7792
8141
  dest: string | Uint8Array;
@@ -7883,6 +8232,41 @@ declare class TokenGateway {
7883
8232
  * @private
7884
8233
  */
7885
8234
  private convertNativeToFeeToken;
8235
+ /**
8236
+ * Optional indexer context for {@link queryAssetTeleported} /
8237
+ * {@link assetTeleportedStatusStream}. Configured via {@link withQueryClient}.
8238
+ */
8239
+ private indexer?;
8240
+ /**
8241
+ * Attaches an indexer GraphQL client so {@link queryAssetTeleported} and
8242
+ * {@link assetTeleportedStatusStream} become available. Returns `this` for chaining.
8243
+ */
8244
+ withQueryClient(queryClient: IndexerQueryClient, options?: {
8245
+ pollInterval?: number;
8246
+ tracing?: boolean;
8247
+ }): this;
8248
+ private requireIndexer;
8249
+ /**
8250
+ * Queries a token gateway asset-teleported event by commitment hash.
8251
+ *
8252
+ * Requires a prior call to {@link withQueryClient}.
8253
+ */
8254
+ queryAssetTeleported(commitment: HexString): Promise<TokenGatewayAssetTeleportedWithStatus | undefined>;
8255
+ /**
8256
+ * Streams status updates for an asset-teleported event until a terminal
8257
+ * state (`RECEIVED` or `REFUNDED`).
8258
+ *
8259
+ * Requires a prior call to {@link withQueryClient}.
8260
+ */
8261
+ assetTeleportedStatusStream(commitment: HexString): AsyncGenerator<{
8262
+ status: TeleportStatus;
8263
+ metadata: {
8264
+ blockHash: string;
8265
+ blockNumber: number;
8266
+ transactionHash: string;
8267
+ timestamp: bigint;
8268
+ };
8269
+ }, void>;
7886
8270
  }
7887
8271
 
7888
8272
  /**
@@ -8375,8 +8759,8 @@ interface ChainConfigData {
8375
8759
  UniswapV4PoolManager?: `0x${string}`;
8376
8760
  /** Uniswap V4 StateView (canonical CREATE2 address) for pool state reads via extsload */
8377
8761
  UniswapV4StateView?: `0x${string}`;
8378
- /** Circle Paymaster v0.8 contract address (ERC-4337 onchain USDC paymaster) */
8379
- CirclePaymasterV08?: `0x${string}`;
8762
+ /** Circle Paymaster contract address (USDC-based ERC-4337 paymaster) */
8763
+ CirclePaymaster?: `0x${string}`;
8380
8764
  };
8381
8765
  rpcEnvKey?: string;
8382
8766
  defaultRpcUrl?: string;
@@ -8392,4 +8776,4 @@ declare const getChainId: (stateMachineId: string) => number | undefined;
8392
8776
  declare const getViemChain: (chainId: number) => Chain | undefined;
8393
8777
  declare const hyperbridgeAddress = "";
8394
8778
 
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, IndexerClient, type IndexerQueryClient, IntentGateway, type IntentGatewayContext, type IntentGatewayParams, ABI$1 as IntentGatewayV2ABI, IntentOrderStatus, type IntentOrderStatusKey, type IntentOrderStatusUpdate, IntentsCoprocessor, 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 };
8779
+ export { ADDRESS_ZERO, type AllStatusKey, type AssetTeleported, type AssetTeleportedResponse, type BidStorageEntry, type BidSubmissionResult, type BlockMetadata, type BundlerGasEstimate, BundlerMethod, type BytesLikeHex, type CancelEvent, type CancelOptions, type CancelOrderOptions, 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, type QuoteUniswapParams, type QuoteUniswapResult, 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 StateMachineId, 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 UniswapProtocol, type UniswapQuote, type UniswapQuoteToken, type UniswapTradeType, type XcmGatewayParams, __test, adjustDecimals, bytes20ToBytes32, bytes32ToBytes20, calculateAllowanceMappingLocation, calculateBalanceMappingLocation, chainConfigs, constructRedeemEscrowRequestBody, constructRefundEscrowRequestBody, convertCodecToIGetRequest, convertCodecToIProof, convertIGetRequestToCodec, convertIProofToCodec, convertStateIdToStateMachineId, convertStateMachineEnumToString, convertStateMachineIdToEnum, createEvmChain, createQueryClient, decodeUserOpScale, encodeERC7821ExecuteBatch, encodeISMPMessage, encodeStateMachineId, encodeUserOpScale, encodeWithdrawalRequest, estimateGasForPost, fetchPrice, fetchSourceProof, generateRootWithProof, getChainId, getConfigByStateMachineId, getContractCallInput, getGasPriceFromEtherscan, getOrFetchStorageSlot, getOrderPlacedFromTx, getPostRequestEventFromTx, getPostResponseEventFromTx, getRequestCommitment, getStateCommitmentFieldSlot, getStateCommitmentSlot, getStorageSlot, getViemChain, hexToString, hyperbridgeAddress, maxBigInt, normalizeAddressForEvmBytes32, normalizeAddressForStateMachine, normalizeEvmChainId, normalizeStateMachineId, orderCommitment, parseStateMachineId, pharosAtlantic, pharosMainnet, polkadotAssetHubPaseo, postRequestCommitment, queryAssetTeleported, queryGetRequest, queryPostRequest, quoteUniswap, requestCommitmentKey, responseCommitmentKey, retryPromise, teleport, teleportDot, transformOrderForContract, tronChainIds, tronNile };