@hyperbridge/sdk 1.6.2 → 1.6.3

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
  *
@@ -970,154 +715,446 @@ declare function estimateGasForPost(params: {
970
715
  call_data: EstimateGasCallData;
971
716
  }>;
972
717
  /**
973
- * Constructs the request body for a redeem escrow operation.
974
- * This function encodes the order commitment, beneficiary address, and token inputs
975
- * to match the format expected by the IntentGateway contract.
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;
723
+ /**
724
+ * Constructs the request body for a redeem escrow operation.
725
+ * This function encodes the order commitment, beneficiary address, and token inputs
726
+ * to match the format expected by the IntentGateway contract.
727
+ */
728
+ declare function constructRedeemEscrowRequestBody(order: Order | OrderV2, beneficiary: HexString): HexString;
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>;
735
+ /**
736
+ * Fetches the current network gas price from an Etherscan-family explorer API.
737
+ * Returns the ProposeGasPrice (in gwei) converted to wei as bigint.
738
+ */
739
+ declare function getGasPriceFromEtherscan(chainId: string, apiKey?: string): Promise<bigint>;
740
+ /**
741
+ * ERC20 method signatures used for storage slot detection
742
+ */
743
+ declare enum ERC20Method {
744
+ /** ERC20 balanceOf(address) method signature */
745
+ BALANCE_OF = "0x70a08231",
746
+ /** ERC20 allowance(address,address) method signature */
747
+ ALLOWANCE = "0xdd62ed3e"
748
+ }
749
+ declare enum EvmLanguage {
750
+ Solidity = 0,
751
+ Vyper = 1
752
+ }
753
+ /**
754
+ * Retrieves the storage slot for a contract call using debug_traceCall
755
+ *
756
+ * This function uses the Ethereum debug API to trace contract execution and identify
757
+ * the storage slot accessed during the call. It's commonly used for ERC20 token state
758
+ * mappings like balanceOf and allowance, but can work with any contract call that
759
+ * performs SLOAD operations.
760
+ *
761
+ * @param client - The viem PublicClient instance connected to an RPC node with debug API enabled
762
+ * @param tokenAddress - The address of the contract to trace
763
+ * @param data - The full encoded function call data (method signature + encoded parameters)
764
+ * @returns The storage slot as a hex string
765
+ * @throws Error if the storage slot cannot be found or if debug API is not available
766
+ *
767
+ * @example
768
+ * ```ts
769
+ * import { ERC20Method, bytes20ToBytes32 } from '@hyperbridge/sdk'
770
+ *
771
+ * // Get balance storage slot for ERC20
772
+ * const balanceData = ERC20Method.BALANCE_OF + bytes20ToBytes32(userAddress).slice(2)
773
+ * const balanceSlot = await getStorageSlot(
774
+ * client,
775
+ * tokenAddress,
776
+ * balanceData as HexString
777
+ * )
778
+ *
779
+ * // Get allowance storage slot for ERC20
780
+ * const allowanceData = ERC20Method.ALLOWANCE +
781
+ * bytes20ToBytes32(ownerAddress).slice(2) +
782
+ * bytes20ToBytes32(spenderAddress).slice(2)
783
+ * const allowanceSlot = await getStorageSlot(
784
+ * client,
785
+ * tokenAddress,
786
+ * allowanceData as HexString
787
+ * )
788
+ * ```
789
+ */
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>;
803
+ /**
804
+ * Adjusts fee amounts between different decimal precisions.
805
+ * Handles scaling up or down based on the decimal difference.
806
+ *
807
+ * @param feeInFeeToken - The fee amount to adjust
808
+ * @param fromDecimals - The current decimal precision
809
+ * @param toDecimals - The target decimal precision
810
+ * @returns The adjusted fee amount with the target decimal precision
811
+ */
812
+ declare function adjustDecimals(feeInFeeToken: bigint, fromDecimals: number, toDecimals: number): bigint;
813
+ /**
814
+ * Chains that should prefer the Etherscan API for gas price lookup
815
+ */
816
+ declare const USE_ETHERSCAN_CHAINS: Set<string>;
817
+ /**
818
+ * Testnet chains
819
+ */
820
+ declare const TESTNET_CHAINS: Set<string>;
821
+ /**
822
+ * Retrieves the calldata used to call a target contract within a transaction using debug_traceTransaction
823
+ * with the callTracer. Unlike the indexer helper, this returns the calldata whether the target is called
824
+ * directly by the transaction or via nested calls.
825
+ *
826
+ * @param client - viem PublicClient connected to an RPC node with debug API enabled
827
+ * @param txHash - The transaction hash
828
+ * @param targetContractAddress - The target contract address to find the call for
829
+ * @returns The input (calldata) as a hex string, or null if the target is not found in the trace
830
+ * @throws Error if the RPC call fails or returns an unexpected response
831
+ */
832
+ declare function getContractCallInput(client: PublicClient, txHash: HexString, targetContractAddress: string): Promise<HexString | null>;
833
+ /**
834
+ * Calculates the balance mapping location for a given slot and holder address.
835
+ * This function handles the different encoding formats used by Solidity and Vyper.
836
+ *
837
+ * @param slot - The slot number to calculate the mapping location for.
838
+ * @param holder - The address of the holder to calculate the mapping location for.
839
+ * @param language - The language of the contract.
840
+ * @returns The balance mapping location as a HexString.
841
+ */
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;
854
+
855
+ declare class SubstrateChain implements IChain {
856
+ private readonly params;
857
+ api?: ApiPromise;
858
+ private rpcClient;
859
+ constructor(params: ISubstrateConfig);
860
+ get config(): ISubstrateConfig;
861
+ /**
862
+ * Connects to the Substrate chain using the provided WebSocket URL.
863
+ */
864
+ connect(): Promise<void>;
865
+ /**
866
+ * Disconnects the Substrate chain connection.
867
+ */
868
+ disconnect(): Promise<void>;
869
+ /**
870
+ * Returns the storage key for a request receipt in the child trie
871
+ * The request commitment is the key
872
+ * @param key - The H256 hash key (as a 0x-prefixed hex string)
873
+ * @returns The storage key as a hex string
874
+ */
875
+ requestReceiptKey(key: HexString): HexString;
876
+ /**
877
+ * Returns the storage key for a request commitment in the child trie
878
+ * The request commitment is the key
879
+ * @param key - The H256 hash key (as a 0x-prefixed hex string)
880
+ * @returns The storage key as a hex string
881
+ */
882
+ requestCommitmentKey(key: HexString): HexString;
883
+ /**
884
+ * Queries a request commitment from the ISMP child trie storage.
885
+ * @param {HexString} commitment - The commitment hash to look up.
886
+ * @returns {Promise<HexString | undefined>} The commitment data if found, undefined otherwise.
887
+ */
888
+ queryRequestCommitment(commitment: HexString): Promise<HexString | undefined>;
889
+ /**
890
+ * Queries the request receipt.
891
+ * @param {HexString} commitment - The commitment to query.
892
+ * @returns {Promise<HexString | undefined>} The relayer address responsible for delivering the request.
893
+ */
894
+ queryRequestReceipt(commitment: HexString): Promise<HexString | undefined>;
895
+ /**
896
+ * Returns the current timestamp of the chain.
897
+ * @returns {Promise<bigint>} The current timestamp.
898
+ */
899
+ timestamp(): Promise<bigint>;
900
+ /**
901
+ * Queries the proof of the commitments.
902
+ * @param {IMessage} message - The message to query.
903
+ * @param {string} counterparty - The counterparty address.
904
+ * @param {bigint} [at] - The block number to query at.
905
+ * @returns {Promise<HexString>} The proof.
906
+ */
907
+ queryProof(message: IMessage, counterparty: string, at?: bigint): Promise<HexString>;
908
+ /**
909
+ * Submit an unsigned ISMP transaction to the chain. Resolves when the transaction is finalized.
910
+ * @param message - The message to be submitted.
911
+ * @returns A promise that resolves to an object containing the transaction hash, block hash, and block number.
912
+ */
913
+ submitUnsigned(message: IIsmpMessage): Promise<{
914
+ transactionHash: string;
915
+ blockHash: string;
916
+ blockNumber: number;
917
+ timestamp: number;
918
+ }>;
919
+ /**
920
+ * Query the state proof for a given set of keys at a specific block height.
921
+ * @param at The block height to query the state proof at.
922
+ * @param keys The keys to query the state proof for.
923
+ * @param _address - Optional address (ignored for Substrate; present for IChain compatibility).
924
+ * @returns The state proof as a hexadecimal string.
925
+ */
926
+ queryStateProof(at: bigint, keys: HexString[], _address?: HexString): Promise<HexString>;
927
+ /**
928
+ * Get the latest state machine height for a given state machine ID.
929
+ * @param {StateMachineIdParams} stateMachineId - The state machine ID.
930
+ * @returns {Promise<bigint>} The latest state machine height.
931
+ */
932
+ latestStateMachineHeight(stateMachineId: StateMachineIdParams): Promise<bigint>;
933
+ /**
934
+ * Get the state machine update time for a given state machine height.
935
+ * @param {StateMachineHeight} stateMachineHeight - The state machine height.
936
+ * @returns {Promise<bigint>} The statemachine update time in seconds.
937
+ */
938
+ stateMachineUpdateTime(stateMachineHeight: StateMachineHeight): Promise<bigint>;
939
+ /**
940
+ * Get the challenge period for a given state machine id.
941
+ * @param {StateMachineIdParams} stateMachineId - The state machine ID.
942
+ * @returns {Promise<bigint>} The challenge period in seconds.
943
+ */
944
+ challengePeriod(stateMachineId: StateMachineIdParams): Promise<bigint>;
945
+ /**
946
+ * Encode an ISMP calldata for a substrate chain.
947
+ * @param message The ISMP message to encode.
948
+ * @returns The encoded message as a hexadecimal string.
949
+ */
950
+ encode(message: IIsmpMessage): HexString;
951
+ /**
952
+ * Returns the index of a pallet by its name, by looking up the pallets in the runtime metadata.
953
+ * @param {string} name - The name of the pallet.
954
+ * @returns {number} The index of the pallet.
955
+ */
956
+ private getPalletIndex;
957
+ }
958
+ /**
959
+ * Converts a state machine ID string to an enum value.
960
+ * @param {string} id - The state machine ID string.
961
+ * @returns {IStateMachine} The corresponding enum value.
976
962
  */
977
- declare function constructRedeemEscrowRequestBody(order: Order | OrderV2, beneficiary: HexString): HexString;
978
- declare function fetchPrice(identifier: string, chainId?: number, apiKey?: string): Promise<number>;
963
+ declare function convertStateMachineIdToEnum(id: string): IStateMachine;
979
964
  /**
980
- * Fetches the current network gas price from an Etherscan-family explorer API.
981
- * Returns the ProposeGasPrice (in gwei) converted to wei as bigint.
965
+ * Converts a state machine enum representation to a string.
966
+ * @param {IStateMachine} stateMachine - The state machine enum object.
967
+ * @returns {string} The state machine ID string like "EVM-97" or "SUBSTRATE-cere".
982
968
  */
983
- declare function getGasPriceFromEtherscan(chainId: string, apiKey?: string): Promise<bigint>;
969
+ declare function convertStateMachineEnumToString(stateMachine: {
970
+ tag: string;
971
+ value: number | number[];
972
+ }): string;
984
973
  /**
985
- * ERC20 method signatures used for storage slot detection
974
+ * Converts a stateId object back to the state_id format used by the RPC.
975
+ * @param stateId - The stateId object from StateMachineIdParams
976
+ * @returns The string representation like "EVM-11155111" or "SUBSTRATE-cere"
986
977
  */
987
- declare enum ERC20Method {
988
- /** ERC20 balanceOf(address) method signature */
989
- BALANCE_OF = "0x70a08231",
990
- /** ERC20 allowance(address,address) method signature */
991
- ALLOWANCE = "0xdd62ed3e"
992
- }
993
- declare enum EvmLanguage {
994
- Solidity = 0,
995
- Vyper = 1
996
- }
978
+ declare function convertStateIdToStateMachineId(stateId: {
979
+ Evm?: number;
980
+ Substrate?: HexString;
981
+ Polkadot?: number;
982
+ Kusama?: number;
983
+ }): string;
997
984
  /**
998
- * Retrieves the storage slot for a contract call using debug_traceCall
999
- *
1000
- * This function uses the Ethereum debug API to trace contract execution and identify
1001
- * the storage slot accessed during the call. It's commonly used for ERC20 token state
1002
- * mappings like balanceOf and allowance, but can work with any contract call that
1003
- * performs SLOAD operations.
1004
- *
1005
- * @param client - The viem PublicClient instance connected to an RPC node with debug API enabled
1006
- * @param tokenAddress - The address of the contract to trace
1007
- * @param data - The full encoded function call data (method signature + encoded parameters)
1008
- * @returns The storage slot as a hex string
1009
- * @throws Error if the storage slot cannot be found or if debug API is not available
1010
- *
1011
- * @example
1012
- * ```ts
1013
- * import { ERC20Method, bytes20ToBytes32 } from '@hyperbridge/sdk'
1014
- *
1015
- * // Get balance storage slot for ERC20
1016
- * const balanceData = ERC20Method.BALANCE_OF + bytes20ToBytes32(userAddress).slice(2)
1017
- * const balanceSlot = await getStorageSlot(
1018
- * client,
1019
- * tokenAddress,
1020
- * balanceData as HexString
1021
- * )
1022
- *
1023
- * // Get allowance storage slot for ERC20
1024
- * const allowanceData = ERC20Method.ALLOWANCE +
1025
- * bytes20ToBytes32(ownerAddress).slice(2) +
1026
- * bytes20ToBytes32(spenderAddress).slice(2)
1027
- * const allowanceSlot = await getStorageSlot(
1028
- * client,
1029
- * tokenAddress,
1030
- * allowanceData as HexString
1031
- * )
1032
- * ```
985
+ * Converts an IGetRequest object to a codec representation.
986
+ * @param {IGetRequest} request - The IGetRequest object.
987
+ * @returns The codec representation of the request.
1033
988
  */
1034
- declare function getStorageSlot(client: PublicClient, contractAddress: HexString, data: HexString): Promise<string>;
989
+ declare function convertIGetRequestToCodec(request: IGetRequest): {
990
+ readonly source: IStateMachine;
991
+ readonly dest: IStateMachine;
992
+ readonly from: number[];
993
+ readonly nonce: bigint;
994
+ readonly keys: number[][];
995
+ readonly context: number[];
996
+ readonly timeoutTimestamp: bigint;
997
+ readonly height: bigint;
998
+ };
1035
999
  /**
1036
- * Adjusts fee amounts between different decimal precisions.
1037
- * Handles scaling up or down based on the decimal difference.
1038
- *
1039
- * @param feeInFeeToken - The fee amount to adjust
1040
- * @param fromDecimals - The current decimal precision
1041
- * @param toDecimals - The target decimal precision
1042
- * @returns The adjusted fee amount with the target decimal precision
1000
+ * Convert codec representation back to IGetRequest
1043
1001
  */
1044
- declare function adjustDecimals(feeInFeeToken: bigint, fromDecimals: number, toDecimals: number): bigint;
1002
+ declare function convertCodecToIGetRequest(codec: {
1003
+ source: {
1004
+ tag: string;
1005
+ value: number | number[];
1006
+ };
1007
+ dest: {
1008
+ tag: string;
1009
+ value: number | number[];
1010
+ };
1011
+ from: number[];
1012
+ nonce: bigint;
1013
+ keys: number[][];
1014
+ height: bigint;
1015
+ context: number[];
1016
+ timeoutTimestamp: bigint;
1017
+ }): IGetRequest;
1045
1018
  /**
1046
- * Chains that should prefer the Etherscan API for gas price lookup
1019
+ * Converts an IProof object to a codec representation.
1020
+ * @param {IProof} proof - The IProof object.
1021
+ * @returns The codec representation of the proof.
1047
1022
  */
1048
- declare const USE_ETHERSCAN_CHAINS: Set<string>;
1023
+ declare function convertIProofToCodec(proof: IProof): {
1024
+ readonly height: {
1025
+ readonly height: bigint;
1026
+ readonly id: {
1027
+ readonly consensusStateId: number[];
1028
+ readonly id: IStateMachine;
1029
+ };
1030
+ };
1031
+ readonly proof: number[];
1032
+ };
1049
1033
  /**
1050
- * Testnet chains
1034
+ * Converts a codec representation back to an IProof object.
1035
+ * @param {any} codec - The codec representation of the proof.
1036
+ * @returns {IProof} The IProof object.
1051
1037
  */
1052
- declare const TESTNET_CHAINS: Set<string>;
1053
- /**
1054
- * Retrieves the calldata used to call a target contract within a transaction using debug_traceTransaction
1055
- * with the callTracer. Unlike the indexer helper, this returns the calldata whether the target is called
1056
- * directly by the transaction or via nested calls.
1057
- *
1058
- * @param client - viem PublicClient connected to an RPC node with debug API enabled
1059
- * @param txHash - The transaction hash
1060
- * @param targetContractAddress - The target contract address to find the call for
1061
- * @returns The input (calldata) as a hex string, or null if the target is not found in the trace
1062
- * @throws Error if the RPC call fails or returns an unexpected response
1038
+ declare function convertCodecToIProof(codec: {
1039
+ height: {
1040
+ height: bigint;
1041
+ id: {
1042
+ consensusStateId: number[];
1043
+ id: {
1044
+ tag: string;
1045
+ value: number | number[];
1046
+ };
1047
+ };
1048
+ };
1049
+ proof: number[];
1050
+ }): IProof;
1051
+ declare function encodeISMPMessage(message: IIsmpMessage): Uint8Array;
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
+ getChainId(chain: string): number;
1073
+ getConsensusStateId(chain: string): HexString;
1074
+ getHyperbridgeChainId(): number;
1075
+ getRpcUrl(chain: string): string;
1076
+ getUniswapRouterV2Address(chain: string): HexString;
1077
+ getUniswapV2FactoryAddress(chain: string): HexString;
1078
+ getUniswapV3FactoryAddress(chain: string): HexString;
1079
+ getUniversalRouterAddress(chain: string): HexString;
1080
+ getUniswapV3QuoterAddress(chain: string): HexString;
1081
+ getUniswapV4QuoterAddress(chain: string): HexString;
1082
+ getPermit2Address(chain: string): HexString;
1083
+ getSolverAccountAddress(chain: string): HexString | undefined;
1084
+ getCoingeckoId(chain: string): string | undefined;
1085
+ getEtherscanApiKey(): string | undefined;
1086
+ getCalldispatcherAddress(chain: string): HexString;
1087
+ getTokenStorageSlots(chain: string, tokenAddress: string): {
1088
+ balanceSlot: number;
1089
+ allowanceSlot: number;
1090
+ } | undefined;
1091
+ getPopularTokens(chain: string): string[];
1092
+ getIntentGatewayV2Address(chain: string): HexString;
1093
+ getEntryPointV08Address(chain: string): HexString;
1094
+ getHyperbridgeAddress(): string;
1095
+ /**
1096
+ * Get the LayerZero Endpoint ID for the chain
1097
+ * Used for USDT0 cross-chain transfers via LayerZero OFT
1098
+ */
1099
+ getLayerZeroEid(chain: string): number | undefined;
1100
+ /**
1101
+ * Get the USDT0 OFT contract address for the chain
1102
+ * On Ethereum: OFT Adapter (locks/unlocks USDT)
1103
+ * On other chains: OFT contract (mints/burns USDT0)
1104
+ */
1105
+ getUsdt0OftAddress(chain: string): HexString | undefined;
1106
+ }
1107
+
1108
+ /**
1109
+ * The default address used as fallback when no address is provided.
1110
+ * This represents the zero address in EVM chains.
1063
1111
  */
1064
- declare function getContractCallInput(client: PublicClient, txHash: HexString, targetContractAddress: string): Promise<HexString | null>;
1112
+ declare const DEFAULT_ADDRESS = "0x0000000000000000000000000000000000000000";
1065
1113
  /**
1066
- * Calculates the balance mapping location for a given slot and holder address.
1067
- * This function handles the different encoding formats used by Solidity and Vyper.
1068
- *
1069
- * @param slot - The slot number to calculate the mapping location for.
1070
- * @param holder - The address of the holder to calculate the mapping location for.
1071
- * @param language - The language of the contract.
1072
- * @returns The balance mapping location as a HexString.
1114
+ * Parameters for an EVM chain.
1073
1115
  */
1074
- declare function calculateBalanceMappingLocation(slot: bigint, holder: string, language: EvmLanguage): HexString;
1075
-
1076
- declare class SubstrateChain implements IChain {
1077
- private readonly params;
1078
- api?: ApiPromise;
1079
- private rpcClient;
1080
- constructor(params: ISubstrateConfig);
1081
- get config(): ISubstrateConfig;
1116
+ interface EvmChainParams {
1082
1117
  /**
1083
- * Connects to the Substrate chain using the provided WebSocket URL.
1118
+ * The chain ID of the EVM chain
1084
1119
  */
1085
- connect(): Promise<void>;
1120
+ chainId: number;
1086
1121
  /**
1087
- * Disconnects the Substrate chain connection.
1122
+ * The RPC URL of the EVM chain
1088
1123
  */
1089
- disconnect(): Promise<void>;
1124
+ rpcUrl: string;
1090
1125
  /**
1091
- * Returns the storage key for a request receipt in the child trie
1092
- * The request commitment is the key
1093
- * @param key - The H256 hash key (as a 0x-prefixed hex string)
1094
- * @returns The storage key as a hex string
1126
+ * The host address of the EVM chain (IsmpHost contract address)
1095
1127
  */
1096
- requestReceiptKey(key: HexString): HexString;
1128
+ host: HexString;
1097
1129
  /**
1098
- * Returns the storage key for a request commitment in the child trie
1099
- * The request commitment is the key
1100
- * @param key - The H256 hash key (as a 0x-prefixed hex string)
1101
- * @returns The storage key as a hex string
1130
+ * Consensus state identifier of this chain on hyperbridge
1102
1131
  */
1103
- requestCommitmentKey(key: HexString): HexString;
1132
+ consensusStateId?: string;
1133
+ }
1134
+ /**
1135
+ * Encapsulates an EVM chain.
1136
+ */
1137
+ declare class EvmChain implements IChain {
1138
+ private readonly params;
1139
+ private publicClient;
1140
+ private chainConfigService;
1141
+ constructor(params: EvmChainParams);
1142
+ get client(): PublicClient;
1143
+ get host(): HexString;
1144
+ get config(): IEvmConfig;
1145
+ get configService(): ChainConfigService;
1104
1146
  /**
1105
- * Queries a request commitment from the ISMP child trie storage.
1106
- * @param {HexString} commitment - The commitment hash to look up.
1107
- * @returns {Promise<HexString | undefined>} The commitment data if found, undefined otherwise.
1147
+ * Derives the key for the request receipt.
1148
+ * @param {HexString} commitment - The commitment to derive the key from.
1149
+ * @returns {HexString} The derived key.
1108
1150
  */
1109
- queryRequestCommitment(commitment: HexString): Promise<HexString | undefined>;
1151
+ requestReceiptKey(commitment: HexString): HexString;
1110
1152
  /**
1111
1153
  * Queries the request receipt.
1112
1154
  * @param {HexString} commitment - The commitment to query.
1113
1155
  * @returns {Promise<HexString | undefined>} The relayer address responsible for delivering the request.
1114
1156
  */
1115
1157
  queryRequestReceipt(commitment: HexString): Promise<HexString | undefined>;
1116
- /**
1117
- * Returns the current timestamp of the chain.
1118
- * @returns {Promise<bigint>} The current timestamp.
1119
- */
1120
- timestamp(): Promise<bigint>;
1121
1158
  /**
1122
1159
  * Queries the proof of the commitments.
1123
1160
  * @param {IMessage} message - The message to query.
@@ -1127,23 +1164,18 @@ declare class SubstrateChain implements IChain {
1127
1164
  */
1128
1165
  queryProof(message: IMessage, counterparty: string, at?: bigint): Promise<HexString>;
1129
1166
  /**
1130
- * Submit an unsigned ISMP transaction to the chain. Resolves when the transaction is finalized.
1131
- * @param message - The message to be submitted.
1132
- * @returns A promise that resolves to an object containing the transaction hash, block hash, and block number.
1167
+ * Query and return the encoded storage proof for the provided keys at the given height.
1168
+ * @param {bigint} at - The block height at which to query the storage proof.
1169
+ * @param {HexString[]} keys - The keys for which to query the storage proof.
1170
+ * @param {HexString} address - Optional contract address to fetch storage proof else default to host contract
1171
+ * @returns {Promise<HexString>} The encoded storage proof.
1133
1172
  */
1134
- submitUnsigned(message: IIsmpMessage): Promise<{
1135
- transactionHash: string;
1136
- blockHash: string;
1137
- blockNumber: number;
1138
- timestamp: number;
1139
- }>;
1173
+ queryStateProof(at: bigint, keys: HexString[], address?: HexString): Promise<HexString>;
1140
1174
  /**
1141
- * Query the state proof for a given set of keys at a specific block height.
1142
- * @param at The block height to query the state proof at.
1143
- * @param keys The keys to query the state proof for.
1144
- * @returns The state proof as a hexadecimal string.
1175
+ * Returns the current timestamp of the chain.
1176
+ * @returns {Promise<bigint>} The current timestamp.
1145
1177
  */
1146
- queryStateProof(at: bigint, keys: HexString[]): Promise<HexString>;
1178
+ timestamp(): Promise<bigint>;
1147
1179
  /**
1148
1180
  * Get the latest state machine height for a given state machine ID.
1149
1181
  * @param {StateMachineIdParams} stateMachineId - The state machine ID.
@@ -1156,6 +1188,10 @@ declare class SubstrateChain implements IChain {
1156
1188
  * @returns {Promise<bigint>} The statemachine update time in seconds.
1157
1189
  */
1158
1190
  stateMachineUpdateTime(stateMachineHeight: StateMachineHeight): Promise<bigint>;
1191
+ /**
1192
+ * Retrieves the placeOrder calldata from a transaction using debug_traceTransaction.
1193
+ */
1194
+ getPlaceOrderCalldata(txHash: string, intentGatewayAddress: string): Promise<HexString>;
1159
1195
  /**
1160
1196
  * Get the challenge period for a given state machine id.
1161
1197
  * @param {StateMachineIdParams} stateMachineId - The state machine ID.
@@ -1163,112 +1199,121 @@ declare class SubstrateChain implements IChain {
1163
1199
  */
1164
1200
  challengePeriod(stateMachineId: StateMachineIdParams): Promise<bigint>;
1165
1201
  /**
1166
- * Encode an ISMP calldata for a substrate chain.
1167
- * @param message The ISMP message to encode.
1168
- * @returns The encoded message as a hexadecimal string.
1202
+ * Encodes an ISMP message for the EVM chain.
1203
+ * @param {IIsmpMessage} message The ISMP message to encode.
1204
+ * @returns {HexString} The encoded calldata.
1169
1205
  */
1170
1206
  encode(message: IIsmpMessage): HexString;
1171
1207
  /**
1172
- * Returns the index of a pallet by its name, by looking up the pallets in the runtime metadata.
1173
- * @param {string} name - The name of the pallet.
1174
- * @returns {number} The index of the pallet.
1208
+ * Calculates the fee required to send a post request to the destination chain.
1209
+ * The fee is calculated based on the per-byte fee for the destination chain
1210
+ * multiplied by the size of the request body.
1211
+ *
1212
+ * @param request - The post request to calculate the fee for
1213
+ * @returns The total fee in wei required to send the post request
1175
1214
  */
1176
- private getPalletIndex;
1215
+ quote(request: IPostRequest | IGetRequest): Promise<bigint>;
1216
+ quoteNative(request: IPostRequest | IGetRequest, fee: bigint): Promise<bigint>;
1217
+ private getAmountsIn;
1218
+ /**
1219
+ * Estimates the gas required for a post request execution on this chain.
1220
+ * This function generates mock proofs for the post request, creates a state override
1221
+ * with the necessary overlay root, and estimates the gas cost for executing the
1222
+ * handlePostRequests transaction on the handler contract.
1223
+ *
1224
+ * @param request - The post request to estimate gas for
1225
+ * @param paraId - The ID of the parachain (Hyperbridge) that will process the request
1226
+ * @returns The estimated gas amount in gas units and the generated calldata
1227
+ */
1228
+ estimateGas(request: IPostRequest): Promise<{
1229
+ gas: bigint;
1230
+ postRequestCalldata: HexString;
1231
+ }>;
1232
+ /**
1233
+ * Gets the fee token address and decimals for the chain.
1234
+ * This function gets the fee token address and decimals for the chain.
1235
+ *
1236
+ * @returns The fee token address and decimals
1237
+ */
1238
+ getFeeTokenWithDecimals(): Promise<{
1239
+ address: HexString;
1240
+ decimals: number;
1241
+ }>;
1242
+ /**
1243
+ * Gets the nonce of the host.
1244
+ * This function gets the nonce of the host.
1245
+ *
1246
+ * @returns The nonce of the host
1247
+ */
1248
+ getHostNonce(): Promise<bigint>;
1249
+ broadcastTransaction(signedTransaction: any): Promise<TransactionReceipt>;
1177
1250
  }
1178
1251
  /**
1179
- * Converts a state machine ID string to an enum value.
1180
- * @param {string} id - The state machine ID string.
1181
- * @returns {IStateMachine} The corresponding enum value.
1252
+ * Factory function for creating EVM chain instances with common defaults
1253
+ *
1254
+ * @param chainId - The EVM chain ID
1255
+ * @param host - The IsmpHost contract address
1256
+ * @param options - Optional configuration overrides
1257
+ * @returns A new EvmChain instance
1258
+ *
1259
+ * @example
1260
+ * ```typescript
1261
+ * // Create with minimal config
1262
+ * const ethChain = createEvmChain(1, "0x87ea45..", {
1263
+ * rpcUrl: "https://eth-mainnet.g.alchemy.com/v2/YOUR_KEY"
1264
+ * })
1265
+ *
1266
+ * // Create with custom consensus state ID
1267
+ * const arbChain = createEvmChain(42161, "0x87ea42345..", {
1268
+ * rpcUrl: "https://arb-mainnet.g.alchemy.com/v2/YOUR_KEY",
1269
+ * consensusStateId: "ARB_CUSTOM"
1270
+ * })
1271
+ * ```
1182
1272
  */
1183
- declare function convertStateMachineIdToEnum(id: string): IStateMachine;
1273
+ declare function createEvmChain(chainId: number, host: HexString, options: {
1274
+ rpcUrl: string;
1275
+ consensusStateId?: string;
1276
+ }): EvmChain;
1184
1277
  /**
1185
- * Converts a state machine enum representation to a string.
1186
- * @param {IStateMachine} stateMachine - The state machine enum object.
1187
- * @returns {string} The state machine ID string like "EVM-97" or "SUBSTRATE-cere".
1278
+ * Slot for storing request commitments.
1188
1279
  */
1189
- declare function convertStateMachineEnumToString(stateMachine: {
1190
- tag: string;
1191
- value: number | number[];
1192
- }): string;
1280
+ declare const REQUEST_COMMITMENTS_SLOT = 0n;
1193
1281
  /**
1194
- * Converts a stateId object back to the state_id format used by the RPC.
1195
- * @param stateId - The stateId object from StateMachineIdParams
1196
- * @returns The string representation like "EVM-11155111" or "SUBSTRATE-cere"
1282
+ * Slot index for response commitments map
1197
1283
  */
1198
- declare function convertStateIdToStateMachineId(stateId: {
1199
- Evm?: number;
1200
- Substrate?: HexString;
1201
- Polkadot?: number;
1202
- Kusama?: number;
1203
- }): string;
1284
+ declare const RESPONSE_COMMITMENTS_SLOT = 1n;
1204
1285
  /**
1205
- * Converts an IGetRequest object to a codec representation.
1206
- * @param {IGetRequest} request - The IGetRequest object.
1207
- * @returns The codec representation of the request.
1286
+ * Slot index for requests receipts map
1208
1287
  */
1209
- declare function convertIGetRequestToCodec(request: IGetRequest): {
1210
- readonly source: IStateMachine;
1211
- readonly dest: IStateMachine;
1212
- readonly from: number[];
1213
- readonly nonce: bigint;
1214
- readonly keys: number[][];
1215
- readonly context: number[];
1216
- readonly timeoutTimestamp: bigint;
1217
- readonly height: bigint;
1218
- };
1288
+ declare const REQUEST_RECEIPTS_SLOT = 2n;
1219
1289
  /**
1220
- * Convert codec representation back to IGetRequest
1290
+ * Slot index for response receipts map
1221
1291
  */
1222
- declare function convertCodecToIGetRequest(codec: {
1223
- source: {
1224
- tag: string;
1225
- value: number | number[];
1226
- };
1227
- dest: {
1228
- tag: string;
1229
- value: number | number[];
1230
- };
1231
- from: number[];
1232
- nonce: bigint;
1233
- keys: number[][];
1234
- height: bigint;
1235
- context: number[];
1236
- timeoutTimestamp: bigint;
1237
- }): IGetRequest;
1292
+ declare const RESPONSE_RECEIPTS_SLOT = 3n;
1238
1293
  /**
1239
- * Converts an IProof object to a codec representation.
1240
- * @param {IProof} proof - The IProof object.
1241
- * @returns The codec representation of the proof.
1294
+ * Slot index for state commitment map
1242
1295
  */
1243
- declare function convertIProofToCodec(proof: IProof): {
1244
- readonly height: {
1245
- readonly height: bigint;
1246
- readonly id: {
1247
- readonly consensusStateId: number[];
1248
- readonly id: IStateMachine;
1249
- };
1250
- };
1251
- readonly proof: number[];
1296
+ declare const STATE_COMMITMENTS_SLOT = 5n;
1297
+ declare function requestCommitmentKey(key: Hex): {
1298
+ slot1: Hex;
1299
+ slot2: Hex;
1252
1300
  };
1253
1301
  /**
1254
- * Converts a codec representation back to an IProof object.
1255
- * @param {any} codec - The codec representation of the proof.
1256
- * @returns {IProof} The IProof object.
1302
+ * Derives the storage slot for a specific field in the StateCommitment struct
1303
+ *
1304
+ * struct StateCommitment {
1305
+ * uint256 timestamp; // slot + 0
1306
+ * bytes32 overlayRoot; // slot + 1
1307
+ * bytes32 stateRoot; // slot + 2
1308
+ * }
1309
+ *
1310
+ * @param stateMachineId - The state machine ID
1311
+ * @param height - The block height
1312
+ * @param field - The field index in the struct (0 for timestamp, 1 for overlayRoot, 2 for stateRoot)
1313
+ * @returns The storage slot for the specific field
1257
1314
  */
1258
- declare function convertCodecToIProof(codec: {
1259
- height: {
1260
- height: bigint;
1261
- id: {
1262
- consensusStateId: number[];
1263
- id: {
1264
- tag: string;
1265
- value: number | number[];
1266
- };
1267
- };
1268
- };
1269
- proof: number[];
1270
- }): IProof;
1271
- declare function encodeISMPMessage(message: IIsmpMessage): Uint8Array;
1315
+ declare function getStateCommitmentFieldSlot(stateMachineId: bigint, height: bigint, field: 0 | 1 | 2): HexString;
1316
+ declare function getStateCommitmentSlot(stateMachineId: bigint, height: bigint): HexString;
1272
1317
 
1273
1318
  /**
1274
1319
  * Encodes a PackedUserOperation using SCALE codec for submission to Hyperbridge.
@@ -1377,6 +1422,64 @@ declare class IntentsCoprocessor {
1377
1422
  private buildOffchainBidKey;
1378
1423
  }
1379
1424
 
1425
+ /**
1426
+ * Parameters for a Tron-backed chain.
1427
+ * TronWeb is constructed internally from `rpcUrl`.
1428
+ */
1429
+ type TronChainParams = EvmChainParams;
1430
+ declare class TronChain implements IChain {
1431
+ private readonly params;
1432
+ private readonly evm;
1433
+ private readonly tronWebInstance;
1434
+ constructor(params: TronChainParams);
1435
+ /** Underlying viem public client (delegated from the internal EvmChain) */
1436
+ get client(): PublicClient;
1437
+ /** Host contract address for this chain (delegated from the internal EvmChain) */
1438
+ get host(): HexString;
1439
+ /** Chain configuration (delegated from the internal EvmChain) */
1440
+ get config(): IEvmConfig;
1441
+ /** Chain configuration service (delegated from the internal EvmChain) */
1442
+ get configService(): ChainConfigService;
1443
+ /** TronWeb instance for this Tron chain (constructed from rpcUrl) */
1444
+ get tronWeb(): InstanceType<typeof TronWeb>;
1445
+ timestamp(): Promise<bigint>;
1446
+ requestReceiptKey(commitment: HexString): HexString;
1447
+ queryRequestReceipt(commitment: HexString): Promise<HexString | undefined>;
1448
+ queryStateProof(at: bigint, keys: HexString[], address?: HexString): Promise<HexString>;
1449
+ queryProof(message: IMessage, counterparty: string, at?: bigint): Promise<HexString>;
1450
+ encode(message: IIsmpMessage): HexString;
1451
+ latestStateMachineHeight(stateMachineId: StateMachineIdParams): Promise<bigint>;
1452
+ challengePeriod(stateMachineId: StateMachineIdParams): Promise<bigint>;
1453
+ stateMachineUpdateTime(stateMachineHeight: StateMachineHeight): Promise<bigint>;
1454
+ /**
1455
+ * Retrieves top-level calldata from a Tron transaction via TronWeb.
1456
+ * Only works for direct calls to IntentGateway (not nested/multicall).
1457
+ * Tron does not support debug_traceTransaction.
1458
+ */
1459
+ getPlaceOrderCalldata(txHash: string, _intentGatewayAddress: string): Promise<HexString>;
1460
+ /**
1461
+ * Broadcasts a signed Tron transaction and waits for confirmation,
1462
+ * returning a 0x-prefixed transaction hash compatible with viem.
1463
+ *
1464
+ * This mirrors the behavior used in IntentGatewayV2 for Tron chains.
1465
+ */
1466
+ broadcastTransaction(signedTransaction: any): Promise<TransactionReceipt>;
1467
+ /** Gets the fee token address and decimals for the chain. */
1468
+ getFeeTokenWithDecimals(): Promise<{
1469
+ address: HexString;
1470
+ decimals: number;
1471
+ }>;
1472
+ /** Gets the nonce of the host contract on this chain. */
1473
+ getHostNonce(): Promise<bigint>;
1474
+ /** Quotes the fee (in native token) required for the given ISMP request. */
1475
+ quoteNative(request: IPostRequest | IGetRequest, fee: bigint): Promise<bigint>;
1476
+ /** Estimates gas for executing a post request on this chain. */
1477
+ estimateGas(request: IPostRequest): Promise<{
1478
+ gas: bigint;
1479
+ postRequestCalldata: HexString;
1480
+ }>;
1481
+ }
1482
+
1380
1483
  /**
1381
1484
  * Type representing an ISMP message.
1382
1485
  */
@@ -1500,8 +1603,9 @@ interface IChain {
1500
1603
  queryRequestReceipt(commitment: HexString): Promise<HexString | undefined>;
1501
1604
  /**
1502
1605
  * Query and return the encoded storage proof for the provided keys at the given height.
1606
+ * @param address - Optional contract address for EVM chains; defaults to host contract when omitted.
1503
1607
  */
1504
- queryStateProof(at: bigint, keys: HexString[]): Promise<HexString>;
1608
+ queryStateProof(at: bigint, keys: HexString[], address?: HexString): Promise<HexString>;
1505
1609
  queryProof(message: IMessage, counterparty: string, at?: bigint): Promise<HexString>;
1506
1610
  encode(message: IIsmpMessage): HexString;
1507
1611
  /**
@@ -1518,11 +1622,36 @@ interface IChain {
1518
1622
  stateMachineUpdateTime(stateMachineHeight: StateMachineHeight): Promise<bigint>;
1519
1623
  }
1520
1624
  /**
1521
- * Returns the chain interface for a given state machine identifier
1625
+ * Interface for EVM-compatible chains (EVM and Tron).
1626
+ * Extends IChain with methods required by IntentGatewayV2 and other EVM-specific protocols.
1627
+ */
1628
+ interface IEvmChain extends IChain {
1629
+ readonly configService: ChainConfigService;
1630
+ readonly client: PublicClient;
1631
+ getHostNonce(): Promise<bigint>;
1632
+ quoteNative(request: IPostRequest | IGetRequest, fee: bigint): Promise<bigint>;
1633
+ getFeeTokenWithDecimals(): Promise<{
1634
+ address: HexString;
1635
+ decimals: number;
1636
+ }>;
1637
+ getPlaceOrderCalldata(txHash: string, intentGatewayAddress: string): Promise<HexString>;
1638
+ broadcastTransaction(signedTransaction: any): Promise<TransactionReceipt>;
1639
+ }
1640
+ /**
1641
+ * Returns the chain interface for a given state machine identifier.
1642
+ *
1643
+ * - For standard EVM chains, returns an `EvmChain`.
1644
+ * - For Substrate chains, returns a connected `SubstrateChain`.
1645
+ * - For Tron chains (identified by chain ID), constructs a `TronChain`
1646
+ * that delegates EVM behavior to an internal `EvmChain` and manages
1647
+ * its own TronWeb instance using the provided RPC URL.
1648
+ *
1522
1649
  * @param chainConfig - Chain configuration
1523
1650
  * @returns Chain interface
1524
1651
  */
1525
1652
  declare function getChain(chainConfig: IEvmConfig | ISubstrateConfig): Promise<IChain>;
1653
+ declare function getEvmChain(chainConfig: IEvmConfig): IChain;
1654
+ declare function getSubstrateChain(chainConfig: ISubstrateConfig): Promise<SubstrateChain>;
1526
1655
 
1527
1656
  type EstimateGasCallData = ContractFunctionArgs<typeof _default.ABI, "nonpayable" | "payable", "handlePostRequests">;
1528
1657
  type HexString = `0x${string}`;
@@ -2186,7 +2315,15 @@ declare enum RequestKind {
2186
2315
  /**
2187
2316
  * Identifies a request for updating parameters
2188
2317
  */
2189
- UpdateParams = 2
2318
+ UpdateParams = 2,
2319
+ /**
2320
+ * Identifies a request for sweeping accumulated protocol dust
2321
+ */
2322
+ SweepDust = 3,
2323
+ /**
2324
+ * Identifies a request for refunding escrowed tokens after cancellation
2325
+ */
2326
+ RefundEscrow = 4
2190
2327
  }
2191
2328
  /**
2192
2329
  * Configuration for the IntentFiller
@@ -2602,8 +2739,8 @@ interface DispatchInfoV2 {
2602
2739
  interface OrderV2 {
2603
2740
  id?: string;
2604
2741
  user: HexString;
2605
- source: string;
2606
- destination: string;
2742
+ source: HexString;
2743
+ destination: HexString;
2607
2744
  deadline: bigint;
2608
2745
  nonce: bigint;
2609
2746
  fees: bigint;
@@ -2641,10 +2778,11 @@ interface SubmitBidOptions {
2641
2778
  preVerificationGas: bigint;
2642
2779
  maxFeePerGas: bigint;
2643
2780
  maxPriorityFeePerGas: bigint;
2781
+ /** Pre-built ERC-7821 calldata encoding the UserOp execution (approvals + fillOrder). */
2782
+ callData: HexString;
2644
2783
  }
2645
2784
  interface EstimateFillOrderV2Params {
2646
2785
  order: OrderV2;
2647
- solverPrivateKey: HexString;
2648
2786
  /**
2649
2787
  * Optional percentage to bump maxPriorityFeePerGas.
2650
2788
  * This is added on top of the base gasPrice.
@@ -2667,7 +2805,6 @@ interface FillOrderEstimateV2 {
2667
2805
  maxPriorityFeePerGas: bigint;
2668
2806
  totalGasCostWei: bigint;
2669
2807
  totalGasInFeeToken: bigint;
2670
- nonce: bigint;
2671
2808
  }
2672
2809
  /**
2673
2810
  * Result of submitting a bid to Hyperbridge
@@ -2733,6 +2870,8 @@ declare const IntentOrderStatus: Readonly<{
2733
2870
  BIDS_RECEIVED: "BIDS_RECEIVED";
2734
2871
  BID_SELECTED: "BID_SELECTED";
2735
2872
  USEROP_SUBMITTED: "USEROP_SUBMITTED";
2873
+ FILLED: "FILLED";
2874
+ PARTIAL_FILL: "PARTIAL_FILL";
2736
2875
  FAILED: "FAILED";
2737
2876
  }>;
2738
2877
  type IntentOrderStatus = typeof IntentOrderStatus;
@@ -2762,6 +2901,7 @@ interface SelectBidResult {
2762
2901
  solverAddress: HexString;
2763
2902
  commitment: HexString;
2764
2903
  txnHash?: HexString;
2904
+ fillStatus?: "full" | "partial";
2765
2905
  }
2766
2906
  /** Options for executing an intent order */
2767
2907
  interface ExecuteIntentOrderOptions {
@@ -3586,8 +3726,160 @@ type CancelEvent$1 = {
3586
3726
  };
3587
3727
  }[keyof CancelEventMap$1];
3588
3728
 
3729
+ type StorageDriverKey = "node" | "localstorage" | "indexeddb" | "memory";
3730
+ interface CancellationStorageOptions {
3731
+ env?: StorageDriverKey;
3732
+ basePath?: string;
3733
+ }
3734
+ interface SessionKeyStorageOptions {
3735
+ env?: StorageDriverKey;
3736
+ basePath?: string;
3737
+ }
3738
+
3739
+ declare function createCancellationStorage(options?: CancellationStorageOptions): Readonly<{
3740
+ getItem: <T>(key: string) => Promise<T | null>;
3741
+ setItem: (key: string, value: unknown) => Promise<void>;
3742
+ removeItem: (key: string) => Promise<void>;
3743
+ hasItem<U extends never, K extends keyof (U extends {
3744
+ [key: string]: unknown;
3745
+ items: unknown;
3746
+ } ? U["items"] : U)>(key: K, opts?: unstorage.TransactionOptions): Promise<boolean>;
3747
+ hasItem(key: string, opts?: unstorage.TransactionOptions): Promise<boolean>;
3748
+ getItems: <U extends unstorage.StorageValue>(items: (string | {
3749
+ key: string;
3750
+ options?: unstorage.TransactionOptions;
3751
+ })[], commonOptions?: unstorage.TransactionOptions) => Promise<{
3752
+ key: string;
3753
+ value: U;
3754
+ }[]>;
3755
+ getItemRaw: <T = any>(key: string, opts?: unstorage.TransactionOptions) => Promise<(T extends any ? T : any) | null>;
3756
+ setItems: <U extends unstorage.StorageValue>(items: {
3757
+ key: string;
3758
+ value: U;
3759
+ options?: unstorage.TransactionOptions;
3760
+ }[], commonOptions?: unstorage.TransactionOptions) => Promise<void>;
3761
+ setItemRaw: <T = any>(key: string, value: T extends any ? T : any, opts?: unstorage.TransactionOptions) => Promise<void>;
3762
+ getMeta: (key: string, opts?: (unstorage.TransactionOptions & {
3763
+ nativeOnly?: boolean;
3764
+ }) | boolean) => unstorage.StorageMeta | Promise<unstorage.StorageMeta>;
3765
+ setMeta: (key: string, value: unstorage.StorageMeta, opts?: unstorage.TransactionOptions) => Promise<void>;
3766
+ removeMeta: (key: string, opts?: unstorage.TransactionOptions) => Promise<void>;
3767
+ getKeys: (base?: string, opts?: unstorage.GetKeysOptions) => Promise<string[]>;
3768
+ clear: (base?: string, opts?: unstorage.TransactionOptions) => Promise<void>;
3769
+ dispose: () => Promise<void>;
3770
+ watch: (callback: unstorage.WatchCallback) => Promise<unstorage.Unwatch>;
3771
+ unwatch: () => Promise<void>;
3772
+ mount: (base: string, driver: unstorage.Driver) => unstorage.Storage;
3773
+ unmount: (base: string, dispose?: boolean) => Promise<void>;
3774
+ getMount: (key?: string) => {
3775
+ base: string;
3776
+ driver: unstorage.Driver;
3777
+ };
3778
+ getMounts: (base?: string, options?: {
3779
+ parents?: boolean;
3780
+ }) => {
3781
+ base: string;
3782
+ driver: unstorage.Driver;
3783
+ }[];
3784
+ keys: unstorage.Storage["getKeys"];
3785
+ get: {
3786
+ <U extends never, K extends string & keyof (U extends {
3787
+ [key: string]: unknown;
3788
+ items: unknown;
3789
+ } ? U["items"] : U)>(key: K, ops?: unstorage.TransactionOptions): Promise<(K extends never ? unstorage.StorageValue[K] : unstorage.StorageValue) | null>;
3790
+ <R = unstorage.StorageValue>(key: string, opts?: unstorage.TransactionOptions): Promise<R | null>;
3791
+ };
3792
+ set: {
3793
+ <U extends never, K extends keyof (U extends {
3794
+ [key: string]: unknown;
3795
+ items: unknown;
3796
+ } ? U["items"] : U)>(key: K, value: K extends never ? unstorage.StorageValue[K] : unstorage.StorageValue, opts?: unstorage.TransactionOptions): Promise<void>;
3797
+ <U extends unstorage.StorageValue>(key: string, value: U, opts?: unstorage.TransactionOptions): Promise<void>;
3798
+ };
3799
+ has: {
3800
+ <U extends never, K extends keyof (U extends {
3801
+ [key: string]: unknown;
3802
+ items: unknown;
3803
+ } ? U["items"] : U)>(key: K, opts?: unstorage.TransactionOptions): Promise<boolean>;
3804
+ (key: string, opts?: unstorage.TransactionOptions): Promise<boolean>;
3805
+ };
3806
+ del: {
3807
+ <U extends never, K extends keyof (U extends {
3808
+ [key: string]: unknown;
3809
+ items: unknown;
3810
+ } ? U["items"] : U)>(key: K, opts?: (unstorage.TransactionOptions & {
3811
+ removeMeta?: boolean;
3812
+ }) | boolean): Promise<void>;
3813
+ (key: string, opts?: (unstorage.TransactionOptions & {
3814
+ removeMeta?: boolean;
3815
+ }) | boolean): Promise<void>;
3816
+ };
3817
+ remove: {
3818
+ <U extends never, K extends keyof (U extends {
3819
+ [key: string]: unknown;
3820
+ items: unknown;
3821
+ } ? U["items"] : U)>(key: K, opts?: (unstorage.TransactionOptions & {
3822
+ removeMeta?: boolean;
3823
+ }) | boolean): Promise<void>;
3824
+ (key: string, opts?: (unstorage.TransactionOptions & {
3825
+ removeMeta?: boolean;
3826
+ }) | boolean): Promise<void>;
3827
+ };
3828
+ }>;
3829
+ /**
3830
+ * Session key data stored for each order
3831
+ */
3832
+ interface SessionKeyData {
3833
+ /**
3834
+ * The private key as a hex string
3835
+ */
3836
+ privateKey: HexString;
3837
+ /**
3838
+ * The derived public address
3839
+ */
3840
+ address: HexString;
3841
+ /**
3842
+ * The order commitment this session key is associated with.
3843
+ * This may be undefined for session keys that were created
3844
+ * but whose corresponding order has not been finalized yet.
3845
+ */
3846
+ commitment?: HexString;
3847
+ /**
3848
+ * Timestamp when the session key was created
3849
+ */
3850
+ createdAt: number;
3851
+ }
3852
+ /**
3853
+ * Creates a session key storage instance for IntentGatewayV2 orders.
3854
+ * The storage is used to persist session key private keys so they can be
3855
+ * used later to sign solver selection messages.
3856
+ *
3857
+ * @param options - Optional configuration for the storage driver
3858
+ * @returns A storage instance with methods to get, set, and remove session keys
3859
+ */
3860
+ declare function createSessionKeyStorage(options?: SessionKeyStorageOptions): Readonly<{
3861
+ getSessionKey: (commitment: HexString) => Promise<SessionKeyData | null>;
3862
+ getSessionKeyByAddress: (address: HexString) => Promise<SessionKeyData | null>;
3863
+ setSessionKey: (commitment: HexString, data: SessionKeyData) => Promise<void>;
3864
+ setSessionKeyByAddress: (address: HexString, data: SessionKeyData) => Promise<void>;
3865
+ removeSessionKey: (commitment: HexString) => Promise<void>;
3866
+ removeSessionKeyByAddress: (address: HexString) => Promise<void>;
3867
+ listSessionKeys: () => Promise<SessionKeyData[]>;
3868
+ }>;
3869
+
3870
+ /** placeOrder function selector */
3871
+ declare const PLACE_ORDER_SELECTOR = "placeOrder((bytes32,bytes,bytes,uint256,uint256,uint256,address,((bytes32,uint256)[],bytes),(bytes32,uint256)[],(bytes32,(bytes32,uint256)[],bytes)),bytes32)";
3872
+ /** placeOrder function parameter type */
3873
+ declare const ORDER_V2_PARAM_TYPE = "(bytes32,bytes,bytes,uint256,uint256,uint256,address,((bytes32,uint256)[],bytes),(bytes32,uint256)[],(bytes32,(bytes32,uint256)[],bytes))";
3589
3874
  /** ERC-7821 single batch execution mode */
3590
3875
  declare const ERC7821_BATCH_MODE: HexString;
3876
+ /** Bundler RPC method names for ERC-4337 operations */
3877
+ declare const BundlerMethod: {
3878
+ readonly ETH_SEND_USER_OPERATION: "eth_sendUserOperation";
3879
+ readonly ETH_GET_USER_OPERATION_RECEIPT: "eth_getUserOperationReceipt";
3880
+ readonly ETH_ESTIMATE_USER_OPERATION_GAS: "eth_estimateUserOperationGas";
3881
+ };
3882
+ type BundlerMethod = (typeof BundlerMethod)[keyof typeof BundlerMethod];
3591
3883
  /** Response from bundler's eth_estimateUserOperationGas */
3592
3884
  interface BundlerGasEstimate {
3593
3885
  preVerificationGas: HexString;
@@ -3596,22 +3888,16 @@ interface BundlerGasEstimate {
3596
3888
  paymasterVerificationGasLimit?: HexString;
3597
3889
  paymasterPostOpGasLimit?: HexString;
3598
3890
  }
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
3891
  /** Event map for cancellation status updates */
3610
3892
  interface CancelEventMap {
3611
3893
  DESTINATION_FINALIZED: {
3612
3894
  proof: IProof;
3613
3895
  };
3614
3896
  AWAITING_GET_REQUEST: undefined;
3897
+ AWAITING_CANCEL_TRANSACTION: {
3898
+ calldata: HexString;
3899
+ to: HexString;
3900
+ };
3615
3901
  SOURCE_FINALIZED: {
3616
3902
  metadata: {
3617
3903
  blockNumber: number;
@@ -3620,6 +3906,11 @@ interface CancelEventMap {
3620
3906
  HYPERBRIDGE_DELIVERED: RequestStatusWithMetadata;
3621
3907
  HYPERBRIDGE_FINALIZED: RequestStatusWithMetadata;
3622
3908
  SOURCE_PROOF_RECEIVED: IProof;
3909
+ CANCELLATION_COMPLETE: {
3910
+ metadata: {
3911
+ blockNumber: number;
3912
+ };
3913
+ };
3623
3914
  }
3624
3915
  type CancelEvent = {
3625
3916
  [K in keyof CancelEventMap]: {
@@ -3627,400 +3918,129 @@ type CancelEvent = {
3627
3918
  data: CancelEventMap[K];
3628
3919
  };
3629
3920
  }[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;
3921
+
3922
+ /** Shared context for IntentsV2 sub-modules */
3923
+ interface IntentsV2Context {
3924
+ source: IEvmChain;
3925
+ dest: IEvmChain;
3926
+ intentsCoprocessor?: IntentsCoprocessor;
3927
+ bundlerUrl?: string;
3928
+ feeTokenCache: Map<string, {
3929
+ address: HexString;
3930
+ decimals: number;
3931
+ cachedAt: number;
3932
+ }>;
3933
+ solverCodeCache: Map<string, string>;
3934
+ sessionKeyStorage: ReturnType<typeof createSessionKeyStorage>;
3935
+ cancellationStorage: ReturnType<typeof createCancellationStorage>;
3936
+ swap: Swap;
3638
3937
  }
3938
+
3639
3939
  /**
3640
- * IntentGatewayV2 utilities for placing orders, submitting bids, and managing the intent lifecycle.
3940
+ * IntentsV2 utilities for placing orders, submitting bids, and managing the intent lifecycle.
3641
3941
  *
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)
3660
- *
3661
- * // Execute and track
3662
- * for await (const status of gateway.executeIntentOrder({ order: finalOrder })) {
3663
- * console.log(status.status)
3664
- * }
3665
- * ```
3942
+ * Use `IntentsV2.create()` to obtain an initialized instance.
3666
3943
  */
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.
3944
+ declare class IntentsV2 {
3945
+ readonly source: IEvmChain;
3946
+ readonly dest: IEvmChain;
3947
+ readonly intentsCoprocessor?: IntentsCoprocessor;
3948
+ readonly bundlerUrl?: string;
3949
+ private readonly ctx;
3950
+ private readonly _crypto;
3951
+ private readonly orderPlacer;
3952
+ private readonly orderExecutor;
3953
+ private readonly orderCanceller;
3954
+ private readonly orderStatusChecker;
3955
+ private readonly bidManager;
3956
+ private readonly gasEstimator;
3957
+ private constructor();
3958
+ /**
3959
+ * Creates an initialized IntentsV2 instance.
3685
3960
  *
3686
3961
  * @param source - Source chain for order placement
3687
3962
  * @param dest - Destination chain for order fulfillment
3688
3963
  * @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<{
3964
+ * @param bundlerUrl - Optional ERC-4337 bundler URL for gas estimation and UserOp submission
3965
+ * @returns Initialized IntentsV2 instance
3966
+ */
3967
+ static create(source: IEvmChain, dest: IEvmChain, intentsCoprocessor?: IntentsCoprocessor, bundlerUrl?: string): Promise<IntentsV2>;
3968
+ private init;
3969
+ execute(order: OrderV2, graffiti?: HexString, options?: {
3970
+ maxPriorityFeePerGasBumpPercent?: number;
3971
+ maxFeePerGasBumpPercent?: number;
3972
+ minBids?: number;
3973
+ bidTimeoutMs?: number;
3974
+ pollIntervalMs?: number;
3975
+ }): AsyncGenerator<{
3732
3976
  calldata: HexString;
3733
3977
  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
- */
3978
+ } | IntentOrderStatusUpdate, void, HexString>;
3979
+ placeOrder(order: OrderV2, graffiti?: HexString): AsyncGenerator<{
3980
+ calldata: HexString;
3981
+ sessionPrivateKey: HexString;
3982
+ }, OrderV2, any>;
3765
3983
  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
- */
3984
+ quoteCancelNative(order: OrderV2, from?: "source" | "dest"): Promise<bigint>;
3985
+ cancelOrder(order: OrderV2, indexerClient: IndexerClient, from?: "source" | "dest"): AsyncGenerator<CancelEvent>;
3825
3986
  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
3987
  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
3988
  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
3989
  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
3990
  decodeERC7821Execute(callData: HexString): ERC7821Call[] | null;
3943
- /** Initializes the fee token cache for source and destination chains */
3944
- private initFeeTokenCache;
3991
+ isOrderFilled(order: OrderV2): Promise<boolean>;
3992
+ isOrderRefunded(order: OrderV2): Promise<boolean>;
3993
+ }
3994
+
3995
+ declare class OrderStatusChecker {
3996
+ private readonly ctx;
3997
+ constructor(ctx: IntentsV2Context);
3945
3998
  /**
3946
- * Validates bids and sorts them by USD value (best to worst).
3999
+ * Checks if a V2 order has been filled by reading the commitment storage slot on the destination chain.
3947
4000
  *
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.
4001
+ * Reads the storage slot returned by `calculateCommitmentSlotHash` on the IntentGatewayV2 contract.
4002
+ * A non-zero value at that slot means the solver has called `fillOrder` and the order is complete
4003
+ * from the user's perspective (the beneficiary has received their tokens).
3954
4004
  *
3955
- * No state overrides are used - the solver should already have tokens and approvals.
3956
- * The contract validates that outputs >= order.output.assets.
4005
+ * @param order - The V2 order to check. `order.id` is used as the commitment; if not set it is computed.
4006
+ * @returns True if the order has been filled on the destination chain, false otherwise.
3957
4007
  */
3958
- private simulateAndValidate;
4008
+ isOrderFilled(order: OrderV2): Promise<boolean>;
3959
4009
  /**
3960
- * Unified state override builder for gas estimation.
4010
+ * Checks if a V2 order has been refunded by reading the `_orders` mapping on the source chain.
3961
4011
  *
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)
4012
+ * Calls `_orders(commitment, tokenAddress)` for each input token. When the order is placed the
4013
+ * escrowed amounts are stored there. After a successful refund the contract zeroes them out.
4014
+ * An order is considered refunded when all escrowed input amounts have been returned (i.e. are 0).
3967
4015
  *
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.
4016
+ * @param order - The V2 order to check. `order.id` is used as the commitment; if not set it is computed.
4017
+ * @returns True if all escrowed inputs have been returned to the user on the source chain, false otherwise.
4000
4018
  */
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;
4019
+ isOrderRefunded(order: OrderV2): Promise<boolean>;
4008
4020
  }
4021
+
4009
4022
  /**
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.
4023
+ * Standalone utility to encode calls into ERC-7821 execute function calldata.
4024
+ * Can be used outside of the IntentGatewayV2 class (e.g., by filler strategies
4025
+ * that need to build custom batch calldata for swap+fill operations).
4026
+ */
4027
+ declare function encodeERC7821ExecuteBatch(calls: ERC7821Call[]): HexString;
4028
+ /**
4029
+ * Fetches proof for the source chain.
4014
4030
  *
4015
- * @param order - The SDK order to transform
4016
- * @returns Contract-compatible order struct
4031
+ * @internal
4032
+ */
4033
+ declare function fetchSourceProof(commitment: HexString, source: IEvmChain, sourceStateMachine: string, sourceConsensusStateId: string, sourceHeight: bigint): Promise<IProof>;
4034
+ /**
4035
+ * Transforms an OrderV2 (SDK type) to the Order struct expected by the contract.
4017
4036
  */
4018
4037
  declare function transformOrderForContract(order: OrderV2): Omit<OrderV2, "id" | "transactionHash">;
4019
- /** @deprecated Use `IntentGatewayV2.SELECT_SOLVER_TYPEHASH` instead */
4038
+
4039
+ /** EIP-712 type hash for SelectSolver message */
4020
4040
  declare const SELECT_SOLVER_TYPEHASH: `0x${string}`;
4021
- /** @deprecated Use `IntentGatewayV2.PACKED_USEROP_TYPEHASH` instead */
4041
+ /** EIP-712 type hash for PackedUserOperation */
4022
4042
  declare const PACKED_USEROP_TYPEHASH: `0x${string}`;
4023
- /** @deprecated Use `IntentGatewayV2.DOMAIN_TYPEHASH` instead */
4043
+ /** EIP-712 type hash for EIP712Domain */
4024
4044
  declare const DOMAIN_TYPEHASH: `0x${string}`;
4025
4045
 
4026
4046
  /**
@@ -4401,6 +4421,7 @@ declare const tronNile: {
4401
4421
  serializers?: viem.ChainSerializers<undefined, viem.TransactionSerializable> | undefined;
4402
4422
  verifyHash?: ((client: viem.Client, parameters: viem.VerifyHashActionParameters) => Promise<viem.VerifyHashActionReturnType>) | undefined;
4403
4423
  };
4424
+ declare const tronChainIds: Set<number>;
4404
4425
  interface ChainConfigData {
4405
4426
  chainId: number;
4406
4427
  stateMachineId: Chains;
@@ -4411,10 +4432,12 @@ interface ChainConfigData {
4411
4432
  DAI: string;
4412
4433
  USDC: string;
4413
4434
  USDT: string;
4435
+ cNGN?: string;
4414
4436
  };
4415
4437
  tokenDecimals?: {
4416
4438
  USDC: number;
4417
4439
  USDT: number;
4440
+ cNGN?: number;
4418
4441
  };
4419
4442
  tokenStorageSlots?: {
4420
4443
  USDT?: {
@@ -4451,6 +4474,8 @@ interface ChainConfigData {
4451
4474
  EntryPointV08?: `0x${string}`;
4452
4475
  /** USDT0 OFT contract address (OFT Adapter on Ethereum, OFT on other chains) */
4453
4476
  Usdt0Oft?: `0x${string}`;
4477
+ /** SolverAccount contract address used for EIP-7702 delegation */
4478
+ SolverAccount?: `0x${string}`;
4454
4479
  };
4455
4480
  rpcEnvKey?: string;
4456
4481
  defaultRpcUrl?: string;
@@ -4466,4 +4491,4 @@ declare const getChainId: (stateMachineId: string) => number | undefined;
4466
4491
  declare const getViemChain: (chainId: number) => Chain | undefined;
4467
4492
  declare const hyperbridgeAddress = "";
4468
4493
 
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 };
4494
+ 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, OrderStatusChecker, 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 };