@hyperbridge/sdk 1.3.7 → 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 +13 -4
- package/dist/browser/index.js +32 -6
- package/dist/browser/index.js.map +1 -1
- package/dist/node/index.d.ts +13 -4
- package/dist/node/index.js +35 -9
- package/dist/node/index.js.map +1 -1
- package/package.json +1 -1
package/dist/node/index.d.ts
CHANGED
|
@@ -984,7 +984,7 @@ 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
|
}
|
|
@@ -2539,6 +2539,15 @@ declare function queryPostRequest(params: {
|
|
|
2539
2539
|
commitmentHash: string;
|
|
2540
2540
|
queryClient: IndexerQueryClient;
|
|
2541
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>;
|
|
2542
2551
|
/**
|
|
2543
2552
|
* Queries a GET Request by CommitmentHash
|
|
2544
2553
|
*
|
|
@@ -2730,8 +2739,8 @@ type XcmGatewayParams = {
|
|
|
2730
2739
|
* Note: There is no guarantee that both Dispatched and Finalized events will be yielded.
|
|
2731
2740
|
* Consumers should listen for either one of these events instead of expecting both.
|
|
2732
2741
|
*
|
|
2733
|
-
* @param
|
|
2734
|
-
* @param
|
|
2742
|
+
* @param sourceApi - Polkadot API instance connected to the relay chain
|
|
2743
|
+
* @param sourceIsAssetHub - If `true` uses AssetHub Network for teleport
|
|
2735
2744
|
* @param who - Sender's SS58Address address
|
|
2736
2745
|
* @param options - Transaction signing options
|
|
2737
2746
|
* @param params - Teleport parameters including destination, recipient, and amount
|
|
@@ -2925,4 +2934,4 @@ declare const coingeckoIds: {
|
|
|
2925
2934
|
"EVM-8453": string;
|
|
2926
2935
|
};
|
|
2927
2936
|
|
|
2928
|
-
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,6 +1,6 @@
|
|
|
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';
|
|
@@ -5527,6 +5527,20 @@ query StateMachineUpdatesByTimestamp($statemachineId: String!, $commitmentTimest
|
|
|
5527
5527
|
}
|
|
5528
5528
|
}
|
|
5529
5529
|
`;
|
|
5530
|
+
var ASSET_TELEPORTED_BY_PARAMS = `
|
|
5531
|
+
query AssetTeleportedByParams($id: String!) {
|
|
5532
|
+
assetTeleported(id: $id) {
|
|
5533
|
+
id
|
|
5534
|
+
from
|
|
5535
|
+
to
|
|
5536
|
+
amount
|
|
5537
|
+
dest
|
|
5538
|
+
commitment
|
|
5539
|
+
createdAt
|
|
5540
|
+
blockNumber
|
|
5541
|
+
}
|
|
5542
|
+
}
|
|
5543
|
+
`;
|
|
5530
5544
|
var GET_RESPONSE_BY_REQUEST_ID = `
|
|
5531
5545
|
query GetResponseByRequestId($requestId: String!) {
|
|
5532
5546
|
getResponses(filter: {requestId: {equalTo: $requestId}}) {
|
|
@@ -5617,6 +5631,18 @@ function createQueryClient(config) {
|
|
|
5617
5631
|
function queryPostRequest(params) {
|
|
5618
5632
|
return _queryRequestInternal(params);
|
|
5619
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
|
+
}
|
|
5620
5646
|
function queryGetRequest(params) {
|
|
5621
5647
|
return _queryGetRequestInternal(params);
|
|
5622
5648
|
}
|
|
@@ -11582,7 +11608,7 @@ var IntentGateway = class {
|
|
|
11582
11608
|
}
|
|
11583
11609
|
})
|
|
11584
11610
|
).then((results) => results.filter(Boolean));
|
|
11585
|
-
|
|
11611
|
+
const stateOverrides = [
|
|
11586
11612
|
// Mock address with ETH balance so that any chain estimation runs
|
|
11587
11613
|
// even when the address doesn't hold any native token in that chain
|
|
11588
11614
|
{
|
|
@@ -12113,7 +12139,7 @@ var IntentGateway = class {
|
|
|
12113
12139
|
*/
|
|
12114
12140
|
async isOrderFilled(order) {
|
|
12115
12141
|
const intentGatewayAddress = this.source.config.getIntentGatewayAddress(order.destChain);
|
|
12116
|
-
|
|
12142
|
+
const filledSlot = await this.dest.client.readContract({
|
|
12117
12143
|
abi: IntentGateway_default.ABI,
|
|
12118
12144
|
address: intentGatewayAddress,
|
|
12119
12145
|
functionName: "calculateCommitmentSlotHash",
|
|
@@ -12323,15 +12349,15 @@ var MultiAccount = Struct({
|
|
|
12323
12349
|
var DECIMALS = 10;
|
|
12324
12350
|
async function teleportDot(param_) {
|
|
12325
12351
|
const { sourceApi, sourceIsAssetHub, who, options, xcmGatewayParams: params } = param_;
|
|
12326
|
-
|
|
12327
|
-
|
|
12352
|
+
const { nonce: accountNonce } = await sourceApi.query.system.account(who);
|
|
12353
|
+
const encoded_message = MultiAccount.enc({
|
|
12328
12354
|
substrate_account: decodeAddress(who),
|
|
12329
12355
|
evm_account: hexToU8a(params.recipient),
|
|
12330
12356
|
dest_state_machine: { tag: "Evm", value: params.destination },
|
|
12331
12357
|
timeout: params.timeout,
|
|
12332
12358
|
account_nonce: accountNonce
|
|
12333
12359
|
});
|
|
12334
|
-
|
|
12360
|
+
const message_id = keccakAsHex(encoded_message);
|
|
12335
12361
|
const beneficiary = {
|
|
12336
12362
|
V3: {
|
|
12337
12363
|
parents: 0,
|
|
@@ -12496,6 +12522,6 @@ async function teleportDot(param_) {
|
|
|
12496
12522
|
return stream;
|
|
12497
12523
|
}
|
|
12498
12524
|
|
|
12499
|
-
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 };
|
|
12500
12526
|
//# sourceMappingURL=index.js.map
|
|
12501
12527
|
//# sourceMappingURL=index.js.map
|