@layerzerolabs/lz-movevm-sdk-v2 3.0.42 → 3.0.44

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
@@ -1,6 +1,6 @@
1
1
  import { EndpointId } from '@layerzerolabs/lz-definitions';
2
- import { MoveFunction, EntryFunctionArgumentTypes, MoveValue, PrivateKey, MnemonicAndPath, ByteCode, GasOptions, TransactionResponse, MoveStructId, TableItemRequest, InputEntryFunctionData } from '@layerzerolabs/move-definitions';
3
2
  import { Packet, PacketV1Codec } from '@layerzerolabs/lz-v2-utilities';
3
+ import { MoveFunction, EntryFunctionArgumentTypes, MoveValue, PrivateKey, MnemonicAndPath, ByteCode, GasOptions, TransactionResponse, MoveStructId, TableItemRequest, InputEntryFunctionData } from '@layerzerolabs/move-definitions';
4
4
 
5
5
  /**
6
6
  * Interface representing the DVN destination configuration.
@@ -1029,6 +1029,12 @@ declare class EndpointCommon<AccountType> {
1029
1029
  * @returns {Promise<number>} The endpoint ID, 0 if not found.
1030
1030
  */
1031
1031
  getEid(): Promise<number>;
1032
+ /**
1033
+ * Create a payload for transferring the LayerZero admin.
1034
+ * @param newAdmin
1035
+ */
1036
+ createTransferLayerzeroAdminPayload(newAdmin: string): InputEntryFunctionData;
1037
+ getLayerzeroAdmin(): Promise<string>;
1032
1038
  }
1033
1039
 
1034
1040
  /**
@@ -2048,6 +2054,43 @@ declare class SimpleMsgLib<AccountType> {
2048
2054
  getMessagingFee(): Promise<[bigint, bigint]>;
2049
2055
  }
2050
2056
 
2057
+ /**
2058
+ * This is the Treasury SDK that provides functions for interacting with the Treasury contract.
2059
+ * @template AccountType - The type of the account.
2060
+ */
2061
+ declare class Treasury<AccountType> {
2062
+ private sdk;
2063
+ module: string[];
2064
+ /**
2065
+ * Creates an instance of Treasury SDK.
2066
+ *
2067
+ * @remarks
2068
+ * This constructor is intended to be used internally by the SDK and does not need to be called directly.
2069
+ *
2070
+ * @param {MoveSdkImpl<AccountType>} sdk - The SDK implementation.
2071
+ */
2072
+ constructor(sdk: MoveSdkImpl<AccountType>);
2073
+ /**
2074
+ * Updates the deposit address.
2075
+ *
2076
+ * @param {AccountType | PrivateKey | MnemonicAndPath} signer - The signer of the transaction.
2077
+ * @param {string} newAddress - The new deposit address.
2078
+ * @param {GasOptions} [gasOptions] - The gas options.
2079
+ * @returns {Promise<TransactionResponse>} The transaction response.
2080
+ */
2081
+ updateDepositAddress(signer: AccountType | PrivateKey | MnemonicAndPath, newAddress: string, gasOptions?: GasOptions): Promise<TransactionResponse>;
2082
+ /**
2083
+ * Gets the fee for the specified total fee and LayerZero token flag.
2084
+ *
2085
+ * @param {bigint} total_fee - The total fee.
2086
+ * @param {boolean} lztoken - The LayerZero token flag.
2087
+ * @returns {Promise<bigint>} The fee.
2088
+ */
2089
+ getFee(total_fee: bigint, lztoken: boolean): Promise<bigint>;
2090
+ createTransferTreasuryAdminPayload(newAdmin: string): InputEntryFunctionData;
2091
+ getTreasuryAdmin(): Promise<string>;
2092
+ }
2093
+
2051
2094
  /**
2052
2095
  * This is the Uln302 SDK that provides functions for interacting with the ULN 302 contract.
2053
2096
  * @template AccountType - The type of the account.
@@ -2216,6 +2259,7 @@ declare class LayerZeroModulesSdk<AccountType> {
2216
2259
  PriceFeed: PriceFeed<AccountType>;
2217
2260
  WorkerCommon: WorkerCommon<AccountType>;
2218
2261
  EndpointV2Common: EndpointCommon<AccountType>;
2262
+ Treasury: Treasury<AccountType>;
2219
2263
  constructor(sdk: MoveSdkImpl<AccountType>);
2220
2264
  }
2221
2265
 
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { EndpointId } from '@layerzerolabs/lz-definitions';
2
- import { MoveFunction, EntryFunctionArgumentTypes, MoveValue, PrivateKey, MnemonicAndPath, ByteCode, GasOptions, TransactionResponse, MoveStructId, TableItemRequest, InputEntryFunctionData } from '@layerzerolabs/move-definitions';
3
2
  import { Packet, PacketV1Codec } from '@layerzerolabs/lz-v2-utilities';
3
+ import { MoveFunction, EntryFunctionArgumentTypes, MoveValue, PrivateKey, MnemonicAndPath, ByteCode, GasOptions, TransactionResponse, MoveStructId, TableItemRequest, InputEntryFunctionData } from '@layerzerolabs/move-definitions';
4
4
 
5
5
  /**
6
6
  * Interface representing the DVN destination configuration.
@@ -1029,6 +1029,12 @@ declare class EndpointCommon<AccountType> {
1029
1029
  * @returns {Promise<number>} The endpoint ID, 0 if not found.
1030
1030
  */
1031
1031
  getEid(): Promise<number>;
1032
+ /**
1033
+ * Create a payload for transferring the LayerZero admin.
1034
+ * @param newAdmin
1035
+ */
1036
+ createTransferLayerzeroAdminPayload(newAdmin: string): InputEntryFunctionData;
1037
+ getLayerzeroAdmin(): Promise<string>;
1032
1038
  }
1033
1039
 
1034
1040
  /**
@@ -2048,6 +2054,43 @@ declare class SimpleMsgLib<AccountType> {
2048
2054
  getMessagingFee(): Promise<[bigint, bigint]>;
2049
2055
  }
2050
2056
 
2057
+ /**
2058
+ * This is the Treasury SDK that provides functions for interacting with the Treasury contract.
2059
+ * @template AccountType - The type of the account.
2060
+ */
2061
+ declare class Treasury<AccountType> {
2062
+ private sdk;
2063
+ module: string[];
2064
+ /**
2065
+ * Creates an instance of Treasury SDK.
2066
+ *
2067
+ * @remarks
2068
+ * This constructor is intended to be used internally by the SDK and does not need to be called directly.
2069
+ *
2070
+ * @param {MoveSdkImpl<AccountType>} sdk - The SDK implementation.
2071
+ */
2072
+ constructor(sdk: MoveSdkImpl<AccountType>);
2073
+ /**
2074
+ * Updates the deposit address.
2075
+ *
2076
+ * @param {AccountType | PrivateKey | MnemonicAndPath} signer - The signer of the transaction.
2077
+ * @param {string} newAddress - The new deposit address.
2078
+ * @param {GasOptions} [gasOptions] - The gas options.
2079
+ * @returns {Promise<TransactionResponse>} The transaction response.
2080
+ */
2081
+ updateDepositAddress(signer: AccountType | PrivateKey | MnemonicAndPath, newAddress: string, gasOptions?: GasOptions): Promise<TransactionResponse>;
2082
+ /**
2083
+ * Gets the fee for the specified total fee and LayerZero token flag.
2084
+ *
2085
+ * @param {bigint} total_fee - The total fee.
2086
+ * @param {boolean} lztoken - The LayerZero token flag.
2087
+ * @returns {Promise<bigint>} The fee.
2088
+ */
2089
+ getFee(total_fee: bigint, lztoken: boolean): Promise<bigint>;
2090
+ createTransferTreasuryAdminPayload(newAdmin: string): InputEntryFunctionData;
2091
+ getTreasuryAdmin(): Promise<string>;
2092
+ }
2093
+
2051
2094
  /**
2052
2095
  * This is the Uln302 SDK that provides functions for interacting with the ULN 302 contract.
2053
2096
  * @template AccountType - The type of the account.
@@ -2216,6 +2259,7 @@ declare class LayerZeroModulesSdk<AccountType> {
2216
2259
  PriceFeed: PriceFeed<AccountType>;
2217
2260
  WorkerCommon: WorkerCommon<AccountType>;
2218
2261
  EndpointV2Common: EndpointCommon<AccountType>;
2262
+ Treasury: Treasury<AccountType>;
2219
2263
  constructor(sdk: MoveSdkImpl<AccountType>);
2220
2264
  }
2221
2265
 
package/dist/index.mjs CHANGED
@@ -1196,6 +1196,25 @@ var EndpointCommon = class {
1196
1196
  throw e;
1197
1197
  }
1198
1198
  }
1199
+ /**
1200
+ * Create a payload for transferring the LayerZero admin.
1201
+ * @param newAdmin
1202
+ */
1203
+ createTransferLayerzeroAdminPayload(newAdmin) {
1204
+ return {
1205
+ function: `${this.universalConfigModule[0]}::${this.universalConfigModule[1]}::transfer_layerzero_admin`,
1206
+ functionArguments: [newAdmin],
1207
+ functionArgumentTypes: ["address"]
1208
+ };
1209
+ }
1210
+ async getLayerzeroAdmin() {
1211
+ const view = await this.sdk.viewFunction({
1212
+ functionName: `${this.universalConfigModule[0]}::${this.universalConfigModule[1]}::layerzero_admin`,
1213
+ functionArgs: [],
1214
+ functionArgTypes: []
1215
+ });
1216
+ return view[0];
1217
+ }
1199
1218
  };
1200
1219
  var Executor = class {
1201
1220
  /**
@@ -3300,6 +3319,73 @@ var SimpleMsgLib = class {
3300
3319
  }
3301
3320
  };
3302
3321
 
3322
+ // src/modules/treasury.ts
3323
+ var Treasury = class {
3324
+ /**
3325
+ * Creates an instance of Treasury SDK.
3326
+ *
3327
+ * @remarks
3328
+ * This constructor is intended to be used internally by the SDK and does not need to be called directly.
3329
+ *
3330
+ * @param {MoveSdkImpl<AccountType>} sdk - The SDK implementation.
3331
+ */
3332
+ constructor(sdk) {
3333
+ this.sdk = sdk;
3334
+ this.module = [sdk.accounts.treasury?.toString() ?? "0x0", "treasury"];
3335
+ }
3336
+ /**
3337
+ * Updates the deposit address.
3338
+ *
3339
+ * @param {AccountType | PrivateKey | MnemonicAndPath} signer - The signer of the transaction.
3340
+ * @param {string} newAddress - The new deposit address.
3341
+ * @param {GasOptions} [gasOptions] - The gas options.
3342
+ * @returns {Promise<TransactionResponse>} The transaction response.
3343
+ */
3344
+ async updateDepositAddress(signer, newAddress, gasOptions) {
3345
+ return this.sdk.sendAndConfirmTransaction(
3346
+ signer,
3347
+ `${this.module[0]}::${this.module[1]}::update_deposit_address`,
3348
+ [newAddress],
3349
+ ["address"],
3350
+ gasOptions
3351
+ );
3352
+ }
3353
+ /**
3354
+ * Gets the fee for the specified total fee and LayerZero token flag.
3355
+ *
3356
+ * @param {bigint} total_fee - The total fee.
3357
+ * @param {boolean} lztoken - The LayerZero token flag.
3358
+ * @returns {Promise<bigint>} The fee.
3359
+ */
3360
+ async getFee(total_fee, lztoken) {
3361
+ const view = await this.sdk.viewFunction({
3362
+ functionName: `${this.module[0]}::${this.module[1]}::get_fee`,
3363
+ functionArgs: [total_fee, lztoken],
3364
+ functionArgTypes: ["u64", "bool"]
3365
+ });
3366
+ return view[0];
3367
+ }
3368
+ /*
3369
+ * Create a payload for transferring the treasury admin.
3370
+ * @param newAdmin
3371
+ */
3372
+ createTransferTreasuryAdminPayload(newAdmin) {
3373
+ return {
3374
+ function: `${this.module[0]}::${this.module[1]}::transfer_treasury_admin`,
3375
+ functionArguments: [newAdmin],
3376
+ functionArgumentTypes: ["address"]
3377
+ };
3378
+ }
3379
+ async getTreasuryAdmin() {
3380
+ const view = await this.sdk.viewFunction({
3381
+ functionName: `${this.module[0]}::${this.module[1]}::layerzero_treasury_admin`,
3382
+ functionArgs: [],
3383
+ functionArgTypes: []
3384
+ });
3385
+ return view[0];
3386
+ }
3387
+ };
3388
+
3303
3389
  // src/modules/uln302.ts
3304
3390
  var Uln302 = class {
3305
3391
  /**
@@ -3606,6 +3692,7 @@ var LayerZeroModulesSdk = class {
3606
3692
  this.PriceFeed = new PriceFeed(sdk);
3607
3693
  this.WorkerCommon = new WorkerCommon(sdk);
3608
3694
  this.EndpointV2Common = new EndpointCommon(sdk);
3695
+ this.Treasury = new Treasury(sdk);
3609
3696
  }
3610
3697
  };
3611
3698