@layerzerolabs/lz-movevm-sdk-v2 3.0.87 → 3.0.89

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.d.mts CHANGED
@@ -350,6 +350,10 @@ type AccountsOption = {
350
350
  * The DVN address.
351
351
  */
352
352
  dvn?: string;
353
+ /**
354
+ * The DVN upgrader address.
355
+ */
356
+ dvn_upgrader?: string;
353
357
  /**
354
358
  * The worker common address.
355
359
  */
@@ -591,6 +595,92 @@ declare class Counter<AccountType> {
591
595
  isInitialized(): Promise<boolean>;
592
596
  }
593
597
 
598
+ /**
599
+ * This is the DvnUpGrader SDK that provides various functions for interacting with the DVN upGrader contract.
600
+ * @template AccountType - The type of the account.
601
+ */
602
+ declare class DvnUpGrader<AccountType> {
603
+ private sdk;
604
+ readonly module: string[];
605
+ /**
606
+ * Creates an instance of DvnWorker SDK.
607
+ *
608
+ * @remarks
609
+ * This constructor is intended to be used internally by the SDK and does not need to be called directly.
610
+ *
611
+ * @param {MoveSdkImpl<AccountType>} sdk - The SDK implementation.
612
+ */
613
+ constructor(sdk: MoveSdkImpl<AccountType>);
614
+ /**
615
+ * Gets the VID.
616
+ * VID is endpointId % 30000.
617
+ *
618
+ * @returns {Promise<number>} The VID.
619
+ */
620
+ getVid(): Promise<number>;
621
+ /**
622
+ * Gets the owner of the DVN upGrader.
623
+ *
624
+ * @returns {Promise<string>} The owner of the DVN upGrader.
625
+ */
626
+ getOwner(): Promise<string>;
627
+ /**
628
+ * Gets the function signature of the DVN.
629
+ * The function signature is a unique 4 byte representation for
630
+ * each the DVN multisig actions initiable through this contract
631
+ *
632
+ * @param {Uint8Array} functionName - The function name.
633
+ * @returns {Promise<Uint8Array>} The function signature.
634
+ */
635
+ getFunctionSignature(functionName: Uint8Array): Promise<Uint8Array>;
636
+ /**
637
+ * Creates an upgrade hash.
638
+ *
639
+ * @param {Uint8Array} metadataSerialized - The serialized metadata of the DVN.
640
+ * @param {Uint8Array[]} code - The code of the DVN.
641
+ * @param {string} dvnAddress - The address of the DVN.
642
+ * @param {number} vid - The VID.
643
+ * @param {bigint} expiration - The expiration.
644
+ * @returns {Promise<Uint8Array>} The upgrade hash.
645
+ */
646
+ createUpgradeHash(metadataSerialized: Uint8Array, code: Uint8Array[], dvnAddress: string, vid: number, expiration: bigint): Promise<Uint8Array>;
647
+ /**
648
+ * Creates a transfer ownership hash.
649
+ *
650
+ * @param {string} dvnAddress - The address of the DVN.
651
+ * @param {string} newOwner - The new owner address.
652
+ * @param {number} vid - The VID.
653
+ * @param {bigint} expiration - The expiration.
654
+ * @returns {Promise<Uint8Array>} The transfer ownership hash.
655
+ */
656
+ createTransferOwnershipHash(dvnAddress: string, newOwner: string, vid: number, expiration: bigint): Promise<Uint8Array>;
657
+ /**
658
+ * Upgrades the DVN.
659
+ *
660
+ * @param {AccountType | PrivateKey | MnemonicAndPath} signer - The signer of the transaction.
661
+ * @param {Uint8Array} metadataSerialized - The serialized metadata of the DVN.
662
+ * @param {Uint8Array[]} code - The code of the DVN.
663
+ * @param {string} dvnAddress - The address of the DVN.
664
+ * @param {string} signatures - The signatures.
665
+ * @param {number} expiration - The expiration.
666
+ * @param {GasOptions} [gasOptions] - The gas options.
667
+ * @returns {Promise<TransactionResponse>} The transaction response.
668
+ */
669
+ upgrade(signer: AccountType | PrivateKey | MnemonicAndPath, metadataSerialized: Uint8Array, code: Uint8Array[], dvnAddress: string, signatures: string, expiration: number, gasOptions?: GasOptions): Promise<TransactionResponse>;
670
+ /**
671
+ * Transfers the ownership of the DVN.
672
+ *
673
+ * @param {AccountType | PrivateKey | MnemonicAndPath} signer - The signer of the transaction.
674
+ * @param {string} dvnAddress - The address of the DVN.
675
+ * @param {string} newOwner - The new owner address.
676
+ * @param {string} signatures - The signatures.
677
+ * @param {number} expiration - The expiration.
678
+ * @param {GasOptions} [gasOptions] - The gas options.
679
+ * @returns {Promise<TransactionResponse>} The transaction response.
680
+ */
681
+ transferOwnership(signer: AccountType | PrivateKey | MnemonicAndPath, dvnAddress: string, newOwner: string, signatures: string, expiration: number, gasOptions?: GasOptions): Promise<TransactionResponse>;
682
+ }
683
+
594
684
  /**
595
685
  * This is the DvnWorker SDK that provides various functions for interacting with the DVN contract.
596
686
  * @template AccountType - The type of the account.
@@ -2361,6 +2451,7 @@ declare class LayerZeroModulesSdk<AccountType> {
2361
2451
  SimpleMsgLib: SimpleMsgLib<AccountType>;
2362
2452
  Executor: Executor<AccountType>;
2363
2453
  DvnWorker: DvnWorker<AccountType>;
2454
+ DvnUpGrader: DvnUpGrader<AccountType>;
2364
2455
  Counter: Counter<AccountType>;
2365
2456
  Oft: Oft<AccountType>;
2366
2457
  PriceFeed: PriceFeed<AccountType>;
@@ -2370,4 +2461,4 @@ declare class LayerZeroModulesSdk<AccountType> {
2370
2461
  constructor(sdk: MoveSdkImpl<AccountType>);
2371
2462
  }
2372
2463
 
2373
- export { type AccountsOption, Counter, DvnWorker, Endpoint, Executor, LayerZeroModulesSdk, type MoveSdkImpl, Oft, PriceFeed, SimpleMsgLib, Uln302, initializeDvnScriptHex, initializeExecutorScriptHex, index as types };
2464
+ export { type AccountsOption, Counter, DvnUpGrader, DvnWorker, Endpoint, Executor, LayerZeroModulesSdk, type MoveSdkImpl, Oft, PriceFeed, SimpleMsgLib, Uln302, initializeDvnScriptHex, initializeExecutorScriptHex, index as types };
package/dist/index.d.ts CHANGED
@@ -350,6 +350,10 @@ type AccountsOption = {
350
350
  * The DVN address.
351
351
  */
352
352
  dvn?: string;
353
+ /**
354
+ * The DVN upgrader address.
355
+ */
356
+ dvn_upgrader?: string;
353
357
  /**
354
358
  * The worker common address.
355
359
  */
@@ -591,6 +595,92 @@ declare class Counter<AccountType> {
591
595
  isInitialized(): Promise<boolean>;
592
596
  }
593
597
 
598
+ /**
599
+ * This is the DvnUpGrader SDK that provides various functions for interacting with the DVN upGrader contract.
600
+ * @template AccountType - The type of the account.
601
+ */
602
+ declare class DvnUpGrader<AccountType> {
603
+ private sdk;
604
+ readonly module: string[];
605
+ /**
606
+ * Creates an instance of DvnWorker SDK.
607
+ *
608
+ * @remarks
609
+ * This constructor is intended to be used internally by the SDK and does not need to be called directly.
610
+ *
611
+ * @param {MoveSdkImpl<AccountType>} sdk - The SDK implementation.
612
+ */
613
+ constructor(sdk: MoveSdkImpl<AccountType>);
614
+ /**
615
+ * Gets the VID.
616
+ * VID is endpointId % 30000.
617
+ *
618
+ * @returns {Promise<number>} The VID.
619
+ */
620
+ getVid(): Promise<number>;
621
+ /**
622
+ * Gets the owner of the DVN upGrader.
623
+ *
624
+ * @returns {Promise<string>} The owner of the DVN upGrader.
625
+ */
626
+ getOwner(): Promise<string>;
627
+ /**
628
+ * Gets the function signature of the DVN.
629
+ * The function signature is a unique 4 byte representation for
630
+ * each the DVN multisig actions initiable through this contract
631
+ *
632
+ * @param {Uint8Array} functionName - The function name.
633
+ * @returns {Promise<Uint8Array>} The function signature.
634
+ */
635
+ getFunctionSignature(functionName: Uint8Array): Promise<Uint8Array>;
636
+ /**
637
+ * Creates an upgrade hash.
638
+ *
639
+ * @param {Uint8Array} metadataSerialized - The serialized metadata of the DVN.
640
+ * @param {Uint8Array[]} code - The code of the DVN.
641
+ * @param {string} dvnAddress - The address of the DVN.
642
+ * @param {number} vid - The VID.
643
+ * @param {bigint} expiration - The expiration.
644
+ * @returns {Promise<Uint8Array>} The upgrade hash.
645
+ */
646
+ createUpgradeHash(metadataSerialized: Uint8Array, code: Uint8Array[], dvnAddress: string, vid: number, expiration: bigint): Promise<Uint8Array>;
647
+ /**
648
+ * Creates a transfer ownership hash.
649
+ *
650
+ * @param {string} dvnAddress - The address of the DVN.
651
+ * @param {string} newOwner - The new owner address.
652
+ * @param {number} vid - The VID.
653
+ * @param {bigint} expiration - The expiration.
654
+ * @returns {Promise<Uint8Array>} The transfer ownership hash.
655
+ */
656
+ createTransferOwnershipHash(dvnAddress: string, newOwner: string, vid: number, expiration: bigint): Promise<Uint8Array>;
657
+ /**
658
+ * Upgrades the DVN.
659
+ *
660
+ * @param {AccountType | PrivateKey | MnemonicAndPath} signer - The signer of the transaction.
661
+ * @param {Uint8Array} metadataSerialized - The serialized metadata of the DVN.
662
+ * @param {Uint8Array[]} code - The code of the DVN.
663
+ * @param {string} dvnAddress - The address of the DVN.
664
+ * @param {string} signatures - The signatures.
665
+ * @param {number} expiration - The expiration.
666
+ * @param {GasOptions} [gasOptions] - The gas options.
667
+ * @returns {Promise<TransactionResponse>} The transaction response.
668
+ */
669
+ upgrade(signer: AccountType | PrivateKey | MnemonicAndPath, metadataSerialized: Uint8Array, code: Uint8Array[], dvnAddress: string, signatures: string, expiration: number, gasOptions?: GasOptions): Promise<TransactionResponse>;
670
+ /**
671
+ * Transfers the ownership of the DVN.
672
+ *
673
+ * @param {AccountType | PrivateKey | MnemonicAndPath} signer - The signer of the transaction.
674
+ * @param {string} dvnAddress - The address of the DVN.
675
+ * @param {string} newOwner - The new owner address.
676
+ * @param {string} signatures - The signatures.
677
+ * @param {number} expiration - The expiration.
678
+ * @param {GasOptions} [gasOptions] - The gas options.
679
+ * @returns {Promise<TransactionResponse>} The transaction response.
680
+ */
681
+ transferOwnership(signer: AccountType | PrivateKey | MnemonicAndPath, dvnAddress: string, newOwner: string, signatures: string, expiration: number, gasOptions?: GasOptions): Promise<TransactionResponse>;
682
+ }
683
+
594
684
  /**
595
685
  * This is the DvnWorker SDK that provides various functions for interacting with the DVN contract.
596
686
  * @template AccountType - The type of the account.
@@ -2361,6 +2451,7 @@ declare class LayerZeroModulesSdk<AccountType> {
2361
2451
  SimpleMsgLib: SimpleMsgLib<AccountType>;
2362
2452
  Executor: Executor<AccountType>;
2363
2453
  DvnWorker: DvnWorker<AccountType>;
2454
+ DvnUpGrader: DvnUpGrader<AccountType>;
2364
2455
  Counter: Counter<AccountType>;
2365
2456
  Oft: Oft<AccountType>;
2366
2457
  PriceFeed: PriceFeed<AccountType>;
@@ -2370,4 +2461,4 @@ declare class LayerZeroModulesSdk<AccountType> {
2370
2461
  constructor(sdk: MoveSdkImpl<AccountType>);
2371
2462
  }
2372
2463
 
2373
- export { type AccountsOption, Counter, DvnWorker, Endpoint, Executor, LayerZeroModulesSdk, type MoveSdkImpl, Oft, PriceFeed, SimpleMsgLib, Uln302, initializeDvnScriptHex, initializeExecutorScriptHex, index as types };
2464
+ export { type AccountsOption, Counter, DvnUpGrader, DvnWorker, Endpoint, Executor, LayerZeroModulesSdk, type MoveSdkImpl, Oft, PriceFeed, SimpleMsgLib, Uln302, initializeDvnScriptHex, initializeExecutorScriptHex, index as types };
package/dist/index.mjs CHANGED
@@ -340,6 +340,139 @@ var Counter = class {
340
340
  }
341
341
  }
342
342
  };
343
+ var DvnUpGrader = class {
344
+ /**
345
+ * Creates an instance of DvnWorker SDK.
346
+ *
347
+ * @remarks
348
+ * This constructor is intended to be used internally by the SDK and does not need to be called directly.
349
+ *
350
+ * @param {MoveSdkImpl<AccountType>} sdk - The SDK implementation.
351
+ */
352
+ constructor(sdk) {
353
+ this.sdk = sdk;
354
+ this.module = [sdk.accounts.dvn_upgrader?.toString() ?? "0x0", "dvn_upgrader"];
355
+ }
356
+ /**
357
+ * Gets the VID.
358
+ * VID is endpointId % 30000.
359
+ *
360
+ * @returns {Promise<number>} The VID.
361
+ */
362
+ async getVid() {
363
+ const view = await this.sdk.viewFunction({
364
+ functionName: `${this.module[0]}::${this.module[1]}::vid`,
365
+ functionArgs: []
366
+ });
367
+ return view[0];
368
+ }
369
+ /**
370
+ * Gets the owner of the DVN upGrader.
371
+ *
372
+ * @returns {Promise<string>} The owner of the DVN upGrader.
373
+ */
374
+ async getOwner() {
375
+ const view = await this.sdk.viewFunction({
376
+ functionName: `${this.module[0]}::${this.module[1]}::dvn_owner`,
377
+ functionArgs: []
378
+ });
379
+ return view[0];
380
+ }
381
+ /**
382
+ * Gets the function signature of the DVN.
383
+ * The function signature is a unique 4 byte representation for
384
+ * each the DVN multisig actions initiable through this contract
385
+ *
386
+ * @param {Uint8Array} functionName - The function name.
387
+ * @returns {Promise<Uint8Array>} The function signature.
388
+ */
389
+ async getFunctionSignature(functionName) {
390
+ const view = await this.sdk.viewFunction({
391
+ functionName: `${this.module[0]}::${this.module[1]}::function_signature`,
392
+ functionArgs: [functionName],
393
+ functionArgTypes: ["vector<u8>"]
394
+ });
395
+ return view[0];
396
+ }
397
+ /**
398
+ * Creates an upgrade hash.
399
+ *
400
+ * @param {Uint8Array} metadataSerialized - The serialized metadata of the DVN.
401
+ * @param {Uint8Array[]} code - The code of the DVN.
402
+ * @param {string} dvnAddress - The address of the DVN.
403
+ * @param {number} vid - The VID.
404
+ * @param {bigint} expiration - The expiration.
405
+ * @returns {Promise<Uint8Array>} The upgrade hash.
406
+ */
407
+ async createUpgradeHash(metadataSerialized, code, dvnAddress, vid, expiration) {
408
+ const view = await this.sdk.viewFunction({
409
+ functionName: `${this.module[0]}::${this.module[1]}::upgrade_hash`,
410
+ functionArgs: [metadataSerialized, code, dvnAddress, vid, expiration],
411
+ functionArgTypes: ["vector<u8>", "vector<vector<u8>>", "address", "u32", "u64"]
412
+ });
413
+ const hash = view[0];
414
+ return hash.bytes;
415
+ }
416
+ /**
417
+ * Creates a transfer ownership hash.
418
+ *
419
+ * @param {string} dvnAddress - The address of the DVN.
420
+ * @param {string} newOwner - The new owner address.
421
+ * @param {number} vid - The VID.
422
+ * @param {bigint} expiration - The expiration.
423
+ * @returns {Promise<Uint8Array>} The transfer ownership hash.
424
+ */
425
+ async createTransferOwnershipHash(dvnAddress, newOwner, vid, expiration) {
426
+ const view = await this.sdk.viewFunction({
427
+ functionName: `${this.module[0]}::${this.module[1]}::ownership_transfer_hash`,
428
+ functionArgs: [dvnAddress, newOwner, vid, expiration],
429
+ functionArgTypes: ["address", "address", "u32", "u64"]
430
+ });
431
+ const hash = view[0];
432
+ return hash.bytes;
433
+ }
434
+ /**
435
+ * Upgrades the DVN.
436
+ *
437
+ * @param {AccountType | PrivateKey | MnemonicAndPath} signer - The signer of the transaction.
438
+ * @param {Uint8Array} metadataSerialized - The serialized metadata of the DVN.
439
+ * @param {Uint8Array[]} code - The code of the DVN.
440
+ * @param {string} dvnAddress - The address of the DVN.
441
+ * @param {string} signatures - The signatures.
442
+ * @param {number} expiration - The expiration.
443
+ * @param {GasOptions} [gasOptions] - The gas options.
444
+ * @returns {Promise<TransactionResponse>} The transaction response.
445
+ */
446
+ async upgrade(signer, metadataSerialized, code, dvnAddress, signatures, expiration, gasOptions) {
447
+ return this.sdk.sendAndConfirmTransaction(
448
+ signer,
449
+ `${this.module[0]}::${this.module[1]}::upgrade`,
450
+ [metadataSerialized, code, dvnAddress, arrayify(signatures), expiration],
451
+ ["vector<u8>", "vector<vector<u8>>", "address", "vector<u8>", "u64"],
452
+ gasOptions
453
+ );
454
+ }
455
+ /**
456
+ * Transfers the ownership of the DVN.
457
+ *
458
+ * @param {AccountType | PrivateKey | MnemonicAndPath} signer - The signer of the transaction.
459
+ * @param {string} dvnAddress - The address of the DVN.
460
+ * @param {string} newOwner - The new owner address.
461
+ * @param {string} signatures - The signatures.
462
+ * @param {number} expiration - The expiration.
463
+ * @param {GasOptions} [gasOptions] - The gas options.
464
+ * @returns {Promise<TransactionResponse>} The transaction response.
465
+ */
466
+ async transferOwnership(signer, dvnAddress, newOwner, signatures, expiration, gasOptions) {
467
+ return this.sdk.sendAndConfirmTransaction(
468
+ signer,
469
+ `${this.module[0]}::${this.module[1]}::transfer_ownership`,
470
+ [dvnAddress, newOwner, arrayify(signatures), expiration],
471
+ ["address", "address", "vector<u8>", "u64"],
472
+ gasOptions
473
+ );
474
+ }
475
+ };
343
476
  var EDVN_DST_EID_NOT_CONFIGURED = 4;
344
477
  var EEXECUTOR_DST_EID_NOT_CONFIGURED = 5;
345
478
  var EWORKER_NOT_REGISTERED = 16;
@@ -3970,6 +4103,7 @@ var LayerZeroModulesSdk = class {
3970
4103
  this.Executor = new Executor(sdk);
3971
4104
  this.SimpleMsgLib = new SimpleMsgLib(sdk);
3972
4105
  this.DvnWorker = new DvnWorker(sdk);
4106
+ this.DvnUpGrader = new DvnUpGrader(sdk);
3973
4107
  this.Counter = new Counter(sdk);
3974
4108
  this.Oft = new Oft(sdk);
3975
4109
  this.PriceFeed = new PriceFeed(sdk);
@@ -3979,6 +4113,6 @@ var LayerZeroModulesSdk = class {
3979
4113
  }
3980
4114
  };
3981
4115
 
3982
- export { Counter, DvnWorker, Endpoint, Executor, LayerZeroModulesSdk, Oft, PriceFeed, SimpleMsgLib, Uln302, initializeDvnScriptHex, initializeExecutorScriptHex, types_exports as types };
4116
+ export { Counter, DvnUpGrader, DvnWorker, Endpoint, Executor, LayerZeroModulesSdk, Oft, PriceFeed, SimpleMsgLib, Uln302, initializeDvnScriptHex, initializeExecutorScriptHex, types_exports as types };
3983
4117
  //# sourceMappingURL=index.mjs.map
3984
4118
  //# sourceMappingURL=index.mjs.map