@hyperbridge/sdk 1.3.7 → 1.3.8
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 +37 -6
- package/dist/browser/index.js.map +1 -1
- package/dist/node/index.d.ts +13 -4
- package/dist/node/index.js +37 -6
- package/dist/node/index.js.map +1 -1
- package/package.json +1 -1
package/dist/browser/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 or asset hub
|
|
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/browser/index.js
CHANGED
|
@@ -5576,6 +5576,20 @@ query StateMachineUpdatesByTimestamp($statemachineId: String!, $commitmentTimest
|
|
|
5576
5576
|
}
|
|
5577
5577
|
}
|
|
5578
5578
|
`;
|
|
5579
|
+
var ASSET_TELEPORTED_BY_PARAMS = `
|
|
5580
|
+
query AssetTeleportedByParams($id: String!) {
|
|
5581
|
+
assetTeleported(id: $id) {
|
|
5582
|
+
id
|
|
5583
|
+
from
|
|
5584
|
+
to
|
|
5585
|
+
amount
|
|
5586
|
+
dest
|
|
5587
|
+
commitment
|
|
5588
|
+
createdAt
|
|
5589
|
+
blockNumber
|
|
5590
|
+
}
|
|
5591
|
+
}
|
|
5592
|
+
`;
|
|
5579
5593
|
var GET_RESPONSE_BY_REQUEST_ID = `
|
|
5580
5594
|
query GetResponseByRequestId($requestId: String!) {
|
|
5581
5595
|
getResponses(filter: {requestId: {equalTo: $requestId}}) {
|
|
@@ -5666,6 +5680,23 @@ function createQueryClient(config) {
|
|
|
5666
5680
|
function queryPostRequest(params) {
|
|
5667
5681
|
return _queryRequestInternal(params);
|
|
5668
5682
|
}
|
|
5683
|
+
async function queryAssetTeleported(params) {
|
|
5684
|
+
const { id, queryClient } = params;
|
|
5685
|
+
return await retryPromise(
|
|
5686
|
+
async () => {
|
|
5687
|
+
const response = await queryClient.request(ASSET_TELEPORTED_BY_PARAMS, { id });
|
|
5688
|
+
if (!response?.assetTeleported) {
|
|
5689
|
+
throw new Error(`AssetTeleportedEvent not found for ${id}`);
|
|
5690
|
+
}
|
|
5691
|
+
return response.assetTeleported;
|
|
5692
|
+
},
|
|
5693
|
+
{
|
|
5694
|
+
logMessage: "queryingAssetTeleported",
|
|
5695
|
+
backoffMs: 15e3,
|
|
5696
|
+
maxRetries: 15
|
|
5697
|
+
}
|
|
5698
|
+
);
|
|
5699
|
+
}
|
|
5669
5700
|
function queryGetRequest(params) {
|
|
5670
5701
|
return _queryGetRequestInternal(params);
|
|
5671
5702
|
}
|
|
@@ -11631,7 +11662,7 @@ var IntentGateway = class {
|
|
|
11631
11662
|
}
|
|
11632
11663
|
})
|
|
11633
11664
|
).then((results) => results.filter(Boolean));
|
|
11634
|
-
|
|
11665
|
+
const stateOverrides = [
|
|
11635
11666
|
// Mock address with ETH balance so that any chain estimation runs
|
|
11636
11667
|
// even when the address doesn't hold any native token in that chain
|
|
11637
11668
|
{
|
|
@@ -12162,7 +12193,7 @@ var IntentGateway = class {
|
|
|
12162
12193
|
*/
|
|
12163
12194
|
async isOrderFilled(order) {
|
|
12164
12195
|
const intentGatewayAddress = this.source.config.getIntentGatewayAddress(order.destChain);
|
|
12165
|
-
|
|
12196
|
+
const filledSlot = await this.dest.client.readContract({
|
|
12166
12197
|
abi: IntentGateway_default.ABI,
|
|
12167
12198
|
address: intentGatewayAddress,
|
|
12168
12199
|
functionName: "calculateCommitmentSlotHash",
|
|
@@ -12372,15 +12403,15 @@ var MultiAccount = Struct({
|
|
|
12372
12403
|
var DECIMALS = 10;
|
|
12373
12404
|
async function teleportDot(param_) {
|
|
12374
12405
|
const { sourceApi, sourceIsAssetHub, who, options, xcmGatewayParams: params } = param_;
|
|
12375
|
-
|
|
12376
|
-
|
|
12406
|
+
const { nonce: accountNonce } = await sourceApi.query.system.account(who);
|
|
12407
|
+
const encoded_message = MultiAccount.enc({
|
|
12377
12408
|
substrate_account: decodeAddress(who),
|
|
12378
12409
|
evm_account: hexToU8a(params.recipient),
|
|
12379
12410
|
dest_state_machine: { tag: "Evm", value: params.destination },
|
|
12380
12411
|
timeout: params.timeout,
|
|
12381
12412
|
account_nonce: accountNonce
|
|
12382
12413
|
});
|
|
12383
|
-
|
|
12414
|
+
const message_id = keccakAsHex(encoded_message);
|
|
12384
12415
|
const beneficiary = {
|
|
12385
12416
|
V3: {
|
|
12386
12417
|
parents: 0,
|
|
@@ -12545,6 +12576,6 @@ async function teleportDot(param_) {
|
|
|
12545
12576
|
return stream;
|
|
12546
12577
|
}
|
|
12547
12578
|
|
|
12548
|
-
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 };
|
|
12579
|
+
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 };
|
|
12549
12580
|
//# sourceMappingURL=index.js.map
|
|
12550
12581
|
//# sourceMappingURL=index.js.map
|