@layerzerolabs/lz-movevm-sdk-v2 3.0.8-aptos.0 → 3.0.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/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @layerzerolabs/lz-movevm-sdk-v2
2
2
 
3
+ ## 3.0.8
4
+
5
+ ### Patch Changes
6
+
7
+ - 1cd5e8e: support READ library
8
+ - Updated dependencies [1cd5e8e]
9
+ - @layerzerolabs/lz-corekit-aptos@3.0.8
10
+ - @layerzerolabs/lz-core@3.0.8
11
+ - @layerzerolabs/lz-definitions@3.0.8
12
+ - @layerzerolabs/lz-serdes@3.0.8
13
+ - @layerzerolabs/lz-utilities@3.0.8
14
+ - @layerzerolabs/lz-v2-utilities@3.0.8
15
+ - @layerzerolabs/move-definitions@3.0.8
16
+
3
17
  ## 3.0.7
4
18
 
5
19
  ### Patch Changes
package/dist/index.cjs CHANGED
@@ -381,21 +381,13 @@ var DvnWorker = class {
381
381
  * @param {bigint} quorum - The quorum required for DVN operations.
382
382
  * @param {string[]} msglibs - The list of message libraries.
383
383
  * @param {string} feeLib - The fee library address.
384
- * @param {string} depositAddress - The deposit address. Defaults to the DVN address.
385
384
  * @returns {InputEntryFunctionData} The input entry function data, used to build the transaction.
386
385
  */
387
- createInitializeDVNPayload(admins, dvnSigners, quorum, msglibs, feeLib, depositAddress) {
386
+ createInitializeDVNPayload(admins, dvnSigners, quorum, msglibs, feeLib) {
388
387
  return {
389
388
  function: `${this.module[0]}::${this.module[1]}::initialize`,
390
- functionArguments: [depositAddress ?? this.module[0], admins, dvnSigners, quorum, msglibs, feeLib],
391
- functionArgumentTypes: [
392
- "address",
393
- "vector<address>",
394
- "vector<vector<u8>>",
395
- "u64",
396
- "vector<address>",
397
- "address"
398
- ]
389
+ functionArguments: [admins, dvnSigners, quorum, msglibs, feeLib],
390
+ functionArgumentTypes: ["vector<address>", "vector<vector<u8>>", "u64", "vector<address>", "address"]
399
391
  };
400
392
  }
401
393
  /**
@@ -912,16 +904,14 @@ var Endpoint = class {
912
904
  }
913
905
  /**
914
906
  * Gets the registered libraries.
915
- * @param {number} startIndex - The start index. Default is 0.
916
- * @param {number} length - The length. Default is 20.
907
+ *
917
908
  * @returns {Promise<string[]>} The list of registered libraries.
918
909
  */
919
- async getRegisteredLibraries(startIndex = 0, length = 20) {
910
+ async getRegisteredLibraries() {
920
911
  try {
921
912
  const view = await this.sdk.viewFunction({
922
913
  functionName: `${this.module[0]}::${this.module[1]}::get_registered_libraries`,
923
- functionArgs: [startIndex, length],
924
- functionArgTypes: ["u64", "u64"]
914
+ functionArgs: []
925
915
  });
926
916
  return view[0];
927
917
  } catch (e) {
@@ -1180,14 +1170,13 @@ var Executor = class {
1180
1170
  * @param {string[]} admins - The list of admin addresses.
1181
1171
  * @param {string[]} msgLibs - The list of message libraries.
1182
1172
  * @param {string} feeLib - The fee library address.
1183
- * @param {string} [depositAddress] - The deposit address. Defaults to the executor address.
1184
1173
  * @returns {InputEntryFunctionData} The input entry function data, used to build the transaction.
1185
1174
  */
1186
- createInitExecutorPayload(roleAdmin, admins, msgLibs, feeLib, depositAddress) {
1175
+ createInitExecutorPayload(roleAdmin, admins, msgLibs, feeLib) {
1187
1176
  return {
1188
1177
  function: `${this.module[0]}::${this.module[1]}::initialize`,
1189
- functionArguments: [depositAddress ?? this.module[0], roleAdmin, admins, msgLibs, feeLib],
1190
- functionArgumentTypes: ["address", "address", "vector<address>", "vector<address>", "address"]
1178
+ functionArguments: [roleAdmin, admins, msgLibs, feeLib],
1179
+ functionArgumentTypes: ["address", "vector<address>", "vector<address>", "address"]
1191
1180
  };
1192
1181
  }
1193
1182
  /**
@@ -1198,16 +1187,15 @@ var Executor = class {
1198
1187
  * @param {string[]} admins - The list of admin addresses.
1199
1188
  * @param {string[]} msgLibs - The list of message libraries.
1200
1189
  * @param {string} feeLib - The fee library address.
1201
- * @param {string} [depositAddress] - The deposit address. Defaults to the executor address.
1202
1190
  * @param {GasOptions} [gasOptions] - The gas options.
1203
1191
  * @returns {Promise<TransactionResponse>} The transaction response.
1204
1192
  */
1205
- async initialize(signer, roleAdmin, admins, msgLibs, feeLib, depositAddress, gasOptions) {
1193
+ async initialize(signer, workerId, roleAdmin, admins, msgLibs, feeLib, gasOptions) {
1206
1194
  return this.sdk.sendAndConfirmTransaction(
1207
1195
  signer,
1208
1196
  `${this.module[0]}::${this.module[1]}::initialize`,
1209
- [depositAddress ?? this.module[0], roleAdmin, admins, msgLibs, feeLib],
1210
- ["address", "address", "vector<address>", "vector<address>", "address"],
1197
+ [workerId, roleAdmin, admins, msgLibs, feeLib],
1198
+ ["u8", "address", "vector<address>", "vector<address>", "address"],
1211
1199
  gasOptions
1212
1200
  );
1213
1201
  }
@@ -1772,6 +1760,24 @@ var Oft = class {
1772
1760
  });
1773
1761
  return view[0];
1774
1762
  }
1763
+ /**
1764
+ * Reports the number of tokens that can be claimed by the account (relevant for Coin-enabled implementations)
1765
+ * location: packages/layerzero-v2/aptos/contracts/oapps/oft/sources/internal_oft/oft.move
1766
+ *
1767
+ * @param address account address
1768
+ * @returns true or false
1769
+ */
1770
+ async claimable(address) {
1771
+ if (await this.isCoin()) {
1772
+ const view = await this.sdk.viewFunction({
1773
+ functionName: `${this.module[0]}::${this.module[1]}::claimable`,
1774
+ functionArgs: [address],
1775
+ functionArgTypes: ["address"]
1776
+ });
1777
+ return BigInt(view[0]);
1778
+ }
1779
+ return BigInt(0);
1780
+ }
1775
1781
  /**
1776
1782
  * Quote the OFT for a particular send without sending
1777
1783
  * location: packages/layerzero-v2/aptos/contracts/oapps/oft/sources/internal_oft/oft.move
@@ -1867,10 +1873,9 @@ var Oft = class {
1867
1873
  async metadata() {
1868
1874
  if (await this.isCoin()) {
1869
1875
  const implModule = await this.getImplModule();
1870
- const coin = this.coin ?? `${implModule[0]}::${implModule[1]}::PlaceholderCoin`;
1871
1876
  const res = await this.sdk.getAccountResource({
1872
1877
  accountAddress: implModule[0],
1873
- resourceType: `0x1::coin::CoinInfo<${coin}>`
1878
+ resourceType: `0x1::coin::CoinInfo<${implModule[0]}::${implModule[1]}::Oft>`
1874
1879
  });
1875
1880
  return res;
1876
1881
  } else {
@@ -1911,12 +1916,25 @@ var Oft = class {
1911
1916
  * @returns account balance
1912
1917
  */
1913
1918
  async balanceOf(address) {
1914
- const view = await this.sdk.viewFunction({
1915
- functionName: `${this.module[0]}::${this.module[1]}::balance`,
1916
- functionArgs: [address],
1917
- functionArgTypes: ["address"]
1918
- });
1919
- return BigInt(view[0]);
1919
+ const token = await this.token();
1920
+ if (await this.isCoin()) {
1921
+ const implModule = await this.getImplModule();
1922
+ const view = await this.sdk.viewFunction({
1923
+ functionName: `0x1::coin::balance`,
1924
+ functionArgs: [address],
1925
+ functionArgTypes: ["address"],
1926
+ typeArgs: [`${implModule[0]}::${implModule[1]}::Oft`]
1927
+ });
1928
+ return BigInt(view[0]);
1929
+ } else {
1930
+ const view = await this.sdk.viewFunction({
1931
+ functionName: `0x1::primary_fungible_store::balance`,
1932
+ functionArgs: [address, token],
1933
+ functionArgTypes: ["address", "address"],
1934
+ typeArgs: ["0x1::fungible_asset::Metadata"]
1935
+ });
1936
+ return BigInt(view[0]);
1937
+ }
1920
1938
  }
1921
1939
  /**
1922
1940
  * debit view
@@ -3273,19 +3291,6 @@ var Uln302 = class {
3273
3291
  }
3274
3292
  return this.parseExecutorConfig(view[0]);
3275
3293
  }
3276
- /**
3277
- * Gets the opt in/out status of a worker
3278
- * @param workerAddress - The worker address
3279
- * @returns {Promise<boolean>} The opt in/out status of the worker
3280
- */
3281
- async getWorkerConfigForFeeLibRoutingOptIn(workerAddress) {
3282
- const view = await this.sdk.viewFunction({
3283
- functionName: `${this.module[0]}::${this.module[1]}::worker_config_for_fee_lib_routing_opt_in`,
3284
- functionArgs: [workerAddress],
3285
- functionArgTypes: ["address"]
3286
- });
3287
- return view[0];
3288
- }
3289
3294
  /**
3290
3295
  * Creates a payload for setting the default ULN send configuration.
3291
3296
  *
@@ -3340,17 +3345,6 @@ var Uln302 = class {
3340
3345
  functionArgumentTypes: ["u32", "u32", "address"]
3341
3346
  };
3342
3347
  }
3343
- /**
3344
- * Creates a payload for setting the worker config for fee lib routing opt in
3345
- * @param optIn
3346
- */
3347
- createSetWorkerConfigForFeeLibRoutingOptInPayload(optIn) {
3348
- return {
3349
- function: `${this.module[0]}::${this.module[1]}::set_worker_config_for_fee_lib_routing_opt_in`,
3350
- functionArguments: [optIn],
3351
- functionArgumentTypes: ["bool"]
3352
- };
3353
- }
3354
3348
  /**
3355
3349
  * Parses the ULN configuration response.
3356
3350
  *