@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.
@@ -984,7 +984,7 @@ interface AssetTeleported {
984
984
  to: string;
985
985
  amount: bigint;
986
986
  dest: string;
987
- commitment: string;
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 relayApi - Polkadot API instance connected to the relay chain
2734
- * @param hyperbridge - Polkadot API instance connected to the Hyperbridge parachain
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 };
@@ -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,18 @@ 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
+ 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
+ }
5669
5695
  function queryGetRequest(params) {
5670
5696
  return _queryGetRequestInternal(params);
5671
5697
  }
@@ -11631,7 +11657,7 @@ var IntentGateway = class {
11631
11657
  }
11632
11658
  })
11633
11659
  ).then((results) => results.filter(Boolean));
11634
- let stateOverrides = [
11660
+ const stateOverrides = [
11635
11661
  // Mock address with ETH balance so that any chain estimation runs
11636
11662
  // even when the address doesn't hold any native token in that chain
11637
11663
  {
@@ -12162,7 +12188,7 @@ var IntentGateway = class {
12162
12188
  */
12163
12189
  async isOrderFilled(order) {
12164
12190
  const intentGatewayAddress = this.source.config.getIntentGatewayAddress(order.destChain);
12165
- let filledSlot = await this.dest.client.readContract({
12191
+ const filledSlot = await this.dest.client.readContract({
12166
12192
  abi: IntentGateway_default.ABI,
12167
12193
  address: intentGatewayAddress,
12168
12194
  functionName: "calculateCommitmentSlotHash",
@@ -12372,15 +12398,15 @@ var MultiAccount = Struct({
12372
12398
  var DECIMALS = 10;
12373
12399
  async function teleportDot(param_) {
12374
12400
  const { sourceApi, sourceIsAssetHub, who, options, xcmGatewayParams: params } = param_;
12375
- let { nonce: accountNonce } = await sourceApi.query.system.account(who);
12376
- let encoded_message = MultiAccount.enc({
12401
+ const { nonce: accountNonce } = await sourceApi.query.system.account(who);
12402
+ const encoded_message = MultiAccount.enc({
12377
12403
  substrate_account: decodeAddress(who),
12378
12404
  evm_account: hexToU8a(params.recipient),
12379
12405
  dest_state_machine: { tag: "Evm", value: params.destination },
12380
12406
  timeout: params.timeout,
12381
12407
  account_nonce: accountNonce
12382
12408
  });
12383
- let message_id = keccakAsHex(encoded_message);
12409
+ const message_id = keccakAsHex(encoded_message);
12384
12410
  const beneficiary = {
12385
12411
  V3: {
12386
12412
  parents: 0,
@@ -12545,6 +12571,6 @@ async function teleportDot(param_) {
12545
12571
  return stream;
12546
12572
  }
12547
12573
 
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 };
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 };
12549
12575
  //# sourceMappingURL=index.js.map
12550
12576
  //# sourceMappingURL=index.js.map