@hyperbridge/sdk 1.3.21 → 1.3.22

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.
@@ -1564,6 +1564,23 @@ interface TokenRegistryResponse {
1564
1564
  }>;
1565
1565
  };
1566
1566
  }
1567
+ /**
1568
+ * Represents a complete transaction structure for swap operations
1569
+ */
1570
+ interface Transaction {
1571
+ /**
1572
+ * The address to send the transaction to (typically the Universal Router address)
1573
+ */
1574
+ to: HexString;
1575
+ /**
1576
+ * The value to send with the transaction (in wei)
1577
+ */
1578
+ value: bigint;
1579
+ /**
1580
+ * The calldata for the transaction
1581
+ */
1582
+ data: HexString;
1583
+ }
1567
1584
 
1568
1585
  declare class ChainConfigService {
1569
1586
  private rpcUrls;
@@ -1584,13 +1601,10 @@ declare class ChainConfigService {
1584
1601
  getRpcUrl(chain: string): string;
1585
1602
  getUniswapRouterV2Address(chain: string): HexString;
1586
1603
  getUniswapV2FactoryAddress(chain: string): HexString;
1587
- getBatchExecutorAddress(chain: string): HexString;
1588
1604
  getUniversalRouterAddress(chain: string): HexString;
1589
- getUniswapV3RouterAddress(chain: string): HexString;
1590
- getUniswapV3FactoryAddress(chain: string): HexString;
1591
1605
  getUniswapV3QuoterAddress(chain: string): HexString;
1592
- getUniswapV4PoolManagerAddress(chain: string): HexString;
1593
1606
  getUniswapV4QuoterAddress(chain: string): HexString;
1607
+ getPermit2Address(chain: string): HexString;
1594
1608
  getCoingeckoId(chain: string): string | undefined;
1595
1609
  }
1596
1610
 
@@ -2648,6 +2662,66 @@ declare class IntentGateway {
2648
2662
  * @returns The native token amount required
2649
2663
  */
2650
2664
  quoteNative(postRequest: IPostRequest, fee: bigint): Promise<bigint>;
2665
+ /**
2666
+ * Gets V2 quote for exact output swap.
2667
+ */
2668
+ getV2QuoteWithAmountOut(getQuoteIn: "source" | "dest", tokenIn: HexString, tokenOut: HexString, amountOut: bigint, evmChainID: string): Promise<bigint>;
2669
+ /**
2670
+ * Gets V2 quote for exact input swap.
2671
+ */
2672
+ getV2QuoteWithAmountIn(getQuoteIn: "source" | "dest", tokenIn: HexString, tokenOut: HexString, amountIn: bigint, evmChainID: string): Promise<bigint>;
2673
+ /**
2674
+ * Gets V3 quote for exact output swap.
2675
+ */
2676
+ getV3QuoteWithAmountOut(getQuoteIn: "source" | "dest", tokenIn: HexString, tokenOut: HexString, amountOut: bigint, evmChainID: string): Promise<{
2677
+ amountIn: bigint;
2678
+ fee: number;
2679
+ }>;
2680
+ /**
2681
+ * Gets V3 quote for exact input swap.
2682
+ */
2683
+ getV3QuoteWithAmountIn(getQuoteIn: "source" | "dest", tokenIn: HexString, tokenOut: HexString, amountIn: bigint, evmChainID: string): Promise<{
2684
+ amountOut: bigint;
2685
+ fee: number;
2686
+ }>;
2687
+ /**
2688
+ * Gets V4 quote for exact output swap.
2689
+ */
2690
+ getV4QuoteWithAmountOut(getQuoteIn: "source" | "dest", tokenIn: HexString, tokenOut: HexString, amountOut: bigint, evmChainID: string): Promise<{
2691
+ amountIn: bigint;
2692
+ fee: number;
2693
+ }>;
2694
+ /**
2695
+ * Gets V4 quote for exact input swap.
2696
+ */
2697
+ getV4QuoteWithAmountIn(getQuoteIn: "source" | "dest", tokenIn: HexString, tokenOut: HexString, amountIn: bigint, evmChainID: string): Promise<{
2698
+ amountOut: bigint;
2699
+ fee: number;
2700
+ }>;
2701
+ /**
2702
+ * Creates transaction structure for V2 exact input swap, including ERC20 transfer if needed.
2703
+ */
2704
+ createV2SwapCalldataExactIn(sourceTokenAddress: HexString, targetTokenAddress: HexString, amountIn: bigint, amountOutMinimum: bigint, recipient: HexString, evmChainID: string, getQuoteIn: "source" | "dest"): Transaction[];
2705
+ /**
2706
+ * Creates transaction structure for V2 exact output swap, including ERC20 transfer if needed.
2707
+ */
2708
+ createV2SwapCalldataExactOut(sourceTokenAddress: HexString, targetTokenAddress: HexString, amountOut: bigint, amountInMax: bigint, recipient: HexString, evmChainID: string, getQuoteIn: "source" | "dest"): Transaction[];
2709
+ /**
2710
+ * Creates transaction structure for V3 exact input swap, including ERC20 transfer if needed.
2711
+ */
2712
+ createV3SwapCalldataExactIn(sourceTokenAddress: HexString, targetTokenAddress: HexString, amountIn: bigint, amountOutMinimum: bigint, fee: number, recipient: HexString, evmChainID: string, getQuoteIn: "source" | "dest"): Transaction[];
2713
+ /**
2714
+ * Creates transaction structure for V3 exact output swap, including ERC20 transfer if needed.
2715
+ */
2716
+ createV3SwapCalldataExactOut(sourceTokenAddress: HexString, targetTokenAddress: HexString, amountOut: bigint, amountInMax: bigint, fee: number, recipient: HexString, evmChainID: string, getQuoteIn: "source" | "dest"): Transaction[];
2717
+ /**
2718
+ * Creates transaction structure for V4 exact input swap, including Permit2 approvals for ERC20 tokens.
2719
+ */
2720
+ createV4SwapCalldataExactIn(sourceTokenAddress: HexString, targetTokenAddress: HexString, amountIn: bigint, amountOutMinimum: bigint, fee: number, evmChainID: string, getQuoteIn: "source" | "dest"): Transaction[];
2721
+ /**
2722
+ * Creates transaction structure for V4 exact output swap, including Permit2 approvals for ERC20 tokens.
2723
+ */
2724
+ createV4SwapCalldataExactOut(sourceTokenAddress: HexString, targetTokenAddress: HexString, amountOut: bigint, amountInMax: bigint, fee: number, evmChainID: string, getQuoteIn: "source" | "dest"): Transaction[];
2651
2725
  /**
2652
2726
  * Finds the best Uniswap protocol (V2, V3, or V4) for swapping tokens given a desired output amount.
2653
2727
  * Compares liquidity and pricing across different protocols and fee tiers.
@@ -2656,12 +2730,17 @@ declare class IntentGateway {
2656
2730
  * @param tokenIn - The address of the input token
2657
2731
  * @param tokenOut - The address of the output token
2658
2732
  * @param amountOut - The desired output amount
2659
- * @returns Object containing the best protocol, required input amount, and fee tier (for V3/V4)
2733
+ * @returns Object containing the best protocol, required input amount, fee tier (for V3/V4), and transaction structure
2660
2734
  */
2661
- findBestProtocolWithAmountOut(getQuoteIn: "source" | "dest", tokenIn: HexString, tokenOut: HexString, amountOut: bigint, evmChainID: string, selectedProtocol?: "v2" | "v3" | "v4"): Promise<{
2735
+ findBestProtocolWithAmountOut(getQuoteIn: "source" | "dest", tokenIn: HexString, tokenOut: HexString, amountOut: bigint, evmChainID: string, options?: {
2736
+ selectedProtocol?: "v2" | "v3" | "v4";
2737
+ generateCalldata?: boolean;
2738
+ recipient?: HexString;
2739
+ }): Promise<{
2662
2740
  protocol: "v2" | "v3" | "v4" | null;
2663
2741
  amountIn: bigint;
2664
2742
  fee?: number;
2743
+ transactions?: Transaction[];
2665
2744
  }>;
2666
2745
  /**
2667
2746
  * Finds the best Uniswap protocol (V2, V3, or V4) for swapping tokens given an input amount.
@@ -2673,12 +2752,17 @@ declare class IntentGateway {
2673
2752
  * @param amountIn - The input amount to swap
2674
2753
  * @param evmChainID - The EVM chain ID in format "EVM-{id}"
2675
2754
  * @param selectedProtocol - Optional specific protocol to use ("v2", "v3", or "v4")
2676
- * @returns Object containing the best protocol, expected output amount, and fee tier (for V3/V4)
2755
+ * @returns Object containing the best protocol, expected output amount, fee tier (for V3/V4), and transaction structure
2677
2756
  */
2678
- findBestProtocolWithAmountIn(getQuoteIn: "source" | "dest", tokenIn: HexString, tokenOut: HexString, amountIn: bigint, evmChainID: string, selectedProtocol?: "v2" | "v3" | "v4"): Promise<{
2757
+ findBestProtocolWithAmountIn(getQuoteIn: "source" | "dest", tokenIn: HexString, tokenOut: HexString, amountIn: bigint, evmChainID: string, options?: {
2758
+ selectedProtocol?: "v2" | "v3" | "v4";
2759
+ generateCalldata?: boolean;
2760
+ recipient?: HexString;
2761
+ }): Promise<{
2679
2762
  protocol: "v2" | "v3" | "v4" | null;
2680
2763
  amountOut: bigint;
2681
2764
  fee?: number;
2765
+ transactions?: Transaction[];
2682
2766
  }>;
2683
2767
  /**
2684
2768
  * Checks if an order has been filled by verifying the commitment status on-chain.
@@ -2817,6 +2901,11 @@ declare class IntentGateway {
2817
2901
  * @returns True if candidate is within threshold of reference
2818
2902
  */
2819
2903
  private isWithinThreshold;
2904
+ /**
2905
+ * Encodes multiple command bytes into packed format
2906
+ * @private
2907
+ */
2908
+ private encodeCommands;
2820
2909
  }
2821
2910
  interface StoredCancellationData {
2822
2911
  destIProof?: IProof;
@@ -3106,4 +3195,4 @@ declare const coingeckoIds: {
3106
3195
  "EVM-130": string;
3107
3196
  };
3108
3197
 
3109
- 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 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, 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, SubstrateChain, type SubstrateChainParams, TeleportStatus, TimeoutStatus, type TimeoutStatusKey, type TokenGatewayAssetTeleportedResponse, type TokenGatewayAssetTeleportedWithStatus, type TokenInfo, type TokenPrice, type TokenPricesResponse, type TokenRegistry, type TokenRegistryResponse, WrappedNativeDecimals, type XcmGatewayParams, __test, addresses, adjustFeeDecimals, assets, bytes20ToBytes32, bytes32ToBytes20, chainIds, coingeckoIds, consensusStateIds, constructRedeemEscrowRequestBody, convertStateIdToStateMachineId, convertStateMachineIdToEnum, createQueryClient, createRpcUrls, encodeISMPMessage, estimateGasForPost, fetchPrice, generateRootWithProof, getChain, getRequestCommitment, getStateCommitmentFieldSlot, getStateCommitmentSlot, getStorageSlot, hexToString, maxBigInt, orderCommitment, postRequestCommitment, queryAssetTeleported, queryGetRequest, queryPostRequest, requestCommitmentKey, teleport, teleportDot, viemChains };
3198
+ 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 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, 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, SubstrateChain, type SubstrateChainParams, TeleportStatus, TimeoutStatus, type TimeoutStatusKey, type TokenGatewayAssetTeleportedResponse, type TokenGatewayAssetTeleportedWithStatus, type TokenInfo, type TokenPrice, type TokenPricesResponse, type TokenRegistry, type TokenRegistryResponse, type Transaction, WrappedNativeDecimals, type XcmGatewayParams, __test, addresses, adjustFeeDecimals, assets, bytes20ToBytes32, bytes32ToBytes20, chainIds, coingeckoIds, consensusStateIds, constructRedeemEscrowRequestBody, convertStateIdToStateMachineId, convertStateMachineIdToEnum, createQueryClient, createRpcUrls, encodeISMPMessage, estimateGasForPost, fetchPrice, generateRootWithProof, getChain, getRequestCommitment, getStateCommitmentFieldSlot, getStateCommitmentSlot, getStorageSlot, hexToString, maxBigInt, orderCommitment, postRequestCommitment, queryAssetTeleported, queryGetRequest, queryPostRequest, requestCommitmentKey, teleport, teleportDot, viemChains };