@hyperbridge/sdk 1.3.4 → 1.3.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/index.d.ts +49 -14
- package/dist/browser/index.js +309 -87
- package/dist/browser/index.js.map +1 -1
- package/dist/node/index.d.ts +49 -14
- package/dist/node/index.js +309 -87
- package/dist/node/index.js.map +1 -1
- package/package.json +3 -2
package/dist/browser/index.d.ts
CHANGED
|
@@ -941,6 +941,7 @@ interface GetRequestWithStatus extends GenericRequestWithStatuses {
|
|
|
941
941
|
height: bigint;
|
|
942
942
|
keys: HexString[];
|
|
943
943
|
context: HexString;
|
|
944
|
+
commitment: HexString;
|
|
944
945
|
}
|
|
945
946
|
interface GetResponseByRequestIdResponse {
|
|
946
947
|
getResponses: {
|
|
@@ -2023,7 +2024,7 @@ declare function encodeISMPMessage(message: IIsmpMessage): Uint8Array;
|
|
|
2023
2024
|
/**
|
|
2024
2025
|
* Type representing an ISMP message.
|
|
2025
2026
|
*/
|
|
2026
|
-
type IIsmpMessage = IRequestMessage | ITimeoutPostRequestMessage | IGetResponseMessage;
|
|
2027
|
+
type IIsmpMessage = IRequestMessage | ITimeoutPostRequestMessage | IGetResponseMessage | IGetRequestMessage;
|
|
2027
2028
|
interface IRequestMessage {
|
|
2028
2029
|
/**
|
|
2029
2030
|
* The kind of message.
|
|
@@ -2052,9 +2053,13 @@ interface IGetRequestMessage {
|
|
|
2052
2053
|
*/
|
|
2053
2054
|
requests: IGetRequest[];
|
|
2054
2055
|
/**
|
|
2055
|
-
* The proof of the requests.
|
|
2056
|
+
* The proof of the requests from the source chain.
|
|
2056
2057
|
*/
|
|
2057
|
-
|
|
2058
|
+
source: IProof;
|
|
2059
|
+
/**
|
|
2060
|
+
* The proof of the response from the target chain
|
|
2061
|
+
*/
|
|
2062
|
+
response: IProof;
|
|
2058
2063
|
/**
|
|
2059
2064
|
* The signer of the message.
|
|
2060
2065
|
*/
|
|
@@ -2262,14 +2267,14 @@ declare class IndexerClient {
|
|
|
2262
2267
|
* @param commitment_hash - Can be commitment
|
|
2263
2268
|
* @returns Latest status and block metadata of the request
|
|
2264
2269
|
*/
|
|
2265
|
-
queryPostRequest(commitment_hash:
|
|
2270
|
+
queryPostRequest(commitment_hash: HexString): Promise<PostRequestWithStatus | undefined>;
|
|
2266
2271
|
/**
|
|
2267
2272
|
* Queries a request by any of its associated hashes and returns it alongside its statuses
|
|
2268
2273
|
* Statuses will be one of SOURCE, HYPERBRIDGE_DELIVERED and DESTINATION
|
|
2269
2274
|
* @param hash - Can be commitment, hyperbridge tx hash, source tx hash, destination tx hash, or timeout tx hash
|
|
2270
2275
|
* @returns Latest status and block metadata of the request
|
|
2271
2276
|
*/
|
|
2272
|
-
queryGetRequest(hash:
|
|
2277
|
+
queryGetRequest(hash: HexString): Promise<GetRequestWithStatus | undefined>;
|
|
2273
2278
|
/**
|
|
2274
2279
|
* Queries the response associated with a specific request ID and returns its commitment
|
|
2275
2280
|
* @param requestId - The ID of the request to find the associated response for
|
|
@@ -2316,7 +2321,31 @@ declare class IndexerClient {
|
|
|
2316
2321
|
* @returns Full request data with all inferred status events, including SOURCE_FINALIZED and HYPERBRIDGE_FINALIZED
|
|
2317
2322
|
* @remarks Unlike queryRequest(), this method adds derived finalization status events by querying state machine updates
|
|
2318
2323
|
*/
|
|
2319
|
-
queryRequestWithStatus(hash:
|
|
2324
|
+
queryRequestWithStatus(hash: HexString): Promise<PostRequestWithStatus | undefined>;
|
|
2325
|
+
/**
|
|
2326
|
+
* Queries a GET request and returns it alongside its statuses,
|
|
2327
|
+
* including any finalization events.
|
|
2328
|
+
* @param hash - Can be commitment, hyperbridge tx hash, source tx hash, destination tx hash, or timeout tx hash
|
|
2329
|
+
* @returns Full GET request data with all inferred status events, including SOURCE_FINALIZED and HYPERBRIDGE_FINALIZED
|
|
2330
|
+
* @remarks Unlike queryGetRequest(), this method adds derived finalization status events by querying state machine updates
|
|
2331
|
+
*/
|
|
2332
|
+
queryGetRequestWithStatus(hash: HexString): Promise<GetRequestWithStatus | undefined>;
|
|
2333
|
+
/**
|
|
2334
|
+
* Enhances a GET request with finality events by querying state machine updates.
|
|
2335
|
+
*
|
|
2336
|
+
* This method augments a GET request object with additional inferred status events
|
|
2337
|
+
* that represent chain finality confirmations. It adds:
|
|
2338
|
+
* - SOURCE_FINALIZED: When the source chain has finalized the request
|
|
2339
|
+
* - HYPERBRIDGE_FINALIZED: When Hyperbridge has finalized the delivery confirmation and response is ready
|
|
2340
|
+
*
|
|
2341
|
+
* The method also generates appropriate calldata for submitting cross-chain proofs
|
|
2342
|
+
* when applicable.
|
|
2343
|
+
*
|
|
2344
|
+
* @param request - The GET request to enhance with finality events
|
|
2345
|
+
* @returns The request with finality events added
|
|
2346
|
+
* @private
|
|
2347
|
+
*/
|
|
2348
|
+
private addGetRequestFinalityEvents;
|
|
2320
2349
|
/**
|
|
2321
2350
|
* Create a Stream of status updates for a post request.
|
|
2322
2351
|
* Stream ends when either the request reaches the destination or times out.
|
|
@@ -2568,8 +2597,7 @@ declare class IntentGateway {
|
|
|
2568
2597
|
* Uses USD pricing to convert between fee token amounts and native token costs.
|
|
2569
2598
|
*
|
|
2570
2599
|
* @param feeTokenAmount - The amount in fee token (DAI)
|
|
2571
|
-
* @param
|
|
2572
|
-
* @param feeTokenDecimals - The decimal places of the fee token
|
|
2600
|
+
* @param getQuoteIn - Whether to use "source" or "dest" chain for the conversion
|
|
2573
2601
|
* @returns The fee token amount converted to native token amount
|
|
2574
2602
|
* @private
|
|
2575
2603
|
*/
|
|
@@ -2579,24 +2607,30 @@ declare class IntentGateway {
|
|
|
2579
2607
|
* Uses USD pricing to convert between native token gas costs and fee token amounts.
|
|
2580
2608
|
*
|
|
2581
2609
|
* @param gasEstimate - The estimated gas units
|
|
2582
|
-
* @param
|
|
2583
|
-
* @param targetDecimals - The decimal places of the target fee token
|
|
2610
|
+
* @param gasEstimateIn - Whether to use "source" or "dest" chain for the conversion
|
|
2584
2611
|
* @returns The gas cost converted to fee token amount
|
|
2585
2612
|
* @private
|
|
2586
2613
|
*/
|
|
2587
2614
|
private convertGasToFeeToken;
|
|
2615
|
+
/**
|
|
2616
|
+
* Gets a quote for the native token cost of dispatching a post request.
|
|
2617
|
+
*
|
|
2618
|
+
* @param postRequest - The post request to quote
|
|
2619
|
+
* @param fee - The fee amount in fee token
|
|
2620
|
+
* @returns The native token amount required
|
|
2621
|
+
*/
|
|
2588
2622
|
quoteNative(postRequest: IPostRequest, fee: bigint): Promise<bigint>;
|
|
2589
2623
|
/**
|
|
2590
2624
|
* Finds the best Uniswap protocol (V2, V3, or V4) for swapping tokens given a desired output amount.
|
|
2591
2625
|
* Compares liquidity and pricing across different protocols and fee tiers.
|
|
2592
2626
|
*
|
|
2593
|
-
* @param
|
|
2627
|
+
* @param getQuoteIn - Whether to use "source" or "dest" chain for the swap
|
|
2594
2628
|
* @param tokenIn - The address of the input token
|
|
2595
2629
|
* @param tokenOut - The address of the output token
|
|
2596
2630
|
* @param amountOut - The desired output amount
|
|
2597
2631
|
* @returns Object containing the best protocol, required input amount, and fee tier (for V3/V4)
|
|
2598
2632
|
*/
|
|
2599
|
-
findBestProtocolWithAmountOut(
|
|
2633
|
+
findBestProtocolWithAmountOut(getQuoteIn: "source" | "dest", tokenIn: HexString, tokenOut: HexString, amountOut: bigint): Promise<{
|
|
2600
2634
|
protocol: "v2" | "v3" | "v4" | null;
|
|
2601
2635
|
amountIn: bigint;
|
|
2602
2636
|
fee?: number;
|
|
@@ -2605,13 +2639,14 @@ declare class IntentGateway {
|
|
|
2605
2639
|
* Finds the best Uniswap protocol (V2, V3, or V4) for swapping tokens given an input amount.
|
|
2606
2640
|
* Compares liquidity and pricing across different protocols and fee tiers.
|
|
2607
2641
|
*
|
|
2608
|
-
* @param
|
|
2642
|
+
* @param getQuoteIn - Whether to use "source" or "dest" chain for the swap
|
|
2609
2643
|
* @param tokenIn - The address of the input token
|
|
2610
2644
|
* @param tokenOut - The address of the output token
|
|
2611
2645
|
* @param amountIn - The input amount to swap
|
|
2646
|
+
* @param selectedProtocol - Optional specific protocol to use ("v2", "v3", or "v4")
|
|
2612
2647
|
* @returns Object containing the best protocol, expected output amount, and fee tier (for V3/V4)
|
|
2613
2648
|
*/
|
|
2614
|
-
findBestProtocolWithAmountIn(
|
|
2649
|
+
findBestProtocolWithAmountIn(getQuoteIn: "source" | "dest", tokenIn: HexString, tokenOut: HexString, amountIn: bigint, selectedProtocol?: "v2" | "v3" | "v4"): Promise<{
|
|
2615
2650
|
protocol: "v2" | "v3" | "v4" | null;
|
|
2616
2651
|
amountOut: bigint;
|
|
2617
2652
|
fee?: number;
|