@hyperbridge/sdk 1.5.1 → 1.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,10 @@
1
1
  import { ConsolaInstance } from 'consola';
2
2
  import { GraphQLClient } from 'graphql-request';
3
- import { PublicClient, Hex, ContractFunctionArgs, Log } from 'viem';
3
+ import { PublicClient, Hex, Log, ContractFunctionArgs } from 'viem';
4
4
  import { ApiPromise } from '@polkadot/api';
5
- import { SignerOptions } from '@polkadot/api/types';
5
+ import { KeyringPair } from '@polkadot/keyring/types';
6
+ import { SignerOptions, SubmittableExtrinsic } from '@polkadot/api/types';
7
+ import { ISubmittableResult } from '@polkadot/types/types';
6
8
  import { Chain } from 'viem/chains';
7
9
 
8
10
  declare const _default: {
@@ -588,10 +590,11 @@ declare const _default: {
588
590
  declare class ChainConfigService {
589
591
  private rpcUrls;
590
592
  constructor(env?: NodeJS.ProcessEnv);
593
+ private getConfig;
591
594
  getChainConfig(chain: string): ChainConfig;
592
- getIntentGatewayAddress(chain: string): `0x${string}`;
593
- getTokenGatewayAddress(chain: string): `0x${string}`;
594
- getHostAddress(chain: string): `0x${string}`;
595
+ getIntentGatewayAddress(chain: string): HexString;
596
+ getTokenGatewayAddress(chain: string): HexString;
597
+ getHostAddress(chain: string): HexString;
595
598
  getWrappedNativeAssetWithDecimals(chain: string): {
596
599
  asset: HexString;
597
600
  decimals: number;
@@ -599,6 +602,8 @@ declare class ChainConfigService {
599
602
  getDaiAsset(chain: string): HexString;
600
603
  getUsdtAsset(chain: string): HexString;
601
604
  getUsdcAsset(chain: string): HexString;
605
+ getUsdcDecimals(chain: string): number;
606
+ getUsdtDecimals(chain: string): number;
602
607
  getChainId(chain: string): number;
603
608
  getConsensusStateId(chain: string): HexString;
604
609
  getHyperbridgeChainId(): number;
@@ -613,6 +618,14 @@ declare class ChainConfigService {
613
618
  getCoingeckoId(chain: string): string | undefined;
614
619
  getEtherscanApiKey(): string | undefined;
615
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;
616
629
  }
617
630
 
618
631
  /**
@@ -866,6 +879,7 @@ type IStateMachine = {
866
879
  };
867
880
 
868
881
  declare const ADDRESS_ZERO: HexString;
882
+ declare const MOCK_ADDRESS: HexString;
869
883
  declare const DUMMY_PRIVATE_KEY: HexString;
870
884
  declare const DEFAULT_GRAFFITI: HexString;
871
885
  /**
@@ -885,6 +899,8 @@ declare function postRequestCommitment(post: IPostRequest): {
885
899
  encodePacked: HexString;
886
900
  };
887
901
  declare function orderCommitment(order: Order): HexString;
902
+ /** Calculates the order commitment hash */
903
+ declare function orderV2Commitment(order: OrderV2): HexString;
888
904
  /**
889
905
  * Converts a bytes32 token address to bytes20 format
890
906
  * This removes the extra padded zeros from the address
@@ -927,7 +943,7 @@ declare function estimateGasForPost(params: {
927
943
  * This function encodes the order commitment, beneficiary address, and token inputs
928
944
  * to match the format expected by the IntentGateway contract.
929
945
  */
930
- declare function constructRedeemEscrowRequestBody(order: Order, beneficiary: HexString): HexString;
946
+ declare function constructRedeemEscrowRequestBody(order: Order | OrderV2, beneficiary: HexString): HexString;
931
947
  declare function fetchPrice(identifier: string, chainId?: number, apiKey?: string): Promise<number>;
932
948
  /**
933
949
  * Fetches the current network gas price from an Etherscan-family explorer API.
@@ -943,6 +959,10 @@ declare enum ERC20Method {
943
959
  /** ERC20 allowance(address,address) method signature */
944
960
  ALLOWANCE = "0xdd62ed3e"
945
961
  }
962
+ declare enum EvmLanguage {
963
+ Solidity = 0,
964
+ Vyper = 1
965
+ }
946
966
  /**
947
967
  * Retrieves the storage slot for a contract call using debug_traceCall
948
968
  *
@@ -990,7 +1010,7 @@ declare function getStorageSlot(client: PublicClient, contractAddress: HexString
990
1010
  * @param toDecimals - The target decimal precision
991
1011
  * @returns The adjusted fee amount with the target decimal precision
992
1012
  */
993
- declare function adjustFeeDecimals(feeInFeeToken: bigint, fromDecimals: number, toDecimals: number): bigint;
1013
+ declare function adjustDecimals(feeInFeeToken: bigint, fromDecimals: number, toDecimals: number): bigint;
994
1014
  /**
995
1015
  * Chains that should prefer the Etherscan API for gas price lookup
996
1016
  */
@@ -999,6 +1019,28 @@ declare const USE_ETHERSCAN_CHAINS: Set<string>;
999
1019
  * Testnet chains
1000
1020
  */
1001
1021
  declare const TESTNET_CHAINS: Set<string>;
1022
+ /**
1023
+ * Retrieves the calldata used to call a target contract within a transaction using debug_traceTransaction
1024
+ * with the callTracer. Unlike the indexer helper, this returns the calldata whether the target is called
1025
+ * directly by the transaction or via nested calls.
1026
+ *
1027
+ * @param client - viem PublicClient connected to an RPC node with debug API enabled
1028
+ * @param txHash - The transaction hash
1029
+ * @param targetContractAddress - The target contract address to find the call for
1030
+ * @returns The input (calldata) as a hex string, or null if the target is not found in the trace
1031
+ * @throws Error if the RPC call fails or returns an unexpected response
1032
+ */
1033
+ declare function getContractCallInput(client: PublicClient, txHash: HexString, targetContractAddress: string): Promise<HexString | null>;
1034
+ /**
1035
+ * Calculates the balance mapping location for a given slot and holder address.
1036
+ * This function handles the different encoding formats used by Solidity and Vyper.
1037
+ *
1038
+ * @param slot - The slot number to calculate the mapping location for.
1039
+ * @param holder - The address of the holder to calculate the mapping location for.
1040
+ * @param language - The language of the contract.
1041
+ * @returns The balance mapping location as a HexString.
1042
+ */
1043
+ declare function calculateBalanceMappingLocation(slot: bigint, holder: string, language: EvmLanguage): HexString;
1002
1044
 
1003
1045
  declare class SubstrateChain implements IChain {
1004
1046
  private readonly params;
@@ -1006,6 +1048,9 @@ declare class SubstrateChain implements IChain {
1006
1048
  private rpcClient;
1007
1049
  constructor(params: ISubstrateConfig);
1008
1050
  get config(): ISubstrateConfig;
1051
+ /**
1052
+ * Connects to the Substrate chain using the provided WebSocket URL.
1053
+ */
1009
1054
  connect(): Promise<void>;
1010
1055
  /**
1011
1056
  * Disconnects the Substrate chain connection.
@@ -1194,6 +1239,113 @@ declare function convertCodecToIProof(codec: {
1194
1239
  }): IProof;
1195
1240
  declare function encodeISMPMessage(message: IIsmpMessage): Uint8Array;
1196
1241
 
1242
+ /**
1243
+ * Encodes a PackedUserOperation using SCALE codec for submission to Hyperbridge.
1244
+ * This is the recommended way to encode UserOps for the intents coprocessor.
1245
+ *
1246
+ * @param userOp - The PackedUserOperation to encode
1247
+ * @returns Hex-encoded SCALE bytes
1248
+ */
1249
+ declare function encodeUserOpScale(userOp: PackedUserOperation): HexString;
1250
+ /**
1251
+ * Decodes a SCALE-encoded PackedUserOperation.
1252
+ *
1253
+ * @param hex - The hex-encoded SCALE bytes
1254
+ * @returns The decoded PackedUserOperation
1255
+ */
1256
+ declare function decodeUserOpScale(hex: HexString): PackedUserOperation;
1257
+ /**
1258
+ * Service for interacting with Hyperbridge's pallet-intents coprocessor.
1259
+ * Handles bid submission and retrieval for the IntentGatewayV2 protocol.
1260
+ *
1261
+ * Can be created from an existing SubstrateChain instance to share the connection.
1262
+ */
1263
+ declare class IntentsCoprocessor {
1264
+ private api;
1265
+ private substratePrivateKey?;
1266
+ private ownsConnection;
1267
+ /**
1268
+ * Creates and connects an IntentsCoprocessor to a Hyperbridge node.
1269
+ * This creates and manages its own API connection.
1270
+ *
1271
+ * @param wsUrl - WebSocket URL of the Hyperbridge node
1272
+ * @param substratePrivateKey - Private key for signing extrinsics (optional for read-only operations)
1273
+ * @returns Promise resolving to a connected IntentsCoprocessor
1274
+ */
1275
+ static connect(wsUrl: string, substratePrivateKey?: string): Promise<IntentsCoprocessor>;
1276
+ /**
1277
+ * Creates an IntentsCoprocessor from an existing SubstrateChain instance.
1278
+ * This shares the connection - the SubstrateChain must already be connected.
1279
+ *
1280
+ * @param chain - Connected SubstrateChain instance (typically Hyperbridge)
1281
+ * @param substratePrivateKey - Private key for signing extrinsics (optional for read-only operations)
1282
+ */
1283
+ static fromSubstrateChain(chain: SubstrateChain, substratePrivateKey?: string): IntentsCoprocessor;
1284
+ /**
1285
+ * Creates an IntentsCoprocessor from an existing ApiPromise instance.
1286
+ *
1287
+ * @param api - Connected ApiPromise instance
1288
+ * @param substratePrivateKey - Private key for signing extrinsics (optional for read-only operations)
1289
+ */
1290
+ static fromApi(api: ApiPromise, substratePrivateKey?: string): IntentsCoprocessor;
1291
+ private constructor();
1292
+ /**
1293
+ * Disconnects the underlying API connection if this instance owns it.
1294
+ * Only disconnects if created via `connect()`, not when using shared connections.
1295
+ */
1296
+ disconnect(): Promise<void>;
1297
+ /**
1298
+ * Creates a Substrate keypair from the configured private key
1299
+ * Supports both hex seed (without 0x prefix) and mnemonic phrases
1300
+ */
1301
+ getKeyPair(): KeyringPair;
1302
+ /**
1303
+ * Signs and sends an extrinsic, handling status updates and errors
1304
+ * Implements retry logic with progressive tip increases for stuck transactions
1305
+ */
1306
+ private signAndSendExtrinsic;
1307
+ /**
1308
+ * Sends an extrinsic with a timeout
1309
+ */
1310
+ private sendWithTimeout;
1311
+ /**
1312
+ * Submits a bid to Hyperbridge's pallet-intents
1313
+ *
1314
+ * @param commitment - The order commitment hash (bytes32)
1315
+ * @param userOp - The encoded PackedUserOperation as hex string
1316
+ * @returns BidSubmissionResult with success status and block/extrinsic hash
1317
+ */
1318
+ submitBid(commitment: HexString, userOp: HexString): Promise<BidSubmissionResult>;
1319
+ /**
1320
+ * Retracts a bid from Hyperbridge and reclaims the deposit
1321
+ *
1322
+ * Use this to remove unused quotes and claim back deposited BRIDGE tokens.
1323
+ *
1324
+ * @param commitment - The order commitment hash (bytes32)
1325
+ * @returns BidSubmissionResult with success status and block/extrinsic hash
1326
+ */
1327
+ retractBid(commitment: HexString): Promise<BidSubmissionResult>;
1328
+ /**
1329
+ * Fetches all bid storage entries for a given order commitment.
1330
+ * Returns the on-chain data only (filler addresses and deposits).
1331
+ *
1332
+ * @param commitment - The order commitment hash (bytes32)
1333
+ * @returns Array of BidStorageEntry objects
1334
+ */
1335
+ getBidStorageEntries(commitment: HexString): Promise<BidStorageEntry[]>;
1336
+ /**
1337
+ * Fetches all bids for a given order commitment from Hyperbridge.
1338
+ *
1339
+ * @param commitment - The order commitment hash (bytes32)
1340
+ * @returns Array of FillerBid objects containing filler address, userOp, and deposit
1341
+ */
1342
+ getBidsForOrder(commitment: HexString): Promise<FillerBid[]>;
1343
+ /** Decodes SCALE-encoded Bid struct and SCALE-encoded PackedUserOperation */
1344
+ private decodeBid;
1345
+ /** Builds offchain storage key: "intents::bid::" + commitment + filler */
1346
+ private buildOffchainBidKey;
1347
+ }
1348
+
1197
1349
  /**
1198
1350
  * Type representing an ISMP message.
1199
1351
  */
@@ -1754,7 +1906,7 @@ interface StateMachineIdParams {
1754
1906
  Polkadot?: number;
1755
1907
  Kusama?: number;
1756
1908
  };
1757
- consensusStateId: HexString;
1909
+ consensusStateId: string;
1758
1910
  }
1759
1911
  /**
1760
1912
  * Configuration for a blockchain chain
@@ -1867,6 +2019,32 @@ interface DecodedOrderPlacedLog extends Log {
1867
2019
  };
1868
2020
  transactionHash: HexString;
1869
2021
  }
2022
+ interface DecodedOrderV2PlacedLog extends Log {
2023
+ eventName: string;
2024
+ args: {
2025
+ user: HexString;
2026
+ source: Hex;
2027
+ destination: Hex;
2028
+ deadline: bigint;
2029
+ nonce: bigint;
2030
+ fees: bigint;
2031
+ session: HexString;
2032
+ beneficiary: HexString;
2033
+ predispatch: Array<{
2034
+ token: HexString;
2035
+ amount: bigint;
2036
+ }>;
2037
+ inputs: Array<{
2038
+ token: HexString;
2039
+ amount: bigint;
2040
+ }>;
2041
+ outputs: Array<{
2042
+ token: HexString;
2043
+ amount: bigint;
2044
+ }>;
2045
+ };
2046
+ transactionHash: HexString;
2047
+ }
1870
2048
  interface DecodedPostRequestEvent extends Log {
1871
2049
  eventName: string;
1872
2050
  args: {
@@ -2036,6 +2214,12 @@ interface FillerConfig {
2036
2214
  */
2037
2215
  maxRechecks?: number;
2038
2216
  };
2217
+ /**
2218
+ * Watch-only mode: per-chain configuration to monitor and log orders without executing fills
2219
+ * Maps chainId to boolean. If a chain is not in this map, defaults to false (normal execution)
2220
+ * Example: { 1: true, 56: false } - watch-only on Ethereum, normal execution on BSC
2221
+ */
2222
+ watchOnly?: Record<number, boolean>;
2039
2223
  }
2040
2224
  /**
2041
2225
  * Result of an order execution attempt
@@ -2160,7 +2344,7 @@ interface StateMachineHeight {
2160
2344
  Polkadot?: number;
2161
2345
  Kusama?: number;
2162
2346
  };
2163
- consensusStateId: HexString;
2347
+ consensusStateId: string;
2164
2348
  };
2165
2349
  height: bigint;
2166
2350
  }
@@ -2371,6 +2555,197 @@ interface StorageFacade {
2371
2555
  set<T>(key: string, value: T): Promise<void>;
2372
2556
  delete(key: string): Promise<void>;
2373
2557
  }
2558
+ interface TokenInfoV2 {
2559
+ token: HexString;
2560
+ amount: bigint;
2561
+ }
2562
+ interface PaymentInfoV2 {
2563
+ beneficiary: HexString;
2564
+ assets: TokenInfoV2[];
2565
+ call: HexString;
2566
+ }
2567
+ interface DispatchInfoV2 {
2568
+ assets: TokenInfoV2[];
2569
+ call: HexString;
2570
+ }
2571
+ interface OrderV2 {
2572
+ id?: string;
2573
+ user: HexString;
2574
+ source: string;
2575
+ destination: string;
2576
+ deadline: bigint;
2577
+ nonce: bigint;
2578
+ fees: bigint;
2579
+ session: HexString;
2580
+ predispatch: DispatchInfoV2;
2581
+ inputs: TokenInfoV2[];
2582
+ output: PaymentInfoV2;
2583
+ transactionHash?: HexString;
2584
+ }
2585
+ interface FillOptionsV2 {
2586
+ relayerFee: bigint;
2587
+ nativeDispatchFee: bigint;
2588
+ outputs: TokenInfoV2[];
2589
+ }
2590
+ interface PackedUserOperation {
2591
+ sender: HexString;
2592
+ nonce: bigint;
2593
+ initCode: HexString;
2594
+ callData: HexString;
2595
+ accountGasLimits: HexString;
2596
+ preVerificationGas: bigint;
2597
+ gasFees: HexString;
2598
+ paymasterAndData: HexString;
2599
+ signature: HexString;
2600
+ }
2601
+ interface SubmitBidOptions {
2602
+ order: OrderV2;
2603
+ fillOptions: FillOptionsV2;
2604
+ solverAccount: HexString;
2605
+ solverPrivateKey: HexString;
2606
+ nonce: bigint;
2607
+ entryPointAddress: HexString;
2608
+ callGasLimit: bigint;
2609
+ verificationGasLimit: bigint;
2610
+ preVerificationGas: bigint;
2611
+ maxFeePerGas: bigint;
2612
+ maxPriorityFeePerGas: bigint;
2613
+ }
2614
+ interface EstimateFillOrderV2Params {
2615
+ order: OrderV2;
2616
+ solverPrivateKey: HexString;
2617
+ /**
2618
+ * Optional percentage to bump maxPriorityFeePerGas.
2619
+ * This is added on top of the base gasPrice.
2620
+ * Default: 8 (8%)
2621
+ */
2622
+ maxPriorityFeePerGasBumpPercent?: number;
2623
+ /**
2624
+ * Optional percentage to bump maxFeePerGas.
2625
+ * This is added on top of the base gasPrice.
2626
+ * Default: 10 (10%)
2627
+ */
2628
+ maxFeePerGasBumpPercent?: number;
2629
+ }
2630
+ interface FillOrderEstimateV2 {
2631
+ fillOptions: FillOptionsV2;
2632
+ callGasLimit: bigint;
2633
+ verificationGasLimit: bigint;
2634
+ preVerificationGas: bigint;
2635
+ maxFeePerGas: bigint;
2636
+ maxPriorityFeePerGas: bigint;
2637
+ totalGasCostWei: bigint;
2638
+ totalGasInFeeToken: bigint;
2639
+ nonce: bigint;
2640
+ }
2641
+ /**
2642
+ * Result of submitting a bid to Hyperbridge
2643
+ */
2644
+ interface BidSubmissionResult {
2645
+ /**
2646
+ * Whether the bid submission was successful
2647
+ */
2648
+ success: boolean;
2649
+ /**
2650
+ * Block hash where the bid was included
2651
+ */
2652
+ blockHash?: HexString;
2653
+ /**
2654
+ * Extrinsic hash of the bid transaction
2655
+ */
2656
+ extrinsicHash?: HexString;
2657
+ /**
2658
+ * Error message if submission failed
2659
+ */
2660
+ error?: string;
2661
+ }
2662
+ /**
2663
+ * Represents a storage entry from pallet-intents Bids storage
2664
+ * StorageDoubleMap<_, Blake2_128Concat, H256, Blake2_128Concat, AccountId, Balance>
2665
+ */
2666
+ interface BidStorageEntry {
2667
+ /** The order commitment hash (H256) */
2668
+ commitment: HexString;
2669
+ /** The filler's Substrate account ID (SS58 encoded) */
2670
+ filler: string;
2671
+ /** The deposit amount stored on-chain (BalanceOf<T> = u128) */
2672
+ deposit: bigint;
2673
+ }
2674
+ /**
2675
+ * Represents a bid placed by a filler for an order
2676
+ * Matches the Rust struct: Bid<AccountId> { filler: AccountId, user_op: Vec<u8> }
2677
+ */
2678
+ interface FillerBid {
2679
+ /** The filler's Substrate account ID (SS58 encoded) */
2680
+ filler: string;
2681
+ /** The decoded PackedUserOperation */
2682
+ userOp: PackedUserOperation;
2683
+ /** The deposit amount stored on-chain (in plancks) */
2684
+ deposit: bigint;
2685
+ }
2686
+ /**
2687
+ * Options for selecting a solver in IntentGatewayV2
2688
+ */
2689
+ interface SelectOptions {
2690
+ /** The order commitment hash (bytes32) */
2691
+ commitment: HexString;
2692
+ /** The solver address to select */
2693
+ solver: HexString;
2694
+ /** The EIP-712 signature from the session key */
2695
+ signature: HexString;
2696
+ }
2697
+ /** Status stages for the intent order execution flow */
2698
+ declare const IntentOrderStatus: Readonly<{
2699
+ ORDER_SUBMITTED: "ORDER_SUBMITTED";
2700
+ ORDER_CONFIRMED: "ORDER_CONFIRMED";
2701
+ AWAITING_BIDS: "AWAITING_BIDS";
2702
+ BIDS_RECEIVED: "BIDS_RECEIVED";
2703
+ BID_SELECTED: "BID_SELECTED";
2704
+ USEROP_SUBMITTED: "USEROP_SUBMITTED";
2705
+ FAILED: "FAILED";
2706
+ }>;
2707
+ type IntentOrderStatus = typeof IntentOrderStatus;
2708
+ type IntentOrderStatusKey = keyof typeof IntentOrderStatus;
2709
+ /** Metadata for intent order status updates */
2710
+ interface IntentOrderStatusMetadata {
2711
+ commitment?: HexString;
2712
+ transactionHash?: HexString;
2713
+ blockHash?: HexString;
2714
+ blockNumber?: number;
2715
+ bidCount?: number;
2716
+ bids?: FillerBid[];
2717
+ selectedSolver?: HexString;
2718
+ userOpHash?: HexString;
2719
+ userOp?: PackedUserOperation;
2720
+ error?: string;
2721
+ }
2722
+ /** Status update yielded by the intent order stream */
2723
+ interface IntentOrderStatusUpdate {
2724
+ status: IntentOrderStatusKey;
2725
+ metadata: IntentOrderStatusMetadata;
2726
+ }
2727
+ /** Result of selecting a bid and submitting to the bundler */
2728
+ interface SelectBidResult {
2729
+ userOp: PackedUserOperation;
2730
+ userOpHash: HexString;
2731
+ solverAddress: HexString;
2732
+ commitment: HexString;
2733
+ txnHash?: HexString;
2734
+ }
2735
+ /** Options for executing an intent order */
2736
+ interface ExecuteIntentOrderOptions {
2737
+ order: OrderV2;
2738
+ sessionPrivateKey?: HexString;
2739
+ minBids?: number;
2740
+ bidTimeoutMs?: number;
2741
+ pollIntervalMs?: number;
2742
+ }
2743
+ /** Type for ERC-7821 Call struct */
2744
+ type ERC7821Call = {
2745
+ target: `0x${string}`;
2746
+ value: bigint;
2747
+ data: `0x${string}`;
2748
+ };
2374
2749
 
2375
2750
  /**
2376
2751
  * Helper function to create chain configuration from legacy config format
@@ -3151,7 +3526,7 @@ declare class IntentGateway {
3151
3526
  * }
3152
3527
  * ```
3153
3528
  */
3154
- cancelOrder(order: Order, indexerClient: IndexerClient): AsyncGenerator<CancelEvent>;
3529
+ cancelOrder(order: Order, indexerClient: IndexerClient): AsyncGenerator<CancelEvent$1>;
3155
3530
  /**
3156
3531
  * Fetches proof for the destination chain.
3157
3532
  * @param order - The order to fetch proof for
@@ -3159,6 +3534,48 @@ declare class IntentGateway {
3159
3534
  */
3160
3535
  private fetchDestinationProof;
3161
3536
  }
3537
+ interface CancelEventMap$1 {
3538
+ DESTINATION_FINALIZED: {
3539
+ proof: IProof;
3540
+ };
3541
+ AWAITING_GET_REQUEST: undefined;
3542
+ SOURCE_FINALIZED: {
3543
+ metadata: {
3544
+ blockNumber: number;
3545
+ };
3546
+ };
3547
+ HYPERBRIDGE_DELIVERED: RequestStatusWithMetadata;
3548
+ HYPERBRIDGE_FINALIZED: RequestStatusWithMetadata;
3549
+ SOURCE_PROOF_RECEIVED: IProof;
3550
+ }
3551
+ type CancelEvent$1 = {
3552
+ [K in keyof CancelEventMap$1]: {
3553
+ status: K;
3554
+ data: CancelEventMap$1[K];
3555
+ };
3556
+ }[keyof CancelEventMap$1];
3557
+
3558
+ /** ERC-7821 single batch execution mode */
3559
+ declare const ERC7821_BATCH_MODE: HexString;
3560
+ /** Response from bundler's eth_estimateUserOperationGas */
3561
+ interface BundlerGasEstimate {
3562
+ preVerificationGas: HexString;
3563
+ verificationGasLimit: HexString;
3564
+ callGasLimit: HexString;
3565
+ paymasterVerificationGasLimit?: HexString;
3566
+ paymasterPostOpGasLimit?: HexString;
3567
+ }
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
+ /** Event map for cancellation status updates */
3162
3579
  interface CancelEventMap {
3163
3580
  DESTINATION_FINALIZED: {
3164
3581
  proof: IProof;
@@ -3179,6 +3596,401 @@ type CancelEvent = {
3179
3596
  data: CancelEventMap[K];
3180
3597
  };
3181
3598
  }[keyof CancelEventMap];
3599
+ /** IntentGatewayV2 contract initialization parameters */
3600
+ interface IntentGatewayV2Params {
3601
+ host: HexString;
3602
+ dispatcher: HexString;
3603
+ solverSelection: boolean;
3604
+ surplusShareBps: bigint;
3605
+ protocolFeeBps: bigint;
3606
+ priceOracle: HexString;
3607
+ }
3608
+ /**
3609
+ * IntentGatewayV2 utilities for placing orders, submitting bids, and managing the intent lifecycle.
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)
3623
+ *
3624
+ * // Place an order
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
+ * ```
3635
+ */
3636
+ declare class IntentGatewayV2 {
3637
+ readonly source: EvmChain;
3638
+ readonly dest: EvmChain;
3639
+ readonly intentsCoprocessor?: IntentsCoprocessor | undefined;
3640
+ readonly bundlerUrl?: string | undefined;
3641
+ /** EIP-712 type hash for SelectSolver message */
3642
+ static readonly SELECT_SOLVER_TYPEHASH: `0x${string}`;
3643
+ /** EIP-712 type hash for PackedUserOperation */
3644
+ static readonly PACKED_USEROP_TYPEHASH: `0x${string}`;
3645
+ /** EIP-712 type hash for EIP712Domain */
3646
+ static readonly DOMAIN_TYPEHASH: `0x${string}`;
3647
+ private readonly sessionKeyStorage;
3648
+ private readonly cancellationStorage;
3649
+ private readonly swap;
3650
+ private readonly feeTokenCache;
3651
+ private initPromise;
3652
+ /**
3653
+ * Creates a new IntentGatewayV2 instance.
3654
+ *
3655
+ * @param source - Source chain for order placement
3656
+ * @param dest - Destination chain for order fulfillment
3657
+ * @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
+ constructor(source: EvmChain, dest: EvmChain, intentsCoprocessor?: IntentsCoprocessor | undefined, bundlerUrl?: string | undefined);
3662
+ /**
3663
+ * Ensures the fee token cache is initialized before use.
3664
+ * Called automatically by methods that need the cache.
3665
+ */
3666
+ ensureInitialized(): Promise<void>;
3667
+ /**
3668
+ * Generator function that prepares and places an order.
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<{
3701
+ calldata: HexString;
3702
+ sessionPrivateKey: HexString;
3703
+ }, OrderV2, HexString>;
3704
+ /**
3705
+ * Generator function that orchestrates the full intent order execution flow.
3706
+ *
3707
+ * Flow: AWAITING_BIDS → BIDS_RECEIVED → BID_SELECTED → USEROP_SUBMITTED
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
+ */
3734
+ executeIntentOrder(options: ExecuteIntentOrderOptions): AsyncGenerator<IntentOrderStatusUpdate, void>;
3735
+ /**
3736
+ * Returns the native token amount required to dispatch a cancellation GET request.
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
+ */
3794
+ 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
+ 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
+ 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
+ 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
+ decodeERC7821Execute(callData: HexString): ERC7821Call[] | null;
3912
+ /** Initializes the fee token cache for source and destination chains */
3913
+ private initFeeTokenCache;
3914
+ /**
3915
+ * Validates bids and sorts them by USD value (best to worst).
3916
+ *
3917
+ * A bid is valid if `fillOptions.outputs[i].amount >= order.output.assets[i].amount` for all i.
3918
+ * USD value is calculated using USDC/USDT at $1 and WETH price fetched via swap.
3919
+ */
3920
+ private validateAndSortBids;
3921
+ /**
3922
+ * Simulates select + fillOrder to verify execution will succeed.
3923
+ *
3924
+ * No state overrides are used - the solver should already have tokens and approvals.
3925
+ * The contract validates that outputs >= order.output.assets.
3926
+ */
3927
+ private simulateAndValidate;
3928
+ /**
3929
+ * Unified state override builder for gas estimation.
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)
3936
+ *
3937
+ * Returns both viem format (for estimateContractGas) and bundler format (for eth_estimateUserOperationGas).
3938
+ *
3939
+ * @param params - Configuration for state overrides
3940
+ * @returns Object with both viem and bundler format state overrides
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.
3969
+ */
3970
+ private convertGasToFeeToken;
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;
3977
+ }
3978
+ /**
3979
+ * Transforms an OrderV2 (SDK type) to the Order struct expected by the contract.
3980
+ *
3981
+ * Removes SDK-specific fields (`id`, `transactionHash`) and converts
3982
+ * source/destination to hex if not already.
3983
+ *
3984
+ * @param order - The SDK order to transform
3985
+ * @returns Contract-compatible order struct
3986
+ */
3987
+ declare function transformOrderForContract(order: OrderV2): Omit<OrderV2, "id" | "transactionHash">;
3988
+ /** @deprecated Use `IntentGatewayV2.SELECT_SOLVER_TYPEHASH` instead */
3989
+ declare const SELECT_SOLVER_TYPEHASH: `0x${string}`;
3990
+ /** @deprecated Use `IntentGatewayV2.PACKED_USEROP_TYPEHASH` instead */
3991
+ declare const PACKED_USEROP_TYPEHASH: `0x${string}`;
3992
+ /** @deprecated Use `IntentGatewayV2.DOMAIN_TYPEHASH` instead */
3993
+ declare const DOMAIN_TYPEHASH: `0x${string}`;
3182
3994
 
3183
3995
  /**
3184
3996
  * Result of the quoteNative fee estimation
@@ -3478,11 +4290,12 @@ type Params = {
3478
4290
  * @param params.recipient - Recipient address
3479
4291
  * @param params.amount - Amount to teleport
3480
4292
  * @param params.timeout - Operation timeout
4293
+ * @param params.extrinsics - An array of SubmittableExtrinsic to prepend to the teleport transaction
3481
4294
  * @param params.tokenGatewayAddress - Gateway contract address
4295
+ * @param options - Signer options
3482
4296
  * @param params.relayerFee - Fee for the relayer
3483
4297
  * @param params.redeem - Whether to redeem on arrival
3484
4298
  * @param params.callData - Optional additional call data
3485
- * @param options - Signer options
3486
4299
  * @yields {HyperbridgeTxEvents} Stream of events indicating transaction status
3487
4300
  * @throws Error when asset ID is unknown or transaction fails
3488
4301
  */
@@ -3491,6 +4304,7 @@ declare function teleport(teleport_param: {
3491
4304
  params: Params;
3492
4305
  apiPromise: ApiPromise;
3493
4306
  options: Partial<SignerOptions>;
4307
+ extrinsics?: Array<SubmittableExtrinsic<"promise", ISubmittableResult>>;
3494
4308
  }): Promise<ReadableStream<HyperbridgeTxEvents>>;
3495
4309
 
3496
4310
  declare enum Chains {
@@ -3503,131 +4317,68 @@ declare enum Chains {
3503
4317
  ARBITRUM_MAINNET = "EVM-42161",
3504
4318
  BASE_MAINNET = "EVM-8453",
3505
4319
  POLYGON_MAINNET = "EVM-137",
3506
- UNICHAIN_MAINNET = "EVM-130"
4320
+ UNICHAIN_MAINNET = "EVM-130",
4321
+ POLYGON_AMOY = "EVM-80002"
3507
4322
  }
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;
3557
- };
3558
- "EVM-1": {
3559
- WETH: string;
3560
- DAI: string;
3561
- USDC: string;
3562
- USDT: string;
3563
- };
3564
- "EVM-56": {
3565
- WETH: string;
3566
- DAI: string;
3567
- USDC: string;
3568
- USDT: string;
3569
- };
3570
- "EVM-42161": {
4323
+ interface ChainConfigData {
4324
+ chainId: number;
4325
+ stateMachineId: Chains;
4326
+ viemChain?: Chain;
4327
+ wrappedNativeDecimals?: number;
4328
+ assets?: {
3571
4329
  WETH: string;
3572
4330
  DAI: string;
3573
4331
  USDC: string;
3574
4332
  USDT: string;
3575
4333
  };
3576
- "EVM-8453": {
3577
- WETH: string;
3578
- DAI: string;
3579
- USDC: string;
3580
- USDT: string;
4334
+ tokenDecimals?: {
4335
+ USDC: number;
4336
+ USDT: number;
3581
4337
  };
3582
- "EVM-137": {
3583
- WETH: string;
3584
- DAI: string;
3585
- USDC: string;
3586
- USDT: string;
4338
+ tokenStorageSlots?: {
4339
+ USDT?: {
4340
+ balanceSlot: number;
4341
+ allowanceSlot: number;
4342
+ };
4343
+ USDC?: {
4344
+ balanceSlot: number;
4345
+ allowanceSlot: number;
4346
+ };
4347
+ WETH?: {
4348
+ balanceSlot: number;
4349
+ allowanceSlot: number;
4350
+ };
4351
+ DAI?: {
4352
+ balanceSlot: number;
4353
+ allowanceSlot: number;
4354
+ };
3587
4355
  };
3588
- "EVM-130": {
3589
- WETH: string;
3590
- DAI: string;
3591
- USDC: string;
3592
- USDT: string;
4356
+ addresses: {
4357
+ IntentGateway?: `0x${string}`;
4358
+ IntentGatewayV2?: `0x${string}`;
4359
+ TokenGateway?: `0x${string}`;
4360
+ Host?: `0x${string}`;
4361
+ UniswapRouter02?: `0x${string}`;
4362
+ UniswapV2Factory?: `0x${string}`;
4363
+ UniswapV3Factory?: `0x${string}`;
4364
+ UniversalRouter?: `0x${string}`;
4365
+ UniswapV3Quoter?: `0x${string}`;
4366
+ UniswapV4Quoter?: `0x${string}`;
4367
+ Calldispatcher?: `0x${string}`;
4368
+ Permit2?: `0x${string}`;
4369
+ /** ERC-4337 v0.8 EntryPoint address (canonical across all EVM chains) */
4370
+ EntryPointV08?: `0x${string}`;
3593
4371
  };
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
- };
4372
+ rpcEnvKey?: string;
4373
+ defaultRpcUrl?: string;
4374
+ consensusStateId: string;
4375
+ coingeckoId: string;
4376
+ popularTokens?: string[];
4377
+ }
4378
+ declare const chainConfigs: Record<number, ChainConfigData>;
4379
+ declare const getConfigByStateMachineId: (id: Chains) => ChainConfigData | undefined;
4380
+ declare const getChainId: (stateMachineId: string) => number | undefined;
4381
+ declare const getViemChain: (chainId: number) => Chain | undefined;
4382
+ declare const hyperbridgeAddress = "";
3632
4383
 
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 };
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, 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, postRequestCommitment, queryAssetTeleported, queryGetRequest, queryPostRequest, requestCommitmentKey, retryPromise, teleport, teleportDot, transformOrderForContract };