@hyperbridge/sdk 1.3.9 → 1.3.11
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 +141 -2
- package/dist/browser/index.js +195 -23
- package/dist/browser/index.js.map +1 -1
- package/dist/node/index.d.ts +141 -2
- package/dist/node/index.js +195 -23
- package/dist/node/index.js.map +1 -1
- package/package.json +2 -2
package/dist/browser/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ConsolaInstance } from 'consola';
|
|
2
2
|
import { GraphQLClient } from 'graphql-request';
|
|
3
|
+
import * as viem from 'viem';
|
|
3
4
|
import { Hex, ContractFunctionArgs, Log, PublicClient } from 'viem';
|
|
4
5
|
import { ApiPromise } from '@polkadot/api';
|
|
5
6
|
import { SignerOptions } from '@polkadot/api/types';
|
|
@@ -1650,9 +1651,10 @@ declare class EvmChain implements IChain {
|
|
|
1650
1651
|
* Query and return the encoded storage proof for the provided keys at the given height.
|
|
1651
1652
|
* @param {bigint} at - The block height at which to query the storage proof.
|
|
1652
1653
|
* @param {HexString[]} keys - The keys for which to query the storage proof.
|
|
1654
|
+
* @param {HexString} address - Optional contract address to fetch storage proof else default to host contract
|
|
1653
1655
|
* @returns {Promise<HexString>} The encoded storage proof.
|
|
1654
1656
|
*/
|
|
1655
|
-
queryStateProof(at: bigint, keys: HexString[]): Promise<HexString>;
|
|
1657
|
+
queryStateProof(at: bigint, keys: HexString[], address?: HexString): Promise<HexString>;
|
|
1656
1658
|
/**
|
|
1657
1659
|
* Returns the current timestamp of the chain.
|
|
1658
1660
|
* @returns {Promise<bigint>} The current timestamp.
|
|
@@ -2573,6 +2575,9 @@ declare function queryGetRequest(params: {
|
|
|
2573
2575
|
declare class IntentGateway {
|
|
2574
2576
|
readonly source: EvmChain;
|
|
2575
2577
|
readonly dest: EvmChain;
|
|
2578
|
+
private destStateproofCache;
|
|
2579
|
+
getCachedProof(id: HexString): IProof | undefined;
|
|
2580
|
+
clearCachedProof(id: HexString): void;
|
|
2576
2581
|
/**
|
|
2577
2582
|
* Creates a new IntentGateway instance for cross-chain operations.
|
|
2578
2583
|
* @param source - The source EVM chain
|
|
@@ -2658,6 +2663,118 @@ declare class IntentGateway {
|
|
|
2658
2663
|
* @returns True if the order has been filled, false otherwise
|
|
2659
2664
|
*/
|
|
2660
2665
|
isOrderFilled(order: Order): Promise<boolean>;
|
|
2666
|
+
cancelOrder(order: Order, hyperbridgeConfig: IHyperbridgeConfig, indexerClient: IndexerClient): AsyncGenerator<{
|
|
2667
|
+
status: RequestStatus["SOURCE"];
|
|
2668
|
+
metadata: {
|
|
2669
|
+
blockHash: string;
|
|
2670
|
+
blockNumber: number;
|
|
2671
|
+
transactionHash: string;
|
|
2672
|
+
timestamp?: number;
|
|
2673
|
+
};
|
|
2674
|
+
} | {
|
|
2675
|
+
status: RequestStatus["SOURCE_FINALIZED"];
|
|
2676
|
+
metadata: {
|
|
2677
|
+
blockHash: string;
|
|
2678
|
+
blockNumber: number;
|
|
2679
|
+
transactionHash: string;
|
|
2680
|
+
timestamp?: number;
|
|
2681
|
+
};
|
|
2682
|
+
} | {
|
|
2683
|
+
status: RequestStatus["HYPERBRIDGE_DELIVERED"];
|
|
2684
|
+
metadata: {
|
|
2685
|
+
blockHash: string;
|
|
2686
|
+
blockNumber: number;
|
|
2687
|
+
transactionHash: string;
|
|
2688
|
+
timestamp?: number;
|
|
2689
|
+
};
|
|
2690
|
+
} | {
|
|
2691
|
+
status: RequestStatus["HYPERBRIDGE_FINALIZED"];
|
|
2692
|
+
metadata: {
|
|
2693
|
+
calldata: viem.Hex;
|
|
2694
|
+
blockHash: string;
|
|
2695
|
+
blockNumber: number;
|
|
2696
|
+
transactionHash: string;
|
|
2697
|
+
timestamp?: number;
|
|
2698
|
+
};
|
|
2699
|
+
} | {
|
|
2700
|
+
status: RequestStatus["DESTINATION"];
|
|
2701
|
+
metadata: {
|
|
2702
|
+
blockHash: string;
|
|
2703
|
+
blockNumber: number;
|
|
2704
|
+
transactionHash: string;
|
|
2705
|
+
timestamp?: number;
|
|
2706
|
+
};
|
|
2707
|
+
} | {
|
|
2708
|
+
status: TimeoutStatus["PENDING_TIMEOUT"];
|
|
2709
|
+
metadata: {
|
|
2710
|
+
blockHash: string;
|
|
2711
|
+
blockNumber: number;
|
|
2712
|
+
transactionHash: string;
|
|
2713
|
+
};
|
|
2714
|
+
} | {
|
|
2715
|
+
status: TimeoutStatus["DESTINATION_FINALIZED_TIMEOUT"];
|
|
2716
|
+
metadata: {
|
|
2717
|
+
blockHash: string;
|
|
2718
|
+
blockNumber: number;
|
|
2719
|
+
transactionHash: string;
|
|
2720
|
+
timestamp?: number;
|
|
2721
|
+
};
|
|
2722
|
+
} | {
|
|
2723
|
+
status: TimeoutStatus["HYPERBRIDGE_TIMED_OUT"];
|
|
2724
|
+
metadata: {
|
|
2725
|
+
blockHash: string;
|
|
2726
|
+
blockNumber: number;
|
|
2727
|
+
transactionHash: string;
|
|
2728
|
+
timestamp?: number;
|
|
2729
|
+
};
|
|
2730
|
+
} | {
|
|
2731
|
+
status: TimeoutStatus["HYPERBRIDGE_FINALIZED_TIMEOUT"];
|
|
2732
|
+
metadata: {
|
|
2733
|
+
calldata: viem.Hex;
|
|
2734
|
+
blockHash: string;
|
|
2735
|
+
blockNumber: number;
|
|
2736
|
+
transactionHash: string;
|
|
2737
|
+
timestamp?: number;
|
|
2738
|
+
};
|
|
2739
|
+
} | {
|
|
2740
|
+
status: TimeoutStatus["TIMED_OUT"];
|
|
2741
|
+
metadata: {
|
|
2742
|
+
blockHash: string;
|
|
2743
|
+
blockNumber: number;
|
|
2744
|
+
transactionHash: string;
|
|
2745
|
+
timestamp?: number;
|
|
2746
|
+
};
|
|
2747
|
+
} | {
|
|
2748
|
+
status: string;
|
|
2749
|
+
data: {
|
|
2750
|
+
currentHeight: bigint;
|
|
2751
|
+
deadline: bigint;
|
|
2752
|
+
height?: undefined;
|
|
2753
|
+
proof?: undefined;
|
|
2754
|
+
};
|
|
2755
|
+
} | {
|
|
2756
|
+
status: string;
|
|
2757
|
+
data: {
|
|
2758
|
+
height: bigint;
|
|
2759
|
+
currentHeight?: undefined;
|
|
2760
|
+
deadline?: undefined;
|
|
2761
|
+
proof?: undefined;
|
|
2762
|
+
};
|
|
2763
|
+
} | {
|
|
2764
|
+
status: string;
|
|
2765
|
+
data: {
|
|
2766
|
+
proof: `0x${string}`;
|
|
2767
|
+
height: bigint;
|
|
2768
|
+
currentHeight?: undefined;
|
|
2769
|
+
deadline?: undefined;
|
|
2770
|
+
};
|
|
2771
|
+
} | {
|
|
2772
|
+
status: string;
|
|
2773
|
+
data?: undefined;
|
|
2774
|
+
} | {
|
|
2775
|
+
status: string;
|
|
2776
|
+
data: `0x${string}`;
|
|
2777
|
+
}, void, IGetRequest | undefined>;
|
|
2661
2778
|
/**
|
|
2662
2779
|
* Returns the tick spacing for a given fee tier in Uniswap V4
|
|
2663
2780
|
* @param fee - The fee tier in basis points
|
|
@@ -2838,7 +2955,9 @@ declare enum Chains {
|
|
|
2838
2955
|
MAINNET = "EVM-1",
|
|
2839
2956
|
BSC_MAINNET = "EVM-56",
|
|
2840
2957
|
ARBITRUM_MAINNET = "EVM-42161",
|
|
2841
|
-
BASE_MAINNET = "EVM-8453"
|
|
2958
|
+
BASE_MAINNET = "EVM-8453",
|
|
2959
|
+
POLYGON_MAINNET = "EVM-137",
|
|
2960
|
+
UNICHAIN_MAINNET = "EVM-130"
|
|
2842
2961
|
}
|
|
2843
2962
|
type AddressMap = {
|
|
2844
2963
|
[key: string]: {
|
|
@@ -2855,6 +2974,8 @@ declare const chainIds: {
|
|
|
2855
2974
|
readonly "EVM-56": 56;
|
|
2856
2975
|
readonly "EVM-42161": 42161;
|
|
2857
2976
|
readonly "EVM-8453": 8453;
|
|
2977
|
+
readonly "EVM-137": 137;
|
|
2978
|
+
readonly "EVM-130": 130;
|
|
2858
2979
|
};
|
|
2859
2980
|
type ChainId = typeof chainIds;
|
|
2860
2981
|
declare const viemChains: Record<string, Chain>;
|
|
@@ -2866,6 +2987,8 @@ declare const WrappedNativeDecimals: {
|
|
|
2866
2987
|
"EVM-56": number;
|
|
2867
2988
|
"EVM-42161": number;
|
|
2868
2989
|
"EVM-8453": number;
|
|
2990
|
+
"EVM-137": number;
|
|
2991
|
+
"EVM-130": number;
|
|
2869
2992
|
};
|
|
2870
2993
|
declare const assets: {
|
|
2871
2994
|
"EVM-97": {
|
|
@@ -2910,6 +3033,18 @@ declare const assets: {
|
|
|
2910
3033
|
USDC: string;
|
|
2911
3034
|
USDT: string;
|
|
2912
3035
|
};
|
|
3036
|
+
"EVM-137": {
|
|
3037
|
+
WETH: string;
|
|
3038
|
+
DAI: string;
|
|
3039
|
+
USDC: string;
|
|
3040
|
+
USDT: string;
|
|
3041
|
+
};
|
|
3042
|
+
"EVM-130": {
|
|
3043
|
+
WETH: string;
|
|
3044
|
+
DAI: string;
|
|
3045
|
+
USDC: string;
|
|
3046
|
+
USDT: string;
|
|
3047
|
+
};
|
|
2913
3048
|
};
|
|
2914
3049
|
declare const addresses: AddressMap;
|
|
2915
3050
|
declare const createRpcUrls: (env: NodeJS.ProcessEnv) => RpcMap;
|
|
@@ -2922,6 +3057,8 @@ declare const consensusStateIds: {
|
|
|
2922
3057
|
"EVM-56": string;
|
|
2923
3058
|
"EVM-42161": string;
|
|
2924
3059
|
"EVM-8453": string;
|
|
3060
|
+
"EVM-137": string;
|
|
3061
|
+
"EVM-130": string;
|
|
2925
3062
|
};
|
|
2926
3063
|
declare const coingeckoIds: {
|
|
2927
3064
|
"EVM-97": string;
|
|
@@ -2932,6 +3069,8 @@ declare const coingeckoIds: {
|
|
|
2932
3069
|
"EVM-56": string;
|
|
2933
3070
|
"EVM-42161": string;
|
|
2934
3071
|
"EVM-8453": string;
|
|
3072
|
+
"EVM-137": string;
|
|
3073
|
+
"EVM-130": string;
|
|
2935
3074
|
};
|
|
2936
3075
|
|
|
2937
3076
|
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, convertStateMachineIdToEnum, createQueryClient, createRpcUrls, encodeISMPMessage, estimateGasForPost, fetchPrice, generateRootWithProof, getChain, getRequestCommitment, getStateCommitmentFieldSlot, getStateCommitmentSlot, getStorageSlot, hexToString, orderCommitment, postRequestCommitment, queryAssetTeleported, queryGetRequest, queryPostRequest, teleport, teleportDot, viemChains };
|
package/dist/browser/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { createConsola, LogLevels } from 'consola';
|
|
2
2
|
import { flatten, zip, capitalize, maxBy, isNil } from 'lodash-es';
|
|
3
|
-
import { toHex, hexToBytes, encodePacked, keccak256, encodeAbiParameters, bytesToHex, concatHex, createPublicClient, http, encodeFunctionData, erc20Abi, bytesToBigInt, pad, toBytes, maxUint256, formatUnits, parseUnits } from 'viem';
|
|
3
|
+
import { toHex, hexToBytes, encodePacked, keccak256, encodeAbiParameters, bytesToHex, concatHex, createPublicClient, http, encodeFunctionData, erc20Abi, bytesToBigInt, pad, toBytes, maxUint256, formatUnits, parseUnits, hexToString as hexToString$1 } from 'viem';
|
|
4
4
|
import mergeRace from '@async-generator/merge-race';
|
|
5
|
-
import { gnosisChiado, gnosis, bscTestnet, bsc, soneium, baseSepolia, base, optimismSepolia, optimism, arbitrumSepolia, arbitrum, mainnet, sepolia } from 'viem/chains';
|
|
5
|
+
import { gnosisChiado, gnosis, bscTestnet, bsc, soneium, baseSepolia, base, optimismSepolia, optimism, arbitrumSepolia, arbitrum, mainnet, unichain, polygon, sepolia } from 'viem/chains';
|
|
6
6
|
import { hasWindow, isNode, env } from 'std-env';
|
|
7
7
|
import { Vector, u8, Struct, Tuple, Enum, _void, u64, u32, Option, bool, u128, Bytes } from 'scale-ts';
|
|
8
8
|
import { match } from 'ts-pattern';
|
|
@@ -3362,6 +3362,8 @@ var Chains = /* @__PURE__ */ ((Chains2) => {
|
|
|
3362
3362
|
Chains2["BSC_MAINNET"] = "EVM-56";
|
|
3363
3363
|
Chains2["ARBITRUM_MAINNET"] = "EVM-42161";
|
|
3364
3364
|
Chains2["BASE_MAINNET"] = "EVM-8453";
|
|
3365
|
+
Chains2["POLYGON_MAINNET"] = "EVM-137";
|
|
3366
|
+
Chains2["UNICHAIN_MAINNET"] = "EVM-130";
|
|
3365
3367
|
return Chains2;
|
|
3366
3368
|
})(Chains || {});
|
|
3367
3369
|
var chainIds = {
|
|
@@ -3372,7 +3374,9 @@ var chainIds = {
|
|
|
3372
3374
|
["EVM-1" /* MAINNET */]: 1,
|
|
3373
3375
|
["EVM-56" /* BSC_MAINNET */]: 56,
|
|
3374
3376
|
["EVM-42161" /* ARBITRUM_MAINNET */]: 42161,
|
|
3375
|
-
["EVM-8453" /* BASE_MAINNET */]: 8453
|
|
3377
|
+
["EVM-8453" /* BASE_MAINNET */]: 8453,
|
|
3378
|
+
["EVM-137" /* POLYGON_MAINNET */]: 137,
|
|
3379
|
+
["EVM-130" /* UNICHAIN_MAINNET */]: 130
|
|
3376
3380
|
};
|
|
3377
3381
|
var viemChains = {
|
|
3378
3382
|
"97": bscTestnet,
|
|
@@ -3381,7 +3385,9 @@ var viemChains = {
|
|
|
3381
3385
|
"1": mainnet,
|
|
3382
3386
|
"56": bsc,
|
|
3383
3387
|
"42161": arbitrum,
|
|
3384
|
-
"8453": base
|
|
3388
|
+
"8453": base,
|
|
3389
|
+
"137": polygon,
|
|
3390
|
+
"130": unichain
|
|
3385
3391
|
};
|
|
3386
3392
|
var WrappedNativeDecimals = {
|
|
3387
3393
|
["EVM-97" /* BSC_CHAPEL */]: 18,
|
|
@@ -3390,7 +3396,9 @@ var WrappedNativeDecimals = {
|
|
|
3390
3396
|
["EVM-1" /* MAINNET */]: 18,
|
|
3391
3397
|
["EVM-56" /* BSC_MAINNET */]: 18,
|
|
3392
3398
|
["EVM-42161" /* ARBITRUM_MAINNET */]: 18,
|
|
3393
|
-
["EVM-8453" /* BASE_MAINNET */]: 18
|
|
3399
|
+
["EVM-8453" /* BASE_MAINNET */]: 18,
|
|
3400
|
+
["EVM-137" /* POLYGON_MAINNET */]: 18,
|
|
3401
|
+
["EVM-130" /* UNICHAIN_MAINNET */]: 18
|
|
3394
3402
|
};
|
|
3395
3403
|
var assets = {
|
|
3396
3404
|
["EVM-97" /* BSC_CHAPEL */]: {
|
|
@@ -3434,17 +3442,31 @@ var assets = {
|
|
|
3434
3442
|
DAI: "0x50c5725949A6F0c72E6C4a641F24049A917DB0Cb".toLowerCase(),
|
|
3435
3443
|
USDC: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913".toLowerCase(),
|
|
3436
3444
|
USDT: "0xfde4C96c8593536E31F229EA8f37b2ADa2699bb2".toLowerCase()
|
|
3445
|
+
},
|
|
3446
|
+
["EVM-137" /* POLYGON_MAINNET */]: {
|
|
3447
|
+
WETH: "0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619".toLowerCase(),
|
|
3448
|
+
DAI: "0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063".toLowerCase(),
|
|
3449
|
+
USDC: "0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359".toLowerCase(),
|
|
3450
|
+
USDT: "0xc2132D05D31c914a87C6611C10748AEb04B58e8F".toLowerCase()
|
|
3451
|
+
},
|
|
3452
|
+
["EVM-130" /* UNICHAIN_MAINNET */]: {
|
|
3453
|
+
WETH: "0x4200000000000000000000000000000000000006".toLowerCase(),
|
|
3454
|
+
DAI: "0x0000000000000000000000000000000000000000".toLowerCase(),
|
|
3455
|
+
USDC: "0x078d782b760474a361dda0af3839290b0ef57ad6".toLowerCase(),
|
|
3456
|
+
USDT: "0x9151434b16b9763660705744891fa906f660ecc5".toLowerCase()
|
|
3437
3457
|
}
|
|
3438
3458
|
};
|
|
3439
3459
|
var addresses = {
|
|
3440
3460
|
IntentGateway: {
|
|
3441
3461
|
["EVM-97" /* BSC_CHAPEL */]: "0x016b6ffC9f890d1e28f9Fdb9eaDA776b02F89509",
|
|
3442
3462
|
["EVM-10200" /* GNOSIS_CHIADO */]: "0x016b6ffC9f890d1e28f9Fdb9eaDA776b02F89509",
|
|
3443
|
-
["EVM-11155111" /* SEPOLIA */]: "
|
|
3463
|
+
["EVM-11155111" /* SEPOLIA */]: "0x016b6ffC9f890d1e28f9Fdb9eaDA776b02F89509",
|
|
3444
3464
|
["EVM-1" /* MAINNET */]: "0xd54165e45926720b062C192a5bacEC64d5bB08DA",
|
|
3445
3465
|
["EVM-56" /* BSC_MAINNET */]: "0xd54165e45926720b062C192a5bacEC64d5bB08DA",
|
|
3446
3466
|
["EVM-42161" /* ARBITRUM_MAINNET */]: "0xd54165e45926720b062C192a5bacEC64d5bB08DA",
|
|
3447
|
-
["EVM-8453" /* BASE_MAINNET */]: "0xd54165e45926720b062C192a5bacEC64d5bB08DA"
|
|
3467
|
+
["EVM-8453" /* BASE_MAINNET */]: "0xd54165e45926720b062C192a5bacEC64d5bB08DA",
|
|
3468
|
+
["EVM-137" /* POLYGON_MAINNET */]: "0xd54165e45926720b062C192a5bacEC64d5bB08DA",
|
|
3469
|
+
["EVM-130" /* UNICHAIN_MAINNET */]: "0xd54165e45926720b062C192a5bacEC64d5bB08DA"
|
|
3448
3470
|
},
|
|
3449
3471
|
Host: {
|
|
3450
3472
|
["EVM-97" /* BSC_CHAPEL */]: "0x8Aa0Dea6D675d785A882967Bf38183f6117C09b7",
|
|
@@ -3453,7 +3475,9 @@ var addresses = {
|
|
|
3453
3475
|
["EVM-1" /* MAINNET */]: "0x792A6236AF69787C40cF76b69B4c8c7B28c4cA20",
|
|
3454
3476
|
["EVM-56" /* BSC_MAINNET */]: "0x24B5d421Ec373FcA57325dd2F0C074009Af021F7",
|
|
3455
3477
|
["EVM-42161" /* ARBITRUM_MAINNET */]: "0xE05AFD4Eb2ce6d65c40e1048381BD0Ef8b4B299e",
|
|
3456
|
-
["EVM-8453" /* BASE_MAINNET */]: "0x6FFe92e4d7a9D589549644544780e6725E84b248"
|
|
3478
|
+
["EVM-8453" /* BASE_MAINNET */]: "0x6FFe92e4d7a9D589549644544780e6725E84b248",
|
|
3479
|
+
["EVM-137" /* POLYGON_MAINNET */]: "0xD8d3db17C1dF65b301D45C84405CcAC1395C559a",
|
|
3480
|
+
["EVM-130" /* UNICHAIN_MAINNET */]: "0x2A17C1c3616Bbc33FCe5aF5B965F166ba76cEDAf"
|
|
3457
3481
|
},
|
|
3458
3482
|
UniswapRouter02: {
|
|
3459
3483
|
["EVM-97" /* BSC_CHAPEL */]: "0x9639379819420704457B07A0C33B678D9E0F8Df0",
|
|
@@ -3462,7 +3486,9 @@ var addresses = {
|
|
|
3462
3486
|
["EVM-1" /* MAINNET */]: "0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D",
|
|
3463
3487
|
["EVM-56" /* BSC_MAINNET */]: "0x10ED43C718714eb63d5aA57B78B54704E256024E",
|
|
3464
3488
|
["EVM-42161" /* ARBITRUM_MAINNET */]: "0x4752ba5DBc23f44D87826276BF6Fd6b1C372aD24",
|
|
3465
|
-
["EVM-8453" /* BASE_MAINNET */]: "0x4752ba5DBc23f44D87826276BF6Fd6b1C372aD24"
|
|
3489
|
+
["EVM-8453" /* BASE_MAINNET */]: "0x4752ba5DBc23f44D87826276BF6Fd6b1C372aD24",
|
|
3490
|
+
["EVM-137" /* POLYGON_MAINNET */]: "0xa5E0829CaCEd8fFDD4De3c43696c57F7D7A678ff",
|
|
3491
|
+
["EVM-130" /* UNICHAIN_MAINNET */]: "0x284f11109359a7e1306c3e447ef14d38400063ff"
|
|
3466
3492
|
},
|
|
3467
3493
|
UniswapV2Factory: {
|
|
3468
3494
|
["EVM-97" /* BSC_CHAPEL */]: "0x12e036669DA18F4A2777853d6e2136b32AceEC86",
|
|
@@ -3471,56 +3497,72 @@ var addresses = {
|
|
|
3471
3497
|
["EVM-1" /* MAINNET */]: "0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f",
|
|
3472
3498
|
["EVM-56" /* BSC_MAINNET */]: "0xcA143Ce32Fe78f1f7019d7d551a6402fC5350c73",
|
|
3473
3499
|
["EVM-42161" /* ARBITRUM_MAINNET */]: "0xf1D7CC64Fb4452F05c498126312eBE29f30Fbcf9",
|
|
3474
|
-
["EVM-8453" /* BASE_MAINNET */]: "0x8909Dc15e40173Ff4699343b6eB8132c65e18eC6"
|
|
3500
|
+
["EVM-8453" /* BASE_MAINNET */]: "0x8909Dc15e40173Ff4699343b6eB8132c65e18eC6",
|
|
3501
|
+
["EVM-137" /* POLYGON_MAINNET */]: "0x5757371414417b8C6CAad45bAeF941aBc7d3Ab32",
|
|
3502
|
+
["EVM-130" /* UNICHAIN_MAINNET */]: "0x1F98400000000000000000000000000000000002"
|
|
3475
3503
|
},
|
|
3476
3504
|
BatchExecutor: {
|
|
3477
3505
|
["EVM-97" /* BSC_CHAPEL */]: "0x4CC58B5D8FBf838d062E4b21F75C327835B5F0ef",
|
|
3478
3506
|
["EVM-1" /* MAINNET */]: "0x0000000000000000000000000000000000000000",
|
|
3479
3507
|
["EVM-56" /* BSC_MAINNET */]: "0x0000000000000000000000000000000000000000",
|
|
3480
3508
|
["EVM-42161" /* ARBITRUM_MAINNET */]: "0x0000000000000000000000000000000000000000",
|
|
3481
|
-
["EVM-8453" /* BASE_MAINNET */]: "0x0000000000000000000000000000000000000000"
|
|
3509
|
+
["EVM-8453" /* BASE_MAINNET */]: "0x0000000000000000000000000000000000000000",
|
|
3510
|
+
["EVM-137" /* POLYGON_MAINNET */]: "0x0000000000000000000000000000000000000000",
|
|
3511
|
+
["EVM-130" /* UNICHAIN_MAINNET */]: "0x0000000000000000000000000000000000000000"
|
|
3482
3512
|
},
|
|
3483
3513
|
UniversalRouter: {
|
|
3484
3514
|
["EVM-97" /* BSC_CHAPEL */]: "0xcc6d5ece3d4a57245bf5a2f64f3ed9179b81f714",
|
|
3485
3515
|
["EVM-1" /* MAINNET */]: "0x0000000000000000000000000000000000000000",
|
|
3486
3516
|
["EVM-56" /* BSC_MAINNET */]: "0x0000000000000000000000000000000000000000",
|
|
3487
3517
|
["EVM-42161" /* ARBITRUM_MAINNET */]: "0x0000000000000000000000000000000000000000",
|
|
3488
|
-
["EVM-8453" /* BASE_MAINNET */]: "0x0000000000000000000000000000000000000000"
|
|
3518
|
+
["EVM-8453" /* BASE_MAINNET */]: "0x0000000000000000000000000000000000000000",
|
|
3519
|
+
["EVM-137" /* POLYGON_MAINNET */]: "0x0000000000000000000000000000000000000000",
|
|
3520
|
+
["EVM-130" /* UNICHAIN_MAINNET */]: "0x0000000000000000000000000000000000000000"
|
|
3489
3521
|
},
|
|
3490
3522
|
UniswapV3Router: {
|
|
3491
3523
|
["EVM-97" /* BSC_CHAPEL */]: "0x0000000000000000000000000000000000000000",
|
|
3492
3524
|
["EVM-1" /* MAINNET */]: "0x1F98431c8aD98523631AE4a59f267346ea31F984",
|
|
3493
3525
|
["EVM-56" /* BSC_MAINNET */]: "0x0000000000000000000000000000000000000000",
|
|
3494
3526
|
["EVM-42161" /* ARBITRUM_MAINNET */]: "0x0000000000000000000000000000000000000000",
|
|
3495
|
-
["EVM-8453" /* BASE_MAINNET */]: "0x0000000000000000000000000000000000000000"
|
|
3527
|
+
["EVM-8453" /* BASE_MAINNET */]: "0x0000000000000000000000000000000000000000",
|
|
3528
|
+
["EVM-137" /* POLYGON_MAINNET */]: "0x0000000000000000000000000000000000000000",
|
|
3529
|
+
["EVM-130" /* UNICHAIN_MAINNET */]: "0x0000000000000000000000000000000000000000"
|
|
3496
3530
|
},
|
|
3497
3531
|
UniswapV3Factory: {
|
|
3498
3532
|
["EVM-97" /* BSC_CHAPEL */]: "0x0000000000000000000000000000000000000000",
|
|
3499
3533
|
["EVM-1" /* MAINNET */]: "0x1F98431c8aD98523631AE4a59f267346ea31F984",
|
|
3500
3534
|
["EVM-56" /* BSC_MAINNET */]: "0x0000000000000000000000000000000000000000",
|
|
3501
3535
|
["EVM-42161" /* ARBITRUM_MAINNET */]: "0x0000000000000000000000000000000000000000",
|
|
3502
|
-
["EVM-8453" /* BASE_MAINNET */]: "0x0000000000000000000000000000000000000000"
|
|
3536
|
+
["EVM-8453" /* BASE_MAINNET */]: "0x0000000000000000000000000000000000000000",
|
|
3537
|
+
["EVM-137" /* POLYGON_MAINNET */]: "0x0000000000000000000000000000000000000000",
|
|
3538
|
+
["EVM-130" /* UNICHAIN_MAINNET */]: "0x0000000000000000000000000000000000000000"
|
|
3503
3539
|
},
|
|
3504
3540
|
UniswapV3Quoter: {
|
|
3505
3541
|
["EVM-97" /* BSC_CHAPEL */]: "0x0000000000000000000000000000000000000000",
|
|
3506
3542
|
["EVM-1" /* MAINNET */]: "0x61fFE014bA17989E743c5F6cB21bF9697530B21e",
|
|
3507
3543
|
["EVM-56" /* BSC_MAINNET */]: "0x0000000000000000000000000000000000000000",
|
|
3508
3544
|
["EVM-42161" /* ARBITRUM_MAINNET */]: "0x0000000000000000000000000000000000000000",
|
|
3509
|
-
["EVM-8453" /* BASE_MAINNET */]: "0x0000000000000000000000000000000000000000"
|
|
3545
|
+
["EVM-8453" /* BASE_MAINNET */]: "0x0000000000000000000000000000000000000000",
|
|
3546
|
+
["EVM-137" /* POLYGON_MAINNET */]: "0x0000000000000000000000000000000000000000",
|
|
3547
|
+
["EVM-130" /* UNICHAIN_MAINNET */]: "0x0000000000000000000000000000000000000000"
|
|
3510
3548
|
},
|
|
3511
3549
|
UniswapV4PoolManager: {
|
|
3512
3550
|
["EVM-97" /* BSC_CHAPEL */]: "0x0000000000000000000000000000000000000000",
|
|
3513
3551
|
["EVM-1" /* MAINNET */]: "0x0000000000000000000000000000000000000000",
|
|
3514
3552
|
["EVM-56" /* BSC_MAINNET */]: "0x0000000000000000000000000000000000000000",
|
|
3515
3553
|
["EVM-42161" /* ARBITRUM_MAINNET */]: "0x0000000000000000000000000000000000000000",
|
|
3516
|
-
["EVM-8453" /* BASE_MAINNET */]: "0x0000000000000000000000000000000000000000"
|
|
3554
|
+
["EVM-8453" /* BASE_MAINNET */]: "0x0000000000000000000000000000000000000000",
|
|
3555
|
+
["EVM-137" /* POLYGON_MAINNET */]: "0x0000000000000000000000000000000000000000",
|
|
3556
|
+
["EVM-130" /* UNICHAIN_MAINNET */]: "0x0000000000000000000000000000000000000000"
|
|
3517
3557
|
},
|
|
3518
3558
|
UniswapV4Quoter: {
|
|
3519
3559
|
["EVM-97" /* BSC_CHAPEL */]: "0x0000000000000000000000000000000000000000",
|
|
3520
3560
|
["EVM-1" /* MAINNET */]: "0x52f0e24d1c21c8a0cb1e5a5dd6198556bd9e1203",
|
|
3521
3561
|
["EVM-56" /* BSC_MAINNET */]: "0x0000000000000000000000000000000000000000",
|
|
3522
3562
|
["EVM-42161" /* ARBITRUM_MAINNET */]: "0x0000000000000000000000000000000000000000",
|
|
3523
|
-
["EVM-8453" /* BASE_MAINNET */]: "0x0000000000000000000000000000000000000000"
|
|
3563
|
+
["EVM-8453" /* BASE_MAINNET */]: "0x0000000000000000000000000000000000000000",
|
|
3564
|
+
["EVM-137" /* POLYGON_MAINNET */]: "0x0000000000000000000000000000000000000000",
|
|
3565
|
+
["EVM-130" /* UNICHAIN_MAINNET */]: "0x0000000000000000000000000000000000000000"
|
|
3524
3566
|
},
|
|
3525
3567
|
Calldispatcher: {
|
|
3526
3568
|
["EVM-11155111" /* SEPOLIA */]: "0xC7f13b6D03A0A7F3239d38897503E90553ABe155"
|
|
@@ -3534,7 +3576,9 @@ var createRpcUrls = (env2) => ({
|
|
|
3534
3576
|
["EVM-1" /* MAINNET */]: env2.ETH_MAINNET || "https://eth-mainnet.g.alchemy.com/v2/demo",
|
|
3535
3577
|
["EVM-56" /* BSC_MAINNET */]: env2.BSC_MAINNET || "https://binance.llamarpc.com",
|
|
3536
3578
|
["EVM-42161" /* ARBITRUM_MAINNET */]: env2.ARBITRUM_MAINNET || "https://arbitrum-one.public.blastapi.io",
|
|
3537
|
-
["EVM-8453" /* BASE_MAINNET */]: env2.BASE_MAINNET || "https://base-mainnet.public.blastapi.io"
|
|
3579
|
+
["EVM-8453" /* BASE_MAINNET */]: env2.BASE_MAINNET || "https://base-mainnet.public.blastapi.io",
|
|
3580
|
+
["EVM-137" /* POLYGON_MAINNET */]: env2.POLYGON_MAINNET || "https://polygon-bor-rpc.publicnode.com",
|
|
3581
|
+
["EVM-130" /* UNICHAIN_MAINNET */]: env2.UNICHAIN_MAINNET || "https://unichain.api.onfinality.io/public"
|
|
3538
3582
|
});
|
|
3539
3583
|
var consensusStateIds = {
|
|
3540
3584
|
["EVM-97" /* BSC_CHAPEL */]: "BSC0",
|
|
@@ -3544,7 +3588,9 @@ var consensusStateIds = {
|
|
|
3544
3588
|
["EVM-1" /* MAINNET */]: "ETH0",
|
|
3545
3589
|
["EVM-56" /* BSC_MAINNET */]: "BSC0",
|
|
3546
3590
|
["EVM-42161" /* ARBITRUM_MAINNET */]: "ETH0",
|
|
3547
|
-
["EVM-8453" /* BASE_MAINNET */]: "ETH0"
|
|
3591
|
+
["EVM-8453" /* BASE_MAINNET */]: "ETH0",
|
|
3592
|
+
["EVM-137" /* POLYGON_MAINNET */]: "ETH0",
|
|
3593
|
+
["EVM-130" /* UNICHAIN_MAINNET */]: "ETH0"
|
|
3548
3594
|
};
|
|
3549
3595
|
var coingeckoIds = {
|
|
3550
3596
|
["EVM-97" /* BSC_CHAPEL */]: "binance-smart-chain",
|
|
@@ -3554,7 +3600,9 @@ var coingeckoIds = {
|
|
|
3554
3600
|
["EVM-1" /* MAINNET */]: "ethereum",
|
|
3555
3601
|
["EVM-56" /* BSC_MAINNET */]: "binance-smart-chain",
|
|
3556
3602
|
["EVM-42161" /* ARBITRUM_MAINNET */]: "arbitrum-one",
|
|
3557
|
-
["EVM-8453" /* BASE_MAINNET */]: "base"
|
|
3603
|
+
["EVM-8453" /* BASE_MAINNET */]: "base",
|
|
3604
|
+
["EVM-137" /* POLYGON_MAINNET */]: "matic-network",
|
|
3605
|
+
["EVM-130" /* UNICHAIN_MAINNET */]: "ethereum"
|
|
3558
3606
|
};
|
|
3559
3607
|
|
|
3560
3608
|
// src/configs/ChainConfigService.ts
|
|
@@ -4667,11 +4715,12 @@ var EvmChain = class {
|
|
|
4667
4715
|
* Query and return the encoded storage proof for the provided keys at the given height.
|
|
4668
4716
|
* @param {bigint} at - The block height at which to query the storage proof.
|
|
4669
4717
|
* @param {HexString[]} keys - The keys for which to query the storage proof.
|
|
4718
|
+
* @param {HexString} address - Optional contract address to fetch storage proof else default to host contract
|
|
4670
4719
|
* @returns {Promise<HexString>} The encoded storage proof.
|
|
4671
4720
|
*/
|
|
4672
|
-
async queryStateProof(at, keys) {
|
|
4721
|
+
async queryStateProof(at, keys, address) {
|
|
4673
4722
|
const config = {
|
|
4674
|
-
address: this.params.host,
|
|
4723
|
+
address: address ?? this.params.host,
|
|
4675
4724
|
storageKeys: keys
|
|
4676
4725
|
};
|
|
4677
4726
|
if (!at) {
|
|
@@ -5535,7 +5584,7 @@ query StateMachineUpdatesByHeight($statemachineId: String!, $height: Int!, $chai
|
|
|
5535
5584
|
{ chain: { equalTo: $chain } }
|
|
5536
5585
|
]
|
|
5537
5586
|
}
|
|
5538
|
-
orderBy:
|
|
5587
|
+
orderBy: HEIGHT_DESC
|
|
5539
5588
|
first: 1
|
|
5540
5589
|
) {
|
|
5541
5590
|
nodes {
|
|
@@ -11600,6 +11649,13 @@ var IntentGateway = class {
|
|
|
11600
11649
|
this.source = source;
|
|
11601
11650
|
this.dest = dest;
|
|
11602
11651
|
}
|
|
11652
|
+
destStateproofCache = /* @__PURE__ */ new Map();
|
|
11653
|
+
getCachedProof(id) {
|
|
11654
|
+
return this.destStateproofCache.get(id);
|
|
11655
|
+
}
|
|
11656
|
+
clearCachedProof(id) {
|
|
11657
|
+
this.destStateproofCache.delete(id);
|
|
11658
|
+
}
|
|
11603
11659
|
/**
|
|
11604
11660
|
* Estimates the total cost required to fill an order, including gas fees, relayer fees,
|
|
11605
11661
|
* protocol fees, and swap operations.
|
|
@@ -12208,6 +12264,122 @@ var IntentGateway = class {
|
|
|
12208
12264
|
});
|
|
12209
12265
|
return filledStatus !== "0x0000000000000000000000000000000000000000000000000000000000000000";
|
|
12210
12266
|
}
|
|
12267
|
+
async *cancelOrder(order, hyperbridgeConfig, indexerClient) {
|
|
12268
|
+
const hyperbridge = await getChain({
|
|
12269
|
+
...hyperbridgeConfig,
|
|
12270
|
+
hasher: "Keccak"
|
|
12271
|
+
});
|
|
12272
|
+
const sourceStateMachine = hexToString$1(order.sourceChain);
|
|
12273
|
+
const destStateMachine = hexToString$1(order.destChain);
|
|
12274
|
+
const sourceConsensusStateId = this.source.config.getConsensusStateId(sourceStateMachine);
|
|
12275
|
+
const destConsensusStateId = this.dest.config.getConsensusStateId(destStateMachine);
|
|
12276
|
+
let latestHeight = 0n;
|
|
12277
|
+
while (latestHeight <= order.deadline) {
|
|
12278
|
+
const { stateId } = parseStateMachineId(destStateMachine);
|
|
12279
|
+
latestHeight = await hyperbridge.latestStateMachineHeight({
|
|
12280
|
+
stateId,
|
|
12281
|
+
consensusStateId: destConsensusStateId
|
|
12282
|
+
});
|
|
12283
|
+
yield {
|
|
12284
|
+
status: "AWAITING_DESTINATION_FINALIZED",
|
|
12285
|
+
data: { currentHeight: latestHeight, deadline: order.deadline }
|
|
12286
|
+
};
|
|
12287
|
+
if (latestHeight <= order.deadline) {
|
|
12288
|
+
await sleep(1e4);
|
|
12289
|
+
}
|
|
12290
|
+
}
|
|
12291
|
+
yield { status: "DESTINATION_FINALIZED", data: { height: latestHeight } };
|
|
12292
|
+
const intentGatewayAddress = this.dest.config.getIntentGatewayAddress(destStateMachine);
|
|
12293
|
+
const orderId = orderCommitment(order);
|
|
12294
|
+
const slotHash = await this.dest.client.readContract({
|
|
12295
|
+
abi: IntentGateway_default.ABI,
|
|
12296
|
+
address: intentGatewayAddress,
|
|
12297
|
+
functionName: "calculateCommitmentSlotHash",
|
|
12298
|
+
args: [orderId]
|
|
12299
|
+
});
|
|
12300
|
+
const proof = await this.dest.queryStateProof(latestHeight, [slotHash], intentGatewayAddress);
|
|
12301
|
+
const destIProof = {
|
|
12302
|
+
consensusStateId: destConsensusStateId,
|
|
12303
|
+
height: latestHeight,
|
|
12304
|
+
proof,
|
|
12305
|
+
stateMachine: destStateMachine
|
|
12306
|
+
};
|
|
12307
|
+
this.destStateproofCache.set(order.id, destIProof);
|
|
12308
|
+
yield { status: "STATE_PROOF_RECEIVED", data: { proof, height: latestHeight } };
|
|
12309
|
+
const getRequest = yield { status: "AWAITING_GET_REQUEST" };
|
|
12310
|
+
if (!getRequest) {
|
|
12311
|
+
throw new Error("[Cancel Order]: Get Request not provided");
|
|
12312
|
+
}
|
|
12313
|
+
const commitment = getRequestCommitment({
|
|
12314
|
+
...getRequest,
|
|
12315
|
+
keys: [...getRequest.keys]
|
|
12316
|
+
});
|
|
12317
|
+
const statusStream = indexerClient.getRequestStatusStream(commitment);
|
|
12318
|
+
for await (const statusUpdate of statusStream) {
|
|
12319
|
+
if (statusUpdate.status === RequestStatus.SOURCE_FINALIZED) {
|
|
12320
|
+
const sourceHeight = statusUpdate.metadata.blockNumber;
|
|
12321
|
+
const proof2 = await this.source.queryProof(
|
|
12322
|
+
{ Requests: [commitment] },
|
|
12323
|
+
hyperbridgeConfig.stateMachineId,
|
|
12324
|
+
BigInt(sourceHeight)
|
|
12325
|
+
);
|
|
12326
|
+
yield { status: "SOURCE_PROOF_RECIEVED", data: proof2 };
|
|
12327
|
+
const { stateId } = parseStateMachineId(sourceStateMachine);
|
|
12328
|
+
const sourceIProof = {
|
|
12329
|
+
height: BigInt(sourceHeight),
|
|
12330
|
+
stateMachine: sourceStateMachine,
|
|
12331
|
+
consensusStateId: sourceConsensusStateId,
|
|
12332
|
+
proof: proof2
|
|
12333
|
+
};
|
|
12334
|
+
const getRequestMessage = {
|
|
12335
|
+
kind: "GetRequest",
|
|
12336
|
+
requests: [getRequest],
|
|
12337
|
+
source: sourceIProof,
|
|
12338
|
+
response: this.getCachedProof(order.id),
|
|
12339
|
+
signer: pad("0x")
|
|
12340
|
+
};
|
|
12341
|
+
await waitForChallengePeriod(hyperbridge, {
|
|
12342
|
+
height: BigInt(sourceHeight),
|
|
12343
|
+
id: {
|
|
12344
|
+
stateId,
|
|
12345
|
+
consensusStateId: sourceConsensusStateId
|
|
12346
|
+
}
|
|
12347
|
+
});
|
|
12348
|
+
const receiptKey = hyperbridge.requestReceiptKey(commitment);
|
|
12349
|
+
const { api } = hyperbridge;
|
|
12350
|
+
if (!api) {
|
|
12351
|
+
throw new Error("Hyperbridge API is not available");
|
|
12352
|
+
}
|
|
12353
|
+
let storageValue = await api.rpc.childstate.getStorage(":child_storage:default:ISMP", receiptKey);
|
|
12354
|
+
if (storageValue.isNone) {
|
|
12355
|
+
console.log("No receipt found. Attempting to submit...");
|
|
12356
|
+
try {
|
|
12357
|
+
await hyperbridge.submitUnsigned(getRequestMessage);
|
|
12358
|
+
} catch {
|
|
12359
|
+
console.warn("Submission failed. Awaiting network confirmation...");
|
|
12360
|
+
}
|
|
12361
|
+
console.log("Waiting for network state update...");
|
|
12362
|
+
await sleep(3e4);
|
|
12363
|
+
storageValue = await retryPromise(
|
|
12364
|
+
async () => {
|
|
12365
|
+
const value = await api.rpc.childstate.getStorage(":child_storage:default:ISMP", receiptKey);
|
|
12366
|
+
if (value.isNone) {
|
|
12367
|
+
throw new Error("Receipt not found");
|
|
12368
|
+
}
|
|
12369
|
+
return value;
|
|
12370
|
+
},
|
|
12371
|
+
{
|
|
12372
|
+
maxRetries: 10,
|
|
12373
|
+
backoffMs: 5e3,
|
|
12374
|
+
logMessage: "Checking for receipt"
|
|
12375
|
+
}
|
|
12376
|
+
);
|
|
12377
|
+
}
|
|
12378
|
+
console.log("Receipt confirmed on Hyperbridge. Proceeding.");
|
|
12379
|
+
}
|
|
12380
|
+
yield statusUpdate;
|
|
12381
|
+
}
|
|
12382
|
+
}
|
|
12211
12383
|
/**
|
|
12212
12384
|
* Returns the tick spacing for a given fee tier in Uniswap V4
|
|
12213
12385
|
* @param fee - The fee tier in basis points
|