@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.
@@ -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 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 };
@@ -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,23 @@ 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
+ return await retryPromise(
5637
+ async () => {
5638
+ const response = await queryClient.request(ASSET_TELEPORTED_BY_PARAMS, { id });
5639
+ if (!response?.assetTeleported) {
5640
+ throw new Error(`AssetTeleportedEvent not found for ${id}`);
5641
+ }
5642
+ return response.assetTeleported;
5643
+ },
5644
+ {
5645
+ logMessage: "queryingAssetTeleported",
5646
+ backoffMs: 15e3,
5647
+ maxRetries: 15
5648
+ }
5649
+ );
5650
+ }
5620
5651
  function queryGetRequest(params) {
5621
5652
  return _queryGetRequestInternal(params);
5622
5653
  }
@@ -11582,7 +11613,7 @@ var IntentGateway = class {
11582
11613
  }
11583
11614
  })
11584
11615
  ).then((results) => results.filter(Boolean));
11585
- let stateOverrides = [
11616
+ const stateOverrides = [
11586
11617
  // Mock address with ETH balance so that any chain estimation runs
11587
11618
  // even when the address doesn't hold any native token in that chain
11588
11619
  {
@@ -12113,7 +12144,7 @@ var IntentGateway = class {
12113
12144
  */
12114
12145
  async isOrderFilled(order) {
12115
12146
  const intentGatewayAddress = this.source.config.getIntentGatewayAddress(order.destChain);
12116
- let filledSlot = await this.dest.client.readContract({
12147
+ const filledSlot = await this.dest.client.readContract({
12117
12148
  abi: IntentGateway_default.ABI,
12118
12149
  address: intentGatewayAddress,
12119
12150
  functionName: "calculateCommitmentSlotHash",
@@ -12323,15 +12354,15 @@ var MultiAccount = Struct({
12323
12354
  var DECIMALS = 10;
12324
12355
  async function teleportDot(param_) {
12325
12356
  const { sourceApi, sourceIsAssetHub, who, options, xcmGatewayParams: params } = param_;
12326
- let { nonce: accountNonce } = await sourceApi.query.system.account(who);
12327
- let encoded_message = MultiAccount.enc({
12357
+ const { nonce: accountNonce } = await sourceApi.query.system.account(who);
12358
+ const encoded_message = MultiAccount.enc({
12328
12359
  substrate_account: decodeAddress(who),
12329
12360
  evm_account: hexToU8a(params.recipient),
12330
12361
  dest_state_machine: { tag: "Evm", value: params.destination },
12331
12362
  timeout: params.timeout,
12332
12363
  account_nonce: accountNonce
12333
12364
  });
12334
- let message_id = keccakAsHex(encoded_message);
12365
+ const message_id = keccakAsHex(encoded_message);
12335
12366
  const beneficiary = {
12336
12367
  V3: {
12337
12368
  parents: 0,
@@ -12496,6 +12527,6 @@ async function teleportDot(param_) {
12496
12527
  return stream;
12497
12528
  }
12498
12529
 
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 };
12530
+ 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
12531
  //# sourceMappingURL=index.js.map
12501
12532
  //# sourceMappingURL=index.js.map