@hyperbridge/sdk 1.5.1 → 1.6.2

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,8 +1,11 @@
1
1
  import { ConsolaInstance } from 'consola';
2
2
  import { GraphQLClient } from 'graphql-request';
3
- import { PublicClient, Hex, ContractFunctionArgs, Log } from 'viem';
3
+ import * as viem from 'viem';
4
+ import { PublicClient, Hex, Log, ContractFunctionArgs } from 'viem';
4
5
  import { ApiPromise } from '@polkadot/api';
5
- import { SignerOptions } from '@polkadot/api/types';
6
+ import { KeyringPair } from '@polkadot/keyring/types';
7
+ import { SignerOptions, SubmittableExtrinsic } from '@polkadot/api/types';
8
+ import { ISubmittableResult } from '@polkadot/types/types';
6
9
  import { Chain } from 'viem/chains';
7
10
 
8
11
  declare const _default: {
@@ -588,10 +591,11 @@ declare const _default: {
588
591
  declare class ChainConfigService {
589
592
  private rpcUrls;
590
593
  constructor(env?: NodeJS.ProcessEnv);
594
+ private getConfig;
591
595
  getChainConfig(chain: string): ChainConfig;
592
- getIntentGatewayAddress(chain: string): `0x${string}`;
593
- getTokenGatewayAddress(chain: string): `0x${string}`;
594
- getHostAddress(chain: string): `0x${string}`;
596
+ getIntentGatewayAddress(chain: string): HexString;
597
+ getTokenGatewayAddress(chain: string): HexString;
598
+ getHostAddress(chain: string): HexString;
595
599
  getWrappedNativeAssetWithDecimals(chain: string): {
596
600
  asset: HexString;
597
601
  decimals: number;
@@ -599,6 +603,8 @@ declare class ChainConfigService {
599
603
  getDaiAsset(chain: string): HexString;
600
604
  getUsdtAsset(chain: string): HexString;
601
605
  getUsdcAsset(chain: string): HexString;
606
+ getUsdcDecimals(chain: string): number;
607
+ getUsdtDecimals(chain: string): number;
602
608
  getChainId(chain: string): number;
603
609
  getConsensusStateId(chain: string): HexString;
604
610
  getHyperbridgeChainId(): number;
@@ -613,6 +619,25 @@ declare class ChainConfigService {
613
619
  getCoingeckoId(chain: string): string | undefined;
614
620
  getEtherscanApiKey(): string | undefined;
615
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;
616
641
  }
617
642
 
618
643
  /**
@@ -866,6 +891,7 @@ type IStateMachine = {
866
891
  };
867
892
 
868
893
  declare const ADDRESS_ZERO: HexString;
894
+ declare const MOCK_ADDRESS: HexString;
869
895
  declare const DUMMY_PRIVATE_KEY: HexString;
870
896
  declare const DEFAULT_GRAFFITI: HexString;
871
897
  /**
@@ -875,6 +901,25 @@ declare const DEFAULT_GRAFFITI: HexString;
875
901
  * @returns The larger of the two values
876
902
  */
877
903
  declare function maxBigInt(a: bigint, b: bigint): bigint;
904
+ /**
905
+ * Converts a state machine ID string to a stateId object.
906
+ * Handles formats like:
907
+ * - "EVM-97" → { Evm: 97 }
908
+ * - "SUBSTRATE-cere" → { Substrate: "0x63657265" } (hex encoded UTF-8 bytes)
909
+ * - "POLKADOT-3367" → { Polkadot: 3367 }
910
+ * - "KUSAMA-123" → { Kusama: 123 }
911
+ *
912
+ * @param stateMachineId The state machine ID string
913
+ * @returns A stateId object conforming to the StateMachineIdParams interface
914
+ */
915
+ declare function parseStateMachineId(stateMachineId: string): {
916
+ stateId: {
917
+ Evm?: number;
918
+ Substrate?: HexString;
919
+ Polkadot?: number;
920
+ Kusama?: number;
921
+ };
922
+ };
878
923
  /**
879
924
  * Calculates the commitment hash for a post request.
880
925
  * @param post The post request to calculate the commitment hash for.
@@ -885,6 +930,8 @@ declare function postRequestCommitment(post: IPostRequest): {
885
930
  encodePacked: HexString;
886
931
  };
887
932
  declare function orderCommitment(order: Order): HexString;
933
+ /** Calculates the order commitment hash */
934
+ declare function orderV2Commitment(order: OrderV2): HexString;
888
935
  /**
889
936
  * Converts a bytes32 token address to bytes20 format
890
937
  * This removes the extra padded zeros from the address
@@ -927,7 +974,7 @@ declare function estimateGasForPost(params: {
927
974
  * This function encodes the order commitment, beneficiary address, and token inputs
928
975
  * to match the format expected by the IntentGateway contract.
929
976
  */
930
- declare function constructRedeemEscrowRequestBody(order: Order, beneficiary: HexString): HexString;
977
+ declare function constructRedeemEscrowRequestBody(order: Order | OrderV2, beneficiary: HexString): HexString;
931
978
  declare function fetchPrice(identifier: string, chainId?: number, apiKey?: string): Promise<number>;
932
979
  /**
933
980
  * Fetches the current network gas price from an Etherscan-family explorer API.
@@ -943,6 +990,10 @@ declare enum ERC20Method {
943
990
  /** ERC20 allowance(address,address) method signature */
944
991
  ALLOWANCE = "0xdd62ed3e"
945
992
  }
993
+ declare enum EvmLanguage {
994
+ Solidity = 0,
995
+ Vyper = 1
996
+ }
946
997
  /**
947
998
  * Retrieves the storage slot for a contract call using debug_traceCall
948
999
  *
@@ -990,7 +1041,7 @@ declare function getStorageSlot(client: PublicClient, contractAddress: HexString
990
1041
  * @param toDecimals - The target decimal precision
991
1042
  * @returns The adjusted fee amount with the target decimal precision
992
1043
  */
993
- declare function adjustFeeDecimals(feeInFeeToken: bigint, fromDecimals: number, toDecimals: number): bigint;
1044
+ declare function adjustDecimals(feeInFeeToken: bigint, fromDecimals: number, toDecimals: number): bigint;
994
1045
  /**
995
1046
  * Chains that should prefer the Etherscan API for gas price lookup
996
1047
  */
@@ -999,6 +1050,28 @@ declare const USE_ETHERSCAN_CHAINS: Set<string>;
999
1050
  * Testnet chains
1000
1051
  */
1001
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
1063
+ */
1064
+ declare function getContractCallInput(client: PublicClient, txHash: HexString, targetContractAddress: string): Promise<HexString | null>;
1065
+ /**
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.
1073
+ */
1074
+ declare function calculateBalanceMappingLocation(slot: bigint, holder: string, language: EvmLanguage): HexString;
1002
1075
 
1003
1076
  declare class SubstrateChain implements IChain {
1004
1077
  private readonly params;
@@ -1006,6 +1079,9 @@ declare class SubstrateChain implements IChain {
1006
1079
  private rpcClient;
1007
1080
  constructor(params: ISubstrateConfig);
1008
1081
  get config(): ISubstrateConfig;
1082
+ /**
1083
+ * Connects to the Substrate chain using the provided WebSocket URL.
1084
+ */
1009
1085
  connect(): Promise<void>;
1010
1086
  /**
1011
1087
  * Disconnects the Substrate chain connection.
@@ -1194,6 +1270,113 @@ declare function convertCodecToIProof(codec: {
1194
1270
  }): IProof;
1195
1271
  declare function encodeISMPMessage(message: IIsmpMessage): Uint8Array;
1196
1272
 
1273
+ /**
1274
+ * Encodes a PackedUserOperation using SCALE codec for submission to Hyperbridge.
1275
+ * This is the recommended way to encode UserOps for the intents coprocessor.
1276
+ *
1277
+ * @param userOp - The PackedUserOperation to encode
1278
+ * @returns Hex-encoded SCALE bytes
1279
+ */
1280
+ declare function encodeUserOpScale(userOp: PackedUserOperation): HexString;
1281
+ /**
1282
+ * Decodes a SCALE-encoded PackedUserOperation.
1283
+ *
1284
+ * @param hex - The hex-encoded SCALE bytes
1285
+ * @returns The decoded PackedUserOperation
1286
+ */
1287
+ declare function decodeUserOpScale(hex: HexString): PackedUserOperation;
1288
+ /**
1289
+ * Service for interacting with Hyperbridge's pallet-intents coprocessor.
1290
+ * Handles bid submission and retrieval for the IntentGatewayV2 protocol.
1291
+ *
1292
+ * Can be created from an existing SubstrateChain instance to share the connection.
1293
+ */
1294
+ declare class IntentsCoprocessor {
1295
+ private api;
1296
+ private substratePrivateKey?;
1297
+ private ownsConnection;
1298
+ /**
1299
+ * Creates and connects an IntentsCoprocessor to a Hyperbridge node.
1300
+ * This creates and manages its own API connection.
1301
+ *
1302
+ * @param wsUrl - WebSocket URL of the Hyperbridge node
1303
+ * @param substratePrivateKey - Private key for signing extrinsics (optional for read-only operations)
1304
+ * @returns Promise resolving to a connected IntentsCoprocessor
1305
+ */
1306
+ static connect(wsUrl: string, substratePrivateKey?: string): Promise<IntentsCoprocessor>;
1307
+ /**
1308
+ * Creates an IntentsCoprocessor from an existing SubstrateChain instance.
1309
+ * This shares the connection - the SubstrateChain must already be connected.
1310
+ *
1311
+ * @param chain - Connected SubstrateChain instance (typically Hyperbridge)
1312
+ * @param substratePrivateKey - Private key for signing extrinsics (optional for read-only operations)
1313
+ */
1314
+ static fromSubstrateChain(chain: SubstrateChain, substratePrivateKey?: string): IntentsCoprocessor;
1315
+ /**
1316
+ * Creates an IntentsCoprocessor from an existing ApiPromise instance.
1317
+ *
1318
+ * @param api - Connected ApiPromise instance
1319
+ * @param substratePrivateKey - Private key for signing extrinsics (optional for read-only operations)
1320
+ */
1321
+ static fromApi(api: ApiPromise, substratePrivateKey?: string): IntentsCoprocessor;
1322
+ private constructor();
1323
+ /**
1324
+ * Disconnects the underlying API connection if this instance owns it.
1325
+ * Only disconnects if created via `connect()`, not when using shared connections.
1326
+ */
1327
+ disconnect(): Promise<void>;
1328
+ /**
1329
+ * Creates a Substrate keypair from the configured private key
1330
+ * Supports both hex seed (without 0x prefix) and mnemonic phrases
1331
+ */
1332
+ getKeyPair(): KeyringPair;
1333
+ /**
1334
+ * Signs and sends an extrinsic, handling status updates and errors
1335
+ * Implements retry logic with progressive tip increases for stuck transactions
1336
+ */
1337
+ private signAndSendExtrinsic;
1338
+ /**
1339
+ * Sends an extrinsic with a timeout
1340
+ */
1341
+ private sendWithTimeout;
1342
+ /**
1343
+ * Submits a bid to Hyperbridge's pallet-intents
1344
+ *
1345
+ * @param commitment - The order commitment hash (bytes32)
1346
+ * @param userOp - The encoded PackedUserOperation as hex string
1347
+ * @returns BidSubmissionResult with success status and block/extrinsic hash
1348
+ */
1349
+ submitBid(commitment: HexString, userOp: HexString): Promise<BidSubmissionResult>;
1350
+ /**
1351
+ * Retracts a bid from Hyperbridge and reclaims the deposit
1352
+ *
1353
+ * Use this to remove unused quotes and claim back deposited BRIDGE tokens.
1354
+ *
1355
+ * @param commitment - The order commitment hash (bytes32)
1356
+ * @returns BidSubmissionResult with success status and block/extrinsic hash
1357
+ */
1358
+ retractBid(commitment: HexString): Promise<BidSubmissionResult>;
1359
+ /**
1360
+ * Fetches all bid storage entries for a given order commitment.
1361
+ * Returns the on-chain data only (filler addresses and deposits).
1362
+ *
1363
+ * @param commitment - The order commitment hash (bytes32)
1364
+ * @returns Array of BidStorageEntry objects
1365
+ */
1366
+ getBidStorageEntries(commitment: HexString): Promise<BidStorageEntry[]>;
1367
+ /**
1368
+ * Fetches all bids for a given order commitment from Hyperbridge.
1369
+ *
1370
+ * @param commitment - The order commitment hash (bytes32)
1371
+ * @returns Array of FillerBid objects containing filler address, userOp, and deposit
1372
+ */
1373
+ getBidsForOrder(commitment: HexString): Promise<FillerBid[]>;
1374
+ /** Decodes SCALE-encoded Bid struct and SCALE-encoded PackedUserOperation */
1375
+ private decodeBid;
1376
+ /** Builds offchain storage key: "intents::bid::" + commitment + filler */
1377
+ private buildOffchainBidKey;
1378
+ }
1379
+
1197
1380
  /**
1198
1381
  * Type representing an ISMP message.
1199
1382
  */
@@ -1754,7 +1937,7 @@ interface StateMachineIdParams {
1754
1937
  Polkadot?: number;
1755
1938
  Kusama?: number;
1756
1939
  };
1757
- consensusStateId: HexString;
1940
+ consensusStateId: string;
1758
1941
  }
1759
1942
  /**
1760
1943
  * Configuration for a blockchain chain
@@ -1867,6 +2050,32 @@ interface DecodedOrderPlacedLog extends Log {
1867
2050
  };
1868
2051
  transactionHash: HexString;
1869
2052
  }
2053
+ interface DecodedOrderV2PlacedLog extends Log {
2054
+ eventName: string;
2055
+ args: {
2056
+ user: HexString;
2057
+ source: Hex;
2058
+ destination: Hex;
2059
+ deadline: bigint;
2060
+ nonce: bigint;
2061
+ fees: bigint;
2062
+ session: HexString;
2063
+ beneficiary: HexString;
2064
+ predispatch: Array<{
2065
+ token: HexString;
2066
+ amount: bigint;
2067
+ }>;
2068
+ inputs: Array<{
2069
+ token: HexString;
2070
+ amount: bigint;
2071
+ }>;
2072
+ outputs: Array<{
2073
+ token: HexString;
2074
+ amount: bigint;
2075
+ }>;
2076
+ };
2077
+ transactionHash: HexString;
2078
+ }
1870
2079
  interface DecodedPostRequestEvent extends Log {
1871
2080
  eventName: string;
1872
2081
  args: {
@@ -2036,6 +2245,12 @@ interface FillerConfig {
2036
2245
  */
2037
2246
  maxRechecks?: number;
2038
2247
  };
2248
+ /**
2249
+ * Watch-only mode: per-chain configuration to monitor and log orders without executing fills
2250
+ * Maps chainId to boolean. If a chain is not in this map, defaults to false (normal execution)
2251
+ * Example: { 1: true, 56: false } - watch-only on Ethereum, normal execution on BSC
2252
+ */
2253
+ watchOnly?: Record<number, boolean>;
2039
2254
  }
2040
2255
  /**
2041
2256
  * Result of an order execution attempt
@@ -2160,7 +2375,7 @@ interface StateMachineHeight {
2160
2375
  Polkadot?: number;
2161
2376
  Kusama?: number;
2162
2377
  };
2163
- consensusStateId: HexString;
2378
+ consensusStateId: string;
2164
2379
  };
2165
2380
  height: bigint;
2166
2381
  }
@@ -2371,6 +2586,197 @@ interface StorageFacade {
2371
2586
  set<T>(key: string, value: T): Promise<void>;
2372
2587
  delete(key: string): Promise<void>;
2373
2588
  }
2589
+ interface TokenInfoV2 {
2590
+ token: HexString;
2591
+ amount: bigint;
2592
+ }
2593
+ interface PaymentInfoV2 {
2594
+ beneficiary: HexString;
2595
+ assets: TokenInfoV2[];
2596
+ call: HexString;
2597
+ }
2598
+ interface DispatchInfoV2 {
2599
+ assets: TokenInfoV2[];
2600
+ call: HexString;
2601
+ }
2602
+ interface OrderV2 {
2603
+ id?: string;
2604
+ user: HexString;
2605
+ source: string;
2606
+ destination: string;
2607
+ deadline: bigint;
2608
+ nonce: bigint;
2609
+ fees: bigint;
2610
+ session: HexString;
2611
+ predispatch: DispatchInfoV2;
2612
+ inputs: TokenInfoV2[];
2613
+ output: PaymentInfoV2;
2614
+ transactionHash?: HexString;
2615
+ }
2616
+ interface FillOptionsV2 {
2617
+ relayerFee: bigint;
2618
+ nativeDispatchFee: bigint;
2619
+ outputs: TokenInfoV2[];
2620
+ }
2621
+ interface PackedUserOperation {
2622
+ sender: HexString;
2623
+ nonce: bigint;
2624
+ initCode: HexString;
2625
+ callData: HexString;
2626
+ accountGasLimits: HexString;
2627
+ preVerificationGas: bigint;
2628
+ gasFees: HexString;
2629
+ paymasterAndData: HexString;
2630
+ signature: HexString;
2631
+ }
2632
+ interface SubmitBidOptions {
2633
+ order: OrderV2;
2634
+ fillOptions: FillOptionsV2;
2635
+ solverAccount: HexString;
2636
+ solverPrivateKey: HexString;
2637
+ nonce: bigint;
2638
+ entryPointAddress: HexString;
2639
+ callGasLimit: bigint;
2640
+ verificationGasLimit: bigint;
2641
+ preVerificationGas: bigint;
2642
+ maxFeePerGas: bigint;
2643
+ maxPriorityFeePerGas: bigint;
2644
+ }
2645
+ interface EstimateFillOrderV2Params {
2646
+ order: OrderV2;
2647
+ solverPrivateKey: HexString;
2648
+ /**
2649
+ * Optional percentage to bump maxPriorityFeePerGas.
2650
+ * This is added on top of the base gasPrice.
2651
+ * Default: 8 (8%)
2652
+ */
2653
+ maxPriorityFeePerGasBumpPercent?: number;
2654
+ /**
2655
+ * Optional percentage to bump maxFeePerGas.
2656
+ * This is added on top of the base gasPrice.
2657
+ * Default: 10 (10%)
2658
+ */
2659
+ maxFeePerGasBumpPercent?: number;
2660
+ }
2661
+ interface FillOrderEstimateV2 {
2662
+ fillOptions: FillOptionsV2;
2663
+ callGasLimit: bigint;
2664
+ verificationGasLimit: bigint;
2665
+ preVerificationGas: bigint;
2666
+ maxFeePerGas: bigint;
2667
+ maxPriorityFeePerGas: bigint;
2668
+ totalGasCostWei: bigint;
2669
+ totalGasInFeeToken: bigint;
2670
+ nonce: bigint;
2671
+ }
2672
+ /**
2673
+ * Result of submitting a bid to Hyperbridge
2674
+ */
2675
+ interface BidSubmissionResult {
2676
+ /**
2677
+ * Whether the bid submission was successful
2678
+ */
2679
+ success: boolean;
2680
+ /**
2681
+ * Block hash where the bid was included
2682
+ */
2683
+ blockHash?: HexString;
2684
+ /**
2685
+ * Extrinsic hash of the bid transaction
2686
+ */
2687
+ extrinsicHash?: HexString;
2688
+ /**
2689
+ * Error message if submission failed
2690
+ */
2691
+ error?: string;
2692
+ }
2693
+ /**
2694
+ * Represents a storage entry from pallet-intents Bids storage
2695
+ * StorageDoubleMap<_, Blake2_128Concat, H256, Blake2_128Concat, AccountId, Balance>
2696
+ */
2697
+ interface BidStorageEntry {
2698
+ /** The order commitment hash (H256) */
2699
+ commitment: HexString;
2700
+ /** The filler's Substrate account ID (SS58 encoded) */
2701
+ filler: string;
2702
+ /** The deposit amount stored on-chain (BalanceOf<T> = u128) */
2703
+ deposit: bigint;
2704
+ }
2705
+ /**
2706
+ * Represents a bid placed by a filler for an order
2707
+ * Matches the Rust struct: Bid<AccountId> { filler: AccountId, user_op: Vec<u8> }
2708
+ */
2709
+ interface FillerBid {
2710
+ /** The filler's Substrate account ID (SS58 encoded) */
2711
+ filler: string;
2712
+ /** The decoded PackedUserOperation */
2713
+ userOp: PackedUserOperation;
2714
+ /** The deposit amount stored on-chain (in plancks) */
2715
+ deposit: bigint;
2716
+ }
2717
+ /**
2718
+ * Options for selecting a solver in IntentGatewayV2
2719
+ */
2720
+ interface SelectOptions {
2721
+ /** The order commitment hash (bytes32) */
2722
+ commitment: HexString;
2723
+ /** The solver address to select */
2724
+ solver: HexString;
2725
+ /** The EIP-712 signature from the session key */
2726
+ signature: HexString;
2727
+ }
2728
+ /** Status stages for the intent order execution flow */
2729
+ declare const IntentOrderStatus: Readonly<{
2730
+ ORDER_SUBMITTED: "ORDER_SUBMITTED";
2731
+ ORDER_CONFIRMED: "ORDER_CONFIRMED";
2732
+ AWAITING_BIDS: "AWAITING_BIDS";
2733
+ BIDS_RECEIVED: "BIDS_RECEIVED";
2734
+ BID_SELECTED: "BID_SELECTED";
2735
+ USEROP_SUBMITTED: "USEROP_SUBMITTED";
2736
+ FAILED: "FAILED";
2737
+ }>;
2738
+ type IntentOrderStatus = typeof IntentOrderStatus;
2739
+ type IntentOrderStatusKey = keyof typeof IntentOrderStatus;
2740
+ /** Metadata for intent order status updates */
2741
+ interface IntentOrderStatusMetadata {
2742
+ commitment?: HexString;
2743
+ transactionHash?: HexString;
2744
+ blockHash?: HexString;
2745
+ blockNumber?: number;
2746
+ bidCount?: number;
2747
+ bids?: FillerBid[];
2748
+ selectedSolver?: HexString;
2749
+ userOpHash?: HexString;
2750
+ userOp?: PackedUserOperation;
2751
+ error?: string;
2752
+ }
2753
+ /** Status update yielded by the intent order stream */
2754
+ interface IntentOrderStatusUpdate {
2755
+ status: IntentOrderStatusKey;
2756
+ metadata: IntentOrderStatusMetadata;
2757
+ }
2758
+ /** Result of selecting a bid and submitting to the bundler */
2759
+ interface SelectBidResult {
2760
+ userOp: PackedUserOperation;
2761
+ userOpHash: HexString;
2762
+ solverAddress: HexString;
2763
+ commitment: HexString;
2764
+ txnHash?: HexString;
2765
+ }
2766
+ /** Options for executing an intent order */
2767
+ interface ExecuteIntentOrderOptions {
2768
+ order: OrderV2;
2769
+ sessionPrivateKey?: HexString;
2770
+ minBids?: number;
2771
+ bidTimeoutMs?: number;
2772
+ pollIntervalMs?: number;
2773
+ }
2774
+ /** Type for ERC-7821 Call struct */
2775
+ type ERC7821Call = {
2776
+ target: `0x${string}`;
2777
+ value: bigint;
2778
+ data: `0x${string}`;
2779
+ };
2374
2780
 
2375
2781
  /**
2376
2782
  * Helper function to create chain configuration from legacy config format
@@ -3151,7 +3557,7 @@ declare class IntentGateway {
3151
3557
  * }
3152
3558
  * ```
3153
3559
  */
3154
- cancelOrder(order: Order, indexerClient: IndexerClient): AsyncGenerator<CancelEvent>;
3560
+ cancelOrder(order: Order, indexerClient: IndexerClient): AsyncGenerator<CancelEvent$1>;
3155
3561
  /**
3156
3562
  * Fetches proof for the destination chain.
3157
3563
  * @param order - The order to fetch proof for
@@ -3159,6 +3565,48 @@ declare class IntentGateway {
3159
3565
  */
3160
3566
  private fetchDestinationProof;
3161
3567
  }
3568
+ interface CancelEventMap$1 {
3569
+ DESTINATION_FINALIZED: {
3570
+ proof: IProof;
3571
+ };
3572
+ AWAITING_GET_REQUEST: undefined;
3573
+ SOURCE_FINALIZED: {
3574
+ metadata: {
3575
+ blockNumber: number;
3576
+ };
3577
+ };
3578
+ HYPERBRIDGE_DELIVERED: RequestStatusWithMetadata;
3579
+ HYPERBRIDGE_FINALIZED: RequestStatusWithMetadata;
3580
+ SOURCE_PROOF_RECEIVED: IProof;
3581
+ }
3582
+ type CancelEvent$1 = {
3583
+ [K in keyof CancelEventMap$1]: {
3584
+ status: K;
3585
+ data: CancelEventMap$1[K];
3586
+ };
3587
+ }[keyof CancelEventMap$1];
3588
+
3589
+ /** ERC-7821 single batch execution mode */
3590
+ declare const ERC7821_BATCH_MODE: HexString;
3591
+ /** Response from bundler's eth_estimateUserOperationGas */
3592
+ interface BundlerGasEstimate {
3593
+ preVerificationGas: HexString;
3594
+ verificationGasLimit: HexString;
3595
+ callGasLimit: HexString;
3596
+ paymasterVerificationGasLimit?: HexString;
3597
+ paymasterPostOpGasLimit?: HexString;
3598
+ }
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
+ /** Event map for cancellation status updates */
3162
3610
  interface CancelEventMap {
3163
3611
  DESTINATION_FINALIZED: {
3164
3612
  proof: IProof;
@@ -3179,6 +3627,401 @@ type CancelEvent = {
3179
3627
  data: CancelEventMap[K];
3180
3628
  };
3181
3629
  }[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;
3638
+ }
3639
+ /**
3640
+ * IntentGatewayV2 utilities for placing orders, submitting bids, and managing the intent lifecycle.
3641
+ *
3642
+ * This class provides a complete SDK for interacting with the IntentGatewayV2 protocol:
3643
+ * - **Order Placement**: Generate session keys and prepare order transactions
3644
+ * - **Bid Management**: Validate, sort, and select optimal bids from solvers
3645
+ * - **Execution Flow**: Full lifecycle management from order to completion
3646
+ * - **Cancellation**: Handle order cancellation with cross-chain proofs
3647
+ *
3648
+ * Session keys are automatically managed with environment-appropriate storage
3649
+ * (Node.js filesystem, browser localStorage/IndexedDB, or in-memory fallback).
3650
+ *
3651
+ * @example
3652
+ * ```typescript
3653
+ * const gateway = new IntentGatewayV2(sourceChain, destChain, coprocessor, bundlerUrl)
3654
+ *
3655
+ * // Place an order
3656
+ * const gen = gateway.preparePlaceOrder(order)
3657
+ * const { value: { calldata } } = await gen.next()
3658
+ * const txHash = await wallet.sendTransaction({ to: gatewayAddr, data: calldata })
3659
+ * const { value: finalOrder } = await gen.next(txHash)
3660
+ *
3661
+ * // Execute and track
3662
+ * for await (const status of gateway.executeIntentOrder({ order: finalOrder })) {
3663
+ * console.log(status.status)
3664
+ * }
3665
+ * ```
3666
+ */
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.
3685
+ *
3686
+ * @param source - Source chain for order placement
3687
+ * @param dest - Destination chain for order fulfillment
3688
+ * @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<{
3732
+ calldata: HexString;
3733
+ 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
+ */
3765
+ 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
+ */
3825
+ 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
+ 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
+ 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
+ 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
+ decodeERC7821Execute(callData: HexString): ERC7821Call[] | null;
3943
+ /** Initializes the fee token cache for source and destination chains */
3944
+ private initFeeTokenCache;
3945
+ /**
3946
+ * Validates bids and sorts them by USD value (best to worst).
3947
+ *
3948
+ * A bid is valid if `fillOptions.outputs[i].amount >= order.output.assets[i].amount` for all i.
3949
+ * USD value is calculated using USDC/USDT at $1 and WETH price fetched via swap.
3950
+ */
3951
+ private validateAndSortBids;
3952
+ /**
3953
+ * Simulates select + fillOrder to verify execution will succeed.
3954
+ *
3955
+ * No state overrides are used - the solver should already have tokens and approvals.
3956
+ * The contract validates that outputs >= order.output.assets.
3957
+ */
3958
+ private simulateAndValidate;
3959
+ /**
3960
+ * Unified state override builder for gas estimation.
3961
+ *
3962
+ * Builds state overrides for:
3963
+ * - EntryPoint deposit (for ERC-4337 UserOps)
3964
+ * - Native balance
3965
+ * - Token balances and allowances
3966
+ * - IntentGatewayV2 params (solverSelection disabled)
3967
+ *
3968
+ * Returns both viem format (for estimateContractGas) and bundler format (for eth_estimateUserOperationGas).
3969
+ *
3970
+ * @param params - Configuration for state overrides
3971
+ * @returns Object with both viem and bundler format state overrides
3972
+ */
3973
+ buildStateOverride(params: {
3974
+ accountAddress: HexString;
3975
+ chain: string;
3976
+ outputAssets: {
3977
+ token: HexString;
3978
+ amount: bigint;
3979
+ }[];
3980
+ spenderAddress: HexString;
3981
+ intentGatewayV2Address?: HexString;
3982
+ entryPointAddress?: HexString;
3983
+ }): {
3984
+ viem: {
3985
+ address: HexString;
3986
+ balance?: bigint;
3987
+ stateDiff?: {
3988
+ slot: HexString;
3989
+ value: HexString;
3990
+ }[];
3991
+ }[];
3992
+ bundler: Record<string, {
3993
+ balance?: string;
3994
+ stateDiff?: Record<string, string>;
3995
+ }>;
3996
+ };
3997
+ /**
3998
+ * Converts gas costs to the equivalent amount in the fee token (DAI).
3999
+ * Uses USD pricing to convert between native token gas costs and fee token amounts.
4000
+ */
4001
+ private convertGasToFeeToken;
4002
+ /** Gets a quote for the native token cost of dispatching a post request */
4003
+ private quoteNative;
4004
+ /** Fetches proof for the destination chain that the order hasn't been filled */
4005
+ private fetchDestinationProof;
4006
+ /** Submits a GET request message to Hyperbridge and confirms receipt */
4007
+ private submitAndConfirmReceipt;
4008
+ }
4009
+ /**
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.
4014
+ *
4015
+ * @param order - The SDK order to transform
4016
+ * @returns Contract-compatible order struct
4017
+ */
4018
+ declare function transformOrderForContract(order: OrderV2): Omit<OrderV2, "id" | "transactionHash">;
4019
+ /** @deprecated Use `IntentGatewayV2.SELECT_SOLVER_TYPEHASH` instead */
4020
+ declare const SELECT_SOLVER_TYPEHASH: `0x${string}`;
4021
+ /** @deprecated Use `IntentGatewayV2.PACKED_USEROP_TYPEHASH` instead */
4022
+ declare const PACKED_USEROP_TYPEHASH: `0x${string}`;
4023
+ /** @deprecated Use `IntentGatewayV2.DOMAIN_TYPEHASH` instead */
4024
+ declare const DOMAIN_TYPEHASH: `0x${string}`;
3182
4025
 
3183
4026
  /**
3184
4027
  * Result of the quoteNative fee estimation
@@ -3478,11 +4321,12 @@ type Params = {
3478
4321
  * @param params.recipient - Recipient address
3479
4322
  * @param params.amount - Amount to teleport
3480
4323
  * @param params.timeout - Operation timeout
4324
+ * @param params.extrinsics - An array of SubmittableExtrinsic to prepend to the teleport transaction
3481
4325
  * @param params.tokenGatewayAddress - Gateway contract address
4326
+ * @param options - Signer options
3482
4327
  * @param params.relayerFee - Fee for the relayer
3483
4328
  * @param params.redeem - Whether to redeem on arrival
3484
4329
  * @param params.callData - Optional additional call data
3485
- * @param options - Signer options
3486
4330
  * @yields {HyperbridgeTxEvents} Stream of events indicating transaction status
3487
4331
  * @throws Error when asset ID is unknown or transaction fails
3488
4332
  */
@@ -3491,6 +4335,7 @@ declare function teleport(teleport_param: {
3491
4335
  params: Params;
3492
4336
  apiPromise: ApiPromise;
3493
4337
  options: Partial<SignerOptions>;
4338
+ extrinsics?: Array<SubmittableExtrinsic<"promise", ISubmittableResult>>;
3494
4339
  }): Promise<ReadableStream<HyperbridgeTxEvents>>;
3495
4340
 
3496
4341
  declare enum Chains {
@@ -3503,131 +4348,122 @@ declare enum Chains {
3503
4348
  ARBITRUM_MAINNET = "EVM-42161",
3504
4349
  BASE_MAINNET = "EVM-8453",
3505
4350
  POLYGON_MAINNET = "EVM-137",
3506
- UNICHAIN_MAINNET = "EVM-130"
4351
+ UNICHAIN_MAINNET = "EVM-130",
4352
+ POLYGON_AMOY = "EVM-80002",
4353
+ TRON_MAINNET = "EVM-728126428",
4354
+ TRON_NILE = "EVM-3448148188"
3507
4355
  }
3508
- type AddressMap = {
3509
- [key: string]: {
3510
- [K in Chains]?: `0x${string}`;
3511
- };
3512
- };
3513
- type RpcMap = Record<Chains, string>;
3514
- declare const chainIds: {
3515
- readonly "EVM-97": 97;
3516
- readonly "EVM-10200": 10200;
3517
- readonly "KUSAMA-4009": 4009;
3518
- readonly "EVM-11155111": 11155111;
3519
- readonly "EVM-1": 1;
3520
- readonly "EVM-56": 56;
3521
- readonly "EVM-42161": 42161;
3522
- readonly "EVM-8453": 8453;
3523
- readonly "EVM-137": 137;
3524
- readonly "EVM-130": 130;
3525
- };
3526
- type ChainId = typeof chainIds;
3527
- declare const viemChains: Record<string, Chain>;
3528
- declare const WrappedNativeDecimals: {
3529
- "EVM-97": number;
3530
- "EVM-10200": number;
3531
- "EVM-11155111": number;
3532
- "EVM-1": number;
3533
- "EVM-56": number;
3534
- "EVM-42161": number;
3535
- "EVM-8453": number;
3536
- "EVM-137": number;
3537
- "EVM-130": number;
3538
- };
3539
- declare const assets: {
3540
- "EVM-97": {
3541
- WETH: string;
3542
- DAI: string;
3543
- USDC: string;
3544
- USDT: string;
3545
- };
3546
- "EVM-10200": {
3547
- WETH: string;
3548
- USDC: string;
3549
- DAI: string;
3550
- USDT: string;
3551
- };
3552
- "EVM-11155111": {
3553
- WETH: string;
3554
- USDC: string;
3555
- USDT: string;
3556
- DAI: string;
4356
+ /** Tron Nile Testnet (chain ID 3448148188) — not in viem/chains */
4357
+ declare const tronNile: {
4358
+ blockExplorers: {
4359
+ readonly default: {
4360
+ readonly name: "Nile Tronscan";
4361
+ readonly url: "https://nile.tronscan.org";
4362
+ };
3557
4363
  };
3558
- "EVM-1": {
3559
- WETH: string;
3560
- DAI: string;
3561
- USDC: string;
3562
- USDT: string;
4364
+ blockTime?: number | undefined | undefined;
4365
+ contracts?: {
4366
+ [x: string]: viem.ChainContract | {
4367
+ [sourceId: number]: viem.ChainContract | undefined;
4368
+ } | undefined;
4369
+ ensRegistry?: viem.ChainContract | undefined;
4370
+ ensUniversalResolver?: viem.ChainContract | undefined;
4371
+ multicall3?: viem.ChainContract | undefined;
4372
+ erc6492Verifier?: viem.ChainContract | undefined;
4373
+ } | undefined;
4374
+ ensTlds?: readonly string[] | undefined;
4375
+ id: 3448148188;
4376
+ name: "TRON Nile Testnet";
4377
+ nativeCurrency: {
4378
+ readonly name: "TRX";
4379
+ readonly symbol: "TRX";
4380
+ readonly decimals: 6;
3563
4381
  };
3564
- "EVM-56": {
3565
- WETH: string;
3566
- DAI: string;
3567
- USDC: string;
3568
- USDT: string;
4382
+ experimental_preconfirmationTime?: number | undefined | undefined;
4383
+ rpcUrls: {
4384
+ readonly default: {
4385
+ readonly http: readonly ["https://nile.trongrid.io/jsonrpc"];
4386
+ };
3569
4387
  };
3570
- "EVM-42161": {
4388
+ sourceId?: number | undefined | undefined;
4389
+ testnet?: boolean | undefined | undefined;
4390
+ custom?: Record<string, unknown> | undefined;
4391
+ extendSchema?: Record<string, unknown> | undefined;
4392
+ fees?: viem.ChainFees<undefined> | undefined;
4393
+ formatters?: undefined;
4394
+ prepareTransactionRequest?: ((args: viem.PrepareTransactionRequestParameters, options: {
4395
+ phase: "beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters";
4396
+ }) => Promise<viem.PrepareTransactionRequestParameters>) | [fn: ((args: viem.PrepareTransactionRequestParameters, options: {
4397
+ phase: "beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters";
4398
+ }) => Promise<viem.PrepareTransactionRequestParameters>) | undefined, options: {
4399
+ runAt: readonly ("beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters")[];
4400
+ }] | undefined;
4401
+ serializers?: viem.ChainSerializers<undefined, viem.TransactionSerializable> | undefined;
4402
+ verifyHash?: ((client: viem.Client, parameters: viem.VerifyHashActionParameters) => Promise<viem.VerifyHashActionReturnType>) | undefined;
4403
+ };
4404
+ interface ChainConfigData {
4405
+ chainId: number;
4406
+ stateMachineId: Chains;
4407
+ viemChain?: Chain;
4408
+ wrappedNativeDecimals?: number;
4409
+ assets?: {
3571
4410
  WETH: string;
3572
4411
  DAI: string;
3573
4412
  USDC: string;
3574
4413
  USDT: string;
3575
4414
  };
3576
- "EVM-8453": {
3577
- WETH: string;
3578
- DAI: string;
3579
- USDC: string;
3580
- USDT: string;
4415
+ tokenDecimals?: {
4416
+ USDC: number;
4417
+ USDT: number;
3581
4418
  };
3582
- "EVM-137": {
3583
- WETH: string;
3584
- DAI: string;
3585
- USDC: string;
3586
- USDT: string;
4419
+ tokenStorageSlots?: {
4420
+ USDT?: {
4421
+ balanceSlot: number;
4422
+ allowanceSlot: number;
4423
+ };
4424
+ USDC?: {
4425
+ balanceSlot: number;
4426
+ allowanceSlot: number;
4427
+ };
4428
+ WETH?: {
4429
+ balanceSlot: number;
4430
+ allowanceSlot: number;
4431
+ };
4432
+ DAI?: {
4433
+ balanceSlot: number;
4434
+ allowanceSlot: number;
4435
+ };
3587
4436
  };
3588
- "EVM-130": {
3589
- WETH: string;
3590
- DAI: string;
3591
- USDC: string;
3592
- USDT: string;
4437
+ addresses: {
4438
+ IntentGateway?: `0x${string}`;
4439
+ IntentGatewayV2?: `0x${string}`;
4440
+ TokenGateway?: `0x${string}`;
4441
+ Host?: `0x${string}`;
4442
+ UniswapRouter02?: `0x${string}`;
4443
+ UniswapV2Factory?: `0x${string}`;
4444
+ UniswapV3Factory?: `0x${string}`;
4445
+ UniversalRouter?: `0x${string}`;
4446
+ UniswapV3Quoter?: `0x${string}`;
4447
+ UniswapV4Quoter?: `0x${string}`;
4448
+ Calldispatcher?: `0x${string}`;
4449
+ Permit2?: `0x${string}`;
4450
+ /** ERC-4337 v0.8 EntryPoint address (canonical across all EVM chains) */
4451
+ EntryPointV08?: `0x${string}`;
4452
+ /** USDT0 OFT contract address (OFT Adapter on Ethereum, OFT on other chains) */
4453
+ Usdt0Oft?: `0x${string}`;
3593
4454
  };
3594
- };
3595
- declare const addresses: AddressMap;
3596
- declare const createRpcUrls: (env: NodeJS.ProcessEnv) => RpcMap;
3597
- declare const consensusStateIds: {
3598
- "EVM-97": string;
3599
- "EVM-10200": string;
3600
- "KUSAMA-4009": string;
3601
- "EVM-11155111": string;
3602
- "EVM-1": string;
3603
- "EVM-56": string;
3604
- "EVM-42161": string;
3605
- "EVM-8453": string;
3606
- "EVM-137": string;
3607
- "EVM-130": string;
3608
- };
3609
- declare const coingeckoIds: {
3610
- "EVM-97": string;
3611
- "EVM-10200": string;
3612
- "KUSAMA-4009": string;
3613
- "EVM-11155111": string;
3614
- "EVM-1": string;
3615
- "EVM-56": string;
3616
- "EVM-42161": string;
3617
- "EVM-8453": string;
3618
- "EVM-137": string;
3619
- "EVM-130": string;
3620
- };
3621
- declare const popularTokens: {
3622
- "EVM-97": string[];
3623
- "EVM-10200": string[];
3624
- "EVM-11155111": string[];
3625
- "EVM-1": string[];
3626
- "EVM-56": string[];
3627
- "EVM-42161": string[];
3628
- "EVM-8453": string[];
3629
- "EVM-137": string[];
3630
- "EVM-130": string[];
3631
- };
4455
+ rpcEnvKey?: string;
4456
+ defaultRpcUrl?: string;
4457
+ consensusStateId: string;
4458
+ coingeckoId: string;
4459
+ popularTokens?: string[];
4460
+ /** LayerZero Endpoint ID for cross-chain messaging */
4461
+ layerZeroEid?: number;
4462
+ }
4463
+ declare const chainConfigs: Record<number, ChainConfigData>;
4464
+ declare const getConfigByStateMachineId: (id: Chains) => ChainConfigData | undefined;
4465
+ declare const getChainId: (stateMachineId: string) => number | undefined;
4466
+ declare const getViemChain: (chainId: number) => Chain | undefined;
4467
+ declare const hyperbridgeAddress = "";
3632
4468
 
3633
- export { ADDRESS_ZERO, type AllStatusKey, type AssetTeleported, type AssetTeleportedResponse, type BlockMetadata, type CancelOptions, type ChainConfig, ChainConfigService, type ChainId, Chains, type ClientConfig, DEFAULT_ADDRESS, DEFAULT_GRAFFITI, DUMMY_PRIVATE_KEY, type DecodedOrderPlacedLog, type DecodedPostRequestEvent, type DecodedPostResponseEvent, type DispatchGet, type DispatchPost, ERC20Method, type EstimateGasCallData, EvmChain, type EvmChainParams, type ExecutionResult, type FillOptions, 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, type IsmpRequest, type NewDeployment, type Order, type OrderResponse, OrderStatus, type OrderStatusMetadata, type OrderWithStatus, type Params, type PaymentInfo, 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, STATE_COMMITMENTS_SLOT, type StateMachineHeight, type StateMachineIdParams, type StateMachineResponse, type StateMachineUpdate, type StorageFacade, SubstrateChain, TESTNET_CHAINS, type TeleportParams, TeleportStatus, TimeoutStatus, type TimeoutStatusKey, TokenGateway, type TokenGatewayAssetTeleportedResponse, type TokenGatewayAssetTeleportedWithStatus, type TokenInfo, type TokenPrice, type TokenPricesResponse, type TokenRegistry, type TokenRegistryResponse, type Transaction, USE_ETHERSCAN_CHAINS, WrappedNativeDecimals, type XcmGatewayParams, __test, addresses, adjustFeeDecimals, assets, bytes20ToBytes32, bytes32ToBytes20, chainIds, coingeckoIds, consensusStateIds, constructRedeemEscrowRequestBody, convertCodecToIGetRequest, convertCodecToIProof, convertIGetRequestToCodec, convertIProofToCodec, convertStateIdToStateMachineId, convertStateMachineEnumToString, convertStateMachineIdToEnum, createChain, createEvmChain, createIndexerClient, createQueryClient, createRpcUrls, encodeISMPMessage, estimateGasForPost, fetchPrice, generateRootWithProof, getChain, getGasPriceFromEtherscan, getOrderPlacedFromTx, getPostRequestEventFromTx, getPostResponseEventFromTx, getRequestCommitment, getStateCommitmentFieldSlot, getStateCommitmentSlot, getStorageSlot, hexToString, maxBigInt, orderCommitment, popularTokens, postRequestCommitment, queryAssetTeleported, queryGetRequest, queryPostRequest, requestCommitmentKey, retryPromise, teleport, teleportDot, viemChains };
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 };