@hyperbridge/sdk 1.6.2 → 1.6.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,12 +1,14 @@
1
1
  import { ConsolaInstance } from 'consola';
2
2
  import { GraphQLClient } from 'graphql-request';
3
3
  import * as viem from 'viem';
4
- import { PublicClient, Hex, Log, ContractFunctionArgs } from 'viem';
4
+ import { PublicClient, TransactionReceipt, Hex, Log, ContractFunctionArgs } from 'viem';
5
5
  import { ApiPromise } from '@polkadot/api';
6
6
  import { KeyringPair } from '@polkadot/keyring/types';
7
+ import * as unstorage from 'unstorage';
7
8
  import { SignerOptions, SubmittableExtrinsic } from '@polkadot/api/types';
8
9
  import { ISubmittableResult } from '@polkadot/types/types';
9
10
  import { Chain } from 'viem/chains';
11
+ import { TronWeb } from 'tronweb';
10
12
 
11
13
  declare const _default: {
12
14
  ABI: readonly [{
@@ -588,263 +590,6 @@ declare const _default: {
588
590
  }];
589
591
  };
590
592
 
591
- declare class ChainConfigService {
592
- private rpcUrls;
593
- constructor(env?: NodeJS.ProcessEnv);
594
- private getConfig;
595
- getChainConfig(chain: string): ChainConfig;
596
- getIntentGatewayAddress(chain: string): HexString;
597
- getTokenGatewayAddress(chain: string): HexString;
598
- getHostAddress(chain: string): HexString;
599
- getWrappedNativeAssetWithDecimals(chain: string): {
600
- asset: HexString;
601
- decimals: number;
602
- };
603
- getDaiAsset(chain: string): HexString;
604
- getUsdtAsset(chain: string): HexString;
605
- getUsdcAsset(chain: string): HexString;
606
- getUsdcDecimals(chain: string): number;
607
- getUsdtDecimals(chain: string): number;
608
- getChainId(chain: string): number;
609
- getConsensusStateId(chain: string): HexString;
610
- getHyperbridgeChainId(): number;
611
- getRpcUrl(chain: string): string;
612
- getUniswapRouterV2Address(chain: string): HexString;
613
- getUniswapV2FactoryAddress(chain: string): HexString;
614
- getUniswapV3FactoryAddress(chain: string): HexString;
615
- getUniversalRouterAddress(chain: string): HexString;
616
- getUniswapV3QuoterAddress(chain: string): HexString;
617
- getUniswapV4QuoterAddress(chain: string): HexString;
618
- getPermit2Address(chain: string): HexString;
619
- getCoingeckoId(chain: string): string | undefined;
620
- getEtherscanApiKey(): string | undefined;
621
- getCalldispatcherAddress(chain: string): HexString;
622
- getTokenStorageSlots(chain: string, tokenAddress: string): {
623
- balanceSlot: number;
624
- allowanceSlot: number;
625
- } | undefined;
626
- getPopularTokens(chain: string): string[];
627
- getIntentGatewayV2Address(chain: string): HexString;
628
- getEntryPointV08Address(chain: string): HexString;
629
- getHyperbridgeAddress(): string;
630
- /**
631
- * Get the LayerZero Endpoint ID for the chain
632
- * Used for USDT0 cross-chain transfers via LayerZero OFT
633
- */
634
- getLayerZeroEid(chain: string): number | undefined;
635
- /**
636
- * Get the USDT0 OFT contract address for the chain
637
- * On Ethereum: OFT Adapter (locks/unlocks USDT)
638
- * On other chains: OFT contract (mints/burns USDT0)
639
- */
640
- getUsdt0OftAddress(chain: string): HexString | undefined;
641
- }
642
-
643
- /**
644
- * The default address used as fallback when no address is provided.
645
- * This represents the zero address in EVM chains.
646
- */
647
- declare const DEFAULT_ADDRESS = "0x0000000000000000000000000000000000000000";
648
- /**
649
- * Parameters for an EVM chain.
650
- */
651
- interface EvmChainParams {
652
- /**
653
- * The chain ID of the EVM chain
654
- */
655
- chainId: number;
656
- /**
657
- * The RPC URL of the EVM chain
658
- */
659
- rpcUrl: string;
660
- /**
661
- * The host address of the EVM chain (IsmpHost contract address)
662
- */
663
- host: HexString;
664
- /**
665
- * Consensus state identifier of this chain on hyperbridge
666
- */
667
- consensusStateId?: string;
668
- }
669
- /**
670
- * Encapsulates an EVM chain.
671
- */
672
- declare class EvmChain implements IChain {
673
- private readonly params;
674
- private publicClient;
675
- private chainConfigService;
676
- constructor(params: EvmChainParams);
677
- get client(): PublicClient;
678
- get host(): HexString;
679
- get config(): IEvmConfig;
680
- get configService(): ChainConfigService;
681
- /**
682
- * Derives the key for the request receipt.
683
- * @param {HexString} commitment - The commitment to derive the key from.
684
- * @returns {HexString} The derived key.
685
- */
686
- requestReceiptKey(commitment: HexString): HexString;
687
- /**
688
- * Queries the request receipt.
689
- * @param {HexString} commitment - The commitment to query.
690
- * @returns {Promise<HexString | undefined>} The relayer address responsible for delivering the request.
691
- */
692
- queryRequestReceipt(commitment: HexString): Promise<HexString | undefined>;
693
- /**
694
- * Queries the proof of the commitments.
695
- * @param {IMessage} message - The message to query.
696
- * @param {string} counterparty - The counterparty address.
697
- * @param {bigint} [at] - The block number to query at.
698
- * @returns {Promise<HexString>} The proof.
699
- */
700
- queryProof(message: IMessage, counterparty: string, at?: bigint): Promise<HexString>;
701
- /**
702
- * Query and return the encoded storage proof for the provided keys at the given height.
703
- * @param {bigint} at - The block height at which to query the storage proof.
704
- * @param {HexString[]} keys - The keys for which to query the storage proof.
705
- * @param {HexString} address - Optional contract address to fetch storage proof else default to host contract
706
- * @returns {Promise<HexString>} The encoded storage proof.
707
- */
708
- queryStateProof(at: bigint, keys: HexString[], address?: HexString): Promise<HexString>;
709
- /**
710
- * Returns the current timestamp of the chain.
711
- * @returns {Promise<bigint>} The current timestamp.
712
- */
713
- timestamp(): Promise<bigint>;
714
- /**
715
- * Get the latest state machine height for a given state machine ID.
716
- * @param {StateMachineIdParams} stateMachineId - The state machine ID.
717
- * @returns {Promise<bigint>} The latest state machine height.
718
- */
719
- latestStateMachineHeight(stateMachineId: StateMachineIdParams): Promise<bigint>;
720
- /**
721
- * Get the state machine update time for a given state machine height.
722
- * @param {StateMachineHeight} stateMachineHeight - The state machine height.
723
- * @returns {Promise<bigint>} The statemachine update time in seconds.
724
- */
725
- stateMachineUpdateTime(stateMachineHeight: StateMachineHeight): Promise<bigint>;
726
- /**
727
- * Get the challenge period for a given state machine id.
728
- * @param {StateMachineIdParams} stateMachineId - The state machine ID.
729
- * @returns {Promise<bigint>} The challenge period in seconds.
730
- */
731
- challengePeriod(stateMachineId: StateMachineIdParams): Promise<bigint>;
732
- /**
733
- * Encodes an ISMP message for the EVM chain.
734
- * @param {IIsmpMessage} message The ISMP message to encode.
735
- * @returns {HexString} The encoded calldata.
736
- */
737
- encode(message: IIsmpMessage): HexString;
738
- /**
739
- * Calculates the fee required to send a post request to the destination chain.
740
- * The fee is calculated based on the per-byte fee for the destination chain
741
- * multiplied by the size of the request body.
742
- *
743
- * @param request - The post request to calculate the fee for
744
- * @returns The total fee in wei required to send the post request
745
- */
746
- quote(request: IPostRequest | IGetRequest): Promise<bigint>;
747
- quoteNative(request: IPostRequest | IGetRequest, fee: bigint): Promise<bigint>;
748
- private getAmountsIn;
749
- /**
750
- * Estimates the gas required for a post request execution on this chain.
751
- * This function generates mock proofs for the post request, creates a state override
752
- * with the necessary overlay root, and estimates the gas cost for executing the
753
- * handlePostRequests transaction on the handler contract.
754
- *
755
- * @param request - The post request to estimate gas for
756
- * @param paraId - The ID of the parachain (Hyperbridge) that will process the request
757
- * @returns The estimated gas amount in gas units and the generated calldata
758
- */
759
- estimateGas(request: IPostRequest): Promise<{
760
- gas: bigint;
761
- postRequestCalldata: HexString;
762
- }>;
763
- /**
764
- * Gets the fee token address and decimals for the chain.
765
- * This function gets the fee token address and decimals for the chain.
766
- *
767
- * @returns The fee token address and decimals
768
- */
769
- getFeeTokenWithDecimals(): Promise<{
770
- address: HexString;
771
- decimals: number;
772
- }>;
773
- /**
774
- * Gets the nonce of the host.
775
- * This function gets the nonce of the host.
776
- *
777
- * @returns The nonce of the host
778
- */
779
- getHostNonce(): Promise<bigint>;
780
- }
781
- /**
782
- * Factory function for creating EVM chain instances with common defaults
783
- *
784
- * @param chainId - The EVM chain ID
785
- * @param host - The IsmpHost contract address
786
- * @param options - Optional configuration overrides
787
- * @returns A new EvmChain instance
788
- *
789
- * @example
790
- * ```typescript
791
- * // Create with minimal config
792
- * const ethChain = createEvmChain(1, "0x87ea45..", {
793
- * rpcUrl: "https://eth-mainnet.g.alchemy.com/v2/YOUR_KEY"
794
- * })
795
- *
796
- * // Create with custom consensus state ID
797
- * const arbChain = createEvmChain(42161, "0x87ea42345..", {
798
- * rpcUrl: "https://arb-mainnet.g.alchemy.com/v2/YOUR_KEY",
799
- * consensusStateId: "ARB_CUSTOM"
800
- * })
801
- * ```
802
- */
803
- declare function createEvmChain(chainId: number, host: HexString, options: {
804
- rpcUrl: string;
805
- consensusStateId?: string;
806
- }): EvmChain;
807
- /**
808
- * Slot for storing request commitments.
809
- */
810
- declare const REQUEST_COMMITMENTS_SLOT = 0n;
811
- /**
812
- * Slot index for response commitments map
813
- */
814
- declare const RESPONSE_COMMITMENTS_SLOT = 1n;
815
- /**
816
- * Slot index for requests receipts map
817
- */
818
- declare const REQUEST_RECEIPTS_SLOT = 2n;
819
- /**
820
- * Slot index for response receipts map
821
- */
822
- declare const RESPONSE_RECEIPTS_SLOT = 3n;
823
- /**
824
- * Slot index for state commitment map
825
- */
826
- declare const STATE_COMMITMENTS_SLOT = 5n;
827
- declare function requestCommitmentKey(key: Hex): {
828
- slot1: Hex;
829
- slot2: Hex;
830
- };
831
- /**
832
- * Derives the storage slot for a specific field in the StateCommitment struct
833
- *
834
- * struct StateCommitment {
835
- * uint256 timestamp; // slot + 0
836
- * bytes32 overlayRoot; // slot + 1
837
- * bytes32 stateRoot; // slot + 2
838
- * }
839
- *
840
- * @param stateMachineId - The state machine ID
841
- * @param height - The block height
842
- * @param field - The field index in the struct (0 for timestamp, 1 for overlayRoot, 2 for stateRoot)
843
- * @returns The storage slot for the specific field
844
- */
845
- declare function getStateCommitmentFieldSlot(stateMachineId: bigint, height: bigint, field: 0 | 1 | 2): HexString;
846
- declare function getStateCommitmentSlot(stateMachineId: bigint, height: bigint): HexString;
847
-
848
593
  /**
849
594
  * Generates a Merkle Mountain Range (MMR) root hash and proof for a post request.
850
595
  *
@@ -969,13 +714,24 @@ declare function estimateGasForPost(params: {
969
714
  gas_fee: bigint;
970
715
  call_data: EstimateGasCallData;
971
716
  }>;
717
+ /**
718
+ * ABI-encodes a WithdrawalRequest (commitment + beneficiary + tokens).
719
+ * Used as the GET-request context for cancel-from-source, and as the inner
720
+ * payload (after the RequestKind prefix) for POST-based escrow operations.
721
+ */
722
+ declare function encodeWithdrawalRequest(order: Order | OrderV2, beneficiary: HexString): HexString;
972
723
  /**
973
724
  * Constructs the request body for a redeem escrow operation.
974
725
  * This function encodes the order commitment, beneficiary address, and token inputs
975
726
  * to match the format expected by the IntentGateway contract.
976
727
  */
977
728
  declare function constructRedeemEscrowRequestBody(order: Order | OrderV2, beneficiary: HexString): HexString;
978
- declare function fetchPrice(identifier: string, chainId?: number, apiKey?: string): Promise<number>;
729
+ /**
730
+ * Constructs the request body for a refund escrow operation (cancel from destination).
731
+ * Uses RequestKind.RefundEscrow to match the IntentGatewayV2 contract's _cancelFromDest.
732
+ */
733
+ declare function constructRefundEscrowRequestBody(order: Order | OrderV2, beneficiary: HexString): HexString;
734
+ declare function fetchPrice(identifier: string | undefined, chainId?: number, apiKey?: string): Promise<number>;
979
735
  /**
980
736
  * Fetches the current network gas price from an Etherscan-family explorer API.
981
737
  * Returns the ProposeGasPrice (in gwei) converted to wei as bigint.
@@ -1032,6 +788,18 @@ declare enum EvmLanguage {
1032
788
  * ```
1033
789
  */
1034
790
  declare function getStorageSlot(client: PublicClient, contractAddress: HexString, data: HexString): Promise<string>;
791
+ /**
792
+ * Returns the storage slot for an ERC20 `balanceOf` or `allowance` call,
793
+ * first checking the recorded slot cache and falling back to an RPC trace
794
+ * call via `getStorageSlot` when no cached slot is available.
795
+ *
796
+ * @param client - The viem PublicClient to use for the RPC trace fallback
797
+ * @param chain - The chain identifier (e.g. "EVM-1")
798
+ * @param contractAddress - The ERC20 token contract address
799
+ * @param data - The ABI-encoded call data (method selector + padded args)
800
+ * @returns The storage slot as a hex string, or undefined if not found
801
+ */
802
+ declare function getOrFetchStorageSlot(client: PublicClient, chain: string, contractAddress: HexString, data: HexString): Promise<HexString | undefined>;
1035
803
  /**
1036
804
  * Adjusts fee amounts between different decimal precisions.
1037
805
  * Handles scaling up or down based on the decimal difference.
@@ -1072,6 +840,17 @@ declare function getContractCallInput(client: PublicClient, txHash: HexString, t
1072
840
  * @returns The balance mapping location as a HexString.
1073
841
  */
1074
842
  declare function calculateBalanceMappingLocation(slot: bigint, holder: string, language: EvmLanguage): HexString;
843
+ /**
844
+ * Calculates the allowance mapping location for a given slot, owner, and spender.
845
+ * ERC20 allowance is a nested mapping: mapping(address owner => mapping(address spender => uint256))
846
+ *
847
+ * @param slot - The base slot number for the allowance mapping
848
+ * @param owner - The address of the token owner (first parameter in allowance(owner, spender))
849
+ * @param spender - The address approved to spend tokens (second parameter)
850
+ * @param language - The language of the contract (Solidity or Vyper)
851
+ * @returns The allowance mapping location as a HexString
852
+ */
853
+ declare function calculateAllowanceMappingLocation(slot: bigint, owner: string, spender: string, language: EvmLanguage): HexString;
1075
854
 
1076
855
  declare class SubstrateChain implements IChain {
1077
856
  private readonly params;
@@ -1141,9 +920,10 @@ declare class SubstrateChain implements IChain {
1141
920
  * Query the state proof for a given set of keys at a specific block height.
1142
921
  * @param at The block height to query the state proof at.
1143
922
  * @param keys The keys to query the state proof for.
923
+ * @param _address - Optional address (ignored for Substrate; present for IChain compatibility).
1144
924
  * @returns The state proof as a hexadecimal string.
1145
925
  */
1146
- queryStateProof(at: bigint, keys: HexString[]): Promise<HexString>;
926
+ queryStateProof(at: bigint, keys: HexString[], _address?: HexString): Promise<HexString>;
1147
927
  /**
1148
928
  * Get the latest state machine height for a given state machine ID.
1149
929
  * @param {StateMachineIdParams} stateMachineId - The state machine ID.
@@ -1270,6 +1050,273 @@ declare function convertCodecToIProof(codec: {
1270
1050
  }): IProof;
1271
1051
  declare function encodeISMPMessage(message: IIsmpMessage): Uint8Array;
1272
1052
 
1053
+ declare class ChainConfigService {
1054
+ private rpcUrls;
1055
+ constructor(env?: NodeJS.ProcessEnv);
1056
+ private getConfig;
1057
+ getChainConfig(chain: string): ChainConfig;
1058
+ getIntentGatewayAddress(chain: string): HexString;
1059
+ getTokenGatewayAddress(chain: string): HexString;
1060
+ getHostAddress(chain: string): HexString;
1061
+ getWrappedNativeAssetWithDecimals(chain: string): {
1062
+ asset: HexString;
1063
+ decimals: number;
1064
+ };
1065
+ getDaiAsset(chain: string): HexString;
1066
+ getUsdtAsset(chain: string): HexString;
1067
+ getUsdcAsset(chain: string): HexString;
1068
+ getUsdcDecimals(chain: string): number;
1069
+ getUsdtDecimals(chain: string): number;
1070
+ getCNgnAsset(chain: string): HexString | undefined;
1071
+ getCNgnDecimals(chain: string): number | undefined;
1072
+ getExtAsset(chain: string): HexString | undefined;
1073
+ getExtDecimals(chain: string): number | undefined;
1074
+ getChainId(chain: string): number;
1075
+ getConsensusStateId(chain: string): HexString;
1076
+ getHyperbridgeChainId(): number;
1077
+ getRpcUrl(chain: string): string;
1078
+ getUniswapRouterV2Address(chain: string): HexString;
1079
+ getUniswapV2FactoryAddress(chain: string): HexString;
1080
+ getUniswapV3FactoryAddress(chain: string): HexString;
1081
+ getUniversalRouterAddress(chain: string): HexString;
1082
+ getUniswapV3QuoterAddress(chain: string): HexString;
1083
+ getUniswapV4QuoterAddress(chain: string): HexString;
1084
+ getPermit2Address(chain: string): HexString;
1085
+ getSolverAccountAddress(chain: string): HexString | undefined;
1086
+ getCoingeckoId(chain: string): string | undefined;
1087
+ getEtherscanApiKey(): string | undefined;
1088
+ getCalldispatcherAddress(chain: string): HexString;
1089
+ getTokenStorageSlots(chain: string, tokenAddress: string): {
1090
+ balanceSlot: number;
1091
+ allowanceSlot: number;
1092
+ } | undefined;
1093
+ getPopularTokens(chain: string): string[];
1094
+ getIntentGatewayV2Address(chain: string): HexString;
1095
+ getEntryPointV08Address(chain: string): HexString;
1096
+ getHyperbridgeAddress(): string;
1097
+ /**
1098
+ * Get the LayerZero Endpoint ID for the chain
1099
+ * Used for USDT0 cross-chain transfers via LayerZero OFT
1100
+ */
1101
+ getLayerZeroEid(chain: string): number | undefined;
1102
+ /**
1103
+ * Get the USDT0 OFT contract address for the chain
1104
+ * On Ethereum: OFT Adapter (locks/unlocks USDT)
1105
+ * On other chains: OFT contract (mints/burns USDT0)
1106
+ */
1107
+ getUsdt0OftAddress(chain: string): HexString | undefined;
1108
+ }
1109
+
1110
+ /**
1111
+ * The default address used as fallback when no address is provided.
1112
+ * This represents the zero address in EVM chains.
1113
+ */
1114
+ declare const DEFAULT_ADDRESS = "0x0000000000000000000000000000000000000000";
1115
+ /**
1116
+ * Parameters for an EVM chain.
1117
+ */
1118
+ interface EvmChainParams {
1119
+ /**
1120
+ * The chain ID of the EVM chain
1121
+ */
1122
+ chainId: number;
1123
+ /**
1124
+ * The RPC URL of the EVM chain
1125
+ */
1126
+ rpcUrl: string;
1127
+ /**
1128
+ * The host address of the EVM chain (IsmpHost contract address)
1129
+ */
1130
+ host: HexString;
1131
+ /**
1132
+ * Consensus state identifier of this chain on hyperbridge
1133
+ */
1134
+ consensusStateId?: string;
1135
+ }
1136
+ /**
1137
+ * Encapsulates an EVM chain.
1138
+ */
1139
+ declare class EvmChain implements IChain {
1140
+ private readonly params;
1141
+ private publicClient;
1142
+ private chainConfigService;
1143
+ constructor(params: EvmChainParams);
1144
+ get client(): PublicClient;
1145
+ get host(): HexString;
1146
+ get config(): IEvmConfig;
1147
+ get configService(): ChainConfigService;
1148
+ /**
1149
+ * Derives the key for the request receipt.
1150
+ * @param {HexString} commitment - The commitment to derive the key from.
1151
+ * @returns {HexString} The derived key.
1152
+ */
1153
+ requestReceiptKey(commitment: HexString): HexString;
1154
+ /**
1155
+ * Queries the request receipt.
1156
+ * @param {HexString} commitment - The commitment to query.
1157
+ * @returns {Promise<HexString | undefined>} The relayer address responsible for delivering the request.
1158
+ */
1159
+ queryRequestReceipt(commitment: HexString): Promise<HexString | undefined>;
1160
+ /**
1161
+ * Queries the proof of the commitments.
1162
+ * @param {IMessage} message - The message to query.
1163
+ * @param {string} counterparty - The counterparty address.
1164
+ * @param {bigint} [at] - The block number to query at.
1165
+ * @returns {Promise<HexString>} The proof.
1166
+ */
1167
+ queryProof(message: IMessage, counterparty: string, at?: bigint): Promise<HexString>;
1168
+ /**
1169
+ * Query and return the encoded storage proof for the provided keys at the given height.
1170
+ * @param {bigint} at - The block height at which to query the storage proof.
1171
+ * @param {HexString[]} keys - The keys for which to query the storage proof.
1172
+ * @param {HexString} address - Optional contract address to fetch storage proof else default to host contract
1173
+ * @returns {Promise<HexString>} The encoded storage proof.
1174
+ */
1175
+ queryStateProof(at: bigint, keys: HexString[], address?: HexString): Promise<HexString>;
1176
+ /**
1177
+ * Returns the current timestamp of the chain.
1178
+ * @returns {Promise<bigint>} The current timestamp.
1179
+ */
1180
+ timestamp(): Promise<bigint>;
1181
+ /**
1182
+ * Get the latest state machine height for a given state machine ID.
1183
+ * @param {StateMachineIdParams} stateMachineId - The state machine ID.
1184
+ * @returns {Promise<bigint>} The latest state machine height.
1185
+ */
1186
+ latestStateMachineHeight(stateMachineId: StateMachineIdParams): Promise<bigint>;
1187
+ /**
1188
+ * Get the state machine update time for a given state machine height.
1189
+ * @param {StateMachineHeight} stateMachineHeight - The state machine height.
1190
+ * @returns {Promise<bigint>} The statemachine update time in seconds.
1191
+ */
1192
+ stateMachineUpdateTime(stateMachineHeight: StateMachineHeight): Promise<bigint>;
1193
+ /**
1194
+ * Retrieves the placeOrder calldata from a transaction using debug_traceTransaction.
1195
+ */
1196
+ getPlaceOrderCalldata(txHash: string, intentGatewayAddress: string): Promise<HexString>;
1197
+ /**
1198
+ * Get the challenge period for a given state machine id.
1199
+ * @param {StateMachineIdParams} stateMachineId - The state machine ID.
1200
+ * @returns {Promise<bigint>} The challenge period in seconds.
1201
+ */
1202
+ challengePeriod(stateMachineId: StateMachineIdParams): Promise<bigint>;
1203
+ /**
1204
+ * Encodes an ISMP message for the EVM chain.
1205
+ * @param {IIsmpMessage} message The ISMP message to encode.
1206
+ * @returns {HexString} The encoded calldata.
1207
+ */
1208
+ encode(message: IIsmpMessage): HexString;
1209
+ /**
1210
+ * Calculates the fee required to send a post request to the destination chain.
1211
+ * The fee is calculated based on the per-byte fee for the destination chain
1212
+ * multiplied by the size of the request body.
1213
+ *
1214
+ * @param request - The post request to calculate the fee for
1215
+ * @returns The total fee in wei required to send the post request
1216
+ */
1217
+ quote(request: IPostRequest | IGetRequest): Promise<bigint>;
1218
+ quoteNative(request: IPostRequest | IGetRequest, fee: bigint): Promise<bigint>;
1219
+ private getAmountsIn;
1220
+ /**
1221
+ * Estimates the gas required for a post request execution on this chain.
1222
+ * This function generates mock proofs for the post request, creates a state override
1223
+ * with the necessary overlay root, and estimates the gas cost for executing the
1224
+ * handlePostRequests transaction on the handler contract.
1225
+ *
1226
+ * @param request - The post request to estimate gas for
1227
+ * @param paraId - The ID of the parachain (Hyperbridge) that will process the request
1228
+ * @returns The estimated gas amount in gas units and the generated calldata
1229
+ */
1230
+ estimateGas(request: IPostRequest): Promise<{
1231
+ gas: bigint;
1232
+ postRequestCalldata: HexString;
1233
+ }>;
1234
+ /**
1235
+ * Gets the fee token address and decimals for the chain.
1236
+ * This function gets the fee token address and decimals for the chain.
1237
+ *
1238
+ * @returns The fee token address and decimals
1239
+ */
1240
+ getFeeTokenWithDecimals(): Promise<{
1241
+ address: HexString;
1242
+ decimals: number;
1243
+ }>;
1244
+ /**
1245
+ * Gets the nonce of the host.
1246
+ * This function gets the nonce of the host.
1247
+ *
1248
+ * @returns The nonce of the host
1249
+ */
1250
+ getHostNonce(): Promise<bigint>;
1251
+ broadcastTransaction(signedTransaction: any): Promise<TransactionReceipt>;
1252
+ }
1253
+ /**
1254
+ * Factory function for creating EVM chain instances with common defaults
1255
+ *
1256
+ * @param chainId - The EVM chain ID
1257
+ * @param host - The IsmpHost contract address
1258
+ * @param options - Optional configuration overrides
1259
+ * @returns A new EvmChain instance
1260
+ *
1261
+ * @example
1262
+ * ```typescript
1263
+ * // Create with minimal config
1264
+ * const ethChain = createEvmChain(1, "0x87ea45..", {
1265
+ * rpcUrl: "https://eth-mainnet.g.alchemy.com/v2/YOUR_KEY"
1266
+ * })
1267
+ *
1268
+ * // Create with custom consensus state ID
1269
+ * const arbChain = createEvmChain(42161, "0x87ea42345..", {
1270
+ * rpcUrl: "https://arb-mainnet.g.alchemy.com/v2/YOUR_KEY",
1271
+ * consensusStateId: "ARB_CUSTOM"
1272
+ * })
1273
+ * ```
1274
+ */
1275
+ declare function createEvmChain(chainId: number, host: HexString, options: {
1276
+ rpcUrl: string;
1277
+ consensusStateId?: string;
1278
+ }): EvmChain;
1279
+ /**
1280
+ * Slot for storing request commitments.
1281
+ */
1282
+ declare const REQUEST_COMMITMENTS_SLOT = 0n;
1283
+ /**
1284
+ * Slot index for response commitments map
1285
+ */
1286
+ declare const RESPONSE_COMMITMENTS_SLOT = 1n;
1287
+ /**
1288
+ * Slot index for requests receipts map
1289
+ */
1290
+ declare const REQUEST_RECEIPTS_SLOT = 2n;
1291
+ /**
1292
+ * Slot index for response receipts map
1293
+ */
1294
+ declare const RESPONSE_RECEIPTS_SLOT = 3n;
1295
+ /**
1296
+ * Slot index for state commitment map
1297
+ */
1298
+ declare const STATE_COMMITMENTS_SLOT = 5n;
1299
+ declare function requestCommitmentKey(key: Hex): {
1300
+ slot1: Hex;
1301
+ slot2: Hex;
1302
+ };
1303
+ /**
1304
+ * Derives the storage slot for a specific field in the StateCommitment struct
1305
+ *
1306
+ * struct StateCommitment {
1307
+ * uint256 timestamp; // slot + 0
1308
+ * bytes32 overlayRoot; // slot + 1
1309
+ * bytes32 stateRoot; // slot + 2
1310
+ * }
1311
+ *
1312
+ * @param stateMachineId - The state machine ID
1313
+ * @param height - The block height
1314
+ * @param field - The field index in the struct (0 for timestamp, 1 for overlayRoot, 2 for stateRoot)
1315
+ * @returns The storage slot for the specific field
1316
+ */
1317
+ declare function getStateCommitmentFieldSlot(stateMachineId: bigint, height: bigint, field: 0 | 1 | 2): HexString;
1318
+ declare function getStateCommitmentSlot(stateMachineId: bigint, height: bigint): HexString;
1319
+
1273
1320
  /**
1274
1321
  * Encodes a PackedUserOperation using SCALE codec for submission to Hyperbridge.
1275
1322
  * This is the recommended way to encode UserOps for the intents coprocessor.
@@ -1377,6 +1424,64 @@ declare class IntentsCoprocessor {
1377
1424
  private buildOffchainBidKey;
1378
1425
  }
1379
1426
 
1427
+ /**
1428
+ * Parameters for a Tron-backed chain.
1429
+ * TronWeb is constructed internally from `rpcUrl`.
1430
+ */
1431
+ type TronChainParams = EvmChainParams;
1432
+ declare class TronChain implements IChain {
1433
+ private readonly params;
1434
+ private readonly evm;
1435
+ private readonly tronWebInstance;
1436
+ constructor(params: TronChainParams);
1437
+ /** Underlying viem public client (delegated from the internal EvmChain) */
1438
+ get client(): PublicClient;
1439
+ /** Host contract address for this chain (delegated from the internal EvmChain) */
1440
+ get host(): HexString;
1441
+ /** Chain configuration (delegated from the internal EvmChain) */
1442
+ get config(): IEvmConfig;
1443
+ /** Chain configuration service (delegated from the internal EvmChain) */
1444
+ get configService(): ChainConfigService;
1445
+ /** TronWeb instance for this Tron chain (constructed from rpcUrl) */
1446
+ get tronWeb(): InstanceType<typeof TronWeb>;
1447
+ timestamp(): Promise<bigint>;
1448
+ requestReceiptKey(commitment: HexString): HexString;
1449
+ queryRequestReceipt(commitment: HexString): Promise<HexString | undefined>;
1450
+ queryStateProof(at: bigint, keys: HexString[], address?: HexString): Promise<HexString>;
1451
+ queryProof(message: IMessage, counterparty: string, at?: bigint): Promise<HexString>;
1452
+ encode(message: IIsmpMessage): HexString;
1453
+ latestStateMachineHeight(stateMachineId: StateMachineIdParams): Promise<bigint>;
1454
+ challengePeriod(stateMachineId: StateMachineIdParams): Promise<bigint>;
1455
+ stateMachineUpdateTime(stateMachineHeight: StateMachineHeight): Promise<bigint>;
1456
+ /**
1457
+ * Retrieves top-level calldata from a Tron transaction via TronWeb.
1458
+ * Only works for direct calls to IntentGateway (not nested/multicall).
1459
+ * Tron does not support debug_traceTransaction.
1460
+ */
1461
+ getPlaceOrderCalldata(txHash: string, _intentGatewayAddress: string): Promise<HexString>;
1462
+ /**
1463
+ * Broadcasts a signed Tron transaction and waits for confirmation,
1464
+ * returning a 0x-prefixed transaction hash compatible with viem.
1465
+ *
1466
+ * This mirrors the behavior used in IntentGatewayV2 for Tron chains.
1467
+ */
1468
+ broadcastTransaction(signedTransaction: any): Promise<TransactionReceipt>;
1469
+ /** Gets the fee token address and decimals for the chain. */
1470
+ getFeeTokenWithDecimals(): Promise<{
1471
+ address: HexString;
1472
+ decimals: number;
1473
+ }>;
1474
+ /** Gets the nonce of the host contract on this chain. */
1475
+ getHostNonce(): Promise<bigint>;
1476
+ /** Quotes the fee (in native token) required for the given ISMP request. */
1477
+ quoteNative(request: IPostRequest | IGetRequest, fee: bigint): Promise<bigint>;
1478
+ /** Estimates gas for executing a post request on this chain. */
1479
+ estimateGas(request: IPostRequest): Promise<{
1480
+ gas: bigint;
1481
+ postRequestCalldata: HexString;
1482
+ }>;
1483
+ }
1484
+
1380
1485
  /**
1381
1486
  * Type representing an ISMP message.
1382
1487
  */
@@ -1500,8 +1605,9 @@ interface IChain {
1500
1605
  queryRequestReceipt(commitment: HexString): Promise<HexString | undefined>;
1501
1606
  /**
1502
1607
  * Query and return the encoded storage proof for the provided keys at the given height.
1608
+ * @param address - Optional contract address for EVM chains; defaults to host contract when omitted.
1503
1609
  */
1504
- queryStateProof(at: bigint, keys: HexString[]): Promise<HexString>;
1610
+ queryStateProof(at: bigint, keys: HexString[], address?: HexString): Promise<HexString>;
1505
1611
  queryProof(message: IMessage, counterparty: string, at?: bigint): Promise<HexString>;
1506
1612
  encode(message: IIsmpMessage): HexString;
1507
1613
  /**
@@ -1518,11 +1624,36 @@ interface IChain {
1518
1624
  stateMachineUpdateTime(stateMachineHeight: StateMachineHeight): Promise<bigint>;
1519
1625
  }
1520
1626
  /**
1521
- * Returns the chain interface for a given state machine identifier
1627
+ * Interface for EVM-compatible chains (EVM and Tron).
1628
+ * Extends IChain with methods required by IntentGatewayV2 and other EVM-specific protocols.
1629
+ */
1630
+ interface IEvmChain extends IChain {
1631
+ readonly configService: ChainConfigService;
1632
+ readonly client: PublicClient;
1633
+ getHostNonce(): Promise<bigint>;
1634
+ quoteNative(request: IPostRequest | IGetRequest, fee: bigint): Promise<bigint>;
1635
+ getFeeTokenWithDecimals(): Promise<{
1636
+ address: HexString;
1637
+ decimals: number;
1638
+ }>;
1639
+ getPlaceOrderCalldata(txHash: string, intentGatewayAddress: string): Promise<HexString>;
1640
+ broadcastTransaction(signedTransaction: any): Promise<TransactionReceipt>;
1641
+ }
1642
+ /**
1643
+ * Returns the chain interface for a given state machine identifier.
1644
+ *
1645
+ * - For standard EVM chains, returns an `EvmChain`.
1646
+ * - For Substrate chains, returns a connected `SubstrateChain`.
1647
+ * - For Tron chains (identified by chain ID), constructs a `TronChain`
1648
+ * that delegates EVM behavior to an internal `EvmChain` and manages
1649
+ * its own TronWeb instance using the provided RPC URL.
1650
+ *
1522
1651
  * @param chainConfig - Chain configuration
1523
1652
  * @returns Chain interface
1524
1653
  */
1525
1654
  declare function getChain(chainConfig: IEvmConfig | ISubstrateConfig): Promise<IChain>;
1655
+ declare function getEvmChain(chainConfig: IEvmConfig): IChain;
1656
+ declare function getSubstrateChain(chainConfig: ISubstrateConfig): Promise<SubstrateChain>;
1526
1657
 
1527
1658
  type EstimateGasCallData = ContractFunctionArgs<typeof _default.ABI, "nonpayable" | "payable", "handlePostRequests">;
1528
1659
  type HexString = `0x${string}`;
@@ -2186,18 +2317,20 @@ declare enum RequestKind {
2186
2317
  /**
2187
2318
  * Identifies a request for updating parameters
2188
2319
  */
2189
- UpdateParams = 2
2320
+ UpdateParams = 2,
2321
+ /**
2322
+ * Identifies a request for sweeping accumulated protocol dust
2323
+ */
2324
+ SweepDust = 3,
2325
+ /**
2326
+ * Identifies a request for refunding escrowed tokens after cancellation
2327
+ */
2328
+ RefundEscrow = 4
2190
2329
  }
2191
2330
  /**
2192
2331
  * Configuration for the IntentFiller
2193
2332
  */
2194
2333
  interface FillerConfig {
2195
- /**
2196
- * Policy for determining confirmation requirements
2197
- */
2198
- confirmationPolicy: {
2199
- getConfirmationBlocks: (chainId: number, amountUsd: number) => number;
2200
- };
2201
2334
  /**
2202
2335
  * Maximum number of orders to process concurrently
2203
2336
  */
@@ -2602,8 +2735,8 @@ interface DispatchInfoV2 {
2602
2735
  interface OrderV2 {
2603
2736
  id?: string;
2604
2737
  user: HexString;
2605
- source: string;
2606
- destination: string;
2738
+ source: HexString;
2739
+ destination: HexString;
2607
2740
  deadline: bigint;
2608
2741
  nonce: bigint;
2609
2742
  fees: bigint;
@@ -2641,10 +2774,11 @@ interface SubmitBidOptions {
2641
2774
  preVerificationGas: bigint;
2642
2775
  maxFeePerGas: bigint;
2643
2776
  maxPriorityFeePerGas: bigint;
2777
+ /** Pre-built ERC-7821 calldata encoding the UserOp execution (approvals + fillOrder). */
2778
+ callData: HexString;
2644
2779
  }
2645
2780
  interface EstimateFillOrderV2Params {
2646
2781
  order: OrderV2;
2647
- solverPrivateKey: HexString;
2648
2782
  /**
2649
2783
  * Optional percentage to bump maxPriorityFeePerGas.
2650
2784
  * This is added on top of the base gasPrice.
@@ -2667,7 +2801,6 @@ interface FillOrderEstimateV2 {
2667
2801
  maxPriorityFeePerGas: bigint;
2668
2802
  totalGasCostWei: bigint;
2669
2803
  totalGasInFeeToken: bigint;
2670
- nonce: bigint;
2671
2804
  }
2672
2805
  /**
2673
2806
  * Result of submitting a bid to Hyperbridge
@@ -2733,6 +2866,8 @@ declare const IntentOrderStatus: Readonly<{
2733
2866
  BIDS_RECEIVED: "BIDS_RECEIVED";
2734
2867
  BID_SELECTED: "BID_SELECTED";
2735
2868
  USEROP_SUBMITTED: "USEROP_SUBMITTED";
2869
+ FILLED: "FILLED";
2870
+ PARTIAL_FILL: "PARTIAL_FILL";
2736
2871
  FAILED: "FAILED";
2737
2872
  }>;
2738
2873
  type IntentOrderStatus = typeof IntentOrderStatus;
@@ -2762,6 +2897,7 @@ interface SelectBidResult {
2762
2897
  solverAddress: HexString;
2763
2898
  commitment: HexString;
2764
2899
  txnHash?: HexString;
2900
+ fillStatus?: "full" | "partial";
2765
2901
  }
2766
2902
  /** Options for executing an intent order */
2767
2903
  interface ExecuteIntentOrderOptions {
@@ -3586,8 +3722,161 @@ type CancelEvent$1 = {
3586
3722
  };
3587
3723
  }[keyof CancelEventMap$1];
3588
3724
 
3725
+ type StorageDriverKey = "node" | "localstorage" | "indexeddb" | "memory";
3726
+ interface CancellationStorageOptions {
3727
+ env?: StorageDriverKey;
3728
+ basePath?: string;
3729
+ }
3730
+ interface SessionKeyStorageOptions {
3731
+ env?: StorageDriverKey;
3732
+ basePath?: string;
3733
+ }
3734
+
3735
+ declare function createCancellationStorage(options?: CancellationStorageOptions): Readonly<{
3736
+ getItem: <T>(key: string) => Promise<T | null>;
3737
+ setItem: (key: string, value: unknown) => Promise<void>;
3738
+ removeItem: (key: string) => Promise<void>;
3739
+ hasItem<U extends never, K extends keyof (U extends {
3740
+ [key: string]: unknown;
3741
+ items: unknown;
3742
+ } ? U["items"] : U)>(key: K, opts?: unstorage.TransactionOptions): Promise<boolean>;
3743
+ hasItem(key: string, opts?: unstorage.TransactionOptions): Promise<boolean>;
3744
+ getItems: <U extends unstorage.StorageValue>(items: (string | {
3745
+ key: string;
3746
+ options?: unstorage.TransactionOptions;
3747
+ })[], commonOptions?: unstorage.TransactionOptions) => Promise<{
3748
+ key: string;
3749
+ value: U;
3750
+ }[]>;
3751
+ getItemRaw: <T = any>(key: string, opts?: unstorage.TransactionOptions) => Promise<(T extends any ? T : any) | null>;
3752
+ setItems: <U extends unstorage.StorageValue>(items: {
3753
+ key: string;
3754
+ value: U;
3755
+ options?: unstorage.TransactionOptions;
3756
+ }[], commonOptions?: unstorage.TransactionOptions) => Promise<void>;
3757
+ setItemRaw: <T = any>(key: string, value: T extends any ? T : any, opts?: unstorage.TransactionOptions) => Promise<void>;
3758
+ getMeta: (key: string, opts?: (unstorage.TransactionOptions & {
3759
+ nativeOnly?: boolean;
3760
+ }) | boolean) => unstorage.StorageMeta | Promise<unstorage.StorageMeta>;
3761
+ setMeta: (key: string, value: unstorage.StorageMeta, opts?: unstorage.TransactionOptions) => Promise<void>;
3762
+ removeMeta: (key: string, opts?: unstorage.TransactionOptions) => Promise<void>;
3763
+ getKeys: (base?: string, opts?: unstorage.GetKeysOptions) => Promise<string[]>;
3764
+ clear: (base?: string, opts?: unstorage.TransactionOptions) => Promise<void>;
3765
+ dispose: () => Promise<void>;
3766
+ watch: (callback: unstorage.WatchCallback) => Promise<unstorage.Unwatch>;
3767
+ unwatch: () => Promise<void>;
3768
+ mount: (base: string, driver: unstorage.Driver) => unstorage.Storage;
3769
+ unmount: (base: string, dispose?: boolean) => Promise<void>;
3770
+ getMount: (key?: string) => {
3771
+ base: string;
3772
+ driver: unstorage.Driver;
3773
+ };
3774
+ getMounts: (base?: string, options?: {
3775
+ parents?: boolean;
3776
+ }) => {
3777
+ base: string;
3778
+ driver: unstorage.Driver;
3779
+ }[];
3780
+ keys: unstorage.Storage["getKeys"];
3781
+ get: {
3782
+ <U extends never, K extends string & keyof (U extends {
3783
+ [key: string]: unknown;
3784
+ items: unknown;
3785
+ } ? U["items"] : U)>(key: K, ops?: unstorage.TransactionOptions): Promise<(K extends never ? unstorage.StorageValue[K] : unstorage.StorageValue) | null>;
3786
+ <R = unstorage.StorageValue>(key: string, opts?: unstorage.TransactionOptions): Promise<R | null>;
3787
+ };
3788
+ set: {
3789
+ <U extends never, K extends keyof (U extends {
3790
+ [key: string]: unknown;
3791
+ items: unknown;
3792
+ } ? U["items"] : U)>(key: K, value: K extends never ? unstorage.StorageValue[K] : unstorage.StorageValue, opts?: unstorage.TransactionOptions): Promise<void>;
3793
+ <U extends unstorage.StorageValue>(key: string, value: U, opts?: unstorage.TransactionOptions): Promise<void>;
3794
+ };
3795
+ has: {
3796
+ <U extends never, K extends keyof (U extends {
3797
+ [key: string]: unknown;
3798
+ items: unknown;
3799
+ } ? U["items"] : U)>(key: K, opts?: unstorage.TransactionOptions): Promise<boolean>;
3800
+ (key: string, opts?: unstorage.TransactionOptions): Promise<boolean>;
3801
+ };
3802
+ del: {
3803
+ <U extends never, K extends keyof (U extends {
3804
+ [key: string]: unknown;
3805
+ items: unknown;
3806
+ } ? U["items"] : U)>(key: K, opts?: (unstorage.TransactionOptions & {
3807
+ removeMeta?: boolean;
3808
+ }) | boolean): Promise<void>;
3809
+ (key: string, opts?: (unstorage.TransactionOptions & {
3810
+ removeMeta?: boolean;
3811
+ }) | boolean): Promise<void>;
3812
+ };
3813
+ remove: {
3814
+ <U extends never, K extends keyof (U extends {
3815
+ [key: string]: unknown;
3816
+ items: unknown;
3817
+ } ? U["items"] : U)>(key: K, opts?: (unstorage.TransactionOptions & {
3818
+ removeMeta?: boolean;
3819
+ }) | boolean): Promise<void>;
3820
+ (key: string, opts?: (unstorage.TransactionOptions & {
3821
+ removeMeta?: boolean;
3822
+ }) | boolean): Promise<void>;
3823
+ };
3824
+ }>;
3825
+ /**
3826
+ * Session key data stored for each order
3827
+ */
3828
+ interface SessionKeyData {
3829
+ /**
3830
+ * The private key as a hex string
3831
+ */
3832
+ privateKey: HexString;
3833
+ /**
3834
+ * The derived public address
3835
+ */
3836
+ address: HexString;
3837
+ /**
3838
+ * The order commitment this session key is associated with.
3839
+ * This may be undefined for session keys that were created
3840
+ * but whose corresponding order has not been finalized yet.
3841
+ */
3842
+ commitment?: HexString;
3843
+ /**
3844
+ * Timestamp when the session key was created
3845
+ */
3846
+ createdAt: number;
3847
+ }
3848
+ /**
3849
+ * Creates a session key storage instance for IntentGatewayV2 orders.
3850
+ * The storage is used to persist session key private keys so they can be
3851
+ * used later to sign solver selection messages.
3852
+ *
3853
+ * @param options - Optional configuration for the storage driver
3854
+ * @returns A storage instance with methods to get, set, and remove session keys
3855
+ */
3856
+ declare function createSessionKeyStorage(options?: SessionKeyStorageOptions): Readonly<{
3857
+ getSessionKey: (commitment: HexString) => Promise<SessionKeyData | null>;
3858
+ getSessionKeyByAddress: (address: HexString) => Promise<SessionKeyData | null>;
3859
+ setSessionKey: (commitment: HexString, data: SessionKeyData) => Promise<void>;
3860
+ setSessionKeyByAddress: (address: HexString, data: SessionKeyData) => Promise<void>;
3861
+ removeSessionKey: (commitment: HexString) => Promise<void>;
3862
+ removeSessionKeyByAddress: (address: HexString) => Promise<void>;
3863
+ listSessionKeys: () => Promise<SessionKeyData[]>;
3864
+ }>;
3865
+
3866
+ /** placeOrder function selector */
3867
+ declare const PLACE_ORDER_SELECTOR = "placeOrder((bytes32,bytes,bytes,uint256,uint256,uint256,address,((bytes32,uint256)[],bytes),(bytes32,uint256)[],(bytes32,(bytes32,uint256)[],bytes)),bytes32)";
3868
+ /** placeOrder function parameter type */
3869
+ declare const ORDER_V2_PARAM_TYPE = "(bytes32,bytes,bytes,uint256,uint256,uint256,address,((bytes32,uint256)[],bytes),(bytes32,uint256)[],(bytes32,(bytes32,uint256)[],bytes))";
3589
3870
  /** ERC-7821 single batch execution mode */
3590
3871
  declare const ERC7821_BATCH_MODE: HexString;
3872
+ /** Bundler RPC method names for ERC-4337 operations */
3873
+ declare const BundlerMethod: {
3874
+ readonly ETH_SEND_USER_OPERATION: "eth_sendUserOperation";
3875
+ readonly ETH_GET_USER_OPERATION_RECEIPT: "eth_getUserOperationReceipt";
3876
+ readonly ETH_ESTIMATE_USER_OPERATION_GAS: "eth_estimateUserOperationGas";
3877
+ readonly PIMLICO_GET_USER_OPERATION_GAS_PRICE: "pimlico_getUserOperationGasPrice";
3878
+ };
3879
+ type BundlerMethod = (typeof BundlerMethod)[keyof typeof BundlerMethod];
3591
3880
  /** Response from bundler's eth_estimateUserOperationGas */
3592
3881
  interface BundlerGasEstimate {
3593
3882
  preVerificationGas: HexString;
@@ -3596,22 +3885,16 @@ interface BundlerGasEstimate {
3596
3885
  paymasterVerificationGasLimit?: HexString;
3597
3886
  paymasterPostOpGasLimit?: HexString;
3598
3887
  }
3599
- /** Bundler RPC method names for ERC-4337 operations */
3600
- declare const BundlerMethod: {
3601
- /** Submit a user operation to the bundler */
3602
- readonly ETH_SEND_USER_OPERATION: "eth_sendUserOperation";
3603
- /** Get the receipt of a user operation */
3604
- readonly ETH_GET_USER_OPERATION_RECEIPT: "eth_getUserOperationReceipt";
3605
- /** Estimate gas for a user operation */
3606
- readonly ETH_ESTIMATE_USER_OPERATION_GAS: "eth_estimateUserOperationGas";
3607
- };
3608
- type BundlerMethod = (typeof BundlerMethod)[keyof typeof BundlerMethod];
3609
3888
  /** Event map for cancellation status updates */
3610
3889
  interface CancelEventMap {
3611
3890
  DESTINATION_FINALIZED: {
3612
3891
  proof: IProof;
3613
3892
  };
3614
3893
  AWAITING_GET_REQUEST: undefined;
3894
+ AWAITING_CANCEL_TRANSACTION: {
3895
+ calldata: HexString;
3896
+ to: HexString;
3897
+ };
3615
3898
  SOURCE_FINALIZED: {
3616
3899
  metadata: {
3617
3900
  blockNumber: number;
@@ -3620,6 +3903,11 @@ interface CancelEventMap {
3620
3903
  HYPERBRIDGE_DELIVERED: RequestStatusWithMetadata;
3621
3904
  HYPERBRIDGE_FINALIZED: RequestStatusWithMetadata;
3622
3905
  SOURCE_PROOF_RECEIVED: IProof;
3906
+ CANCELLATION_COMPLETE: {
3907
+ metadata: {
3908
+ blockNumber: number;
3909
+ };
3910
+ };
3623
3911
  }
3624
3912
  type CancelEvent = {
3625
3913
  [K in keyof CancelEventMap]: {
@@ -3627,400 +3915,100 @@ type CancelEvent = {
3627
3915
  data: CancelEventMap[K];
3628
3916
  };
3629
3917
  }[keyof CancelEventMap];
3630
- /** IntentGatewayV2 contract initialization parameters */
3631
- interface IntentGatewayV2Params {
3632
- host: HexString;
3633
- dispatcher: HexString;
3634
- solverSelection: boolean;
3635
- surplusShareBps: bigint;
3636
- protocolFeeBps: bigint;
3637
- priceOracle: HexString;
3918
+
3919
+ /** Shared context for IntentsV2 sub-modules */
3920
+ interface IntentsV2Context {
3921
+ source: IEvmChain;
3922
+ dest: IEvmChain;
3923
+ intentsCoprocessor?: IntentsCoprocessor;
3924
+ bundlerUrl?: string;
3925
+ feeTokenCache: Map<string, {
3926
+ address: HexString;
3927
+ decimals: number;
3928
+ cachedAt: number;
3929
+ }>;
3930
+ solverCodeCache: Map<string, string>;
3931
+ sessionKeyStorage: ReturnType<typeof createSessionKeyStorage>;
3932
+ cancellationStorage: ReturnType<typeof createCancellationStorage>;
3933
+ swap: Swap;
3638
3934
  }
3935
+
3639
3936
  /**
3640
- * IntentGatewayV2 utilities for placing orders, submitting bids, and managing the intent lifecycle.
3641
- *
3642
- * This class provides a complete SDK for interacting with the IntentGatewayV2 protocol:
3643
- * - **Order Placement**: Generate session keys and prepare order transactions
3644
- * - **Bid Management**: Validate, sort, and select optimal bids from solvers
3645
- * - **Execution Flow**: Full lifecycle management from order to completion
3646
- * - **Cancellation**: Handle order cancellation with cross-chain proofs
3647
- *
3648
- * Session keys are automatically managed with environment-appropriate storage
3649
- * (Node.js filesystem, browser localStorage/IndexedDB, or in-memory fallback).
3650
- *
3651
- * @example
3652
- * ```typescript
3653
- * const gateway = new IntentGatewayV2(sourceChain, destChain, coprocessor, bundlerUrl)
3654
- *
3655
- * // Place an order
3656
- * const gen = gateway.preparePlaceOrder(order)
3657
- * const { value: { calldata } } = await gen.next()
3658
- * const txHash = await wallet.sendTransaction({ to: gatewayAddr, data: calldata })
3659
- * const { value: finalOrder } = await gen.next(txHash)
3937
+ * IntentsV2 utilities for placing orders, submitting bids, and managing the intent lifecycle.
3660
3938
  *
3661
- * // Execute and track
3662
- * for await (const status of gateway.executeIntentOrder({ order: finalOrder })) {
3663
- * console.log(status.status)
3664
- * }
3665
- * ```
3939
+ * Use `IntentsV2.create()` to obtain an initialized instance.
3666
3940
  */
3667
- declare class IntentGatewayV2 {
3668
- readonly source: EvmChain;
3669
- readonly dest: EvmChain;
3670
- readonly intentsCoprocessor?: IntentsCoprocessor | undefined;
3671
- readonly bundlerUrl?: string | undefined;
3672
- /** EIP-712 type hash for SelectSolver message */
3673
- static readonly SELECT_SOLVER_TYPEHASH: `0x${string}`;
3674
- /** EIP-712 type hash for PackedUserOperation */
3675
- static readonly PACKED_USEROP_TYPEHASH: `0x${string}`;
3676
- /** EIP-712 type hash for EIP712Domain */
3677
- static readonly DOMAIN_TYPEHASH: `0x${string}`;
3678
- private readonly sessionKeyStorage;
3679
- private readonly cancellationStorage;
3680
- private readonly swap;
3681
- private readonly feeTokenCache;
3682
- private initPromise;
3683
- /**
3684
- * Creates a new IntentGatewayV2 instance.
3941
+ declare class IntentsV2 {
3942
+ readonly source: IEvmChain;
3943
+ readonly dest: IEvmChain;
3944
+ readonly intentsCoprocessor?: IntentsCoprocessor;
3945
+ readonly bundlerUrl?: string;
3946
+ private readonly ctx;
3947
+ private readonly _crypto;
3948
+ private readonly orderPlacer;
3949
+ private readonly orderExecutor;
3950
+ private readonly orderCanceller;
3951
+ private readonly bidManager;
3952
+ private readonly gasEstimator;
3953
+ private constructor();
3954
+ /**
3955
+ * Creates an initialized IntentsV2 instance.
3685
3956
  *
3686
3957
  * @param source - Source chain for order placement
3687
3958
  * @param dest - Destination chain for order fulfillment
3688
3959
  * @param intentsCoprocessor - Optional coprocessor for bid fetching and order execution
3689
- * @param bundlerUrl - Optional ERC-4337 bundler URL for gas estimation and UserOp submission.
3690
- *
3691
- */
3692
- constructor(source: EvmChain, dest: EvmChain, intentsCoprocessor?: IntentsCoprocessor | undefined, bundlerUrl?: string | undefined);
3693
- /**
3694
- * Ensures the fee token cache is initialized before use.
3695
- * Called automatically by methods that need the cache.
3696
- */
3697
- ensureInitialized(): Promise<void>;
3698
- /**
3699
- * Generator function that prepares and places an order.
3700
- *
3701
- * Flow:
3702
- * 1. Generates a session key and sets `order.session`
3703
- * 2. Encodes the placeOrder calldata and yields `{ calldata, sessionPrivateKey }`
3704
- * 3. Waits for the user/frontend to submit the transaction and provide the txHash via `next(txHash)`
3705
- * 4. Fetches the transaction receipt and extracts the OrderPlaced event
3706
- * 5. Updates `order.nonce` and `order.inputs` from the actual event data
3707
- * 6. Computes the commitment and sets `order.id`
3708
- * 7. Stores the session key and returns the finalized order
3709
- *
3710
- * @param order - The order to prepare and place
3711
- * @yields `{ calldata, sessionPrivateKey }` - Encoded placeOrder calldata and session private key
3712
- * @returns The finalized order with correct nonce, inputs, and commitment from on-chain event
3713
- *
3714
- * @example
3715
- * ```typescript
3716
- * const generator = gateway.preparePlaceOrder(order)
3717
- *
3718
- * // Step 1: Get calldata and private key
3719
- * const { value: { calldata, sessionPrivateKey } } = await generator.next()
3720
- *
3721
- * // Step 2: Submit transaction using the calldata
3722
- * const txHash = await walletClient.sendTransaction({
3723
- * to: intentGatewayV2Address,
3724
- * data: calldata,
3725
- * })
3726
- *
3727
- * // Step 3: Pass txHash back to generator and get finalized order
3728
- * const { value: finalizedOrder } = await generator.next(txHash)
3729
- * ```
3730
- */
3731
- preparePlaceOrder(order: OrderV2): AsyncGenerator<{
3960
+ * @param bundlerUrl - Optional ERC-4337 bundler URL for gas estimation and UserOp submission
3961
+ * @returns Initialized IntentsV2 instance
3962
+ */
3963
+ static create(source: IEvmChain, dest: IEvmChain, intentsCoprocessor?: IntentsCoprocessor, bundlerUrl?: string): Promise<IntentsV2>;
3964
+ private init;
3965
+ execute(order: OrderV2, graffiti?: HexString, options?: {
3966
+ maxPriorityFeePerGasBumpPercent?: number;
3967
+ maxFeePerGasBumpPercent?: number;
3968
+ minBids?: number;
3969
+ bidTimeoutMs?: number;
3970
+ pollIntervalMs?: number;
3971
+ }): AsyncGenerator<{
3732
3972
  calldata: HexString;
3973
+ feesInWei?: bigint;
3733
3974
  sessionPrivateKey: HexString;
3734
- }, OrderV2, HexString>;
3735
- /**
3736
- * Generator function that orchestrates the full intent order execution flow.
3737
- *
3738
- * Flow: AWAITING_BIDS → BIDS_RECEIVED → BID_SELECTED → USEROP_SUBMITTED
3739
- *
3740
- * Requires `intentsCoprocessor` and `bundlerUrl` to be set in the constructor.
3741
- *
3742
- * @param options - Execution options including the order and optional parameters
3743
- * @yields Status updates throughout the execution flow
3744
- *
3745
- * @example
3746
- * ```typescript
3747
- * for await (const status of gateway.executeIntentOrder({ order, orderTxHash: txHash })) {
3748
- * switch (status.status) {
3749
- * case 'AWAITING_BIDS':
3750
- * console.log('Waiting for solver bids...')
3751
- * break
3752
- * case 'BIDS_RECEIVED':
3753
- * console.log(`Received ${status.metadata.bidCount} bids`)
3754
- * break
3755
- * case 'BID_SELECTED':
3756
- * console.log(`Selected solver: ${status.metadata.selectedSolver}`)
3757
- * break
3758
- * case 'USEROP_SUBMITTED':
3759
- * console.log(`UserOp submitted: ${status.metadata.userOpHash}`)
3760
- * break
3761
- * }
3762
- * }
3763
- * ```
3764
- */
3975
+ } | IntentOrderStatusUpdate, void, HexString>;
3976
+ placeOrder(order: OrderV2, graffiti?: HexString): AsyncGenerator<{
3977
+ calldata: HexString;
3978
+ sessionPrivateKey: HexString;
3979
+ }, OrderV2, any>;
3765
3980
  executeIntentOrder(options: ExecuteIntentOrderOptions): AsyncGenerator<IntentOrderStatusUpdate, void>;
3766
- /**
3767
- * Returns the native token amount required to dispatch a cancellation GET request.
3768
- *
3769
- * @param order - The order to get the cancellation quote for
3770
- * @returns Native token amount required for the cancellation GET request
3771
- */
3772
- quoteCancelNative(order: OrderV2): Promise<bigint>;
3773
- /**
3774
- * Generator function that handles the full order cancellation flow.
3775
- *
3776
- * This allows users to cancel orders that haven't been filled by the deadline.
3777
- *
3778
- * Flow:
3779
- * 1. Fetch proof that the order wasn't filled on the destination chain
3780
- * 2. Submit a GET request to read the unfilled order state
3781
- * 3. Wait for the GET request to be processed through Hyperbridge
3782
- * 4. Finalize the cancellation on Hyperbridge
3783
- *
3784
- * @param order - The order to cancel
3785
- * @param indexerClient - Client for querying the indexer
3786
- * @yields Status updates throughout the cancellation process
3787
- *
3788
- * @example
3789
- * ```typescript
3790
- * const cancelStream = gateway.cancelOrder(order, indexerClient)
3791
- *
3792
- * for await (const event of cancelStream) {
3793
- * switch (event.status) {
3794
- * case 'DESTINATION_FINALIZED':
3795
- * console.log('Got destination proof')
3796
- * break
3797
- * case 'AWAITING_GET_REQUEST':
3798
- * const txHash = await submitCancelTx()
3799
- * cancelStream.next(txHash)
3800
- * break
3801
- * case 'SOURCE_FINALIZED':
3802
- * console.log('Source finalized')
3803
- * break
3804
- * case 'HYPERBRIDGE_DELIVERED':
3805
- * console.log('Delivered to Hyperbridge')
3806
- * break
3807
- * case 'HYPERBRIDGE_FINALIZED':
3808
- * console.log('Cancellation complete')
3809
- * break
3810
- * }
3811
- * }
3812
- * ```
3813
- */
3814
- cancelOrder(order: OrderV2, indexerClient: IndexerClient): AsyncGenerator<CancelEvent>;
3815
- /**
3816
- * Prepares a bid UserOperation for submitting to Hyperbridge (used by fillers/solvers).
3817
- *
3818
- * The callData is encoded using ERC-7821 batch executor format since SolverAccount
3819
- * extends ERC7821. Format: `execute(bytes32 mode, bytes executionData)`
3820
- * where executionData contains the fillOrder call to IntentGatewayV2.
3821
- *
3822
- * @param options - Bid submission options including order, fillOptions, and gas parameters
3823
- * @returns PackedUserOperation ready for submission to Hyperbridge
3824
- */
3981
+ quoteCancelNative(order: OrderV2, from?: "source" | "dest"): Promise<bigint>;
3982
+ cancelOrder(order: OrderV2, indexerClient: IndexerClient, from?: "source" | "dest"): AsyncGenerator<CancelEvent>;
3825
3983
  prepareSubmitBid(options: SubmitBidOptions): Promise<PackedUserOperation>;
3826
- /**
3827
- * Selects the best bid from Hyperbridge and submits to the bundler.
3828
- *
3829
- * Flow:
3830
- * 1. Fetches bids from Hyperbridge
3831
- * 2. Validates and sorts bids by USD value (WETH price fetched via swap, USDC/USDT at $1)
3832
- * 3. Tries each bid (best to worst) until one passes simulation
3833
- * 4. Signs and submits the winning bid to the bundler
3834
- *
3835
- * Requires `bundlerUrl` and `intentsCoprocessor` to be set in the constructor.
3836
- *
3837
- * @param order - The order to select a bid for
3838
- * @param bids - Array of filler bids to evaluate
3839
- * @param sessionPrivateKey - Optional session private key (retrieved from storage if not provided)
3840
- * @returns Result containing the selected bid, userOp, and transaction details
3841
- */
3842
3984
  selectBid(order: OrderV2, bids: FillerBid[], sessionPrivateKey?: HexString): Promise<SelectBidResult>;
3843
- /**
3844
- * Estimates gas costs for fillOrder execution via ERC-4337.
3845
- *
3846
- * Calculates all gas parameters needed for UserOperation submission:
3847
- * - `callGasLimit`: Gas for fillOrder execution
3848
- * - `verificationGasLimit`: Gas for SolverAccount.validateUserOp
3849
- * - `preVerificationGas`: Bundler overhead for calldata
3850
- * - Gas prices based on current network conditions
3851
- *
3852
- * Uses the bundler's eth_estimateUserOperationGas method for accurate gas estimation
3853
- * when a bundler URL is configured.
3854
- *
3855
- * @param params - Estimation parameters including order and solver account
3856
- * @returns Complete gas estimate with all ERC-4337 parameters
3857
- */
3858
3985
  estimateFillOrderV2(params: EstimateFillOrderV2Params): Promise<FillOrderEstimateV2>;
3859
- /**
3860
- * Computes the EIP-712 domain separator for a contract.
3861
- *
3862
- * @param contractName - Contract name (e.g., "IntentGateway", "ERC4337")
3863
- * @param version - Contract version
3864
- * @param chainId - Chain ID
3865
- * @param contractAddress - Contract address
3866
- * @returns The domain separator hash
3867
- */
3868
- getDomainSeparator(contractName: string, version: string, chainId: bigint, contractAddress: HexString): HexString;
3869
- /**
3870
- * Signs a solver selection message using the session key (EIP-712).
3871
- *
3872
- * @param commitment - Order commitment hash
3873
- * @param solverAddress - Address of the selected solver
3874
- * @param domainSeparator - EIP-712 domain separator
3875
- * @param privateKey - Session private key
3876
- * @returns The signature or null if signing fails
3877
- */
3878
- signSolverSelection(commitment: HexString, solverAddress: HexString, domainSeparator: HexString, privateKey: HexString): Promise<HexString | null>;
3879
- /**
3880
- * Computes the EIP-4337 UserOperation hash.
3881
- *
3882
- * @param userOp - The packed user operation
3883
- * @param entryPoint - EntryPoint contract address
3884
- * @param chainId - Chain ID
3885
- * @returns The UserOperation hash
3886
- */
3887
- computeUserOpHash(userOp: PackedUserOperation, entryPoint: Hex, chainId: bigint): Hex;
3888
- /**
3889
- * Gets the packed user struct hash for a UserOperation.
3890
- *
3891
- * @param userOp - The UserOperation to hash
3892
- * @returns The struct hash
3893
- */
3894
- getPackedUserStructHash(userOp: PackedUserOperation): HexString;
3895
- /** Packs verificationGasLimit and callGasLimit into bytes32 */
3896
- packGasLimits(verificationGasLimit: bigint, callGasLimit: bigint): HexString;
3897
- /** Packs maxPriorityFeePerGas and maxFeePerGas into bytes32 */
3898
- packGasFees(maxPriorityFeePerGas: bigint, maxFeePerGas: bigint): HexString;
3899
- /** Unpacks accountGasLimits (bytes32) into verificationGasLimit and callGasLimit */
3900
- unpackGasLimits(accountGasLimits: HexString): {
3901
- verificationGasLimit: bigint;
3902
- callGasLimit: bigint;
3903
- };
3904
- /** Unpacks gasFees (bytes32) into maxPriorityFeePerGas and maxFeePerGas */
3905
- unpackGasFees(gasFees: HexString): {
3906
- maxPriorityFeePerGas: bigint;
3907
- maxFeePerGas: bigint;
3908
- };
3909
- /**
3910
- * Converts a PackedUserOperation to bundler-compatible v0.7/v0.8 format.
3911
- * Unpacks gas limits and fees, extracts factory/paymaster data from packed fields.
3912
- *
3913
- * @param userOp - The packed user operation to convert
3914
- * @returns Bundler-compatible user operation object
3915
- */
3916
- prepareBundlerCall(userOp: PackedUserOperation): Record<string, unknown>;
3917
- /**
3918
- * Sends a JSON-RPC request to the bundler endpoint.
3919
- *
3920
- * @param method - The bundler method to call
3921
- * @param params - Parameters array for the RPC call
3922
- * @returns The result from the bundler
3923
- * @throws Error if bundler URL not configured or bundler returns an error
3924
- */
3925
- sendBundler<T = unknown>(method: BundlerMethod, params?: unknown[]): Promise<T>;
3926
- /**
3927
- * Encodes calls into ERC-7821 execute function calldata.
3928
- *
3929
- * Format: `execute(bytes32 mode, bytes executionData)`
3930
- * Where executionData = abi.encode(calls) and calls = (address target, uint256 value, bytes data)[]
3931
- *
3932
- * @param calls - Array of calls to encode
3933
- * @returns Encoded calldata for execute function
3934
- */
3935
3986
  encodeERC7821Execute(calls: ERC7821Call[]): HexString;
3936
- /**
3937
- * Decodes ERC-7821 execute function calldata back into individual calls.
3938
- *
3939
- * @param callData - The execute function calldata to decode
3940
- * @returns Array of decoded calls, or null if decoding fails
3941
- */
3942
3987
  decodeERC7821Execute(callData: HexString): ERC7821Call[] | null;
3943
- /** Initializes the fee token cache for source and destination chains */
3944
- private initFeeTokenCache;
3945
- /**
3946
- * Validates bids and sorts them by USD value (best to worst).
3947
- *
3948
- * A bid is valid if `fillOptions.outputs[i].amount >= order.output.assets[i].amount` for all i.
3949
- * USD value is calculated using USDC/USDT at $1 and WETH price fetched via swap.
3950
- */
3951
- private validateAndSortBids;
3952
- /**
3953
- * Simulates select + fillOrder to verify execution will succeed.
3954
- *
3955
- * No state overrides are used - the solver should already have tokens and approvals.
3956
- * The contract validates that outputs >= order.output.assets.
3957
- */
3958
- private simulateAndValidate;
3959
- /**
3960
- * Unified state override builder for gas estimation.
3961
- *
3962
- * Builds state overrides for:
3963
- * - EntryPoint deposit (for ERC-4337 UserOps)
3964
- * - Native balance
3965
- * - Token balances and allowances
3966
- * - IntentGatewayV2 params (solverSelection disabled)
3967
- *
3968
- * Returns both viem format (for estimateContractGas) and bundler format (for eth_estimateUserOperationGas).
3969
- *
3970
- * @param params - Configuration for state overrides
3971
- * @returns Object with both viem and bundler format state overrides
3972
- */
3973
- buildStateOverride(params: {
3974
- accountAddress: HexString;
3975
- chain: string;
3976
- outputAssets: {
3977
- token: HexString;
3978
- amount: bigint;
3979
- }[];
3980
- spenderAddress: HexString;
3981
- intentGatewayV2Address?: HexString;
3982
- entryPointAddress?: HexString;
3983
- }): {
3984
- viem: {
3985
- address: HexString;
3986
- balance?: bigint;
3987
- stateDiff?: {
3988
- slot: HexString;
3989
- value: HexString;
3990
- }[];
3991
- }[];
3992
- bundler: Record<string, {
3993
- balance?: string;
3994
- stateDiff?: Record<string, string>;
3995
- }>;
3996
- };
3997
- /**
3998
- * Converts gas costs to the equivalent amount in the fee token (DAI).
3999
- * Uses USD pricing to convert between native token gas costs and fee token amounts.
4000
- */
4001
- private convertGasToFeeToken;
4002
- /** Gets a quote for the native token cost of dispatching a post request */
4003
- private quoteNative;
4004
- /** Fetches proof for the destination chain that the order hasn't been filled */
4005
- private fetchDestinationProof;
4006
- /** Submits a GET request message to Hyperbridge and confirms receipt */
4007
- private submitAndConfirmReceipt;
4008
3988
  }
3989
+
4009
3990
  /**
4010
- * Transforms an OrderV2 (SDK type) to the Order struct expected by the contract.
4011
- *
4012
- * Removes SDK-specific fields (`id`, `transactionHash`) and converts
4013
- * source/destination to hex if not already.
3991
+ * Standalone utility to encode calls into ERC-7821 execute function calldata.
3992
+ * Can be used outside of the IntentGatewayV2 class (e.g., by filler strategies
3993
+ * that need to build custom batch calldata for swap+fill operations).
3994
+ */
3995
+ declare function encodeERC7821ExecuteBatch(calls: ERC7821Call[]): HexString;
3996
+ /**
3997
+ * Fetches proof for the source chain.
4014
3998
  *
4015
- * @param order - The SDK order to transform
4016
- * @returns Contract-compatible order struct
3999
+ * @internal
4000
+ */
4001
+ declare function fetchSourceProof(commitment: HexString, source: IEvmChain, sourceStateMachine: string, sourceConsensusStateId: string, sourceHeight: bigint): Promise<IProof>;
4002
+ /**
4003
+ * Transforms an OrderV2 (SDK type) to the Order struct expected by the contract.
4017
4004
  */
4018
4005
  declare function transformOrderForContract(order: OrderV2): Omit<OrderV2, "id" | "transactionHash">;
4019
- /** @deprecated Use `IntentGatewayV2.SELECT_SOLVER_TYPEHASH` instead */
4006
+
4007
+ /** EIP-712 type hash for SelectSolver message */
4020
4008
  declare const SELECT_SOLVER_TYPEHASH: `0x${string}`;
4021
- /** @deprecated Use `IntentGatewayV2.PACKED_USEROP_TYPEHASH` instead */
4009
+ /** EIP-712 type hash for PackedUserOperation */
4022
4010
  declare const PACKED_USEROP_TYPEHASH: `0x${string}`;
4023
- /** @deprecated Use `IntentGatewayV2.DOMAIN_TYPEHASH` instead */
4011
+ /** EIP-712 type hash for EIP712Domain */
4024
4012
  declare const DOMAIN_TYPEHASH: `0x${string}`;
4025
4013
 
4026
4014
  /**
@@ -4401,6 +4389,7 @@ declare const tronNile: {
4401
4389
  serializers?: viem.ChainSerializers<undefined, viem.TransactionSerializable> | undefined;
4402
4390
  verifyHash?: ((client: viem.Client, parameters: viem.VerifyHashActionParameters) => Promise<viem.VerifyHashActionReturnType>) | undefined;
4403
4391
  };
4392
+ declare const tronChainIds: Set<number>;
4404
4393
  interface ChainConfigData {
4405
4394
  chainId: number;
4406
4395
  stateMachineId: Chains;
@@ -4411,10 +4400,14 @@ interface ChainConfigData {
4411
4400
  DAI: string;
4412
4401
  USDC: string;
4413
4402
  USDT: string;
4403
+ cNGN?: string;
4404
+ EXT?: string;
4414
4405
  };
4415
4406
  tokenDecimals?: {
4416
4407
  USDC: number;
4417
4408
  USDT: number;
4409
+ cNGN?: number;
4410
+ EXT?: number;
4418
4411
  };
4419
4412
  tokenStorageSlots?: {
4420
4413
  USDT?: {
@@ -4451,6 +4444,8 @@ interface ChainConfigData {
4451
4444
  EntryPointV08?: `0x${string}`;
4452
4445
  /** USDT0 OFT contract address (OFT Adapter on Ethereum, OFT on other chains) */
4453
4446
  Usdt0Oft?: `0x${string}`;
4447
+ /** SolverAccount contract address used for EIP-7702 delegation */
4448
+ SolverAccount?: `0x${string}`;
4454
4449
  };
4455
4450
  rpcEnvKey?: string;
4456
4451
  defaultRpcUrl?: string;
@@ -4466,4 +4461,4 @@ declare const getChainId: (stateMachineId: string) => number | undefined;
4466
4461
  declare const getViemChain: (chainId: number) => Chain | undefined;
4467
4462
  declare const hyperbridgeAddress = "";
4468
4463
 
4469
- export { ADDRESS_ZERO, type AllStatusKey, type AssetTeleported, type AssetTeleportedResponse, type BidStorageEntry, type BidSubmissionResult, type BlockMetadata, type BundlerGasEstimate, BundlerMethod, type CancelEvent, type CancelEventMap, type CancelOptions, type ChainConfig, type ChainConfigData, ChainConfigService, Chains, type ClientConfig, DEFAULT_ADDRESS, DEFAULT_GRAFFITI, DOMAIN_TYPEHASH, DUMMY_PRIVATE_KEY, type DecodedOrderPlacedLog, type DecodedOrderV2PlacedLog, type DecodedPostRequestEvent, type DecodedPostResponseEvent, type DispatchGet, type DispatchInfoV2, type DispatchPost, ERC20Method, type ERC7821Call, ERC7821_BATCH_MODE, type EstimateFillOrderV2Params, type EstimateGasCallData, EvmChain, type EvmChainParams, EvmLanguage, type ExecuteIntentOrderOptions, type ExecutionResult, type FillOptions, type FillOptionsV2, type FillOrderEstimateV2, type FillerBid, type FillerConfig, type GetRequestResponse, type GetRequestWithStatus, type GetResponseByRequestIdResponse, type GetResponseStorageValues, type HexString, type HostParams, HyperClientStatus, type HyperbridgeTxEvents, type IChain, type IConfig, type IEvmConfig, type IGetRequest, type IGetRequestMessage, type IGetResponse, type IGetResponseMessage, type IHyperbridgeConfig, type IIsmpMessage, type IMessage, type IPostRequest, type IPostResponse, type IProof, type IRequestMessage, type ISubstrateConfig, type ITimeoutPostRequestMessage, IndexerClient, type IndexerQueryClient, IntentGateway, type IntentGatewayParams, IntentGatewayV2, type IntentGatewayV2Params, IntentOrderStatus, type IntentOrderStatusKey, type IntentOrderStatusMetadata, type IntentOrderStatusUpdate, IntentsCoprocessor, type IsmpRequest, MOCK_ADDRESS, type NewDeployment, type Order, type OrderResponse, OrderStatus, type OrderStatusMetadata, type OrderV2, type OrderWithStatus, PACKED_USEROP_TYPEHASH, type PackedUserOperation, type Params, type PaymentInfo, type PaymentInfoV2, 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 RetryConfig, SELECT_SOLVER_TYPEHASH, STATE_COMMITMENTS_SLOT, type SelectBidResult, type SelectOptions, type StateMachineHeight, type StateMachineIdParams, type StateMachineResponse, type StateMachineUpdate, type StorageFacade, type SubmitBidOptions, SubstrateChain, TESTNET_CHAINS, type TeleportParams, TeleportStatus, TimeoutStatus, type TimeoutStatusKey, TokenGateway, type TokenGatewayAssetTeleportedResponse, type TokenGatewayAssetTeleportedWithStatus, type TokenInfo, type TokenInfoV2, type TokenPrice, type TokenPricesResponse, type TokenRegistry, type TokenRegistryResponse, type Transaction, USE_ETHERSCAN_CHAINS, type XcmGatewayParams, __test, adjustDecimals, bytes20ToBytes32, bytes32ToBytes20, calculateBalanceMappingLocation, chainConfigs, constructRedeemEscrowRequestBody, convertCodecToIGetRequest, convertCodecToIProof, convertIGetRequestToCodec, convertIProofToCodec, convertStateIdToStateMachineId, convertStateMachineEnumToString, convertStateMachineIdToEnum, createChain, createEvmChain, createIndexerClient, createQueryClient, decodeUserOpScale, encodeISMPMessage, encodeUserOpScale, estimateGasForPost, fetchPrice, generateRootWithProof, getChain, getChainId, getConfigByStateMachineId, getContractCallInput, getGasPriceFromEtherscan, getOrderPlacedFromTx, getPostRequestEventFromTx, getPostResponseEventFromTx, getRequestCommitment, getStateCommitmentFieldSlot, getStateCommitmentSlot, getStorageSlot, getViemChain, hexToString, hyperbridgeAddress, maxBigInt, orderCommitment, orderV2Commitment, parseStateMachineId, postRequestCommitment, queryAssetTeleported, queryGetRequest, queryPostRequest, requestCommitmentKey, retryPromise, teleport, teleportDot, transformOrderForContract, tronNile };
4464
+ export { ADDRESS_ZERO, type AllStatusKey, type AssetTeleported, type AssetTeleportedResponse, type BidStorageEntry, type BidSubmissionResult, type BlockMetadata, type BundlerGasEstimate, BundlerMethod, type CancelEvent, type CancelEventMap, type CancelOptions, type ChainConfig, type ChainConfigData, ChainConfigService, Chains, type ClientConfig, DEFAULT_ADDRESS, DEFAULT_GRAFFITI, DOMAIN_TYPEHASH, DUMMY_PRIVATE_KEY, type DecodedOrderPlacedLog, type DecodedOrderV2PlacedLog, type DecodedPostRequestEvent, type DecodedPostResponseEvent, type DispatchGet, type DispatchInfoV2, type DispatchPost, ERC20Method, type ERC7821Call, ERC7821_BATCH_MODE, type EstimateFillOrderV2Params, type EstimateGasCallData, EvmChain, type EvmChainParams, EvmLanguage, type ExecuteIntentOrderOptions, type ExecutionResult, type FillOptions, type FillOptionsV2, type FillOrderEstimateV2, 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 IPostRequest, type IPostResponse, type IProof, type IRequestMessage, type ISubstrateConfig, type ITimeoutPostRequestMessage, IndexerClient, type IndexerQueryClient, IntentGateway, type IntentGatewayParams, IntentOrderStatus, type IntentOrderStatusKey, type IntentOrderStatusMetadata, type IntentOrderStatusUpdate, IntentsCoprocessor, IntentsV2, type IntentsV2Context, type IsmpRequest, MOCK_ADDRESS, type NewDeployment, ORDER_V2_PARAM_TYPE, type Order, type OrderResponse, OrderStatus, type OrderStatusMetadata, type OrderV2, type OrderWithStatus, PACKED_USEROP_TYPEHASH, PLACE_ORDER_SELECTOR, type PackedUserOperation, type Params, type PaymentInfo, type PaymentInfoV2, 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 RetryConfig, SELECT_SOLVER_TYPEHASH, STATE_COMMITMENTS_SLOT, type SelectBidResult, type SelectOptions, 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 TokenInfoV2, type TokenPrice, type TokenPricesResponse, type TokenRegistry, type TokenRegistryResponse, 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, createChain, createEvmChain, createIndexerClient, createQueryClient, decodeUserOpScale, encodeERC7821ExecuteBatch, encodeISMPMessage, encodeUserOpScale, encodeWithdrawalRequest, estimateGasForPost, fetchPrice, fetchSourceProof, generateRootWithProof, getChain, getChainId, getConfigByStateMachineId, getContractCallInput, getEvmChain, getGasPriceFromEtherscan, getOrFetchStorageSlot, getOrderPlacedFromTx, getPostRequestEventFromTx, getPostResponseEventFromTx, getRequestCommitment, getStateCommitmentFieldSlot, getStateCommitmentSlot, getStorageSlot, getSubstrateChain, getViemChain, hexToString, hyperbridgeAddress, maxBigInt, orderCommitment, orderV2Commitment, parseStateMachineId, postRequestCommitment, queryAssetTeleported, queryGetRequest, queryPostRequest, requestCommitmentKey, retryPromise, teleport, teleportDot, transformOrderForContract, tronChainIds, tronNile };