@layerzerolabs/lz-movevm-sdk-v2 3.0.99 → 3.0.101

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,29 @@
1
1
  # @layerzerolabs/lz-movevm-sdk-v2
2
2
 
3
+ ## 3.0.101
4
+
5
+ ### Patch Changes
6
+
7
+ - efcbaf2: endpoints: katana testnet, mainnet, botanix mainnet
8
+ - Updated dependencies [efcbaf2]
9
+ - @layerzerolabs/lz-definitions@3.0.101
10
+ - @layerzerolabs/lz-serdes@3.0.101
11
+ - @layerzerolabs/lz-utilities@3.0.101
12
+ - @layerzerolabs/lz-v2-utilities@3.0.101
13
+ - @layerzerolabs/move-definitions@3.0.101
14
+
15
+ ## 3.0.100
16
+
17
+ ### Patch Changes
18
+
19
+ - 41862e9: Deployed dvn_upgrader of Aptos on testnet and mainnet
20
+ - Updated dependencies [41862e9]
21
+ - @layerzerolabs/lz-definitions@3.0.100
22
+ - @layerzerolabs/lz-serdes@3.0.100
23
+ - @layerzerolabs/lz-utilities@3.0.100
24
+ - @layerzerolabs/lz-v2-utilities@3.0.100
25
+ - @layerzerolabs/move-definitions@3.0.100
26
+
3
27
  ## 3.0.99
4
28
 
5
29
  ### Patch Changes
package/dist/index.cjs CHANGED
@@ -163,6 +163,35 @@ var Counter = class {
163
163
  this.module = [sdk.accounts.counter_v2?.toString() ?? "0x0", "counter"];
164
164
  this.oappCoreModule = [sdk.accounts.counter_v2?.toString() ?? "0x0", "oapp_core"];
165
165
  }
166
+ /**
167
+ * Create a payload of set delegate contract function.
168
+ *
169
+ * @param {string} delegate - The delegate address.
170
+ * @returns {InputEntryFunctionData} The input entry function data, use to build the transaction.
171
+ */
172
+ setDelegatePayload(delegate) {
173
+ return {
174
+ function: `${this.oappCoreModule[0]}::${this.oappCoreModule[1]}::set_delegate`,
175
+ functionArguments: [delegate],
176
+ functionArgumentTypes: ["address"]
177
+ };
178
+ }
179
+ /**
180
+ * Create a payload of set config contract function.
181
+ *
182
+ * @param {number} eid - The endpoint ID.
183
+ * @param {number} config_type - The config type.
184
+ * @param {Uint8Array} config - The config.
185
+ * @returns {InputEntryFunctionData} The input entry function data, use to build the transaction.
186
+ */
187
+ setConfigPayload(eid, config_type, config) {
188
+ const ulnMsgLibAddr = this.sdk.accounts.uln_message_lib?.toString() ?? "0x0";
189
+ return {
190
+ function: `${this.oappCoreModule[0]}::${this.oappCoreModule[1]}::set_config`,
191
+ functionArguments: [ulnMsgLibAddr, eid, config_type, config],
192
+ functionArgumentTypes: ["address", "u32", "u32", "vector<u8>"]
193
+ };
194
+ }
166
195
  /**
167
196
  * Create a payload of send contract function.
168
197
  *
@@ -281,6 +310,33 @@ var Counter = class {
281
310
  gasOptions
282
311
  );
283
312
  }
313
+ /**
314
+ * Checks if the counter has a delegate.
315
+ *
316
+ * @returns {Promise<boolean>} True if the counter has a delegate, false otherwise.
317
+ */
318
+ async hasDelegate() {
319
+ const view = await this.sdk.viewFunction({
320
+ functionName: `${this.oappCoreModule[0]}::${this.oappCoreModule[1]}::has_delegate`,
321
+ functionArgs: [],
322
+ functionArgTypes: []
323
+ });
324
+ return view[0];
325
+ }
326
+ /**
327
+ * Gets the delegate address.
328
+ *
329
+ * @returns {Promise<string>} The delegate address, '' if not found.
330
+ */
331
+ async getDelegate() {
332
+ const view = await this.sdk.viewFunction({
333
+ functionName: `${this.oappCoreModule[0]}::${this.oappCoreModule[1]}::get_delegate`,
334
+ functionArgs: [],
335
+ functionArgTypes: []
336
+ });
337
+ const bytes = view[0];
338
+ return lzUtilities.ensure0x(bytes);
339
+ }
284
340
  /**
285
341
  * Gets the peer for the specified remote endpoint.
286
342
  *
@@ -361,6 +417,61 @@ var Counter = class {
361
417
  return false;
362
418
  }
363
419
  }
420
+ /**
421
+ * Gets the oapp admin
422
+ *
423
+ * @returns {Promise<string>} The admin address, '' if not found.
424
+ */
425
+ async getAdmin() {
426
+ try {
427
+ const view = await this.sdk.viewFunction({
428
+ functionName: `${this.oappCoreModule[0]}::${this.oappCoreModule[1]}::get_admin`,
429
+ functionArgs: [],
430
+ functionArgTypes: []
431
+ });
432
+ const bytes = view[0];
433
+ return lzUtilities.ensure0x(bytes);
434
+ } catch (e) {
435
+ if (e instanceof moveDefinitions.MoveResourceNotFoundError) {
436
+ return "";
437
+ } else if (e instanceof moveDefinitions.MoveAbortError && e.abortCode === 2) {
438
+ return "";
439
+ }
440
+ throw e;
441
+ }
442
+ }
443
+ /**
444
+ * Create a payload of set peer contract function.
445
+ *
446
+ * @param {EndpointId} remoteEid - The remote endpoint ID.
447
+ * @param {string} remoteOapp - The remote OAPP address.
448
+ * @returns {InputEntryFunctionData} The input entry function data, use to build the transaction.
449
+ */
450
+ setAdminPayload(newAdmin) {
451
+ return {
452
+ function: `${this.oappCoreModule[0]}::${this.oappCoreModule[1]}::transfer_admin`,
453
+ functionArguments: [newAdmin],
454
+ functionArgumentTypes: ["address"]
455
+ };
456
+ }
457
+ /**
458
+ * Sets the peer for the specified remote endpoint.
459
+ *
460
+ * @param {AccountType | PrivateKey | MnemonicAndPath} signer - The signer of the transaction.
461
+ * @param {EndpointId} remoteEid - The remote endpoint ID.
462
+ * @param {string} remoteOapp - The remote OAPP address.
463
+ * @param {GasOptions} [gasOptions] - The gas options.
464
+ * @returns {Promise<TransactionResponse>} The transaction response.
465
+ */
466
+ async setAdmin(signer, newAdmin, gasOptions) {
467
+ return this.sdk.sendAndConfirmTransaction(
468
+ signer,
469
+ `${this.oappCoreModule[0]}::${this.oappCoreModule[1]}::transfer_admin`,
470
+ [newAdmin],
471
+ ["address"],
472
+ gasOptions
473
+ );
474
+ }
364
475
  };
365
476
  var DvnUpGrader = class {
366
477
  /**