@hyperbridge/sdk 1.6.1 → 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.
- package/dist/browser/index.d.ts +741 -631
- package/dist/browser/index.js +3950 -3522
- package/dist/browser/index.js.map +1 -1
- package/dist/node/index.d.ts +741 -631
- package/dist/node/index.js +3069 -2641
- package/dist/node/index.js.map +1 -1
- package/package.json +7 -7
package/dist/browser/index.d.ts
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { ConsolaInstance } from 'consola';
|
|
2
2
|
import { GraphQLClient } from 'graphql-request';
|
|
3
|
-
import
|
|
3
|
+
import * as viem from 'viem';
|
|
4
|
+
import { PublicClient, TransactionReceipt, Hex, Log, ContractFunctionArgs } from 'viem';
|
|
4
5
|
import { ApiPromise } from '@polkadot/api';
|
|
5
6
|
import { KeyringPair } from '@polkadot/keyring/types';
|
|
7
|
+
import * as unstorage from 'unstorage';
|
|
6
8
|
import { SignerOptions, SubmittableExtrinsic } from '@polkadot/api/types';
|
|
7
9
|
import { ISubmittableResult } from '@polkadot/types/types';
|
|
8
10
|
import { Chain } from 'viem/chains';
|
|
11
|
+
import { TronWeb } from 'tronweb';
|
|
9
12
|
|
|
10
13
|
declare const _default: {
|
|
11
14
|
ABI: readonly [{
|
|
@@ -587,252 +590,6 @@ declare const _default: {
|
|
|
587
590
|
}];
|
|
588
591
|
};
|
|
589
592
|
|
|
590
|
-
declare class ChainConfigService {
|
|
591
|
-
private rpcUrls;
|
|
592
|
-
constructor(env?: NodeJS.ProcessEnv);
|
|
593
|
-
private getConfig;
|
|
594
|
-
getChainConfig(chain: string): ChainConfig;
|
|
595
|
-
getIntentGatewayAddress(chain: string): HexString;
|
|
596
|
-
getTokenGatewayAddress(chain: string): HexString;
|
|
597
|
-
getHostAddress(chain: string): HexString;
|
|
598
|
-
getWrappedNativeAssetWithDecimals(chain: string): {
|
|
599
|
-
asset: HexString;
|
|
600
|
-
decimals: number;
|
|
601
|
-
};
|
|
602
|
-
getDaiAsset(chain: string): HexString;
|
|
603
|
-
getUsdtAsset(chain: string): HexString;
|
|
604
|
-
getUsdcAsset(chain: string): HexString;
|
|
605
|
-
getUsdcDecimals(chain: string): number;
|
|
606
|
-
getUsdtDecimals(chain: string): number;
|
|
607
|
-
getChainId(chain: string): number;
|
|
608
|
-
getConsensusStateId(chain: string): HexString;
|
|
609
|
-
getHyperbridgeChainId(): number;
|
|
610
|
-
getRpcUrl(chain: string): string;
|
|
611
|
-
getUniswapRouterV2Address(chain: string): HexString;
|
|
612
|
-
getUniswapV2FactoryAddress(chain: string): HexString;
|
|
613
|
-
getUniswapV3FactoryAddress(chain: string): HexString;
|
|
614
|
-
getUniversalRouterAddress(chain: string): HexString;
|
|
615
|
-
getUniswapV3QuoterAddress(chain: string): HexString;
|
|
616
|
-
getUniswapV4QuoterAddress(chain: string): HexString;
|
|
617
|
-
getPermit2Address(chain: string): HexString;
|
|
618
|
-
getCoingeckoId(chain: string): string | undefined;
|
|
619
|
-
getEtherscanApiKey(): string | undefined;
|
|
620
|
-
getCalldispatcherAddress(chain: string): HexString;
|
|
621
|
-
getTokenStorageSlots(chain: string, tokenAddress: string): {
|
|
622
|
-
balanceSlot: number;
|
|
623
|
-
allowanceSlot: number;
|
|
624
|
-
} | undefined;
|
|
625
|
-
getPopularTokens(chain: string): string[];
|
|
626
|
-
getIntentGatewayV2Address(chain: string): HexString;
|
|
627
|
-
getEntryPointV08Address(chain: string): HexString;
|
|
628
|
-
getHyperbridgeAddress(): string;
|
|
629
|
-
}
|
|
630
|
-
|
|
631
|
-
/**
|
|
632
|
-
* The default address used as fallback when no address is provided.
|
|
633
|
-
* This represents the zero address in EVM chains.
|
|
634
|
-
*/
|
|
635
|
-
declare const DEFAULT_ADDRESS = "0x0000000000000000000000000000000000000000";
|
|
636
|
-
/**
|
|
637
|
-
* Parameters for an EVM chain.
|
|
638
|
-
*/
|
|
639
|
-
interface EvmChainParams {
|
|
640
|
-
/**
|
|
641
|
-
* The chain ID of the EVM chain
|
|
642
|
-
*/
|
|
643
|
-
chainId: number;
|
|
644
|
-
/**
|
|
645
|
-
* The RPC URL of the EVM chain
|
|
646
|
-
*/
|
|
647
|
-
rpcUrl: string;
|
|
648
|
-
/**
|
|
649
|
-
* The host address of the EVM chain (IsmpHost contract address)
|
|
650
|
-
*/
|
|
651
|
-
host: HexString;
|
|
652
|
-
/**
|
|
653
|
-
* Consensus state identifier of this chain on hyperbridge
|
|
654
|
-
*/
|
|
655
|
-
consensusStateId?: string;
|
|
656
|
-
}
|
|
657
|
-
/**
|
|
658
|
-
* Encapsulates an EVM chain.
|
|
659
|
-
*/
|
|
660
|
-
declare class EvmChain implements IChain {
|
|
661
|
-
private readonly params;
|
|
662
|
-
private publicClient;
|
|
663
|
-
private chainConfigService;
|
|
664
|
-
constructor(params: EvmChainParams);
|
|
665
|
-
get client(): PublicClient;
|
|
666
|
-
get host(): HexString;
|
|
667
|
-
get config(): IEvmConfig;
|
|
668
|
-
get configService(): ChainConfigService;
|
|
669
|
-
/**
|
|
670
|
-
* Derives the key for the request receipt.
|
|
671
|
-
* @param {HexString} commitment - The commitment to derive the key from.
|
|
672
|
-
* @returns {HexString} The derived key.
|
|
673
|
-
*/
|
|
674
|
-
requestReceiptKey(commitment: HexString): HexString;
|
|
675
|
-
/**
|
|
676
|
-
* Queries the request receipt.
|
|
677
|
-
* @param {HexString} commitment - The commitment to query.
|
|
678
|
-
* @returns {Promise<HexString | undefined>} The relayer address responsible for delivering the request.
|
|
679
|
-
*/
|
|
680
|
-
queryRequestReceipt(commitment: HexString): Promise<HexString | undefined>;
|
|
681
|
-
/**
|
|
682
|
-
* Queries the proof of the commitments.
|
|
683
|
-
* @param {IMessage} message - The message to query.
|
|
684
|
-
* @param {string} counterparty - The counterparty address.
|
|
685
|
-
* @param {bigint} [at] - The block number to query at.
|
|
686
|
-
* @returns {Promise<HexString>} The proof.
|
|
687
|
-
*/
|
|
688
|
-
queryProof(message: IMessage, counterparty: string, at?: bigint): Promise<HexString>;
|
|
689
|
-
/**
|
|
690
|
-
* Query and return the encoded storage proof for the provided keys at the given height.
|
|
691
|
-
* @param {bigint} at - The block height at which to query the storage proof.
|
|
692
|
-
* @param {HexString[]} keys - The keys for which to query the storage proof.
|
|
693
|
-
* @param {HexString} address - Optional contract address to fetch storage proof else default to host contract
|
|
694
|
-
* @returns {Promise<HexString>} The encoded storage proof.
|
|
695
|
-
*/
|
|
696
|
-
queryStateProof(at: bigint, keys: HexString[], address?: HexString): Promise<HexString>;
|
|
697
|
-
/**
|
|
698
|
-
* Returns the current timestamp of the chain.
|
|
699
|
-
* @returns {Promise<bigint>} The current timestamp.
|
|
700
|
-
*/
|
|
701
|
-
timestamp(): Promise<bigint>;
|
|
702
|
-
/**
|
|
703
|
-
* Get the latest state machine height for a given state machine ID.
|
|
704
|
-
* @param {StateMachineIdParams} stateMachineId - The state machine ID.
|
|
705
|
-
* @returns {Promise<bigint>} The latest state machine height.
|
|
706
|
-
*/
|
|
707
|
-
latestStateMachineHeight(stateMachineId: StateMachineIdParams): Promise<bigint>;
|
|
708
|
-
/**
|
|
709
|
-
* Get the state machine update time for a given state machine height.
|
|
710
|
-
* @param {StateMachineHeight} stateMachineHeight - The state machine height.
|
|
711
|
-
* @returns {Promise<bigint>} The statemachine update time in seconds.
|
|
712
|
-
*/
|
|
713
|
-
stateMachineUpdateTime(stateMachineHeight: StateMachineHeight): Promise<bigint>;
|
|
714
|
-
/**
|
|
715
|
-
* Get the challenge period for a given state machine id.
|
|
716
|
-
* @param {StateMachineIdParams} stateMachineId - The state machine ID.
|
|
717
|
-
* @returns {Promise<bigint>} The challenge period in seconds.
|
|
718
|
-
*/
|
|
719
|
-
challengePeriod(stateMachineId: StateMachineIdParams): Promise<bigint>;
|
|
720
|
-
/**
|
|
721
|
-
* Encodes an ISMP message for the EVM chain.
|
|
722
|
-
* @param {IIsmpMessage} message The ISMP message to encode.
|
|
723
|
-
* @returns {HexString} The encoded calldata.
|
|
724
|
-
*/
|
|
725
|
-
encode(message: IIsmpMessage): HexString;
|
|
726
|
-
/**
|
|
727
|
-
* Calculates the fee required to send a post request to the destination chain.
|
|
728
|
-
* The fee is calculated based on the per-byte fee for the destination chain
|
|
729
|
-
* multiplied by the size of the request body.
|
|
730
|
-
*
|
|
731
|
-
* @param request - The post request to calculate the fee for
|
|
732
|
-
* @returns The total fee in wei required to send the post request
|
|
733
|
-
*/
|
|
734
|
-
quote(request: IPostRequest | IGetRequest): Promise<bigint>;
|
|
735
|
-
quoteNative(request: IPostRequest | IGetRequest, fee: bigint): Promise<bigint>;
|
|
736
|
-
private getAmountsIn;
|
|
737
|
-
/**
|
|
738
|
-
* Estimates the gas required for a post request execution on this chain.
|
|
739
|
-
* This function generates mock proofs for the post request, creates a state override
|
|
740
|
-
* with the necessary overlay root, and estimates the gas cost for executing the
|
|
741
|
-
* handlePostRequests transaction on the handler contract.
|
|
742
|
-
*
|
|
743
|
-
* @param request - The post request to estimate gas for
|
|
744
|
-
* @param paraId - The ID of the parachain (Hyperbridge) that will process the request
|
|
745
|
-
* @returns The estimated gas amount in gas units and the generated calldata
|
|
746
|
-
*/
|
|
747
|
-
estimateGas(request: IPostRequest): Promise<{
|
|
748
|
-
gas: bigint;
|
|
749
|
-
postRequestCalldata: HexString;
|
|
750
|
-
}>;
|
|
751
|
-
/**
|
|
752
|
-
* Gets the fee token address and decimals for the chain.
|
|
753
|
-
* This function gets the fee token address and decimals for the chain.
|
|
754
|
-
*
|
|
755
|
-
* @returns The fee token address and decimals
|
|
756
|
-
*/
|
|
757
|
-
getFeeTokenWithDecimals(): Promise<{
|
|
758
|
-
address: HexString;
|
|
759
|
-
decimals: number;
|
|
760
|
-
}>;
|
|
761
|
-
/**
|
|
762
|
-
* Gets the nonce of the host.
|
|
763
|
-
* This function gets the nonce of the host.
|
|
764
|
-
*
|
|
765
|
-
* @returns The nonce of the host
|
|
766
|
-
*/
|
|
767
|
-
getHostNonce(): Promise<bigint>;
|
|
768
|
-
}
|
|
769
|
-
/**
|
|
770
|
-
* Factory function for creating EVM chain instances with common defaults
|
|
771
|
-
*
|
|
772
|
-
* @param chainId - The EVM chain ID
|
|
773
|
-
* @param host - The IsmpHost contract address
|
|
774
|
-
* @param options - Optional configuration overrides
|
|
775
|
-
* @returns A new EvmChain instance
|
|
776
|
-
*
|
|
777
|
-
* @example
|
|
778
|
-
* ```typescript
|
|
779
|
-
* // Create with minimal config
|
|
780
|
-
* const ethChain = createEvmChain(1, "0x87ea45..", {
|
|
781
|
-
* rpcUrl: "https://eth-mainnet.g.alchemy.com/v2/YOUR_KEY"
|
|
782
|
-
* })
|
|
783
|
-
*
|
|
784
|
-
* // Create with custom consensus state ID
|
|
785
|
-
* const arbChain = createEvmChain(42161, "0x87ea42345..", {
|
|
786
|
-
* rpcUrl: "https://arb-mainnet.g.alchemy.com/v2/YOUR_KEY",
|
|
787
|
-
* consensusStateId: "ARB_CUSTOM"
|
|
788
|
-
* })
|
|
789
|
-
* ```
|
|
790
|
-
*/
|
|
791
|
-
declare function createEvmChain(chainId: number, host: HexString, options: {
|
|
792
|
-
rpcUrl: string;
|
|
793
|
-
consensusStateId?: string;
|
|
794
|
-
}): EvmChain;
|
|
795
|
-
/**
|
|
796
|
-
* Slot for storing request commitments.
|
|
797
|
-
*/
|
|
798
|
-
declare const REQUEST_COMMITMENTS_SLOT = 0n;
|
|
799
|
-
/**
|
|
800
|
-
* Slot index for response commitments map
|
|
801
|
-
*/
|
|
802
|
-
declare const RESPONSE_COMMITMENTS_SLOT = 1n;
|
|
803
|
-
/**
|
|
804
|
-
* Slot index for requests receipts map
|
|
805
|
-
*/
|
|
806
|
-
declare const REQUEST_RECEIPTS_SLOT = 2n;
|
|
807
|
-
/**
|
|
808
|
-
* Slot index for response receipts map
|
|
809
|
-
*/
|
|
810
|
-
declare const RESPONSE_RECEIPTS_SLOT = 3n;
|
|
811
|
-
/**
|
|
812
|
-
* Slot index for state commitment map
|
|
813
|
-
*/
|
|
814
|
-
declare const STATE_COMMITMENTS_SLOT = 5n;
|
|
815
|
-
declare function requestCommitmentKey(key: Hex): {
|
|
816
|
-
slot1: Hex;
|
|
817
|
-
slot2: Hex;
|
|
818
|
-
};
|
|
819
|
-
/**
|
|
820
|
-
* Derives the storage slot for a specific field in the StateCommitment struct
|
|
821
|
-
*
|
|
822
|
-
* struct StateCommitment {
|
|
823
|
-
* uint256 timestamp; // slot + 0
|
|
824
|
-
* bytes32 overlayRoot; // slot + 1
|
|
825
|
-
* bytes32 stateRoot; // slot + 2
|
|
826
|
-
* }
|
|
827
|
-
*
|
|
828
|
-
* @param stateMachineId - The state machine ID
|
|
829
|
-
* @param height - The block height
|
|
830
|
-
* @param field - The field index in the struct (0 for timestamp, 1 for overlayRoot, 2 for stateRoot)
|
|
831
|
-
* @returns The storage slot for the specific field
|
|
832
|
-
*/
|
|
833
|
-
declare function getStateCommitmentFieldSlot(stateMachineId: bigint, height: bigint, field: 0 | 1 | 2): HexString;
|
|
834
|
-
declare function getStateCommitmentSlot(stateMachineId: bigint, height: bigint): HexString;
|
|
835
|
-
|
|
836
593
|
/**
|
|
837
594
|
* Generates a Merkle Mountain Range (MMR) root hash and proof for a post request.
|
|
838
595
|
*
|
|
@@ -889,6 +646,25 @@ declare const DEFAULT_GRAFFITI: HexString;
|
|
|
889
646
|
* @returns The larger of the two values
|
|
890
647
|
*/
|
|
891
648
|
declare function maxBigInt(a: bigint, b: bigint): bigint;
|
|
649
|
+
/**
|
|
650
|
+
* Converts a state machine ID string to a stateId object.
|
|
651
|
+
* Handles formats like:
|
|
652
|
+
* - "EVM-97" → { Evm: 97 }
|
|
653
|
+
* - "SUBSTRATE-cere" → { Substrate: "0x63657265" } (hex encoded UTF-8 bytes)
|
|
654
|
+
* - "POLKADOT-3367" → { Polkadot: 3367 }
|
|
655
|
+
* - "KUSAMA-123" → { Kusama: 123 }
|
|
656
|
+
*
|
|
657
|
+
* @param stateMachineId The state machine ID string
|
|
658
|
+
* @returns A stateId object conforming to the StateMachineIdParams interface
|
|
659
|
+
*/
|
|
660
|
+
declare function parseStateMachineId(stateMachineId: string): {
|
|
661
|
+
stateId: {
|
|
662
|
+
Evm?: number;
|
|
663
|
+
Substrate?: HexString;
|
|
664
|
+
Polkadot?: number;
|
|
665
|
+
Kusama?: number;
|
|
666
|
+
};
|
|
667
|
+
};
|
|
892
668
|
/**
|
|
893
669
|
* Calculates the commitment hash for a post request.
|
|
894
670
|
* @param post The post request to calculate the commitment hash for.
|
|
@@ -938,13 +714,24 @@ declare function estimateGasForPost(params: {
|
|
|
938
714
|
gas_fee: bigint;
|
|
939
715
|
call_data: EstimateGasCallData;
|
|
940
716
|
}>;
|
|
717
|
+
/**
|
|
718
|
+
* ABI-encodes a WithdrawalRequest (commitment + beneficiary + tokens).
|
|
719
|
+
* Used as the GET-request context for cancel-from-source, and as the inner
|
|
720
|
+
* payload (after the RequestKind prefix) for POST-based escrow operations.
|
|
721
|
+
*/
|
|
722
|
+
declare function encodeWithdrawalRequest(order: Order | OrderV2, beneficiary: HexString): HexString;
|
|
941
723
|
/**
|
|
942
724
|
* Constructs the request body for a redeem escrow operation.
|
|
943
725
|
* This function encodes the order commitment, beneficiary address, and token inputs
|
|
944
726
|
* to match the format expected by the IntentGateway contract.
|
|
945
727
|
*/
|
|
946
728
|
declare function constructRedeemEscrowRequestBody(order: Order | OrderV2, beneficiary: HexString): HexString;
|
|
947
|
-
|
|
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>;
|
|
948
735
|
/**
|
|
949
736
|
* Fetches the current network gas price from an Etherscan-family explorer API.
|
|
950
737
|
* Returns the ProposeGasPrice (in gwei) converted to wei as bigint.
|
|
@@ -1001,6 +788,18 @@ declare enum EvmLanguage {
|
|
|
1001
788
|
* ```
|
|
1002
789
|
*/
|
|
1003
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>;
|
|
1004
803
|
/**
|
|
1005
804
|
* Adjusts fee amounts between different decimal precisions.
|
|
1006
805
|
* Handles scaling up or down based on the decimal difference.
|
|
@@ -1041,6 +840,17 @@ declare function getContractCallInput(client: PublicClient, txHash: HexString, t
|
|
|
1041
840
|
* @returns The balance mapping location as a HexString.
|
|
1042
841
|
*/
|
|
1043
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;
|
|
1044
854
|
|
|
1045
855
|
declare class SubstrateChain implements IChain {
|
|
1046
856
|
private readonly params;
|
|
@@ -1110,9 +920,10 @@ declare class SubstrateChain implements IChain {
|
|
|
1110
920
|
* Query the state proof for a given set of keys at a specific block height.
|
|
1111
921
|
* @param at The block height to query the state proof at.
|
|
1112
922
|
* @param keys The keys to query the state proof for.
|
|
923
|
+
* @param _address - Optional address (ignored for Substrate; present for IChain compatibility).
|
|
1113
924
|
* @returns The state proof as a hexadecimal string.
|
|
1114
925
|
*/
|
|
1115
|
-
queryStateProof(at: bigint, keys: HexString[]): Promise<HexString>;
|
|
926
|
+
queryStateProof(at: bigint, keys: HexString[], _address?: HexString): Promise<HexString>;
|
|
1116
927
|
/**
|
|
1117
928
|
* Get the latest state machine height for a given state machine ID.
|
|
1118
929
|
* @param {StateMachineIdParams} stateMachineId - The state machine ID.
|
|
@@ -1239,6 +1050,271 @@ declare function convertCodecToIProof(codec: {
|
|
|
1239
1050
|
}): IProof;
|
|
1240
1051
|
declare function encodeISMPMessage(message: IIsmpMessage): Uint8Array;
|
|
1241
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.
|
|
1111
|
+
*/
|
|
1112
|
+
declare const DEFAULT_ADDRESS = "0x0000000000000000000000000000000000000000";
|
|
1113
|
+
/**
|
|
1114
|
+
* Parameters for an EVM chain.
|
|
1115
|
+
*/
|
|
1116
|
+
interface EvmChainParams {
|
|
1117
|
+
/**
|
|
1118
|
+
* The chain ID of the EVM chain
|
|
1119
|
+
*/
|
|
1120
|
+
chainId: number;
|
|
1121
|
+
/**
|
|
1122
|
+
* The RPC URL of the EVM chain
|
|
1123
|
+
*/
|
|
1124
|
+
rpcUrl: string;
|
|
1125
|
+
/**
|
|
1126
|
+
* The host address of the EVM chain (IsmpHost contract address)
|
|
1127
|
+
*/
|
|
1128
|
+
host: HexString;
|
|
1129
|
+
/**
|
|
1130
|
+
* Consensus state identifier of this chain on hyperbridge
|
|
1131
|
+
*/
|
|
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;
|
|
1146
|
+
/**
|
|
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.
|
|
1150
|
+
*/
|
|
1151
|
+
requestReceiptKey(commitment: HexString): HexString;
|
|
1152
|
+
/**
|
|
1153
|
+
* Queries the request receipt.
|
|
1154
|
+
* @param {HexString} commitment - The commitment to query.
|
|
1155
|
+
* @returns {Promise<HexString | undefined>} The relayer address responsible for delivering the request.
|
|
1156
|
+
*/
|
|
1157
|
+
queryRequestReceipt(commitment: HexString): Promise<HexString | undefined>;
|
|
1158
|
+
/**
|
|
1159
|
+
* Queries the proof of the commitments.
|
|
1160
|
+
* @param {IMessage} message - The message to query.
|
|
1161
|
+
* @param {string} counterparty - The counterparty address.
|
|
1162
|
+
* @param {bigint} [at] - The block number to query at.
|
|
1163
|
+
* @returns {Promise<HexString>} The proof.
|
|
1164
|
+
*/
|
|
1165
|
+
queryProof(message: IMessage, counterparty: string, at?: bigint): Promise<HexString>;
|
|
1166
|
+
/**
|
|
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.
|
|
1172
|
+
*/
|
|
1173
|
+
queryStateProof(at: bigint, keys: HexString[], address?: HexString): Promise<HexString>;
|
|
1174
|
+
/**
|
|
1175
|
+
* Returns the current timestamp of the chain.
|
|
1176
|
+
* @returns {Promise<bigint>} The current timestamp.
|
|
1177
|
+
*/
|
|
1178
|
+
timestamp(): Promise<bigint>;
|
|
1179
|
+
/**
|
|
1180
|
+
* Get the latest state machine height for a given state machine ID.
|
|
1181
|
+
* @param {StateMachineIdParams} stateMachineId - The state machine ID.
|
|
1182
|
+
* @returns {Promise<bigint>} The latest state machine height.
|
|
1183
|
+
*/
|
|
1184
|
+
latestStateMachineHeight(stateMachineId: StateMachineIdParams): Promise<bigint>;
|
|
1185
|
+
/**
|
|
1186
|
+
* Get the state machine update time for a given state machine height.
|
|
1187
|
+
* @param {StateMachineHeight} stateMachineHeight - The state machine height.
|
|
1188
|
+
* @returns {Promise<bigint>} The statemachine update time in seconds.
|
|
1189
|
+
*/
|
|
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>;
|
|
1195
|
+
/**
|
|
1196
|
+
* Get the challenge period for a given state machine id.
|
|
1197
|
+
* @param {StateMachineIdParams} stateMachineId - The state machine ID.
|
|
1198
|
+
* @returns {Promise<bigint>} The challenge period in seconds.
|
|
1199
|
+
*/
|
|
1200
|
+
challengePeriod(stateMachineId: StateMachineIdParams): Promise<bigint>;
|
|
1201
|
+
/**
|
|
1202
|
+
* Encodes an ISMP message for the EVM chain.
|
|
1203
|
+
* @param {IIsmpMessage} message The ISMP message to encode.
|
|
1204
|
+
* @returns {HexString} The encoded calldata.
|
|
1205
|
+
*/
|
|
1206
|
+
encode(message: IIsmpMessage): HexString;
|
|
1207
|
+
/**
|
|
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
|
|
1214
|
+
*/
|
|
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>;
|
|
1250
|
+
}
|
|
1251
|
+
/**
|
|
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
|
+
* ```
|
|
1272
|
+
*/
|
|
1273
|
+
declare function createEvmChain(chainId: number, host: HexString, options: {
|
|
1274
|
+
rpcUrl: string;
|
|
1275
|
+
consensusStateId?: string;
|
|
1276
|
+
}): EvmChain;
|
|
1277
|
+
/**
|
|
1278
|
+
* Slot for storing request commitments.
|
|
1279
|
+
*/
|
|
1280
|
+
declare const REQUEST_COMMITMENTS_SLOT = 0n;
|
|
1281
|
+
/**
|
|
1282
|
+
* Slot index for response commitments map
|
|
1283
|
+
*/
|
|
1284
|
+
declare const RESPONSE_COMMITMENTS_SLOT = 1n;
|
|
1285
|
+
/**
|
|
1286
|
+
* Slot index for requests receipts map
|
|
1287
|
+
*/
|
|
1288
|
+
declare const REQUEST_RECEIPTS_SLOT = 2n;
|
|
1289
|
+
/**
|
|
1290
|
+
* Slot index for response receipts map
|
|
1291
|
+
*/
|
|
1292
|
+
declare const RESPONSE_RECEIPTS_SLOT = 3n;
|
|
1293
|
+
/**
|
|
1294
|
+
* Slot index for state commitment map
|
|
1295
|
+
*/
|
|
1296
|
+
declare const STATE_COMMITMENTS_SLOT = 5n;
|
|
1297
|
+
declare function requestCommitmentKey(key: Hex): {
|
|
1298
|
+
slot1: Hex;
|
|
1299
|
+
slot2: Hex;
|
|
1300
|
+
};
|
|
1301
|
+
/**
|
|
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
|
|
1314
|
+
*/
|
|
1315
|
+
declare function getStateCommitmentFieldSlot(stateMachineId: bigint, height: bigint, field: 0 | 1 | 2): HexString;
|
|
1316
|
+
declare function getStateCommitmentSlot(stateMachineId: bigint, height: bigint): HexString;
|
|
1317
|
+
|
|
1242
1318
|
/**
|
|
1243
1319
|
* Encodes a PackedUserOperation using SCALE codec for submission to Hyperbridge.
|
|
1244
1320
|
* This is the recommended way to encode UserOps for the intents coprocessor.
|
|
@@ -1346,6 +1422,64 @@ declare class IntentsCoprocessor {
|
|
|
1346
1422
|
private buildOffchainBidKey;
|
|
1347
1423
|
}
|
|
1348
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
|
+
|
|
1349
1483
|
/**
|
|
1350
1484
|
* Type representing an ISMP message.
|
|
1351
1485
|
*/
|
|
@@ -1469,8 +1603,9 @@ interface IChain {
|
|
|
1469
1603
|
queryRequestReceipt(commitment: HexString): Promise<HexString | undefined>;
|
|
1470
1604
|
/**
|
|
1471
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.
|
|
1472
1607
|
*/
|
|
1473
|
-
queryStateProof(at: bigint, keys: HexString[]): Promise<HexString>;
|
|
1608
|
+
queryStateProof(at: bigint, keys: HexString[], address?: HexString): Promise<HexString>;
|
|
1474
1609
|
queryProof(message: IMessage, counterparty: string, at?: bigint): Promise<HexString>;
|
|
1475
1610
|
encode(message: IIsmpMessage): HexString;
|
|
1476
1611
|
/**
|
|
@@ -1487,11 +1622,36 @@ interface IChain {
|
|
|
1487
1622
|
stateMachineUpdateTime(stateMachineHeight: StateMachineHeight): Promise<bigint>;
|
|
1488
1623
|
}
|
|
1489
1624
|
/**
|
|
1490
|
-
*
|
|
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
|
+
*
|
|
1491
1649
|
* @param chainConfig - Chain configuration
|
|
1492
1650
|
* @returns Chain interface
|
|
1493
1651
|
*/
|
|
1494
1652
|
declare function getChain(chainConfig: IEvmConfig | ISubstrateConfig): Promise<IChain>;
|
|
1653
|
+
declare function getEvmChain(chainConfig: IEvmConfig): IChain;
|
|
1654
|
+
declare function getSubstrateChain(chainConfig: ISubstrateConfig): Promise<SubstrateChain>;
|
|
1495
1655
|
|
|
1496
1656
|
type EstimateGasCallData = ContractFunctionArgs<typeof _default.ABI, "nonpayable" | "payable", "handlePostRequests">;
|
|
1497
1657
|
type HexString = `0x${string}`;
|
|
@@ -2155,7 +2315,15 @@ declare enum RequestKind {
|
|
|
2155
2315
|
/**
|
|
2156
2316
|
* Identifies a request for updating parameters
|
|
2157
2317
|
*/
|
|
2158
|
-
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
|
|
2159
2327
|
}
|
|
2160
2328
|
/**
|
|
2161
2329
|
* Configuration for the IntentFiller
|
|
@@ -2571,8 +2739,8 @@ interface DispatchInfoV2 {
|
|
|
2571
2739
|
interface OrderV2 {
|
|
2572
2740
|
id?: string;
|
|
2573
2741
|
user: HexString;
|
|
2574
|
-
source:
|
|
2575
|
-
destination:
|
|
2742
|
+
source: HexString;
|
|
2743
|
+
destination: HexString;
|
|
2576
2744
|
deadline: bigint;
|
|
2577
2745
|
nonce: bigint;
|
|
2578
2746
|
fees: bigint;
|
|
@@ -2610,10 +2778,11 @@ interface SubmitBidOptions {
|
|
|
2610
2778
|
preVerificationGas: bigint;
|
|
2611
2779
|
maxFeePerGas: bigint;
|
|
2612
2780
|
maxPriorityFeePerGas: bigint;
|
|
2781
|
+
/** Pre-built ERC-7821 calldata encoding the UserOp execution (approvals + fillOrder). */
|
|
2782
|
+
callData: HexString;
|
|
2613
2783
|
}
|
|
2614
2784
|
interface EstimateFillOrderV2Params {
|
|
2615
2785
|
order: OrderV2;
|
|
2616
|
-
solverPrivateKey: HexString;
|
|
2617
2786
|
/**
|
|
2618
2787
|
* Optional percentage to bump maxPriorityFeePerGas.
|
|
2619
2788
|
* This is added on top of the base gasPrice.
|
|
@@ -2636,7 +2805,6 @@ interface FillOrderEstimateV2 {
|
|
|
2636
2805
|
maxPriorityFeePerGas: bigint;
|
|
2637
2806
|
totalGasCostWei: bigint;
|
|
2638
2807
|
totalGasInFeeToken: bigint;
|
|
2639
|
-
nonce: bigint;
|
|
2640
2808
|
}
|
|
2641
2809
|
/**
|
|
2642
2810
|
* Result of submitting a bid to Hyperbridge
|
|
@@ -2702,6 +2870,8 @@ declare const IntentOrderStatus: Readonly<{
|
|
|
2702
2870
|
BIDS_RECEIVED: "BIDS_RECEIVED";
|
|
2703
2871
|
BID_SELECTED: "BID_SELECTED";
|
|
2704
2872
|
USEROP_SUBMITTED: "USEROP_SUBMITTED";
|
|
2873
|
+
FILLED: "FILLED";
|
|
2874
|
+
PARTIAL_FILL: "PARTIAL_FILL";
|
|
2705
2875
|
FAILED: "FAILED";
|
|
2706
2876
|
}>;
|
|
2707
2877
|
type IntentOrderStatus = typeof IntentOrderStatus;
|
|
@@ -2731,6 +2901,7 @@ interface SelectBidResult {
|
|
|
2731
2901
|
solverAddress: HexString;
|
|
2732
2902
|
commitment: HexString;
|
|
2733
2903
|
txnHash?: HexString;
|
|
2904
|
+
fillStatus?: "full" | "partial";
|
|
2734
2905
|
}
|
|
2735
2906
|
/** Options for executing an intent order */
|
|
2736
2907
|
interface ExecuteIntentOrderOptions {
|
|
@@ -3555,8 +3726,160 @@ type CancelEvent$1 = {
|
|
|
3555
3726
|
};
|
|
3556
3727
|
}[keyof CancelEventMap$1];
|
|
3557
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))";
|
|
3558
3874
|
/** ERC-7821 single batch execution mode */
|
|
3559
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];
|
|
3560
3883
|
/** Response from bundler's eth_estimateUserOperationGas */
|
|
3561
3884
|
interface BundlerGasEstimate {
|
|
3562
3885
|
preVerificationGas: HexString;
|
|
@@ -3565,22 +3888,16 @@ interface BundlerGasEstimate {
|
|
|
3565
3888
|
paymasterVerificationGasLimit?: HexString;
|
|
3566
3889
|
paymasterPostOpGasLimit?: HexString;
|
|
3567
3890
|
}
|
|
3568
|
-
/** Bundler RPC method names for ERC-4337 operations */
|
|
3569
|
-
declare const BundlerMethod: {
|
|
3570
|
-
/** Submit a user operation to the bundler */
|
|
3571
|
-
readonly ETH_SEND_USER_OPERATION: "eth_sendUserOperation";
|
|
3572
|
-
/** Get the receipt of a user operation */
|
|
3573
|
-
readonly ETH_GET_USER_OPERATION_RECEIPT: "eth_getUserOperationReceipt";
|
|
3574
|
-
/** Estimate gas for a user operation */
|
|
3575
|
-
readonly ETH_ESTIMATE_USER_OPERATION_GAS: "eth_estimateUserOperationGas";
|
|
3576
|
-
};
|
|
3577
|
-
type BundlerMethod = (typeof BundlerMethod)[keyof typeof BundlerMethod];
|
|
3578
3891
|
/** Event map for cancellation status updates */
|
|
3579
3892
|
interface CancelEventMap {
|
|
3580
3893
|
DESTINATION_FINALIZED: {
|
|
3581
3894
|
proof: IProof;
|
|
3582
3895
|
};
|
|
3583
3896
|
AWAITING_GET_REQUEST: undefined;
|
|
3897
|
+
AWAITING_CANCEL_TRANSACTION: {
|
|
3898
|
+
calldata: HexString;
|
|
3899
|
+
to: HexString;
|
|
3900
|
+
};
|
|
3584
3901
|
SOURCE_FINALIZED: {
|
|
3585
3902
|
metadata: {
|
|
3586
3903
|
blockNumber: number;
|
|
@@ -3589,6 +3906,11 @@ interface CancelEventMap {
|
|
|
3589
3906
|
HYPERBRIDGE_DELIVERED: RequestStatusWithMetadata;
|
|
3590
3907
|
HYPERBRIDGE_FINALIZED: RequestStatusWithMetadata;
|
|
3591
3908
|
SOURCE_PROOF_RECEIVED: IProof;
|
|
3909
|
+
CANCELLATION_COMPLETE: {
|
|
3910
|
+
metadata: {
|
|
3911
|
+
blockNumber: number;
|
|
3912
|
+
};
|
|
3913
|
+
};
|
|
3592
3914
|
}
|
|
3593
3915
|
type CancelEvent = {
|
|
3594
3916
|
[K in keyof CancelEventMap]: {
|
|
@@ -3596,400 +3918,129 @@ type CancelEvent = {
|
|
|
3596
3918
|
data: CancelEventMap[K];
|
|
3597
3919
|
};
|
|
3598
3920
|
}[keyof CancelEventMap];
|
|
3599
|
-
|
|
3600
|
-
|
|
3601
|
-
|
|
3602
|
-
|
|
3603
|
-
|
|
3604
|
-
|
|
3605
|
-
|
|
3606
|
-
|
|
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;
|
|
3607
3937
|
}
|
|
3938
|
+
|
|
3608
3939
|
/**
|
|
3609
|
-
*
|
|
3610
|
-
*
|
|
3611
|
-
* This class provides a complete SDK for interacting with the IntentGatewayV2 protocol:
|
|
3612
|
-
* - **Order Placement**: Generate session keys and prepare order transactions
|
|
3613
|
-
* - **Bid Management**: Validate, sort, and select optimal bids from solvers
|
|
3614
|
-
* - **Execution Flow**: Full lifecycle management from order to completion
|
|
3615
|
-
* - **Cancellation**: Handle order cancellation with cross-chain proofs
|
|
3616
|
-
*
|
|
3617
|
-
* Session keys are automatically managed with environment-appropriate storage
|
|
3618
|
-
* (Node.js filesystem, browser localStorage/IndexedDB, or in-memory fallback).
|
|
3619
|
-
*
|
|
3620
|
-
* @example
|
|
3621
|
-
* ```typescript
|
|
3622
|
-
* const gateway = new IntentGatewayV2(sourceChain, destChain, coprocessor, bundlerUrl)
|
|
3940
|
+
* IntentsV2 utilities for placing orders, submitting bids, and managing the intent lifecycle.
|
|
3623
3941
|
*
|
|
3624
|
-
*
|
|
3625
|
-
* const gen = gateway.preparePlaceOrder(order)
|
|
3626
|
-
* const { value: { calldata } } = await gen.next()
|
|
3627
|
-
* const txHash = await wallet.sendTransaction({ to: gatewayAddr, data: calldata })
|
|
3628
|
-
* const { value: finalOrder } = await gen.next(txHash)
|
|
3629
|
-
*
|
|
3630
|
-
* // Execute and track
|
|
3631
|
-
* for await (const status of gateway.executeIntentOrder({ order: finalOrder })) {
|
|
3632
|
-
* console.log(status.status)
|
|
3633
|
-
* }
|
|
3634
|
-
* ```
|
|
3942
|
+
* Use `IntentsV2.create()` to obtain an initialized instance.
|
|
3635
3943
|
*/
|
|
3636
|
-
declare class
|
|
3637
|
-
readonly source:
|
|
3638
|
-
readonly dest:
|
|
3639
|
-
readonly intentsCoprocessor?: IntentsCoprocessor
|
|
3640
|
-
readonly bundlerUrl?: string
|
|
3641
|
-
|
|
3642
|
-
|
|
3643
|
-
|
|
3644
|
-
|
|
3645
|
-
|
|
3646
|
-
|
|
3647
|
-
private readonly
|
|
3648
|
-
private readonly
|
|
3649
|
-
private
|
|
3650
|
-
|
|
3651
|
-
|
|
3652
|
-
/**
|
|
3653
|
-
* 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.
|
|
3654
3960
|
*
|
|
3655
3961
|
* @param source - Source chain for order placement
|
|
3656
3962
|
* @param dest - Destination chain for order fulfillment
|
|
3657
3963
|
* @param intentsCoprocessor - Optional coprocessor for bid fetching and order execution
|
|
3658
|
-
* @param bundlerUrl - Optional ERC-4337 bundler URL for gas estimation and UserOp submission
|
|
3659
|
-
*
|
|
3660
|
-
*/
|
|
3661
|
-
|
|
3662
|
-
|
|
3663
|
-
|
|
3664
|
-
|
|
3665
|
-
|
|
3666
|
-
|
|
3667
|
-
|
|
3668
|
-
|
|
3669
|
-
|
|
3670
|
-
* Flow:
|
|
3671
|
-
* 1. Generates a session key and sets `order.session`
|
|
3672
|
-
* 2. Encodes the placeOrder calldata and yields `{ calldata, sessionPrivateKey }`
|
|
3673
|
-
* 3. Waits for the user/frontend to submit the transaction and provide the txHash via `next(txHash)`
|
|
3674
|
-
* 4. Fetches the transaction receipt and extracts the OrderPlaced event
|
|
3675
|
-
* 5. Updates `order.nonce` and `order.inputs` from the actual event data
|
|
3676
|
-
* 6. Computes the commitment and sets `order.id`
|
|
3677
|
-
* 7. Stores the session key and returns the finalized order
|
|
3678
|
-
*
|
|
3679
|
-
* @param order - The order to prepare and place
|
|
3680
|
-
* @yields `{ calldata, sessionPrivateKey }` - Encoded placeOrder calldata and session private key
|
|
3681
|
-
* @returns The finalized order with correct nonce, inputs, and commitment from on-chain event
|
|
3682
|
-
*
|
|
3683
|
-
* @example
|
|
3684
|
-
* ```typescript
|
|
3685
|
-
* const generator = gateway.preparePlaceOrder(order)
|
|
3686
|
-
*
|
|
3687
|
-
* // Step 1: Get calldata and private key
|
|
3688
|
-
* const { value: { calldata, sessionPrivateKey } } = await generator.next()
|
|
3689
|
-
*
|
|
3690
|
-
* // Step 2: Submit transaction using the calldata
|
|
3691
|
-
* const txHash = await walletClient.sendTransaction({
|
|
3692
|
-
* to: intentGatewayV2Address,
|
|
3693
|
-
* data: calldata,
|
|
3694
|
-
* })
|
|
3695
|
-
*
|
|
3696
|
-
* // Step 3: Pass txHash back to generator and get finalized order
|
|
3697
|
-
* const { value: finalizedOrder } = await generator.next(txHash)
|
|
3698
|
-
* ```
|
|
3699
|
-
*/
|
|
3700
|
-
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<{
|
|
3701
3976
|
calldata: HexString;
|
|
3702
3977
|
sessionPrivateKey: HexString;
|
|
3703
|
-
},
|
|
3704
|
-
|
|
3705
|
-
|
|
3706
|
-
|
|
3707
|
-
|
|
3708
|
-
*
|
|
3709
|
-
* Requires `intentsCoprocessor` and `bundlerUrl` to be set in the constructor.
|
|
3710
|
-
*
|
|
3711
|
-
* @param options - Execution options including the order and optional parameters
|
|
3712
|
-
* @yields Status updates throughout the execution flow
|
|
3713
|
-
*
|
|
3714
|
-
* @example
|
|
3715
|
-
* ```typescript
|
|
3716
|
-
* for await (const status of gateway.executeIntentOrder({ order, orderTxHash: txHash })) {
|
|
3717
|
-
* switch (status.status) {
|
|
3718
|
-
* case 'AWAITING_BIDS':
|
|
3719
|
-
* console.log('Waiting for solver bids...')
|
|
3720
|
-
* break
|
|
3721
|
-
* case 'BIDS_RECEIVED':
|
|
3722
|
-
* console.log(`Received ${status.metadata.bidCount} bids`)
|
|
3723
|
-
* break
|
|
3724
|
-
* case 'BID_SELECTED':
|
|
3725
|
-
* console.log(`Selected solver: ${status.metadata.selectedSolver}`)
|
|
3726
|
-
* break
|
|
3727
|
-
* case 'USEROP_SUBMITTED':
|
|
3728
|
-
* console.log(`UserOp submitted: ${status.metadata.userOpHash}`)
|
|
3729
|
-
* break
|
|
3730
|
-
* }
|
|
3731
|
-
* }
|
|
3732
|
-
* ```
|
|
3733
|
-
*/
|
|
3978
|
+
} | IntentOrderStatusUpdate, void, HexString>;
|
|
3979
|
+
placeOrder(order: OrderV2, graffiti?: HexString): AsyncGenerator<{
|
|
3980
|
+
calldata: HexString;
|
|
3981
|
+
sessionPrivateKey: HexString;
|
|
3982
|
+
}, OrderV2, any>;
|
|
3734
3983
|
executeIntentOrder(options: ExecuteIntentOrderOptions): AsyncGenerator<IntentOrderStatusUpdate, void>;
|
|
3735
|
-
|
|
3736
|
-
|
|
3737
|
-
*
|
|
3738
|
-
* @param order - The order to get the cancellation quote for
|
|
3739
|
-
* @returns Native token amount required for the cancellation GET request
|
|
3740
|
-
*/
|
|
3741
|
-
quoteCancelNative(order: OrderV2): Promise<bigint>;
|
|
3742
|
-
/**
|
|
3743
|
-
* Generator function that handles the full order cancellation flow.
|
|
3744
|
-
*
|
|
3745
|
-
* This allows users to cancel orders that haven't been filled by the deadline.
|
|
3746
|
-
*
|
|
3747
|
-
* Flow:
|
|
3748
|
-
* 1. Fetch proof that the order wasn't filled on the destination chain
|
|
3749
|
-
* 2. Submit a GET request to read the unfilled order state
|
|
3750
|
-
* 3. Wait for the GET request to be processed through Hyperbridge
|
|
3751
|
-
* 4. Finalize the cancellation on Hyperbridge
|
|
3752
|
-
*
|
|
3753
|
-
* @param order - The order to cancel
|
|
3754
|
-
* @param indexerClient - Client for querying the indexer
|
|
3755
|
-
* @yields Status updates throughout the cancellation process
|
|
3756
|
-
*
|
|
3757
|
-
* @example
|
|
3758
|
-
* ```typescript
|
|
3759
|
-
* const cancelStream = gateway.cancelOrder(order, indexerClient)
|
|
3760
|
-
*
|
|
3761
|
-
* for await (const event of cancelStream) {
|
|
3762
|
-
* switch (event.status) {
|
|
3763
|
-
* case 'DESTINATION_FINALIZED':
|
|
3764
|
-
* console.log('Got destination proof')
|
|
3765
|
-
* break
|
|
3766
|
-
* case 'AWAITING_GET_REQUEST':
|
|
3767
|
-
* const txHash = await submitCancelTx()
|
|
3768
|
-
* cancelStream.next(txHash)
|
|
3769
|
-
* break
|
|
3770
|
-
* case 'SOURCE_FINALIZED':
|
|
3771
|
-
* console.log('Source finalized')
|
|
3772
|
-
* break
|
|
3773
|
-
* case 'HYPERBRIDGE_DELIVERED':
|
|
3774
|
-
* console.log('Delivered to Hyperbridge')
|
|
3775
|
-
* break
|
|
3776
|
-
* case 'HYPERBRIDGE_FINALIZED':
|
|
3777
|
-
* console.log('Cancellation complete')
|
|
3778
|
-
* break
|
|
3779
|
-
* }
|
|
3780
|
-
* }
|
|
3781
|
-
* ```
|
|
3782
|
-
*/
|
|
3783
|
-
cancelOrder(order: OrderV2, indexerClient: IndexerClient): AsyncGenerator<CancelEvent>;
|
|
3784
|
-
/**
|
|
3785
|
-
* Prepares a bid UserOperation for submitting to Hyperbridge (used by fillers/solvers).
|
|
3786
|
-
*
|
|
3787
|
-
* The callData is encoded using ERC-7821 batch executor format since SolverAccount
|
|
3788
|
-
* extends ERC7821. Format: `execute(bytes32 mode, bytes executionData)`
|
|
3789
|
-
* where executionData contains the fillOrder call to IntentGatewayV2.
|
|
3790
|
-
*
|
|
3791
|
-
* @param options - Bid submission options including order, fillOptions, and gas parameters
|
|
3792
|
-
* @returns PackedUserOperation ready for submission to Hyperbridge
|
|
3793
|
-
*/
|
|
3984
|
+
quoteCancelNative(order: OrderV2, from?: "source" | "dest"): Promise<bigint>;
|
|
3985
|
+
cancelOrder(order: OrderV2, indexerClient: IndexerClient, from?: "source" | "dest"): AsyncGenerator<CancelEvent>;
|
|
3794
3986
|
prepareSubmitBid(options: SubmitBidOptions): Promise<PackedUserOperation>;
|
|
3795
|
-
/**
|
|
3796
|
-
* Selects the best bid from Hyperbridge and submits to the bundler.
|
|
3797
|
-
*
|
|
3798
|
-
* Flow:
|
|
3799
|
-
* 1. Fetches bids from Hyperbridge
|
|
3800
|
-
* 2. Validates and sorts bids by USD value (WETH price fetched via swap, USDC/USDT at $1)
|
|
3801
|
-
* 3. Tries each bid (best to worst) until one passes simulation
|
|
3802
|
-
* 4. Signs and submits the winning bid to the bundler
|
|
3803
|
-
*
|
|
3804
|
-
* Requires `bundlerUrl` and `intentsCoprocessor` to be set in the constructor.
|
|
3805
|
-
*
|
|
3806
|
-
* @param order - The order to select a bid for
|
|
3807
|
-
* @param bids - Array of filler bids to evaluate
|
|
3808
|
-
* @param sessionPrivateKey - Optional session private key (retrieved from storage if not provided)
|
|
3809
|
-
* @returns Result containing the selected bid, userOp, and transaction details
|
|
3810
|
-
*/
|
|
3811
3987
|
selectBid(order: OrderV2, bids: FillerBid[], sessionPrivateKey?: HexString): Promise<SelectBidResult>;
|
|
3812
|
-
/**
|
|
3813
|
-
* Estimates gas costs for fillOrder execution via ERC-4337.
|
|
3814
|
-
*
|
|
3815
|
-
* Calculates all gas parameters needed for UserOperation submission:
|
|
3816
|
-
* - `callGasLimit`: Gas for fillOrder execution
|
|
3817
|
-
* - `verificationGasLimit`: Gas for SolverAccount.validateUserOp
|
|
3818
|
-
* - `preVerificationGas`: Bundler overhead for calldata
|
|
3819
|
-
* - Gas prices based on current network conditions
|
|
3820
|
-
*
|
|
3821
|
-
* Uses the bundler's eth_estimateUserOperationGas method for accurate gas estimation
|
|
3822
|
-
* when a bundler URL is configured.
|
|
3823
|
-
*
|
|
3824
|
-
* @param params - Estimation parameters including order and solver account
|
|
3825
|
-
* @returns Complete gas estimate with all ERC-4337 parameters
|
|
3826
|
-
*/
|
|
3827
3988
|
estimateFillOrderV2(params: EstimateFillOrderV2Params): Promise<FillOrderEstimateV2>;
|
|
3828
|
-
/**
|
|
3829
|
-
* Computes the EIP-712 domain separator for a contract.
|
|
3830
|
-
*
|
|
3831
|
-
* @param contractName - Contract name (e.g., "IntentGateway", "ERC4337")
|
|
3832
|
-
* @param version - Contract version
|
|
3833
|
-
* @param chainId - Chain ID
|
|
3834
|
-
* @param contractAddress - Contract address
|
|
3835
|
-
* @returns The domain separator hash
|
|
3836
|
-
*/
|
|
3837
|
-
getDomainSeparator(contractName: string, version: string, chainId: bigint, contractAddress: HexString): HexString;
|
|
3838
|
-
/**
|
|
3839
|
-
* Signs a solver selection message using the session key (EIP-712).
|
|
3840
|
-
*
|
|
3841
|
-
* @param commitment - Order commitment hash
|
|
3842
|
-
* @param solverAddress - Address of the selected solver
|
|
3843
|
-
* @param domainSeparator - EIP-712 domain separator
|
|
3844
|
-
* @param privateKey - Session private key
|
|
3845
|
-
* @returns The signature or null if signing fails
|
|
3846
|
-
*/
|
|
3847
|
-
signSolverSelection(commitment: HexString, solverAddress: HexString, domainSeparator: HexString, privateKey: HexString): Promise<HexString | null>;
|
|
3848
|
-
/**
|
|
3849
|
-
* Computes the EIP-4337 UserOperation hash.
|
|
3850
|
-
*
|
|
3851
|
-
* @param userOp - The packed user operation
|
|
3852
|
-
* @param entryPoint - EntryPoint contract address
|
|
3853
|
-
* @param chainId - Chain ID
|
|
3854
|
-
* @returns The UserOperation hash
|
|
3855
|
-
*/
|
|
3856
|
-
computeUserOpHash(userOp: PackedUserOperation, entryPoint: Hex, chainId: bigint): Hex;
|
|
3857
|
-
/**
|
|
3858
|
-
* Gets the packed user struct hash for a UserOperation.
|
|
3859
|
-
*
|
|
3860
|
-
* @param userOp - The UserOperation to hash
|
|
3861
|
-
* @returns The struct hash
|
|
3862
|
-
*/
|
|
3863
|
-
getPackedUserStructHash(userOp: PackedUserOperation): HexString;
|
|
3864
|
-
/** Packs verificationGasLimit and callGasLimit into bytes32 */
|
|
3865
|
-
packGasLimits(verificationGasLimit: bigint, callGasLimit: bigint): HexString;
|
|
3866
|
-
/** Packs maxPriorityFeePerGas and maxFeePerGas into bytes32 */
|
|
3867
|
-
packGasFees(maxPriorityFeePerGas: bigint, maxFeePerGas: bigint): HexString;
|
|
3868
|
-
/** Unpacks accountGasLimits (bytes32) into verificationGasLimit and callGasLimit */
|
|
3869
|
-
unpackGasLimits(accountGasLimits: HexString): {
|
|
3870
|
-
verificationGasLimit: bigint;
|
|
3871
|
-
callGasLimit: bigint;
|
|
3872
|
-
};
|
|
3873
|
-
/** Unpacks gasFees (bytes32) into maxPriorityFeePerGas and maxFeePerGas */
|
|
3874
|
-
unpackGasFees(gasFees: HexString): {
|
|
3875
|
-
maxPriorityFeePerGas: bigint;
|
|
3876
|
-
maxFeePerGas: bigint;
|
|
3877
|
-
};
|
|
3878
|
-
/**
|
|
3879
|
-
* Converts a PackedUserOperation to bundler-compatible v0.7/v0.8 format.
|
|
3880
|
-
* Unpacks gas limits and fees, extracts factory/paymaster data from packed fields.
|
|
3881
|
-
*
|
|
3882
|
-
* @param userOp - The packed user operation to convert
|
|
3883
|
-
* @returns Bundler-compatible user operation object
|
|
3884
|
-
*/
|
|
3885
|
-
prepareBundlerCall(userOp: PackedUserOperation): Record<string, unknown>;
|
|
3886
|
-
/**
|
|
3887
|
-
* Sends a JSON-RPC request to the bundler endpoint.
|
|
3888
|
-
*
|
|
3889
|
-
* @param method - The bundler method to call
|
|
3890
|
-
* @param params - Parameters array for the RPC call
|
|
3891
|
-
* @returns The result from the bundler
|
|
3892
|
-
* @throws Error if bundler URL not configured or bundler returns an error
|
|
3893
|
-
*/
|
|
3894
|
-
sendBundler<T = unknown>(method: BundlerMethod, params?: unknown[]): Promise<T>;
|
|
3895
|
-
/**
|
|
3896
|
-
* Encodes calls into ERC-7821 execute function calldata.
|
|
3897
|
-
*
|
|
3898
|
-
* Format: `execute(bytes32 mode, bytes executionData)`
|
|
3899
|
-
* Where executionData = abi.encode(calls) and calls = (address target, uint256 value, bytes data)[]
|
|
3900
|
-
*
|
|
3901
|
-
* @param calls - Array of calls to encode
|
|
3902
|
-
* @returns Encoded calldata for execute function
|
|
3903
|
-
*/
|
|
3904
3989
|
encodeERC7821Execute(calls: ERC7821Call[]): HexString;
|
|
3905
|
-
/**
|
|
3906
|
-
* Decodes ERC-7821 execute function calldata back into individual calls.
|
|
3907
|
-
*
|
|
3908
|
-
* @param callData - The execute function calldata to decode
|
|
3909
|
-
* @returns Array of decoded calls, or null if decoding fails
|
|
3910
|
-
*/
|
|
3911
3990
|
decodeERC7821Execute(callData: HexString): ERC7821Call[] | null;
|
|
3912
|
-
|
|
3913
|
-
|
|
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);
|
|
3914
3998
|
/**
|
|
3915
|
-
*
|
|
3999
|
+
* Checks if a V2 order has been filled by reading the commitment storage slot on the destination chain.
|
|
3916
4000
|
*
|
|
3917
|
-
*
|
|
3918
|
-
*
|
|
3919
|
-
|
|
3920
|
-
private validateAndSortBids;
|
|
3921
|
-
/**
|
|
3922
|
-
* 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).
|
|
3923
4004
|
*
|
|
3924
|
-
*
|
|
3925
|
-
*
|
|
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.
|
|
3926
4007
|
*/
|
|
3927
|
-
|
|
4008
|
+
isOrderFilled(order: OrderV2): Promise<boolean>;
|
|
3928
4009
|
/**
|
|
3929
|
-
*
|
|
3930
|
-
*
|
|
3931
|
-
* Builds state overrides for:
|
|
3932
|
-
* - EntryPoint deposit (for ERC-4337 UserOps)
|
|
3933
|
-
* - Native balance
|
|
3934
|
-
* - Token balances and allowances
|
|
3935
|
-
* - IntentGatewayV2 params (solverSelection disabled)
|
|
4010
|
+
* Checks if a V2 order has been refunded by reading the `_orders` mapping on the source chain.
|
|
3936
4011
|
*
|
|
3937
|
-
*
|
|
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).
|
|
3938
4015
|
*
|
|
3939
|
-
* @param
|
|
3940
|
-
* @returns
|
|
3941
|
-
*/
|
|
3942
|
-
buildStateOverride(params: {
|
|
3943
|
-
accountAddress: HexString;
|
|
3944
|
-
chain: string;
|
|
3945
|
-
outputAssets: {
|
|
3946
|
-
token: HexString;
|
|
3947
|
-
amount: bigint;
|
|
3948
|
-
}[];
|
|
3949
|
-
spenderAddress: HexString;
|
|
3950
|
-
intentGatewayV2Address?: HexString;
|
|
3951
|
-
entryPointAddress?: HexString;
|
|
3952
|
-
}): {
|
|
3953
|
-
viem: {
|
|
3954
|
-
address: HexString;
|
|
3955
|
-
balance?: bigint;
|
|
3956
|
-
stateDiff?: {
|
|
3957
|
-
slot: HexString;
|
|
3958
|
-
value: HexString;
|
|
3959
|
-
}[];
|
|
3960
|
-
}[];
|
|
3961
|
-
bundler: Record<string, {
|
|
3962
|
-
balance?: string;
|
|
3963
|
-
stateDiff?: Record<string, string>;
|
|
3964
|
-
}>;
|
|
3965
|
-
};
|
|
3966
|
-
/**
|
|
3967
|
-
* Converts gas costs to the equivalent amount in the fee token (DAI).
|
|
3968
|
-
* 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.
|
|
3969
4018
|
*/
|
|
3970
|
-
|
|
3971
|
-
/** Gets a quote for the native token cost of dispatching a post request */
|
|
3972
|
-
private quoteNative;
|
|
3973
|
-
/** Fetches proof for the destination chain that the order hasn't been filled */
|
|
3974
|
-
private fetchDestinationProof;
|
|
3975
|
-
/** Submits a GET request message to Hyperbridge and confirms receipt */
|
|
3976
|
-
private submitAndConfirmReceipt;
|
|
4019
|
+
isOrderRefunded(order: OrderV2): Promise<boolean>;
|
|
3977
4020
|
}
|
|
4021
|
+
|
|
3978
4022
|
/**
|
|
3979
|
-
*
|
|
3980
|
-
*
|
|
3981
|
-
*
|
|
3982
|
-
|
|
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.
|
|
3983
4030
|
*
|
|
3984
|
-
* @
|
|
3985
|
-
|
|
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.
|
|
3986
4036
|
*/
|
|
3987
4037
|
declare function transformOrderForContract(order: OrderV2): Omit<OrderV2, "id" | "transactionHash">;
|
|
3988
|
-
|
|
4038
|
+
|
|
4039
|
+
/** EIP-712 type hash for SelectSolver message */
|
|
3989
4040
|
declare const SELECT_SOLVER_TYPEHASH: `0x${string}`;
|
|
3990
|
-
/**
|
|
4041
|
+
/** EIP-712 type hash for PackedUserOperation */
|
|
3991
4042
|
declare const PACKED_USEROP_TYPEHASH: `0x${string}`;
|
|
3992
|
-
/**
|
|
4043
|
+
/** EIP-712 type hash for EIP712Domain */
|
|
3993
4044
|
declare const DOMAIN_TYPEHASH: `0x${string}`;
|
|
3994
4045
|
|
|
3995
4046
|
/**
|
|
@@ -4318,8 +4369,59 @@ declare enum Chains {
|
|
|
4318
4369
|
BASE_MAINNET = "EVM-8453",
|
|
4319
4370
|
POLYGON_MAINNET = "EVM-137",
|
|
4320
4371
|
UNICHAIN_MAINNET = "EVM-130",
|
|
4321
|
-
POLYGON_AMOY = "EVM-80002"
|
|
4372
|
+
POLYGON_AMOY = "EVM-80002",
|
|
4373
|
+
TRON_MAINNET = "EVM-728126428",
|
|
4374
|
+
TRON_NILE = "EVM-3448148188"
|
|
4322
4375
|
}
|
|
4376
|
+
/** Tron Nile Testnet (chain ID 3448148188) — not in viem/chains */
|
|
4377
|
+
declare const tronNile: {
|
|
4378
|
+
blockExplorers: {
|
|
4379
|
+
readonly default: {
|
|
4380
|
+
readonly name: "Nile Tronscan";
|
|
4381
|
+
readonly url: "https://nile.tronscan.org";
|
|
4382
|
+
};
|
|
4383
|
+
};
|
|
4384
|
+
blockTime?: number | undefined | undefined;
|
|
4385
|
+
contracts?: {
|
|
4386
|
+
[x: string]: viem.ChainContract | {
|
|
4387
|
+
[sourceId: number]: viem.ChainContract | undefined;
|
|
4388
|
+
} | undefined;
|
|
4389
|
+
ensRegistry?: viem.ChainContract | undefined;
|
|
4390
|
+
ensUniversalResolver?: viem.ChainContract | undefined;
|
|
4391
|
+
multicall3?: viem.ChainContract | undefined;
|
|
4392
|
+
erc6492Verifier?: viem.ChainContract | undefined;
|
|
4393
|
+
} | undefined;
|
|
4394
|
+
ensTlds?: readonly string[] | undefined;
|
|
4395
|
+
id: 3448148188;
|
|
4396
|
+
name: "TRON Nile Testnet";
|
|
4397
|
+
nativeCurrency: {
|
|
4398
|
+
readonly name: "TRX";
|
|
4399
|
+
readonly symbol: "TRX";
|
|
4400
|
+
readonly decimals: 6;
|
|
4401
|
+
};
|
|
4402
|
+
experimental_preconfirmationTime?: number | undefined | undefined;
|
|
4403
|
+
rpcUrls: {
|
|
4404
|
+
readonly default: {
|
|
4405
|
+
readonly http: readonly ["https://nile.trongrid.io/jsonrpc"];
|
|
4406
|
+
};
|
|
4407
|
+
};
|
|
4408
|
+
sourceId?: number | undefined | undefined;
|
|
4409
|
+
testnet?: boolean | undefined | undefined;
|
|
4410
|
+
custom?: Record<string, unknown> | undefined;
|
|
4411
|
+
extendSchema?: Record<string, unknown> | undefined;
|
|
4412
|
+
fees?: viem.ChainFees<undefined> | undefined;
|
|
4413
|
+
formatters?: undefined;
|
|
4414
|
+
prepareTransactionRequest?: ((args: viem.PrepareTransactionRequestParameters, options: {
|
|
4415
|
+
phase: "beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters";
|
|
4416
|
+
}) => Promise<viem.PrepareTransactionRequestParameters>) | [fn: ((args: viem.PrepareTransactionRequestParameters, options: {
|
|
4417
|
+
phase: "beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters";
|
|
4418
|
+
}) => Promise<viem.PrepareTransactionRequestParameters>) | undefined, options: {
|
|
4419
|
+
runAt: readonly ("beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters")[];
|
|
4420
|
+
}] | undefined;
|
|
4421
|
+
serializers?: viem.ChainSerializers<undefined, viem.TransactionSerializable> | undefined;
|
|
4422
|
+
verifyHash?: ((client: viem.Client, parameters: viem.VerifyHashActionParameters) => Promise<viem.VerifyHashActionReturnType>) | undefined;
|
|
4423
|
+
};
|
|
4424
|
+
declare const tronChainIds: Set<number>;
|
|
4323
4425
|
interface ChainConfigData {
|
|
4324
4426
|
chainId: number;
|
|
4325
4427
|
stateMachineId: Chains;
|
|
@@ -4330,10 +4432,12 @@ interface ChainConfigData {
|
|
|
4330
4432
|
DAI: string;
|
|
4331
4433
|
USDC: string;
|
|
4332
4434
|
USDT: string;
|
|
4435
|
+
cNGN?: string;
|
|
4333
4436
|
};
|
|
4334
4437
|
tokenDecimals?: {
|
|
4335
4438
|
USDC: number;
|
|
4336
4439
|
USDT: number;
|
|
4440
|
+
cNGN?: number;
|
|
4337
4441
|
};
|
|
4338
4442
|
tokenStorageSlots?: {
|
|
4339
4443
|
USDT?: {
|
|
@@ -4368,12 +4472,18 @@ interface ChainConfigData {
|
|
|
4368
4472
|
Permit2?: `0x${string}`;
|
|
4369
4473
|
/** ERC-4337 v0.8 EntryPoint address (canonical across all EVM chains) */
|
|
4370
4474
|
EntryPointV08?: `0x${string}`;
|
|
4475
|
+
/** USDT0 OFT contract address (OFT Adapter on Ethereum, OFT on other chains) */
|
|
4476
|
+
Usdt0Oft?: `0x${string}`;
|
|
4477
|
+
/** SolverAccount contract address used for EIP-7702 delegation */
|
|
4478
|
+
SolverAccount?: `0x${string}`;
|
|
4371
4479
|
};
|
|
4372
4480
|
rpcEnvKey?: string;
|
|
4373
4481
|
defaultRpcUrl?: string;
|
|
4374
4482
|
consensusStateId: string;
|
|
4375
4483
|
coingeckoId: string;
|
|
4376
4484
|
popularTokens?: string[];
|
|
4485
|
+
/** LayerZero Endpoint ID for cross-chain messaging */
|
|
4486
|
+
layerZeroEid?: number;
|
|
4377
4487
|
}
|
|
4378
4488
|
declare const chainConfigs: Record<number, ChainConfigData>;
|
|
4379
4489
|
declare const getConfigByStateMachineId: (id: Chains) => ChainConfigData | undefined;
|
|
@@ -4381,4 +4491,4 @@ declare const getChainId: (stateMachineId: string) => number | undefined;
|
|
|
4381
4491
|
declare const getViemChain: (chainId: number) => Chain | undefined;
|
|
4382
4492
|
declare const hyperbridgeAddress = "";
|
|
4383
4493
|
|
|
4384
|
-
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,
|
|
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 };
|