@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/browser/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/browser/index.js
CHANGED
|
@@ -4,14 +4,14 @@ import { toHex, hexToBytes, encodePacked, keccak256, encodeAbiParameters, bytesT
|
|
|
4
4
|
import mergeRace from '@async-generator/merge-race';
|
|
5
5
|
import { gnosisChiado, gnosis, bscTestnet, bsc, soneium, baseSepolia, base, optimismSepolia, optimism, arbitrumSepolia, arbitrum, mainnet, sepolia } from 'viem/chains';
|
|
6
6
|
import { hasWindow, isNode, env } from 'std-env';
|
|
7
|
-
import { Vector, u8, Struct, Tuple, Enum, _void, u64, u32, Option, bool, u128 } from 'scale-ts';
|
|
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
10
|
import { RpcWebSocketClient } from 'rpc-websocket-client';
|
|
11
|
-
import { keccakAsU8a, decodeAddress, xxhashAsU8a } from '@polkadot/util-crypto';
|
|
11
|
+
import { keccakAsU8a, decodeAddress, keccakAsHex, xxhashAsU8a } from '@polkadot/util-crypto';
|
|
12
12
|
import { GraphQLClient } from 'graphql-request';
|
|
13
13
|
import { Decimal } from 'decimal.js';
|
|
14
|
-
import { u8aToHex } from '@polkadot/util';
|
|
14
|
+
import { hexToU8a, u8aToHex } from '@polkadot/util';
|
|
15
15
|
|
|
16
16
|
var __defProp = Object.defineProperty;
|
|
17
17
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
@@ -5577,20 +5577,8 @@ query StateMachineUpdatesByTimestamp($statemachineId: String!, $commitmentTimest
|
|
|
5577
5577
|
}
|
|
5578
5578
|
`;
|
|
5579
5579
|
var ASSET_TELEPORTED_BY_PARAMS = `
|
|
5580
|
-
query AssetTeleportedByParams($
|
|
5581
|
-
|
|
5582
|
-
filter: {
|
|
5583
|
-
and: [
|
|
5584
|
-
{ from: { equalTo: $from } }
|
|
5585
|
-
{ to: { equalTo: $to } }
|
|
5586
|
-
{ dest: { includes: $dest } }
|
|
5587
|
-
{ blockNumber: { greaterThanOrEqualTo: $blockNumber } }
|
|
5588
|
-
]
|
|
5589
|
-
}
|
|
5590
|
-
orderBy: CREATED_AT_DESC
|
|
5591
|
-
first: 1
|
|
5592
|
-
) {
|
|
5593
|
-
nodes {
|
|
5580
|
+
query AssetTeleportedByParams($id: String!) {
|
|
5581
|
+
assetTeleported(id: $id) {
|
|
5594
5582
|
id
|
|
5595
5583
|
from
|
|
5596
5584
|
to
|
|
@@ -5599,7 +5587,6 @@ query AssetTeleportedByParams($from: String!, $to: String!, $dest: String!, $blo
|
|
|
5599
5587
|
commitment
|
|
5600
5588
|
createdAt
|
|
5601
5589
|
blockNumber
|
|
5602
|
-
}
|
|
5603
5590
|
}
|
|
5604
5591
|
}
|
|
5605
5592
|
`;
|
|
@@ -5693,6 +5680,18 @@ function createQueryClient(config) {
|
|
|
5693
5680
|
function queryPostRequest(params) {
|
|
5694
5681
|
return _queryRequestInternal(params);
|
|
5695
5682
|
}
|
|
5683
|
+
async function queryAssetTeleported(params) {
|
|
5684
|
+
const { id, queryClient } = params;
|
|
5685
|
+
while (true) {
|
|
5686
|
+
const response = await queryClient.request(ASSET_TELEPORTED_BY_PARAMS, {
|
|
5687
|
+
id
|
|
5688
|
+
});
|
|
5689
|
+
if (response?.assetTeleported) {
|
|
5690
|
+
return response.assetTeleported;
|
|
5691
|
+
}
|
|
5692
|
+
await sleep(2e3);
|
|
5693
|
+
}
|
|
5694
|
+
}
|
|
5696
5695
|
function queryGetRequest(params) {
|
|
5697
5696
|
return _queryGetRequestInternal(params);
|
|
5698
5697
|
}
|
|
@@ -7035,24 +7034,6 @@ var IndexerClient = class {
|
|
|
7035
7034
|
}
|
|
7036
7035
|
}
|
|
7037
7036
|
}
|
|
7038
|
-
/**
|
|
7039
|
-
* Query for asset teleported events by sender, recipient, and destination chain
|
|
7040
|
-
* @param from - The sender address
|
|
7041
|
-
* @param to - The recipient address
|
|
7042
|
-
* @param dest - The destination chain ID
|
|
7043
|
-
* @returns The asset teleported event if found, undefined otherwise
|
|
7044
|
-
*/
|
|
7045
|
-
async queryAssetTeleported(from, to, dest, blockNumber) {
|
|
7046
|
-
const response = await this.withRetry(
|
|
7047
|
-
() => this.client.request(ASSET_TELEPORTED_BY_PARAMS, {
|
|
7048
|
-
from,
|
|
7049
|
-
to,
|
|
7050
|
-
dest,
|
|
7051
|
-
blockNumber
|
|
7052
|
-
})
|
|
7053
|
-
);
|
|
7054
|
-
return response.assetTeleporteds.nodes[0];
|
|
7055
|
-
}
|
|
7056
7037
|
/**
|
|
7057
7038
|
* Executes an async operation with exponential backoff retry
|
|
7058
7039
|
* @param operation - Async function to execute
|
|
@@ -11676,7 +11657,7 @@ var IntentGateway = class {
|
|
|
11676
11657
|
}
|
|
11677
11658
|
})
|
|
11678
11659
|
).then((results) => results.filter(Boolean));
|
|
11679
|
-
|
|
11660
|
+
const stateOverrides = [
|
|
11680
11661
|
// Mock address with ETH balance so that any chain estimation runs
|
|
11681
11662
|
// even when the address doesn't hold any native token in that chain
|
|
11682
11663
|
{
|
|
@@ -12207,7 +12188,7 @@ var IntentGateway = class {
|
|
|
12207
12188
|
*/
|
|
12208
12189
|
async isOrderFilled(order) {
|
|
12209
12190
|
const intentGatewayAddress = this.source.config.getIntentGatewayAddress(order.destChain);
|
|
12210
|
-
|
|
12191
|
+
const filledSlot = await this.dest.client.readContract({
|
|
12211
12192
|
abi: IntentGateway_default.ABI,
|
|
12212
12193
|
address: intentGatewayAddress,
|
|
12213
12194
|
functionName: "calculateCommitmentSlotHash",
|
|
@@ -12407,24 +12388,30 @@ function readIsmpCommitmentHash(events) {
|
|
|
12407
12388
|
}
|
|
12408
12389
|
}
|
|
12409
12390
|
}
|
|
12391
|
+
var MultiAccount = Struct({
|
|
12392
|
+
substrate_account: Bytes(32),
|
|
12393
|
+
evm_account: Bytes(20),
|
|
12394
|
+
dest_state_machine: StateMachine,
|
|
12395
|
+
timeout: u64,
|
|
12396
|
+
account_nonce: u64
|
|
12397
|
+
});
|
|
12410
12398
|
var DECIMALS = 10;
|
|
12411
12399
|
async function teleportDot(param_) {
|
|
12412
|
-
const {
|
|
12413
|
-
const
|
|
12414
|
-
|
|
12415
|
-
|
|
12416
|
-
|
|
12417
|
-
|
|
12418
|
-
|
|
12419
|
-
|
|
12420
|
-
|
|
12421
|
-
|
|
12422
|
-
};
|
|
12400
|
+
const { sourceApi, sourceIsAssetHub, who, options, xcmGatewayParams: params } = param_;
|
|
12401
|
+
const { nonce: accountNonce } = await sourceApi.query.system.account(who);
|
|
12402
|
+
const encoded_message = MultiAccount.enc({
|
|
12403
|
+
substrate_account: decodeAddress(who),
|
|
12404
|
+
evm_account: hexToU8a(params.recipient),
|
|
12405
|
+
dest_state_machine: { tag: "Evm", value: params.destination },
|
|
12406
|
+
timeout: params.timeout,
|
|
12407
|
+
account_nonce: accountNonce
|
|
12408
|
+
});
|
|
12409
|
+
const message_id = keccakAsHex(encoded_message);
|
|
12423
12410
|
const beneficiary = {
|
|
12424
12411
|
V3: {
|
|
12425
12412
|
parents: 0,
|
|
12426
12413
|
interior: {
|
|
12427
|
-
|
|
12414
|
+
X4: [
|
|
12428
12415
|
{
|
|
12429
12416
|
AccountId32: {
|
|
12430
12417
|
id: u8aToHex(decodeAddress(who)),
|
|
@@ -12443,37 +12430,89 @@ async function teleportDot(param_) {
|
|
|
12443
12430
|
},
|
|
12444
12431
|
{
|
|
12445
12432
|
GeneralIndex: params.timeout
|
|
12433
|
+
},
|
|
12434
|
+
{
|
|
12435
|
+
GeneralIndex: accountNonce
|
|
12446
12436
|
}
|
|
12447
12437
|
]
|
|
12448
12438
|
}
|
|
12449
12439
|
}
|
|
12450
12440
|
};
|
|
12451
|
-
|
|
12452
|
-
|
|
12453
|
-
|
|
12454
|
-
|
|
12455
|
-
|
|
12456
|
-
|
|
12457
|
-
|
|
12441
|
+
let assets2;
|
|
12442
|
+
let destination;
|
|
12443
|
+
if (sourceIsAssetHub) {
|
|
12444
|
+
destination = {
|
|
12445
|
+
V3: {
|
|
12446
|
+
parents: 1,
|
|
12447
|
+
interior: {
|
|
12448
|
+
X1: {
|
|
12449
|
+
Parachain: params.paraId
|
|
12458
12450
|
}
|
|
12459
|
-
},
|
|
12460
|
-
fun: {
|
|
12461
|
-
Fungible: parseUnits(params.amount.toString(), DECIMALS)
|
|
12462
12451
|
}
|
|
12463
12452
|
}
|
|
12464
|
-
|
|
12465
|
-
|
|
12453
|
+
};
|
|
12454
|
+
assets2 = {
|
|
12455
|
+
V3: [
|
|
12456
|
+
{
|
|
12457
|
+
id: {
|
|
12458
|
+
Concrete: {
|
|
12459
|
+
parents: 1,
|
|
12460
|
+
interior: "Here"
|
|
12461
|
+
}
|
|
12462
|
+
},
|
|
12463
|
+
fun: {
|
|
12464
|
+
Fungible: parseUnits(params.amount.toString(), DECIMALS)
|
|
12465
|
+
}
|
|
12466
|
+
}
|
|
12467
|
+
]
|
|
12468
|
+
};
|
|
12469
|
+
} else {
|
|
12470
|
+
destination = {
|
|
12471
|
+
V3: {
|
|
12472
|
+
parents: 0,
|
|
12473
|
+
interior: {
|
|
12474
|
+
X1: {
|
|
12475
|
+
Parachain: params.paraId
|
|
12476
|
+
}
|
|
12477
|
+
}
|
|
12478
|
+
}
|
|
12479
|
+
};
|
|
12480
|
+
assets2 = {
|
|
12481
|
+
V3: [
|
|
12482
|
+
{
|
|
12483
|
+
id: {
|
|
12484
|
+
Concrete: {
|
|
12485
|
+
parents: 0,
|
|
12486
|
+
interior: "Here"
|
|
12487
|
+
}
|
|
12488
|
+
},
|
|
12489
|
+
fun: {
|
|
12490
|
+
Fungible: parseUnits(params.amount.toString(), DECIMALS)
|
|
12491
|
+
}
|
|
12492
|
+
}
|
|
12493
|
+
]
|
|
12494
|
+
};
|
|
12495
|
+
}
|
|
12466
12496
|
const feeAssetItem = 0;
|
|
12467
12497
|
const weightLimit = "Unlimited";
|
|
12468
|
-
|
|
12469
|
-
|
|
12470
|
-
|
|
12471
|
-
|
|
12472
|
-
|
|
12473
|
-
|
|
12474
|
-
|
|
12475
|
-
|
|
12476
|
-
|
|
12498
|
+
let tx;
|
|
12499
|
+
if (sourceIsAssetHub) {
|
|
12500
|
+
tx = sourceApi.tx.polkadotXcm.limitedReserveTransferAssets(
|
|
12501
|
+
destination,
|
|
12502
|
+
beneficiary,
|
|
12503
|
+
assets2,
|
|
12504
|
+
feeAssetItem,
|
|
12505
|
+
weightLimit
|
|
12506
|
+
);
|
|
12507
|
+
} else {
|
|
12508
|
+
tx = sourceApi.tx.xcmPallet.limitedReserveTransferAssets(
|
|
12509
|
+
destination,
|
|
12510
|
+
beneficiary,
|
|
12511
|
+
assets2,
|
|
12512
|
+
feeAssetItem,
|
|
12513
|
+
weightLimit
|
|
12514
|
+
);
|
|
12515
|
+
}
|
|
12477
12516
|
let closed = false;
|
|
12478
12517
|
let unsubscribe;
|
|
12479
12518
|
const stream = new ReadableStream(
|
|
@@ -12495,44 +12534,14 @@ async function teleportDot(param_) {
|
|
|
12495
12534
|
if (status.isReady) {
|
|
12496
12535
|
controller.enqueue({
|
|
12497
12536
|
kind: "Ready",
|
|
12498
|
-
transaction_hash: txHash.toHex()
|
|
12537
|
+
transaction_hash: txHash.toHex(),
|
|
12538
|
+
message_id
|
|
12499
12539
|
});
|
|
12500
12540
|
} else if (status.isInBlock || status.isFinalized) {
|
|
12501
|
-
const decodedWho = u8aToHex(decodeAddress(who, false));
|
|
12502
|
-
let assetTeleported = void 0;
|
|
12503
|
-
let attempts = 0;
|
|
12504
|
-
const maxAttempts = Math.ceil(3e5 / pollInterval);
|
|
12505
|
-
if (!indexerClient) {
|
|
12506
|
-
controller.enqueue({
|
|
12507
|
-
kind: "Error",
|
|
12508
|
-
error: "IndexerClient is required but not provided"
|
|
12509
|
-
});
|
|
12510
|
-
return;
|
|
12511
|
-
}
|
|
12512
|
-
while (!assetTeleported && attempts < maxAttempts) {
|
|
12513
|
-
await sleep(pollInterval);
|
|
12514
|
-
assetTeleported = await indexerClient.queryAssetTeleported(
|
|
12515
|
-
decodedWho,
|
|
12516
|
-
params.recipient.toLowerCase(),
|
|
12517
|
-
params.destination.toString(),
|
|
12518
|
-
hyperbridgeBlock
|
|
12519
|
-
);
|
|
12520
|
-
attempts++;
|
|
12521
|
-
}
|
|
12522
|
-
if (!assetTeleported) {
|
|
12523
|
-
controller.enqueue({
|
|
12524
|
-
kind: "Error",
|
|
12525
|
-
error: "Failed to locate AssetTeleported event in the indexer after maximum attempts"
|
|
12526
|
-
});
|
|
12527
|
-
return;
|
|
12528
|
-
}
|
|
12529
|
-
const commitment = assetTeleported.commitment;
|
|
12530
|
-
const blockNumber = BigInt(assetTeleported.blockNumber);
|
|
12531
12541
|
controller.enqueue({
|
|
12532
12542
|
kind: "Finalized",
|
|
12533
12543
|
transaction_hash: txHash.toHex(),
|
|
12534
|
-
|
|
12535
|
-
commitment
|
|
12544
|
+
message_id
|
|
12536
12545
|
});
|
|
12537
12546
|
closed = true;
|
|
12538
12547
|
unsubscribe?.();
|
|
@@ -12562,6 +12571,6 @@ async function teleportDot(param_) {
|
|
|
12562
12571
|
return stream;
|
|
12563
12572
|
}
|
|
12564
12573
|
|
|
12565
|
-
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 };
|
|
12574
|
+
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 };
|
|
12566
12575
|
//# sourceMappingURL=index.js.map
|
|
12567
12576
|
//# sourceMappingURL=index.js.map
|