@layerzerolabs/lz-aptos-sdk-v1 1.5.16-rc2 → 1.5.16

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/index.cjs CHANGED
@@ -724,10 +724,12 @@ var Endpoint = class {
724
724
  }
725
725
  );
726
726
  }
727
- async quoteFee(uaAddress, dstChainId, adapterParams, payloadSize) {
728
- let totalFee = BigInt(await this.sdk.LayerzeroModule.Uln.Config.quoteFee(uaAddress, dstChainId, payloadSize));
729
- const [executor] = await this.sdk.LayerzeroModule.ExecutorConfig.getExecutor(uaAddress, dstChainId);
730
- totalFee += await this.sdk.LayerzeroModule.Executor.quoteFee(executor, dstChainId, adapterParams);
727
+ async quoteFee(uaAddress, dstChainId, adapterParams, payloadSize, query) {
728
+ let totalFee = BigInt(
729
+ await this.sdk.LayerzeroModule.Uln.Config.quoteFee(uaAddress, dstChainId, payloadSize, query)
730
+ );
731
+ const [executor] = await this.sdk.LayerzeroModule.ExecutorConfig.getExecutor(uaAddress, dstChainId, query);
732
+ totalFee += await this.sdk.LayerzeroModule.Executor.quoteFee(executor, dstChainId, adapterParams, query);
731
733
  return totalFee;
732
734
  }
733
735
  registerExecutorPayload(executorType) {
@@ -1766,15 +1768,19 @@ var Executor = class {
1766
1768
  const transaction = this.setFeePayload(dstChainId, config);
1767
1769
  return this.sdk.sendAndConfirmTransaction(signer, transaction);
1768
1770
  }
1769
- async getFee(executor, chainId) {
1771
+ async getFee(executor, chainId, query) {
1770
1772
  try {
1771
- const resource = await this.sdk.client.getAccountResource(executor, `${this.module}::ExecutorConfig`);
1773
+ const resource = await this.sdk.client.getAccountResource(executor, `${this.module}::ExecutorConfig`, query);
1772
1774
  const { fee } = resource.data;
1773
- const response = await this.sdk.client.getTableItem(fee.handle, {
1774
- key_type: "u64",
1775
- value_type: `${this.module}::Fee`,
1776
- key: chainId.toString()
1777
- });
1775
+ const response = await this.sdk.client.getTableItem(
1776
+ fee.handle,
1777
+ {
1778
+ key_type: "u64",
1779
+ value_type: `${this.module}::Fee`,
1780
+ key: chainId.toString()
1781
+ },
1782
+ query
1783
+ );
1778
1784
  return {
1779
1785
  airdropAmtCap: BigInt(response.airdrop_amt_cap),
1780
1786
  priceRatio: BigInt(response.price_ratio),
@@ -1825,11 +1831,11 @@ var Executor = class {
1825
1831
  throw e;
1826
1832
  }
1827
1833
  }
1828
- async quoteFee(executor, dstChainId, adapterParams) {
1834
+ async quoteFee(executor, dstChainId, adapterParams, query) {
1829
1835
  if (adapterParams === void 0 || adapterParams.length === 0) {
1830
1836
  adapterParams = await this.getDefaultAdapterParams(dstChainId);
1831
1837
  }
1832
- const fee = await this.getFee(executor, dstChainId);
1838
+ const fee = await this.getFee(executor, dstChainId, query);
1833
1839
  const [, uaGas, airdropAmount] = this.decodeAdapterParams(adapterParams);
1834
1840
  return (uaGas * fee.gasPrice + airdropAmount) * fee.priceRatio / 10000000000n;
1835
1841
  }
@@ -1976,15 +1982,19 @@ var ExecutorConfig = class {
1976
1982
  throw e;
1977
1983
  }
1978
1984
  }
1979
- async getExecutor(uaAddress, remoteChainId) {
1980
- const resource = await this.sdk.client.getAccountResource(uaAddress, `${this.module}::ConfigStore`);
1985
+ async getExecutor(uaAddress, remoteChainId, query) {
1986
+ const resource = await this.sdk.client.getAccountResource(uaAddress, `${this.module}::ConfigStore`, query);
1981
1987
  const { config } = resource.data;
1982
1988
  try {
1983
- const response = await this.sdk.client.getTableItem(config.handle, {
1984
- key_type: "u64",
1985
- value_type: `${this.module}::Config`,
1986
- key: remoteChainId.toString()
1987
- });
1989
+ const response = await this.sdk.client.getTableItem(
1990
+ config.handle,
1991
+ {
1992
+ key_type: "u64",
1993
+ value_type: `${this.module}::Config`,
1994
+ key: remoteChainId.toString()
1995
+ },
1996
+ query
1997
+ );
1988
1998
  return [response.executor, response.version];
1989
1999
  } catch (e) {
1990
2000
  if (isErrorOfApiError(e, 404)) {
@@ -2292,13 +2302,14 @@ var UlnConfig = class {
2292
2302
  }
2293
2303
  return mergedConfig;
2294
2304
  }
2295
- async quoteFee(uaAddress, dstChainId, payloadSize) {
2305
+ async quoteFee(uaAddress, dstChainId, payloadSize, query) {
2296
2306
  const config = await this.getAppConfig(uaAddress, dstChainId);
2297
- const oracleFee = await this.sdk.LayerzeroModule.Uln.Signer.getFee(config.oracle, dstChainId);
2298
- const relayerFee = await this.sdk.LayerzeroModule.Uln.Signer.getFee(config.relayer, dstChainId);
2307
+ const oracleFee = await this.sdk.LayerzeroModule.Uln.Signer.getFee(config.oracle, dstChainId, query);
2308
+ const relayerFee = await this.sdk.LayerzeroModule.Uln.Signer.getFee(config.relayer, dstChainId, query);
2299
2309
  const treasuryConfigResource = await this.sdk.client.getAccountResource(
2300
2310
  this.sdk.accounts.layerzero,
2301
- `${this.sdk.LayerzeroModule.Uln.MsgLibV1.module}::GlobalStore`
2311
+ `${this.sdk.LayerzeroModule.Uln.MsgLibV1.module}::GlobalStore`,
2312
+ query
2302
2313
  );
2303
2314
  console.log(`treasuryConfigResource`, treasuryConfigResource.data);
2304
2315
  const { treasury_fee_bps: treasuryFeeBps } = treasuryConfigResource.data;
@@ -2485,15 +2496,19 @@ var UlnSigner = class {
2485
2496
  signFunc
2486
2497
  );
2487
2498
  }
2488
- async getFee(address, dstChainId) {
2499
+ async getFee(address, dstChainId, query) {
2489
2500
  try {
2490
- const resource = await this.sdk.client.getAccountResource(address, `${this.module}::Config`);
2501
+ const resource = await this.sdk.client.getAccountResource(address, `${this.module}::Config`, query);
2491
2502
  const { fees } = resource.data;
2492
- const response = await this.sdk.client.getTableItem(fees.handle, {
2493
- key_type: `u64`,
2494
- value_type: `${this.module}::Fee`,
2495
- key: dstChainId.toString()
2496
- });
2503
+ const response = await this.sdk.client.getTableItem(
2504
+ fees.handle,
2505
+ {
2506
+ key_type: `u64`,
2507
+ value_type: `${this.module}::Fee`,
2508
+ key: dstChainId.toString()
2509
+ },
2510
+ query
2511
+ );
2497
2512
  return {
2498
2513
  base_fee: BigInt(response.base_fee),
2499
2514
  fee_per_byte: BigInt(response.fee_per_byte)