@hyperbridge/sdk 1.3.10 → 1.3.12
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 +63 -18
- package/dist/browser/index.js +267 -135
- package/dist/browser/index.js.map +1 -1
- package/dist/node/index.d.ts +63 -18
- package/dist/node/index.js +267 -135
- package/dist/node/index.js.map +1 -1
- package/package.json +2 -2
package/dist/browser/index.js
CHANGED
|
@@ -2,12 +2,11 @@ import { createConsola, LogLevels } from 'consola';
|
|
|
2
2
|
import { flatten, zip, capitalize, maxBy, isNil } from 'lodash-es';
|
|
3
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';
|
|
9
9
|
import { WsProvider, ApiPromise } from '@polkadot/api';
|
|
10
|
-
import { RpcWebSocketClient } from 'rpc-websocket-client';
|
|
11
10
|
import { keccakAsU8a, decodeAddress, keccakAsHex, xxhashAsU8a } from '@polkadot/util-crypto';
|
|
12
11
|
import { GraphQLClient } from 'graphql-request';
|
|
13
12
|
import { Decimal } from 'decimal.js';
|
|
@@ -3362,6 +3361,8 @@ var Chains = /* @__PURE__ */ ((Chains2) => {
|
|
|
3362
3361
|
Chains2["BSC_MAINNET"] = "EVM-56";
|
|
3363
3362
|
Chains2["ARBITRUM_MAINNET"] = "EVM-42161";
|
|
3364
3363
|
Chains2["BASE_MAINNET"] = "EVM-8453";
|
|
3364
|
+
Chains2["POLYGON_MAINNET"] = "EVM-137";
|
|
3365
|
+
Chains2["UNICHAIN_MAINNET"] = "EVM-130";
|
|
3365
3366
|
return Chains2;
|
|
3366
3367
|
})(Chains || {});
|
|
3367
3368
|
var chainIds = {
|
|
@@ -3372,7 +3373,9 @@ var chainIds = {
|
|
|
3372
3373
|
["EVM-1" /* MAINNET */]: 1,
|
|
3373
3374
|
["EVM-56" /* BSC_MAINNET */]: 56,
|
|
3374
3375
|
["EVM-42161" /* ARBITRUM_MAINNET */]: 42161,
|
|
3375
|
-
["EVM-8453" /* BASE_MAINNET */]: 8453
|
|
3376
|
+
["EVM-8453" /* BASE_MAINNET */]: 8453,
|
|
3377
|
+
["EVM-137" /* POLYGON_MAINNET */]: 137,
|
|
3378
|
+
["EVM-130" /* UNICHAIN_MAINNET */]: 130
|
|
3376
3379
|
};
|
|
3377
3380
|
var viemChains = {
|
|
3378
3381
|
"97": bscTestnet,
|
|
@@ -3381,7 +3384,9 @@ var viemChains = {
|
|
|
3381
3384
|
"1": mainnet,
|
|
3382
3385
|
"56": bsc,
|
|
3383
3386
|
"42161": arbitrum,
|
|
3384
|
-
"8453": base
|
|
3387
|
+
"8453": base,
|
|
3388
|
+
"137": polygon,
|
|
3389
|
+
"130": unichain
|
|
3385
3390
|
};
|
|
3386
3391
|
var WrappedNativeDecimals = {
|
|
3387
3392
|
["EVM-97" /* BSC_CHAPEL */]: 18,
|
|
@@ -3390,7 +3395,9 @@ var WrappedNativeDecimals = {
|
|
|
3390
3395
|
["EVM-1" /* MAINNET */]: 18,
|
|
3391
3396
|
["EVM-56" /* BSC_MAINNET */]: 18,
|
|
3392
3397
|
["EVM-42161" /* ARBITRUM_MAINNET */]: 18,
|
|
3393
|
-
["EVM-8453" /* BASE_MAINNET */]: 18
|
|
3398
|
+
["EVM-8453" /* BASE_MAINNET */]: 18,
|
|
3399
|
+
["EVM-137" /* POLYGON_MAINNET */]: 18,
|
|
3400
|
+
["EVM-130" /* UNICHAIN_MAINNET */]: 18
|
|
3394
3401
|
};
|
|
3395
3402
|
var assets = {
|
|
3396
3403
|
["EVM-97" /* BSC_CHAPEL */]: {
|
|
@@ -3434,6 +3441,18 @@ var assets = {
|
|
|
3434
3441
|
DAI: "0x50c5725949A6F0c72E6C4a641F24049A917DB0Cb".toLowerCase(),
|
|
3435
3442
|
USDC: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913".toLowerCase(),
|
|
3436
3443
|
USDT: "0xfde4C96c8593536E31F229EA8f37b2ADa2699bb2".toLowerCase()
|
|
3444
|
+
},
|
|
3445
|
+
["EVM-137" /* POLYGON_MAINNET */]: {
|
|
3446
|
+
WETH: "0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619".toLowerCase(),
|
|
3447
|
+
DAI: "0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063".toLowerCase(),
|
|
3448
|
+
USDC: "0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359".toLowerCase(),
|
|
3449
|
+
USDT: "0xc2132D05D31c914a87C6611C10748AEb04B58e8F".toLowerCase()
|
|
3450
|
+
},
|
|
3451
|
+
["EVM-130" /* UNICHAIN_MAINNET */]: {
|
|
3452
|
+
WETH: "0x4200000000000000000000000000000000000006".toLowerCase(),
|
|
3453
|
+
DAI: "0x0000000000000000000000000000000000000000".toLowerCase(),
|
|
3454
|
+
USDC: "0x078d782b760474a361dda0af3839290b0ef57ad6".toLowerCase(),
|
|
3455
|
+
USDT: "0x9151434b16b9763660705744891fa906f660ecc5".toLowerCase()
|
|
3437
3456
|
}
|
|
3438
3457
|
};
|
|
3439
3458
|
var addresses = {
|
|
@@ -3444,7 +3463,9 @@ var addresses = {
|
|
|
3444
3463
|
["EVM-1" /* MAINNET */]: "0xd54165e45926720b062C192a5bacEC64d5bB08DA",
|
|
3445
3464
|
["EVM-56" /* BSC_MAINNET */]: "0xd54165e45926720b062C192a5bacEC64d5bB08DA",
|
|
3446
3465
|
["EVM-42161" /* ARBITRUM_MAINNET */]: "0xd54165e45926720b062C192a5bacEC64d5bB08DA",
|
|
3447
|
-
["EVM-8453" /* BASE_MAINNET */]: "0xd54165e45926720b062C192a5bacEC64d5bB08DA"
|
|
3466
|
+
["EVM-8453" /* BASE_MAINNET */]: "0xd54165e45926720b062C192a5bacEC64d5bB08DA",
|
|
3467
|
+
["EVM-137" /* POLYGON_MAINNET */]: "0xd54165e45926720b062C192a5bacEC64d5bB08DA",
|
|
3468
|
+
["EVM-130" /* UNICHAIN_MAINNET */]: "0xd54165e45926720b062C192a5bacEC64d5bB08DA"
|
|
3448
3469
|
},
|
|
3449
3470
|
Host: {
|
|
3450
3471
|
["EVM-97" /* BSC_CHAPEL */]: "0x8Aa0Dea6D675d785A882967Bf38183f6117C09b7",
|
|
@@ -3453,7 +3474,9 @@ var addresses = {
|
|
|
3453
3474
|
["EVM-1" /* MAINNET */]: "0x792A6236AF69787C40cF76b69B4c8c7B28c4cA20",
|
|
3454
3475
|
["EVM-56" /* BSC_MAINNET */]: "0x24B5d421Ec373FcA57325dd2F0C074009Af021F7",
|
|
3455
3476
|
["EVM-42161" /* ARBITRUM_MAINNET */]: "0xE05AFD4Eb2ce6d65c40e1048381BD0Ef8b4B299e",
|
|
3456
|
-
["EVM-8453" /* BASE_MAINNET */]: "0x6FFe92e4d7a9D589549644544780e6725E84b248"
|
|
3477
|
+
["EVM-8453" /* BASE_MAINNET */]: "0x6FFe92e4d7a9D589549644544780e6725E84b248",
|
|
3478
|
+
["EVM-137" /* POLYGON_MAINNET */]: "0xD8d3db17C1dF65b301D45C84405CcAC1395C559a",
|
|
3479
|
+
["EVM-130" /* UNICHAIN_MAINNET */]: "0x2A17C1c3616Bbc33FCe5aF5B965F166ba76cEDAf"
|
|
3457
3480
|
},
|
|
3458
3481
|
UniswapRouter02: {
|
|
3459
3482
|
["EVM-97" /* BSC_CHAPEL */]: "0x9639379819420704457B07A0C33B678D9E0F8Df0",
|
|
@@ -3462,7 +3485,9 @@ var addresses = {
|
|
|
3462
3485
|
["EVM-1" /* MAINNET */]: "0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D",
|
|
3463
3486
|
["EVM-56" /* BSC_MAINNET */]: "0x10ED43C718714eb63d5aA57B78B54704E256024E",
|
|
3464
3487
|
["EVM-42161" /* ARBITRUM_MAINNET */]: "0x4752ba5DBc23f44D87826276BF6Fd6b1C372aD24",
|
|
3465
|
-
["EVM-8453" /* BASE_MAINNET */]: "0x4752ba5DBc23f44D87826276BF6Fd6b1C372aD24"
|
|
3488
|
+
["EVM-8453" /* BASE_MAINNET */]: "0x4752ba5DBc23f44D87826276BF6Fd6b1C372aD24",
|
|
3489
|
+
["EVM-137" /* POLYGON_MAINNET */]: "0xa5E0829CaCEd8fFDD4De3c43696c57F7D7A678ff",
|
|
3490
|
+
["EVM-130" /* UNICHAIN_MAINNET */]: "0x284f11109359a7e1306c3e447ef14d38400063ff"
|
|
3466
3491
|
},
|
|
3467
3492
|
UniswapV2Factory: {
|
|
3468
3493
|
["EVM-97" /* BSC_CHAPEL */]: "0x12e036669DA18F4A2777853d6e2136b32AceEC86",
|
|
@@ -3471,56 +3496,72 @@ var addresses = {
|
|
|
3471
3496
|
["EVM-1" /* MAINNET */]: "0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f",
|
|
3472
3497
|
["EVM-56" /* BSC_MAINNET */]: "0xcA143Ce32Fe78f1f7019d7d551a6402fC5350c73",
|
|
3473
3498
|
["EVM-42161" /* ARBITRUM_MAINNET */]: "0xf1D7CC64Fb4452F05c498126312eBE29f30Fbcf9",
|
|
3474
|
-
["EVM-8453" /* BASE_MAINNET */]: "0x8909Dc15e40173Ff4699343b6eB8132c65e18eC6"
|
|
3499
|
+
["EVM-8453" /* BASE_MAINNET */]: "0x8909Dc15e40173Ff4699343b6eB8132c65e18eC6",
|
|
3500
|
+
["EVM-137" /* POLYGON_MAINNET */]: "0x5757371414417b8C6CAad45bAeF941aBc7d3Ab32",
|
|
3501
|
+
["EVM-130" /* UNICHAIN_MAINNET */]: "0x1F98400000000000000000000000000000000002"
|
|
3475
3502
|
},
|
|
3476
3503
|
BatchExecutor: {
|
|
3477
3504
|
["EVM-97" /* BSC_CHAPEL */]: "0x4CC58B5D8FBf838d062E4b21F75C327835B5F0ef",
|
|
3478
3505
|
["EVM-1" /* MAINNET */]: "0x0000000000000000000000000000000000000000",
|
|
3479
3506
|
["EVM-56" /* BSC_MAINNET */]: "0x0000000000000000000000000000000000000000",
|
|
3480
3507
|
["EVM-42161" /* ARBITRUM_MAINNET */]: "0x0000000000000000000000000000000000000000",
|
|
3481
|
-
["EVM-8453" /* BASE_MAINNET */]: "0x0000000000000000000000000000000000000000"
|
|
3508
|
+
["EVM-8453" /* BASE_MAINNET */]: "0x0000000000000000000000000000000000000000",
|
|
3509
|
+
["EVM-137" /* POLYGON_MAINNET */]: "0x0000000000000000000000000000000000000000",
|
|
3510
|
+
["EVM-130" /* UNICHAIN_MAINNET */]: "0x0000000000000000000000000000000000000000"
|
|
3482
3511
|
},
|
|
3483
3512
|
UniversalRouter: {
|
|
3484
3513
|
["EVM-97" /* BSC_CHAPEL */]: "0xcc6d5ece3d4a57245bf5a2f64f3ed9179b81f714",
|
|
3485
3514
|
["EVM-1" /* MAINNET */]: "0x0000000000000000000000000000000000000000",
|
|
3486
3515
|
["EVM-56" /* BSC_MAINNET */]: "0x0000000000000000000000000000000000000000",
|
|
3487
3516
|
["EVM-42161" /* ARBITRUM_MAINNET */]: "0x0000000000000000000000000000000000000000",
|
|
3488
|
-
["EVM-8453" /* BASE_MAINNET */]: "0x0000000000000000000000000000000000000000"
|
|
3517
|
+
["EVM-8453" /* BASE_MAINNET */]: "0x0000000000000000000000000000000000000000",
|
|
3518
|
+
["EVM-137" /* POLYGON_MAINNET */]: "0x0000000000000000000000000000000000000000",
|
|
3519
|
+
["EVM-130" /* UNICHAIN_MAINNET */]: "0x0000000000000000000000000000000000000000"
|
|
3489
3520
|
},
|
|
3490
3521
|
UniswapV3Router: {
|
|
3491
3522
|
["EVM-97" /* BSC_CHAPEL */]: "0x0000000000000000000000000000000000000000",
|
|
3492
3523
|
["EVM-1" /* MAINNET */]: "0x1F98431c8aD98523631AE4a59f267346ea31F984",
|
|
3493
3524
|
["EVM-56" /* BSC_MAINNET */]: "0x0000000000000000000000000000000000000000",
|
|
3494
3525
|
["EVM-42161" /* ARBITRUM_MAINNET */]: "0x0000000000000000000000000000000000000000",
|
|
3495
|
-
["EVM-8453" /* BASE_MAINNET */]: "0x0000000000000000000000000000000000000000"
|
|
3526
|
+
["EVM-8453" /* BASE_MAINNET */]: "0x0000000000000000000000000000000000000000",
|
|
3527
|
+
["EVM-137" /* POLYGON_MAINNET */]: "0x0000000000000000000000000000000000000000",
|
|
3528
|
+
["EVM-130" /* UNICHAIN_MAINNET */]: "0x0000000000000000000000000000000000000000"
|
|
3496
3529
|
},
|
|
3497
3530
|
UniswapV3Factory: {
|
|
3498
3531
|
["EVM-97" /* BSC_CHAPEL */]: "0x0000000000000000000000000000000000000000",
|
|
3499
3532
|
["EVM-1" /* MAINNET */]: "0x1F98431c8aD98523631AE4a59f267346ea31F984",
|
|
3500
3533
|
["EVM-56" /* BSC_MAINNET */]: "0x0000000000000000000000000000000000000000",
|
|
3501
3534
|
["EVM-42161" /* ARBITRUM_MAINNET */]: "0x0000000000000000000000000000000000000000",
|
|
3502
|
-
["EVM-8453" /* BASE_MAINNET */]: "0x0000000000000000000000000000000000000000"
|
|
3535
|
+
["EVM-8453" /* BASE_MAINNET */]: "0x0000000000000000000000000000000000000000",
|
|
3536
|
+
["EVM-137" /* POLYGON_MAINNET */]: "0x0000000000000000000000000000000000000000",
|
|
3537
|
+
["EVM-130" /* UNICHAIN_MAINNET */]: "0x0000000000000000000000000000000000000000"
|
|
3503
3538
|
},
|
|
3504
3539
|
UniswapV3Quoter: {
|
|
3505
3540
|
["EVM-97" /* BSC_CHAPEL */]: "0x0000000000000000000000000000000000000000",
|
|
3506
3541
|
["EVM-1" /* MAINNET */]: "0x61fFE014bA17989E743c5F6cB21bF9697530B21e",
|
|
3507
3542
|
["EVM-56" /* BSC_MAINNET */]: "0x0000000000000000000000000000000000000000",
|
|
3508
3543
|
["EVM-42161" /* ARBITRUM_MAINNET */]: "0x0000000000000000000000000000000000000000",
|
|
3509
|
-
["EVM-8453" /* BASE_MAINNET */]: "0x0000000000000000000000000000000000000000"
|
|
3544
|
+
["EVM-8453" /* BASE_MAINNET */]: "0x0000000000000000000000000000000000000000",
|
|
3545
|
+
["EVM-137" /* POLYGON_MAINNET */]: "0x0000000000000000000000000000000000000000",
|
|
3546
|
+
["EVM-130" /* UNICHAIN_MAINNET */]: "0x0000000000000000000000000000000000000000"
|
|
3510
3547
|
},
|
|
3511
3548
|
UniswapV4PoolManager: {
|
|
3512
3549
|
["EVM-97" /* BSC_CHAPEL */]: "0x0000000000000000000000000000000000000000",
|
|
3513
3550
|
["EVM-1" /* MAINNET */]: "0x0000000000000000000000000000000000000000",
|
|
3514
3551
|
["EVM-56" /* BSC_MAINNET */]: "0x0000000000000000000000000000000000000000",
|
|
3515
3552
|
["EVM-42161" /* ARBITRUM_MAINNET */]: "0x0000000000000000000000000000000000000000",
|
|
3516
|
-
["EVM-8453" /* BASE_MAINNET */]: "0x0000000000000000000000000000000000000000"
|
|
3553
|
+
["EVM-8453" /* BASE_MAINNET */]: "0x0000000000000000000000000000000000000000",
|
|
3554
|
+
["EVM-137" /* POLYGON_MAINNET */]: "0x0000000000000000000000000000000000000000",
|
|
3555
|
+
["EVM-130" /* UNICHAIN_MAINNET */]: "0x0000000000000000000000000000000000000000"
|
|
3517
3556
|
},
|
|
3518
3557
|
UniswapV4Quoter: {
|
|
3519
3558
|
["EVM-97" /* BSC_CHAPEL */]: "0x0000000000000000000000000000000000000000",
|
|
3520
3559
|
["EVM-1" /* MAINNET */]: "0x52f0e24d1c21c8a0cb1e5a5dd6198556bd9e1203",
|
|
3521
3560
|
["EVM-56" /* BSC_MAINNET */]: "0x0000000000000000000000000000000000000000",
|
|
3522
3561
|
["EVM-42161" /* ARBITRUM_MAINNET */]: "0x0000000000000000000000000000000000000000",
|
|
3523
|
-
["EVM-8453" /* BASE_MAINNET */]: "0x0000000000000000000000000000000000000000"
|
|
3562
|
+
["EVM-8453" /* BASE_MAINNET */]: "0x0000000000000000000000000000000000000000",
|
|
3563
|
+
["EVM-137" /* POLYGON_MAINNET */]: "0x0000000000000000000000000000000000000000",
|
|
3564
|
+
["EVM-130" /* UNICHAIN_MAINNET */]: "0x0000000000000000000000000000000000000000"
|
|
3524
3565
|
},
|
|
3525
3566
|
Calldispatcher: {
|
|
3526
3567
|
["EVM-11155111" /* SEPOLIA */]: "0xC7f13b6D03A0A7F3239d38897503E90553ABe155"
|
|
@@ -3534,7 +3575,9 @@ var createRpcUrls = (env2) => ({
|
|
|
3534
3575
|
["EVM-1" /* MAINNET */]: env2.ETH_MAINNET || "https://eth-mainnet.g.alchemy.com/v2/demo",
|
|
3535
3576
|
["EVM-56" /* BSC_MAINNET */]: env2.BSC_MAINNET || "https://binance.llamarpc.com",
|
|
3536
3577
|
["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"
|
|
3578
|
+
["EVM-8453" /* BASE_MAINNET */]: env2.BASE_MAINNET || "https://base-mainnet.public.blastapi.io",
|
|
3579
|
+
["EVM-137" /* POLYGON_MAINNET */]: env2.POLYGON_MAINNET || "https://polygon-bor-rpc.publicnode.com",
|
|
3580
|
+
["EVM-130" /* UNICHAIN_MAINNET */]: env2.UNICHAIN_MAINNET || "https://unichain.api.onfinality.io/public"
|
|
3538
3581
|
});
|
|
3539
3582
|
var consensusStateIds = {
|
|
3540
3583
|
["EVM-97" /* BSC_CHAPEL */]: "BSC0",
|
|
@@ -3544,7 +3587,9 @@ var consensusStateIds = {
|
|
|
3544
3587
|
["EVM-1" /* MAINNET */]: "ETH0",
|
|
3545
3588
|
["EVM-56" /* BSC_MAINNET */]: "BSC0",
|
|
3546
3589
|
["EVM-42161" /* ARBITRUM_MAINNET */]: "ETH0",
|
|
3547
|
-
["EVM-8453" /* BASE_MAINNET */]: "ETH0"
|
|
3590
|
+
["EVM-8453" /* BASE_MAINNET */]: "ETH0",
|
|
3591
|
+
["EVM-137" /* POLYGON_MAINNET */]: "ETH0",
|
|
3592
|
+
["EVM-130" /* UNICHAIN_MAINNET */]: "ETH0"
|
|
3548
3593
|
};
|
|
3549
3594
|
var coingeckoIds = {
|
|
3550
3595
|
["EVM-97" /* BSC_CHAPEL */]: "binance-smart-chain",
|
|
@@ -3554,7 +3599,9 @@ var coingeckoIds = {
|
|
|
3554
3599
|
["EVM-1" /* MAINNET */]: "ethereum",
|
|
3555
3600
|
["EVM-56" /* BSC_MAINNET */]: "binance-smart-chain",
|
|
3556
3601
|
["EVM-42161" /* ARBITRUM_MAINNET */]: "arbitrum-one",
|
|
3557
|
-
["EVM-8453" /* BASE_MAINNET */]: "base"
|
|
3602
|
+
["EVM-8453" /* BASE_MAINNET */]: "base",
|
|
3603
|
+
["EVM-137" /* POLYGON_MAINNET */]: "matic-network",
|
|
3604
|
+
["EVM-130" /* UNICHAIN_MAINNET */]: "ethereum"
|
|
3558
3605
|
};
|
|
3559
3606
|
|
|
3560
3607
|
// src/configs/ChainConfigService.ts
|
|
@@ -4554,6 +4601,14 @@ function adjustFeeDecimals(feeInFeeToken, fromDecimals, toDecimals) {
|
|
|
4554
4601
|
return (feeInFeeToken + scaleFactor - 1n) / scaleFactor;
|
|
4555
4602
|
}
|
|
4556
4603
|
}
|
|
4604
|
+
function replaceWebsocketWithHttp(url) {
|
|
4605
|
+
if (url.startsWith("ws://")) {
|
|
4606
|
+
return url.replace("ws://", "http://");
|
|
4607
|
+
} else if (url.startsWith("wss://")) {
|
|
4608
|
+
return url.replace("wss://", "https://");
|
|
4609
|
+
}
|
|
4610
|
+
return url;
|
|
4611
|
+
}
|
|
4557
4612
|
|
|
4558
4613
|
// src/utils/exceptions.ts
|
|
4559
4614
|
var AbortSignalInternal = class _AbortSignalInternal extends Error {
|
|
@@ -5063,14 +5118,52 @@ function deriveSecondLevelSlot(key, firstLevelSlot) {
|
|
|
5063
5118
|
const combined = new Uint8Array([...keyBytes, ...slotBytes]);
|
|
5064
5119
|
return keccak256(combined);
|
|
5065
5120
|
}
|
|
5121
|
+
var HttpRpcClient = class {
|
|
5122
|
+
constructor(url) {
|
|
5123
|
+
this.url = url;
|
|
5124
|
+
}
|
|
5125
|
+
/**
|
|
5126
|
+
* Make an RPC call over HTTP
|
|
5127
|
+
* @param method - The RPC method name
|
|
5128
|
+
* @param params - The parameters for the RPC call
|
|
5129
|
+
* @returns Promise resolving to the RPC response
|
|
5130
|
+
*/
|
|
5131
|
+
async call(method, params = []) {
|
|
5132
|
+
const body = JSON.stringify({
|
|
5133
|
+
jsonrpc: "2.0",
|
|
5134
|
+
id: Date.now(),
|
|
5135
|
+
method,
|
|
5136
|
+
params
|
|
5137
|
+
});
|
|
5138
|
+
const response = await fetch(this.url, {
|
|
5139
|
+
method: "POST",
|
|
5140
|
+
headers: {
|
|
5141
|
+
"Content-Type": "application/json"
|
|
5142
|
+
},
|
|
5143
|
+
body
|
|
5144
|
+
});
|
|
5145
|
+
if (!response.ok) {
|
|
5146
|
+
throw new Error(`HTTP error! status: ${response.status}`);
|
|
5147
|
+
}
|
|
5148
|
+
const result = await response.json();
|
|
5149
|
+
if (result.error) {
|
|
5150
|
+
throw new Error(`RPC error: ${result.error.message}`);
|
|
5151
|
+
}
|
|
5152
|
+
return result.result;
|
|
5153
|
+
}
|
|
5154
|
+
};
|
|
5066
5155
|
var SubstrateChain = class {
|
|
5067
5156
|
constructor(params) {
|
|
5068
5157
|
this.params = params;
|
|
5158
|
+
const url = this.params.ws;
|
|
5159
|
+
const httpUrl = replaceWebsocketWithHttp(url);
|
|
5160
|
+
this.rpcClient = new HttpRpcClient(httpUrl);
|
|
5069
5161
|
}
|
|
5070
5162
|
/*
|
|
5071
5163
|
* api: The Polkadot API instance for the Substrate chain.
|
|
5072
5164
|
*/
|
|
5073
5165
|
api;
|
|
5166
|
+
rpcClient;
|
|
5074
5167
|
/*
|
|
5075
5168
|
* connect: Connects to the Substrate chain using the provided WebSocket URL.
|
|
5076
5169
|
*/
|
|
@@ -5130,9 +5223,7 @@ var SubstrateChain = class {
|
|
|
5130
5223
|
async queryRequestCommitment(commitment) {
|
|
5131
5224
|
const prefix = toHex(":child_storage:default:ISMP");
|
|
5132
5225
|
const key = this.requestCommitmentKey(commitment);
|
|
5133
|
-
const
|
|
5134
|
-
await rpc.connect(this.params.ws);
|
|
5135
|
-
const item = await rpc.call("childstate_getStorage", [prefix, key]);
|
|
5226
|
+
const item = await this.rpcClient.call("childstate_getStorage", [prefix, key]);
|
|
5136
5227
|
return item;
|
|
5137
5228
|
}
|
|
5138
5229
|
/**
|
|
@@ -5143,9 +5234,7 @@ var SubstrateChain = class {
|
|
|
5143
5234
|
async queryRequestReceipt(commitment) {
|
|
5144
5235
|
const prefix = toHex(":child_storage:default:ISMP");
|
|
5145
5236
|
const key = this.requestReceiptKey(commitment);
|
|
5146
|
-
const
|
|
5147
|
-
await rpc.connect(this.params.ws);
|
|
5148
|
-
const item = await rpc.call("childstate_getStorage", [prefix, key]);
|
|
5237
|
+
const item = await this.rpcClient.call("childstate_getStorage", [prefix, key]);
|
|
5149
5238
|
return item;
|
|
5150
5239
|
}
|
|
5151
5240
|
/**
|
|
@@ -5165,15 +5254,13 @@ var SubstrateChain = class {
|
|
|
5165
5254
|
* @returns {Promise<HexString>} The proof.
|
|
5166
5255
|
*/
|
|
5167
5256
|
async queryProof(message, counterparty, at) {
|
|
5168
|
-
const rpc = new RpcWebSocketClient();
|
|
5169
|
-
await rpc.connect(this.params.ws);
|
|
5170
5257
|
if (isEvmChain(counterparty)) {
|
|
5171
|
-
const proof = await
|
|
5258
|
+
const proof = await this.rpcClient.call("mmr_queryProof", [Number(at), message]);
|
|
5172
5259
|
return toHex(proof.proof);
|
|
5173
5260
|
}
|
|
5174
5261
|
if (isSubstrateChain(counterparty)) {
|
|
5175
5262
|
const childTrieKeys = "Requests" in message ? message.Requests.map(requestCommitmentStorageKey) : message.Responses.map(responseCommitmentStorageKey);
|
|
5176
|
-
const proof = await
|
|
5263
|
+
const proof = await this.rpcClient.call("ismp_queryChildTrieProof", [Number(at), childTrieKeys]);
|
|
5177
5264
|
const basicProof = BasicProof.dec(toHex(proof.proof));
|
|
5178
5265
|
const encoded = SubstrateStateProof.enc({
|
|
5179
5266
|
tag: "OverlayProof",
|
|
@@ -5237,10 +5324,8 @@ var SubstrateChain = class {
|
|
|
5237
5324
|
* @returns The state proof as a hexadecimal string.
|
|
5238
5325
|
*/
|
|
5239
5326
|
async queryStateProof(at, keys) {
|
|
5240
|
-
const rpc = new RpcWebSocketClient();
|
|
5241
|
-
await rpc.connect(this.params.ws);
|
|
5242
5327
|
const encodedKeys = keys.map((key) => Array.from(hexToBytes(key)));
|
|
5243
|
-
const proof = await
|
|
5328
|
+
const proof = await this.rpcClient.call("ismp_queryChildTrieProof", [Number(at), encodedKeys]);
|
|
5244
5329
|
const basicProof = BasicProof.dec(toHex(proof.proof));
|
|
5245
5330
|
const encoded = SubstrateStateProof.enc({
|
|
5246
5331
|
tag: "OverlayProof",
|
|
@@ -5260,9 +5345,16 @@ var SubstrateChain = class {
|
|
|
5260
5345
|
* @returns {Promise<bigint>} The latest state machine height.
|
|
5261
5346
|
*/
|
|
5262
5347
|
async latestStateMachineHeight(stateMachineId) {
|
|
5263
|
-
|
|
5264
|
-
const
|
|
5265
|
-
|
|
5348
|
+
const state_id = convertStateIdToStateMachineId(stateMachineId.stateId);
|
|
5349
|
+
const consensusStateIdToBytes = hexToBytes(stateMachineId.consensusStateId);
|
|
5350
|
+
const decoder = new TextDecoder("utf-8");
|
|
5351
|
+
const decodedConsensusStateId = decoder.decode(consensusStateIdToBytes);
|
|
5352
|
+
const payload = {
|
|
5353
|
+
state_id,
|
|
5354
|
+
consensus_state_id: decodedConsensusStateId
|
|
5355
|
+
};
|
|
5356
|
+
const latestHeight = await this.rpcClient.call("ismp_queryStateMachineLatestHeight", [payload]);
|
|
5357
|
+
return BigInt(latestHeight);
|
|
5266
5358
|
}
|
|
5267
5359
|
/**
|
|
5268
5360
|
* Get the state machine update time for a given state machine height.
|
|
@@ -5270,9 +5362,20 @@ var SubstrateChain = class {
|
|
|
5270
5362
|
* @returns {Promise<bigint>} The statemachine update time in seconds.
|
|
5271
5363
|
*/
|
|
5272
5364
|
async stateMachineUpdateTime(stateMachineHeight) {
|
|
5273
|
-
|
|
5274
|
-
const
|
|
5275
|
-
|
|
5365
|
+
const state_id = convertStateIdToStateMachineId(stateMachineHeight.id.stateId);
|
|
5366
|
+
const consensusStateIdToBytes = hexToBytes(stateMachineHeight.id.consensusStateId);
|
|
5367
|
+
const decoder = new TextDecoder("utf-8");
|
|
5368
|
+
const decodedConsensusStateId = decoder.decode(consensusStateIdToBytes);
|
|
5369
|
+
const stateMachineId = {
|
|
5370
|
+
state_id,
|
|
5371
|
+
consensus_state_id: decodedConsensusStateId
|
|
5372
|
+
};
|
|
5373
|
+
const payload = {
|
|
5374
|
+
id: stateMachineId,
|
|
5375
|
+
height: Number(stateMachineHeight.height)
|
|
5376
|
+
};
|
|
5377
|
+
const updateTime = await this.rpcClient.call("ismp_queryStateMachineUpdateTime", [payload]);
|
|
5378
|
+
return BigInt(updateTime);
|
|
5276
5379
|
}
|
|
5277
5380
|
/**
|
|
5278
5381
|
* Get the challenge period for a given state machine id.
|
|
@@ -5280,9 +5383,16 @@ var SubstrateChain = class {
|
|
|
5280
5383
|
* @returns {Promise<bigint>} The challenge period in seconds.
|
|
5281
5384
|
*/
|
|
5282
5385
|
async challengePeriod(stateMachineId) {
|
|
5283
|
-
|
|
5284
|
-
const
|
|
5285
|
-
|
|
5386
|
+
const state_id = convertStateIdToStateMachineId(stateMachineId.stateId);
|
|
5387
|
+
const consensusStateIdToBytes = hexToBytes(stateMachineId.consensusStateId);
|
|
5388
|
+
const decoder = new TextDecoder("utf-8");
|
|
5389
|
+
const decodedConsensusStateId = decoder.decode(consensusStateIdToBytes);
|
|
5390
|
+
const payload = {
|
|
5391
|
+
state_id,
|
|
5392
|
+
consensus_state_id: decodedConsensusStateId
|
|
5393
|
+
};
|
|
5394
|
+
const challengePeriod = await this.rpcClient.call("ismp_queryChallengePeriod", [payload]);
|
|
5395
|
+
return BigInt(challengePeriod);
|
|
5286
5396
|
}
|
|
5287
5397
|
/**
|
|
5288
5398
|
* Encode an ISMP calldata for a substrate chain.
|
|
@@ -5332,6 +5442,24 @@ function convertStateMachineIdToEnum(id) {
|
|
|
5332
5442
|
}
|
|
5333
5443
|
return { tag, value };
|
|
5334
5444
|
}
|
|
5445
|
+
function convertStateIdToStateMachineId(stateId) {
|
|
5446
|
+
switch (true) {
|
|
5447
|
+
case stateId.Evm !== void 0:
|
|
5448
|
+
return `EVM-${stateId.Evm}`;
|
|
5449
|
+
case stateId.Polkadot !== void 0:
|
|
5450
|
+
return `POLKADOT-${stateId.Polkadot}`;
|
|
5451
|
+
case stateId.Kusama !== void 0:
|
|
5452
|
+
return `KUSAMA-${stateId.Kusama}`;
|
|
5453
|
+
case stateId.Substrate !== void 0: {
|
|
5454
|
+
const bytes = hexToBytes(stateId.Substrate);
|
|
5455
|
+
const decoder = new TextDecoder("utf-8");
|
|
5456
|
+
const decoded = decoder.decode(bytes);
|
|
5457
|
+
return `SUBSTRATE-${decoded}`;
|
|
5458
|
+
}
|
|
5459
|
+
default:
|
|
5460
|
+
throw new Error("Unsupported stateId variant");
|
|
5461
|
+
}
|
|
5462
|
+
}
|
|
5335
5463
|
function convertIPostRequestToCodec(request) {
|
|
5336
5464
|
return {
|
|
5337
5465
|
tag: "Post",
|
|
@@ -11601,13 +11729,6 @@ var IntentGateway = class {
|
|
|
11601
11729
|
this.source = source;
|
|
11602
11730
|
this.dest = dest;
|
|
11603
11731
|
}
|
|
11604
|
-
destStateproofCache = /* @__PURE__ */ new Map();
|
|
11605
|
-
getCachedProof(id) {
|
|
11606
|
-
return this.destStateproofCache.get(id);
|
|
11607
|
-
}
|
|
11608
|
-
clearCachedProof(id) {
|
|
11609
|
-
this.destStateproofCache.delete(id);
|
|
11610
|
-
}
|
|
11611
11732
|
/**
|
|
11612
11733
|
* Estimates the total cost required to fill an order, including gas fees, relayer fees,
|
|
11613
11734
|
* protocol fees, and swap operations.
|
|
@@ -12216,117 +12337,128 @@ var IntentGateway = class {
|
|
|
12216
12337
|
});
|
|
12217
12338
|
return filledStatus !== "0x0000000000000000000000000000000000000000000000000000000000000000";
|
|
12218
12339
|
}
|
|
12219
|
-
async
|
|
12220
|
-
|
|
12221
|
-
|
|
12222
|
-
|
|
12223
|
-
|
|
12340
|
+
async submitAndConfirmReceipt(hyperbridge, commitment, message) {
|
|
12341
|
+
let storageValue = await hyperbridge.queryRequestReceipt(commitment);
|
|
12342
|
+
if (!storageValue) {
|
|
12343
|
+
console.log("No receipt found. Attempting to submit...");
|
|
12344
|
+
try {
|
|
12345
|
+
await hyperbridge.submitUnsigned(message);
|
|
12346
|
+
} catch {
|
|
12347
|
+
console.warn("Submission failed. Awaiting network confirmation...");
|
|
12348
|
+
}
|
|
12349
|
+
console.log("Waiting for network state update...");
|
|
12350
|
+
await sleep(3e4);
|
|
12351
|
+
storageValue = await retryPromise(
|
|
12352
|
+
async () => {
|
|
12353
|
+
const value = await hyperbridge.queryRequestReceipt(commitment);
|
|
12354
|
+
if (!value) throw new Error("Receipt not found");
|
|
12355
|
+
return value;
|
|
12356
|
+
},
|
|
12357
|
+
{ maxRetries: 5, backoffMs: 5e3, logMessage: "Checking for receipt" }
|
|
12358
|
+
);
|
|
12359
|
+
}
|
|
12360
|
+
console.log("Hyperbridge Receipt confirmed.");
|
|
12361
|
+
}
|
|
12362
|
+
async *cancelOrder(order, hyperbridgeConfig, indexerClient, storedData) {
|
|
12363
|
+
const hyperbridge = await getChain({ ...hyperbridgeConfig, hasher: "Keccak" });
|
|
12224
12364
|
const sourceStateMachine = hexToString$1(order.sourceChain);
|
|
12225
12365
|
const destStateMachine = hexToString$1(order.destChain);
|
|
12226
12366
|
const sourceConsensusStateId = this.source.config.getConsensusStateId(sourceStateMachine);
|
|
12227
12367
|
const destConsensusStateId = this.dest.config.getConsensusStateId(destStateMachine);
|
|
12228
|
-
let
|
|
12229
|
-
|
|
12230
|
-
|
|
12231
|
-
|
|
12232
|
-
|
|
12233
|
-
|
|
12234
|
-
|
|
12235
|
-
|
|
12236
|
-
|
|
12237
|
-
|
|
12238
|
-
|
|
12239
|
-
|
|
12240
|
-
|
|
12368
|
+
let destIProof;
|
|
12369
|
+
if (storedData?.destIProof) {
|
|
12370
|
+
destIProof = storedData.destIProof;
|
|
12371
|
+
yield { status: "DESTINATION_FINALIZED", data: { proof: destIProof.proof, height: destIProof.height } };
|
|
12372
|
+
} else {
|
|
12373
|
+
let latestHeight = 0n;
|
|
12374
|
+
let lastFailedHeight = null;
|
|
12375
|
+
let proofHex = null;
|
|
12376
|
+
while (!proofHex) {
|
|
12377
|
+
latestHeight = await retryPromise(
|
|
12378
|
+
() => hyperbridge.latestStateMachineHeight({
|
|
12379
|
+
stateId: parseStateMachineId(destStateMachine).stateId,
|
|
12380
|
+
consensusStateId: destConsensusStateId
|
|
12381
|
+
}),
|
|
12382
|
+
{ maxRetries: 5, backoffMs: 500, logMessage: "Failed to fetch latest state machine height" }
|
|
12383
|
+
);
|
|
12384
|
+
const shouldFetchProof = lastFailedHeight === null ? latestHeight > order.deadline : latestHeight > lastFailedHeight;
|
|
12385
|
+
if (!shouldFetchProof) {
|
|
12386
|
+
yield {
|
|
12387
|
+
status: "AWAITING_DESTINATION_FINALIZED",
|
|
12388
|
+
data: {
|
|
12389
|
+
currentHeight: latestHeight,
|
|
12390
|
+
deadline: order.deadline,
|
|
12391
|
+
...lastFailedHeight && { lastFailedHeight }
|
|
12392
|
+
}
|
|
12393
|
+
};
|
|
12394
|
+
await sleep(1e4);
|
|
12395
|
+
continue;
|
|
12396
|
+
}
|
|
12397
|
+
try {
|
|
12398
|
+
const intentGatewayAddress = this.dest.config.getIntentGatewayAddress(destStateMachine);
|
|
12399
|
+
const orderId = orderCommitment(order);
|
|
12400
|
+
const slotHash = await this.dest.client.readContract({
|
|
12401
|
+
abi: IntentGateway_default.ABI,
|
|
12402
|
+
address: intentGatewayAddress,
|
|
12403
|
+
functionName: "calculateCommitmentSlotHash",
|
|
12404
|
+
args: [orderId]
|
|
12405
|
+
});
|
|
12406
|
+
proofHex = await this.dest.queryStateProof(latestHeight, [slotHash], intentGatewayAddress);
|
|
12407
|
+
} catch (error) {
|
|
12408
|
+
lastFailedHeight = latestHeight;
|
|
12409
|
+
yield {
|
|
12410
|
+
status: "PROOF_FETCH_FAILED",
|
|
12411
|
+
data: {
|
|
12412
|
+
failedHeight: latestHeight,
|
|
12413
|
+
error: error instanceof Error ? error.message : String(error),
|
|
12414
|
+
deadline: order.deadline
|
|
12415
|
+
}
|
|
12416
|
+
};
|
|
12417
|
+
await sleep(1e4);
|
|
12418
|
+
}
|
|
12241
12419
|
}
|
|
12420
|
+
destIProof = {
|
|
12421
|
+
consensusStateId: destConsensusStateId,
|
|
12422
|
+
height: latestHeight,
|
|
12423
|
+
proof: proofHex,
|
|
12424
|
+
stateMachine: destStateMachine
|
|
12425
|
+
};
|
|
12426
|
+
yield { status: "DESTINATION_FINALIZED", data: { proof: destIProof.proof, height: destIProof.height } };
|
|
12242
12427
|
}
|
|
12243
|
-
yield { status: "
|
|
12244
|
-
|
|
12245
|
-
const
|
|
12246
|
-
const
|
|
12247
|
-
|
|
12248
|
-
address: intentGatewayAddress,
|
|
12249
|
-
functionName: "calculateCommitmentSlotHash",
|
|
12250
|
-
args: [orderId]
|
|
12251
|
-
});
|
|
12252
|
-
const proof = await this.dest.queryStateProof(latestHeight, [slotHash], intentGatewayAddress);
|
|
12253
|
-
const destIProof = {
|
|
12254
|
-
consensusStateId: destConsensusStateId,
|
|
12255
|
-
height: latestHeight,
|
|
12256
|
-
proof,
|
|
12257
|
-
stateMachine: destStateMachine
|
|
12258
|
-
};
|
|
12259
|
-
this.destStateproofCache.set(order.id, destIProof);
|
|
12260
|
-
yield { status: "STATE_PROOF_RECEIVED", data: { proof, height: latestHeight } };
|
|
12261
|
-
const getRequest = yield { status: "AWAITING_GET_REQUEST" };
|
|
12262
|
-
if (!getRequest) {
|
|
12263
|
-
throw new Error("[Cancel Order]: Get Request not provided");
|
|
12264
|
-
}
|
|
12265
|
-
const commitment = getRequestCommitment({
|
|
12266
|
-
...getRequest,
|
|
12267
|
-
keys: [...getRequest.keys]
|
|
12268
|
-
});
|
|
12269
|
-
const statusStream = indexerClient.getRequestStatusStream(commitment);
|
|
12270
|
-
for await (const statusUpdate of statusStream) {
|
|
12428
|
+
const getRequest = storedData?.getRequest ?? (yield { status: "AWAITING_GET_REQUEST" });
|
|
12429
|
+
if (!getRequest) throw new Error("[Cancel Order]: Get Request not provided");
|
|
12430
|
+
const commitment = getRequestCommitment({ ...getRequest, keys: [...getRequest.keys] });
|
|
12431
|
+
const sourceStatusStream = indexerClient.getRequestStatusStream(commitment);
|
|
12432
|
+
for await (const statusUpdate of sourceStatusStream) {
|
|
12271
12433
|
if (statusUpdate.status === RequestStatus.SOURCE_FINALIZED) {
|
|
12272
|
-
const sourceHeight = statusUpdate.metadata.blockNumber;
|
|
12273
|
-
const
|
|
12434
|
+
const sourceHeight = BigInt(statusUpdate.metadata.blockNumber);
|
|
12435
|
+
const proof = await this.source.queryProof(
|
|
12274
12436
|
{ Requests: [commitment] },
|
|
12275
12437
|
hyperbridgeConfig.stateMachineId,
|
|
12276
|
-
|
|
12438
|
+
sourceHeight
|
|
12277
12439
|
);
|
|
12278
|
-
const { stateId } = parseStateMachineId(sourceStateMachine);
|
|
12279
12440
|
const sourceIProof = {
|
|
12280
|
-
height:
|
|
12441
|
+
height: sourceHeight,
|
|
12281
12442
|
stateMachine: sourceStateMachine,
|
|
12282
12443
|
consensusStateId: sourceConsensusStateId,
|
|
12283
|
-
proof
|
|
12444
|
+
proof
|
|
12284
12445
|
};
|
|
12446
|
+
yield { status: "SOURCE_PROOF_RECEIVED", data: sourceIProof };
|
|
12285
12447
|
const getRequestMessage = {
|
|
12286
12448
|
kind: "GetRequest",
|
|
12287
12449
|
requests: [getRequest],
|
|
12288
12450
|
source: sourceIProof,
|
|
12289
|
-
response:
|
|
12451
|
+
response: destIProof,
|
|
12290
12452
|
signer: pad("0x")
|
|
12291
12453
|
};
|
|
12292
12454
|
await waitForChallengePeriod(hyperbridge, {
|
|
12293
|
-
height:
|
|
12455
|
+
height: sourceHeight,
|
|
12294
12456
|
id: {
|
|
12295
|
-
stateId,
|
|
12457
|
+
stateId: parseStateMachineId(sourceStateMachine).stateId,
|
|
12296
12458
|
consensusStateId: sourceConsensusStateId
|
|
12297
12459
|
}
|
|
12298
12460
|
});
|
|
12299
|
-
|
|
12300
|
-
const { api } = hyperbridge;
|
|
12301
|
-
if (!api) {
|
|
12302
|
-
throw new Error("Hyperbridge API is not available");
|
|
12303
|
-
}
|
|
12304
|
-
let storageValue = await api.rpc.childstate.getStorage(":child_storage:default:ISMP", receiptKey);
|
|
12305
|
-
if (storageValue.isNone) {
|
|
12306
|
-
console.log("No receipt found. Attempting to submit...");
|
|
12307
|
-
try {
|
|
12308
|
-
await hyperbridge.submitUnsigned(getRequestMessage);
|
|
12309
|
-
} catch {
|
|
12310
|
-
console.warn("Submission failed. Awaiting network confirmation...");
|
|
12311
|
-
}
|
|
12312
|
-
console.log("Waiting for network state update...");
|
|
12313
|
-
await sleep(3e4);
|
|
12314
|
-
storageValue = await retryPromise(
|
|
12315
|
-
async () => {
|
|
12316
|
-
const value = await api.rpc.childstate.getStorage(":child_storage:default:ISMP", receiptKey);
|
|
12317
|
-
if (value.isNone) {
|
|
12318
|
-
throw new Error("Receipt not found");
|
|
12319
|
-
}
|
|
12320
|
-
return value;
|
|
12321
|
-
},
|
|
12322
|
-
{
|
|
12323
|
-
maxRetries: 10,
|
|
12324
|
-
backoffMs: 5e3,
|
|
12325
|
-
logMessage: "Checking for receipt"
|
|
12326
|
-
}
|
|
12327
|
-
);
|
|
12328
|
-
}
|
|
12329
|
-
console.log("Receipt confirmed on Hyperbridge. Proceeding.");
|
|
12461
|
+
await this.submitAndConfirmReceipt(hyperbridge, commitment, getRequestMessage);
|
|
12330
12462
|
}
|
|
12331
12463
|
yield statusUpdate;
|
|
12332
12464
|
}
|
|
@@ -12702,6 +12834,6 @@ async function teleportDot(param_) {
|
|
|
12702
12834
|
return stream;
|
|
12703
12835
|
}
|
|
12704
12836
|
|
|
12705
|
-
export { ADDRESS_ZERO, ChainConfigService, Chains, DEFAULT_ADDRESS, DEFAULT_GRAFFITI, DUMMY_PRIVATE_KEY, ERC20Method, EvmChain, HyperClientStatus, IndexerClient, IntentGateway, OrderStatus, REQUEST_COMMITMENTS_SLOT, REQUEST_RECEIPTS_SLOT, RESPONSE_COMMITMENTS_SLOT, RESPONSE_RECEIPTS_SLOT, RequestKind, RequestStatus, STATE_COMMITMENTS_SLOT, SubstrateChain, TeleportStatus, TimeoutStatus, WrappedNativeDecimals, __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 };
|
|
12837
|
+
export { ADDRESS_ZERO, ChainConfigService, Chains, DEFAULT_ADDRESS, DEFAULT_GRAFFITI, DUMMY_PRIVATE_KEY, ERC20Method, EvmChain, HyperClientStatus, IndexerClient, IntentGateway, OrderStatus, REQUEST_COMMITMENTS_SLOT, REQUEST_RECEIPTS_SLOT, RESPONSE_COMMITMENTS_SLOT, RESPONSE_RECEIPTS_SLOT, RequestKind, RequestStatus, STATE_COMMITMENTS_SLOT, SubstrateChain, TeleportStatus, TimeoutStatus, WrappedNativeDecimals, __test, addresses, adjustFeeDecimals, assets, bytes20ToBytes32, bytes32ToBytes20, chainIds, coingeckoIds, consensusStateIds, constructRedeemEscrowRequestBody, convertStateIdToStateMachineId, convertStateMachineIdToEnum, createQueryClient, createRpcUrls, encodeISMPMessage, estimateGasForPost, fetchPrice, generateRootWithProof, getChain, getRequestCommitment, getStateCommitmentFieldSlot, getStateCommitmentSlot, getStorageSlot, hexToString, orderCommitment, postRequestCommitment, queryAssetTeleported, queryGetRequest, queryPostRequest, teleport, teleportDot, viemChains };
|
|
12706
12838
|
//# sourceMappingURL=index.js.map
|
|
12707
12839
|
//# sourceMappingURL=index.js.map
|