@hyperbridge/sdk 1.3.6 → 1.3.8-canary-0000001
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 +19 -19
- package/dist/browser/index.js +114 -105
- package/dist/browser/index.js.map +1 -1
- package/dist/node/index.d.ts +19 -19
- package/dist/node/index.js +117 -108
- package/dist/node/index.js.map +1 -1
- package/package.json +1 -1
package/dist/node/index.d.ts
CHANGED
|
@@ -984,14 +984,12 @@ interface AssetTeleported {
|
|
|
984
984
|
to: string;
|
|
985
985
|
amount: bigint;
|
|
986
986
|
dest: string;
|
|
987
|
-
commitment:
|
|
987
|
+
commitment: HexString;
|
|
988
988
|
createdAt: Date;
|
|
989
989
|
blockNumber: number;
|
|
990
990
|
}
|
|
991
991
|
interface AssetTeleportedResponse {
|
|
992
|
-
|
|
993
|
-
nodes: AssetTeleported[];
|
|
994
|
-
};
|
|
992
|
+
assetTeleported: AssetTeleported;
|
|
995
993
|
}
|
|
996
994
|
interface StateMachineIdParams {
|
|
997
995
|
stateId: {
|
|
@@ -2445,14 +2443,6 @@ declare class IndexerClient {
|
|
|
2445
2443
|
* @returns AsyncGenerator that emits status updates until a terminal state is reached
|
|
2446
2444
|
*/
|
|
2447
2445
|
postRequestTimeoutStreamInternal(hash: HexString, signal: AbortSignal): AsyncGenerator<PostRequestTimeoutStatus, void>;
|
|
2448
|
-
/**
|
|
2449
|
-
* Query for asset teleported events by sender, recipient, and destination chain
|
|
2450
|
-
* @param from - The sender address
|
|
2451
|
-
* @param to - The recipient address
|
|
2452
|
-
* @param dest - The destination chain ID
|
|
2453
|
-
* @returns The asset teleported event if found, undefined otherwise
|
|
2454
|
-
*/
|
|
2455
|
-
queryAssetTeleported(from: string, to: string, dest: string, blockNumber: number): Promise<AssetTeleported | undefined>;
|
|
2456
2446
|
/**
|
|
2457
2447
|
* Executes an async operation with exponential backoff retry
|
|
2458
2448
|
* @param operation - Async function to execute
|
|
@@ -2549,6 +2539,15 @@ declare function queryPostRequest(params: {
|
|
|
2549
2539
|
commitmentHash: string;
|
|
2550
2540
|
queryClient: IndexerQueryClient;
|
|
2551
2541
|
}): Promise<PostRequestWithStatus | undefined>;
|
|
2542
|
+
/**
|
|
2543
|
+
* Query for asset teleported events by sender, recipient, and destination chain
|
|
2544
|
+
* @param id - Encoded Message Id
|
|
2545
|
+
* @returns The asset teleported event if found, undefined otherwise
|
|
2546
|
+
*/
|
|
2547
|
+
declare function queryAssetTeleported(params: {
|
|
2548
|
+
id: HexString;
|
|
2549
|
+
queryClient: IndexerQueryClient;
|
|
2550
|
+
}): Promise<AssetTeleported | undefined>;
|
|
2552
2551
|
/**
|
|
2553
2552
|
* Queries a GET Request by CommitmentHash
|
|
2554
2553
|
*
|
|
@@ -2678,14 +2677,17 @@ declare class IntentGateway {
|
|
|
2678
2677
|
type HyperbridgeTxEvents = {
|
|
2679
2678
|
kind: "Ready";
|
|
2680
2679
|
transaction_hash: HexString;
|
|
2680
|
+
message_id?: HexString;
|
|
2681
2681
|
} | {
|
|
2682
2682
|
kind: "Dispatched";
|
|
2683
2683
|
transaction_hash: HexString;
|
|
2684
2684
|
block_number: bigint;
|
|
2685
|
+
message_id?: HexString;
|
|
2685
2686
|
commitment: HexString;
|
|
2686
2687
|
} | {
|
|
2687
2688
|
kind: "Finalized";
|
|
2688
2689
|
transaction_hash: HexString;
|
|
2690
|
+
message_id?: HexString;
|
|
2689
2691
|
block_number?: bigint;
|
|
2690
2692
|
commitment?: HexString;
|
|
2691
2693
|
} | {
|
|
@@ -2737,8 +2739,8 @@ type XcmGatewayParams = {
|
|
|
2737
2739
|
* Note: There is no guarantee that both Dispatched and Finalized events will be yielded.
|
|
2738
2740
|
* Consumers should listen for either one of these events instead of expecting both.
|
|
2739
2741
|
*
|
|
2740
|
-
* @param
|
|
2741
|
-
* @param
|
|
2742
|
+
* @param sourceApi - Polkadot API instance connected to the relay chain
|
|
2743
|
+
* @param sourceIsAssetHub - If `true` uses AssetHub Network for teleport
|
|
2742
2744
|
* @param who - Sender's SS58Address address
|
|
2743
2745
|
* @param options - Transaction signing options
|
|
2744
2746
|
* @param params - Teleport parameters including destination, recipient, and amount
|
|
@@ -2747,12 +2749,10 @@ type XcmGatewayParams = {
|
|
|
2747
2749
|
* @yields {HyperbridgeTxEvents} Stream of events indicating transaction status
|
|
2748
2750
|
*/
|
|
2749
2751
|
declare function teleportDot(param_: {
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
+
sourceApi: ApiPromise;
|
|
2753
|
+
sourceIsAssetHub: boolean;
|
|
2752
2754
|
who: string;
|
|
2753
2755
|
xcmGatewayParams: XcmGatewayParams;
|
|
2754
|
-
indexerClient: IndexerClient;
|
|
2755
|
-
pollInterval?: number;
|
|
2756
2756
|
options: Partial<SignerOptions>;
|
|
2757
2757
|
}): Promise<ReadableStream<HyperbridgeTxEvents>>;
|
|
2758
2758
|
|
|
@@ -2934,4 +2934,4 @@ declare const coingeckoIds: {
|
|
|
2934
2934
|
"EVM-8453": string;
|
|
2935
2935
|
};
|
|
2936
2936
|
|
|
2937
|
-
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, queryGetRequest, queryPostRequest, teleport, teleportDot, viemChains };
|
|
2937
|
+
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/node/index.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { readFileSync } from 'fs';
|
|
2
|
-
import { join } from 'path';
|
|
3
|
-
import { TextDecoder as TextDecoder$1, TextEncoder as TextEncoder$1 } from 'util';
|
|
1
|
+
import { readFileSync } from 'node:fs';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
import { TextDecoder as TextDecoder$1, TextEncoder as TextEncoder$1 } from 'node:util';
|
|
4
4
|
import { createConsola, LogLevels } from 'consola';
|
|
5
5
|
import { flatten, zip, capitalize, maxBy, isNil } from 'lodash-es';
|
|
6
6
|
import { toHex, hexToBytes, encodePacked, keccak256, encodeAbiParameters, bytesToHex, concatHex, createPublicClient, http, encodeFunctionData, erc20Abi, bytesToBigInt, pad, toBytes, maxUint256, formatUnits, parseUnits } from 'viem';
|
|
7
7
|
import mergeRace from '@async-generator/merge-race';
|
|
8
8
|
import { gnosisChiado, gnosis, bscTestnet, bsc, soneium, baseSepolia, base, optimismSepolia, optimism, arbitrumSepolia, arbitrum, mainnet, sepolia } from 'viem/chains';
|
|
9
9
|
import { hasWindow, isNode, env } from 'std-env';
|
|
10
|
-
import { Vector, u8, Struct, Tuple, Enum, _void, u64, u32, Option, bool, u128 } from 'scale-ts';
|
|
10
|
+
import { Vector, u8, Struct, Tuple, Enum, _void, u64, u32, Option, bool, u128, Bytes } from 'scale-ts';
|
|
11
11
|
import { match } from 'ts-pattern';
|
|
12
12
|
import { WsProvider, ApiPromise } from '@polkadot/api';
|
|
13
13
|
import { RpcWebSocketClient } from 'rpc-websocket-client';
|
|
14
|
-
import { keccakAsU8a, decodeAddress, xxhashAsU8a } from '@polkadot/util-crypto';
|
|
14
|
+
import { keccakAsU8a, decodeAddress, keccakAsHex, xxhashAsU8a } from '@polkadot/util-crypto';
|
|
15
15
|
import { GraphQLClient } from 'graphql-request';
|
|
16
16
|
import { Decimal } from 'decimal.js';
|
|
17
|
-
import { u8aToHex } from '@polkadot/util';
|
|
17
|
+
import { hexToU8a, u8aToHex } from '@polkadot/util';
|
|
18
18
|
|
|
19
19
|
var __defProp = Object.defineProperty;
|
|
20
20
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
@@ -5528,20 +5528,8 @@ query StateMachineUpdatesByTimestamp($statemachineId: String!, $commitmentTimest
|
|
|
5528
5528
|
}
|
|
5529
5529
|
`;
|
|
5530
5530
|
var ASSET_TELEPORTED_BY_PARAMS = `
|
|
5531
|
-
query AssetTeleportedByParams($
|
|
5532
|
-
|
|
5533
|
-
filter: {
|
|
5534
|
-
and: [
|
|
5535
|
-
{ from: { equalTo: $from } }
|
|
5536
|
-
{ to: { equalTo: $to } }
|
|
5537
|
-
{ dest: { includes: $dest } }
|
|
5538
|
-
{ blockNumber: { greaterThanOrEqualTo: $blockNumber } }
|
|
5539
|
-
]
|
|
5540
|
-
}
|
|
5541
|
-
orderBy: CREATED_AT_DESC
|
|
5542
|
-
first: 1
|
|
5543
|
-
) {
|
|
5544
|
-
nodes {
|
|
5531
|
+
query AssetTeleportedByParams($id: String!) {
|
|
5532
|
+
assetTeleported(id: $id) {
|
|
5545
5533
|
id
|
|
5546
5534
|
from
|
|
5547
5535
|
to
|
|
@@ -5550,7 +5538,6 @@ query AssetTeleportedByParams($from: String!, $to: String!, $dest: String!, $blo
|
|
|
5550
5538
|
commitment
|
|
5551
5539
|
createdAt
|
|
5552
5540
|
blockNumber
|
|
5553
|
-
}
|
|
5554
5541
|
}
|
|
5555
5542
|
}
|
|
5556
5543
|
`;
|
|
@@ -5644,6 +5631,18 @@ function createQueryClient(config) {
|
|
|
5644
5631
|
function queryPostRequest(params) {
|
|
5645
5632
|
return _queryRequestInternal(params);
|
|
5646
5633
|
}
|
|
5634
|
+
async function queryAssetTeleported(params) {
|
|
5635
|
+
const { id, queryClient } = params;
|
|
5636
|
+
while (true) {
|
|
5637
|
+
const response = await queryClient.request(ASSET_TELEPORTED_BY_PARAMS, {
|
|
5638
|
+
id
|
|
5639
|
+
});
|
|
5640
|
+
if (response?.assetTeleported) {
|
|
5641
|
+
return response.assetTeleported;
|
|
5642
|
+
}
|
|
5643
|
+
await sleep(2e3);
|
|
5644
|
+
}
|
|
5645
|
+
}
|
|
5647
5646
|
function queryGetRequest(params) {
|
|
5648
5647
|
return _queryGetRequestInternal(params);
|
|
5649
5648
|
}
|
|
@@ -6986,24 +6985,6 @@ var IndexerClient = class {
|
|
|
6986
6985
|
}
|
|
6987
6986
|
}
|
|
6988
6987
|
}
|
|
6989
|
-
/**
|
|
6990
|
-
* Query for asset teleported events by sender, recipient, and destination chain
|
|
6991
|
-
* @param from - The sender address
|
|
6992
|
-
* @param to - The recipient address
|
|
6993
|
-
* @param dest - The destination chain ID
|
|
6994
|
-
* @returns The asset teleported event if found, undefined otherwise
|
|
6995
|
-
*/
|
|
6996
|
-
async queryAssetTeleported(from, to, dest, blockNumber) {
|
|
6997
|
-
const response = await this.withRetry(
|
|
6998
|
-
() => this.client.request(ASSET_TELEPORTED_BY_PARAMS, {
|
|
6999
|
-
from,
|
|
7000
|
-
to,
|
|
7001
|
-
dest,
|
|
7002
|
-
blockNumber
|
|
7003
|
-
})
|
|
7004
|
-
);
|
|
7005
|
-
return response.assetTeleporteds.nodes[0];
|
|
7006
|
-
}
|
|
7007
6988
|
/**
|
|
7008
6989
|
* Executes an async operation with exponential backoff retry
|
|
7009
6990
|
* @param operation - Async function to execute
|
|
@@ -11627,7 +11608,7 @@ var IntentGateway = class {
|
|
|
11627
11608
|
}
|
|
11628
11609
|
})
|
|
11629
11610
|
).then((results) => results.filter(Boolean));
|
|
11630
|
-
|
|
11611
|
+
const stateOverrides = [
|
|
11631
11612
|
// Mock address with ETH balance so that any chain estimation runs
|
|
11632
11613
|
// even when the address doesn't hold any native token in that chain
|
|
11633
11614
|
{
|
|
@@ -12158,7 +12139,7 @@ var IntentGateway = class {
|
|
|
12158
12139
|
*/
|
|
12159
12140
|
async isOrderFilled(order) {
|
|
12160
12141
|
const intentGatewayAddress = this.source.config.getIntentGatewayAddress(order.destChain);
|
|
12161
|
-
|
|
12142
|
+
const filledSlot = await this.dest.client.readContract({
|
|
12162
12143
|
abi: IntentGateway_default.ABI,
|
|
12163
12144
|
address: intentGatewayAddress,
|
|
12164
12145
|
functionName: "calculateCommitmentSlotHash",
|
|
@@ -12358,24 +12339,30 @@ function readIsmpCommitmentHash(events) {
|
|
|
12358
12339
|
}
|
|
12359
12340
|
}
|
|
12360
12341
|
}
|
|
12342
|
+
var MultiAccount = Struct({
|
|
12343
|
+
substrate_account: Bytes(32),
|
|
12344
|
+
evm_account: Bytes(20),
|
|
12345
|
+
dest_state_machine: StateMachine,
|
|
12346
|
+
timeout: u64,
|
|
12347
|
+
account_nonce: u64
|
|
12348
|
+
});
|
|
12361
12349
|
var DECIMALS = 10;
|
|
12362
12350
|
async function teleportDot(param_) {
|
|
12363
|
-
const {
|
|
12364
|
-
const
|
|
12365
|
-
|
|
12366
|
-
|
|
12367
|
-
|
|
12368
|
-
|
|
12369
|
-
|
|
12370
|
-
|
|
12371
|
-
|
|
12372
|
-
|
|
12373
|
-
};
|
|
12351
|
+
const { sourceApi, sourceIsAssetHub, who, options, xcmGatewayParams: params } = param_;
|
|
12352
|
+
const { nonce: accountNonce } = await sourceApi.query.system.account(who);
|
|
12353
|
+
const encoded_message = MultiAccount.enc({
|
|
12354
|
+
substrate_account: decodeAddress(who),
|
|
12355
|
+
evm_account: hexToU8a(params.recipient),
|
|
12356
|
+
dest_state_machine: { tag: "Evm", value: params.destination },
|
|
12357
|
+
timeout: params.timeout,
|
|
12358
|
+
account_nonce: accountNonce
|
|
12359
|
+
});
|
|
12360
|
+
const message_id = keccakAsHex(encoded_message);
|
|
12374
12361
|
const beneficiary = {
|
|
12375
12362
|
V3: {
|
|
12376
12363
|
parents: 0,
|
|
12377
12364
|
interior: {
|
|
12378
|
-
|
|
12365
|
+
X4: [
|
|
12379
12366
|
{
|
|
12380
12367
|
AccountId32: {
|
|
12381
12368
|
id: u8aToHex(decodeAddress(who)),
|
|
@@ -12394,37 +12381,89 @@ async function teleportDot(param_) {
|
|
|
12394
12381
|
},
|
|
12395
12382
|
{
|
|
12396
12383
|
GeneralIndex: params.timeout
|
|
12384
|
+
},
|
|
12385
|
+
{
|
|
12386
|
+
GeneralIndex: accountNonce
|
|
12397
12387
|
}
|
|
12398
12388
|
]
|
|
12399
12389
|
}
|
|
12400
12390
|
}
|
|
12401
12391
|
};
|
|
12402
|
-
|
|
12403
|
-
|
|
12404
|
-
|
|
12405
|
-
|
|
12406
|
-
|
|
12407
|
-
|
|
12408
|
-
|
|
12392
|
+
let assets2;
|
|
12393
|
+
let destination;
|
|
12394
|
+
if (sourceIsAssetHub) {
|
|
12395
|
+
destination = {
|
|
12396
|
+
V3: {
|
|
12397
|
+
parents: 1,
|
|
12398
|
+
interior: {
|
|
12399
|
+
X1: {
|
|
12400
|
+
Parachain: params.paraId
|
|
12409
12401
|
}
|
|
12410
|
-
},
|
|
12411
|
-
fun: {
|
|
12412
|
-
Fungible: parseUnits(params.amount.toString(), DECIMALS)
|
|
12413
12402
|
}
|
|
12414
12403
|
}
|
|
12415
|
-
|
|
12416
|
-
|
|
12404
|
+
};
|
|
12405
|
+
assets2 = {
|
|
12406
|
+
V3: [
|
|
12407
|
+
{
|
|
12408
|
+
id: {
|
|
12409
|
+
Concrete: {
|
|
12410
|
+
parents: 1,
|
|
12411
|
+
interior: "Here"
|
|
12412
|
+
}
|
|
12413
|
+
},
|
|
12414
|
+
fun: {
|
|
12415
|
+
Fungible: parseUnits(params.amount.toString(), DECIMALS)
|
|
12416
|
+
}
|
|
12417
|
+
}
|
|
12418
|
+
]
|
|
12419
|
+
};
|
|
12420
|
+
} else {
|
|
12421
|
+
destination = {
|
|
12422
|
+
V3: {
|
|
12423
|
+
parents: 0,
|
|
12424
|
+
interior: {
|
|
12425
|
+
X1: {
|
|
12426
|
+
Parachain: params.paraId
|
|
12427
|
+
}
|
|
12428
|
+
}
|
|
12429
|
+
}
|
|
12430
|
+
};
|
|
12431
|
+
assets2 = {
|
|
12432
|
+
V3: [
|
|
12433
|
+
{
|
|
12434
|
+
id: {
|
|
12435
|
+
Concrete: {
|
|
12436
|
+
parents: 0,
|
|
12437
|
+
interior: "Here"
|
|
12438
|
+
}
|
|
12439
|
+
},
|
|
12440
|
+
fun: {
|
|
12441
|
+
Fungible: parseUnits(params.amount.toString(), DECIMALS)
|
|
12442
|
+
}
|
|
12443
|
+
}
|
|
12444
|
+
]
|
|
12445
|
+
};
|
|
12446
|
+
}
|
|
12417
12447
|
const feeAssetItem = 0;
|
|
12418
12448
|
const weightLimit = "Unlimited";
|
|
12419
|
-
|
|
12420
|
-
|
|
12421
|
-
|
|
12422
|
-
|
|
12423
|
-
|
|
12424
|
-
|
|
12425
|
-
|
|
12426
|
-
|
|
12427
|
-
|
|
12449
|
+
let tx;
|
|
12450
|
+
if (sourceIsAssetHub) {
|
|
12451
|
+
tx = sourceApi.tx.polkadotXcm.limitedReserveTransferAssets(
|
|
12452
|
+
destination,
|
|
12453
|
+
beneficiary,
|
|
12454
|
+
assets2,
|
|
12455
|
+
feeAssetItem,
|
|
12456
|
+
weightLimit
|
|
12457
|
+
);
|
|
12458
|
+
} else {
|
|
12459
|
+
tx = sourceApi.tx.xcmPallet.limitedReserveTransferAssets(
|
|
12460
|
+
destination,
|
|
12461
|
+
beneficiary,
|
|
12462
|
+
assets2,
|
|
12463
|
+
feeAssetItem,
|
|
12464
|
+
weightLimit
|
|
12465
|
+
);
|
|
12466
|
+
}
|
|
12428
12467
|
let closed = false;
|
|
12429
12468
|
let unsubscribe;
|
|
12430
12469
|
const stream = new ReadableStream(
|
|
@@ -12446,44 +12485,14 @@ async function teleportDot(param_) {
|
|
|
12446
12485
|
if (status.isReady) {
|
|
12447
12486
|
controller.enqueue({
|
|
12448
12487
|
kind: "Ready",
|
|
12449
|
-
transaction_hash: txHash.toHex()
|
|
12488
|
+
transaction_hash: txHash.toHex(),
|
|
12489
|
+
message_id
|
|
12450
12490
|
});
|
|
12451
12491
|
} else if (status.isInBlock || status.isFinalized) {
|
|
12452
|
-
const decodedWho = u8aToHex(decodeAddress(who, false));
|
|
12453
|
-
let assetTeleported = void 0;
|
|
12454
|
-
let attempts = 0;
|
|
12455
|
-
const maxAttempts = Math.ceil(3e5 / pollInterval);
|
|
12456
|
-
if (!indexerClient) {
|
|
12457
|
-
controller.enqueue({
|
|
12458
|
-
kind: "Error",
|
|
12459
|
-
error: "IndexerClient is required but not provided"
|
|
12460
|
-
});
|
|
12461
|
-
return;
|
|
12462
|
-
}
|
|
12463
|
-
while (!assetTeleported && attempts < maxAttempts) {
|
|
12464
|
-
await sleep(pollInterval);
|
|
12465
|
-
assetTeleported = await indexerClient.queryAssetTeleported(
|
|
12466
|
-
decodedWho,
|
|
12467
|
-
params.recipient.toLowerCase(),
|
|
12468
|
-
params.destination.toString(),
|
|
12469
|
-
hyperbridgeBlock
|
|
12470
|
-
);
|
|
12471
|
-
attempts++;
|
|
12472
|
-
}
|
|
12473
|
-
if (!assetTeleported) {
|
|
12474
|
-
controller.enqueue({
|
|
12475
|
-
kind: "Error",
|
|
12476
|
-
error: "Failed to locate AssetTeleported event in the indexer after maximum attempts"
|
|
12477
|
-
});
|
|
12478
|
-
return;
|
|
12479
|
-
}
|
|
12480
|
-
const commitment = assetTeleported.commitment;
|
|
12481
|
-
const blockNumber = BigInt(assetTeleported.blockNumber);
|
|
12482
12492
|
controller.enqueue({
|
|
12483
12493
|
kind: "Finalized",
|
|
12484
12494
|
transaction_hash: txHash.toHex(),
|
|
12485
|
-
|
|
12486
|
-
commitment
|
|
12495
|
+
message_id
|
|
12487
12496
|
});
|
|
12488
12497
|
closed = true;
|
|
12489
12498
|
unsubscribe?.();
|
|
@@ -12513,6 +12522,6 @@ async function teleportDot(param_) {
|
|
|
12513
12522
|
return stream;
|
|
12514
12523
|
}
|
|
12515
12524
|
|
|
12516
|
-
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, queryGetRequest, queryPostRequest, teleport, teleportDot, viemChains };
|
|
12525
|
+
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 };
|
|
12517
12526
|
//# sourceMappingURL=index.js.map
|
|
12518
12527
|
//# sourceMappingURL=index.js.map
|