@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 +24 -0
- package/dist/index.cjs +111 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +52 -0
- package/dist/index.d.ts +52 -0
- package/dist/index.mjs +111 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +8 -8
package/dist/index.d.mts
CHANGED
|
@@ -508,6 +508,22 @@ declare class Counter<AccountType> {
|
|
|
508
508
|
* @param {MoveSdkImpl<AccountType>} sdk - The SDK implementation.
|
|
509
509
|
*/
|
|
510
510
|
constructor(sdk: MoveSdkImpl<AccountType>);
|
|
511
|
+
/**
|
|
512
|
+
* Create a payload of set delegate contract function.
|
|
513
|
+
*
|
|
514
|
+
* @param {string} delegate - The delegate address.
|
|
515
|
+
* @returns {InputEntryFunctionData} The input entry function data, use to build the transaction.
|
|
516
|
+
*/
|
|
517
|
+
setDelegatePayload(delegate: string): InputEntryFunctionData;
|
|
518
|
+
/**
|
|
519
|
+
* Create a payload of set config contract function.
|
|
520
|
+
*
|
|
521
|
+
* @param {number} eid - The endpoint ID.
|
|
522
|
+
* @param {number} config_type - The config type.
|
|
523
|
+
* @param {Uint8Array} config - The config.
|
|
524
|
+
* @returns {InputEntryFunctionData} The input entry function data, use to build the transaction.
|
|
525
|
+
*/
|
|
526
|
+
setConfigPayload(eid: number, config_type: number, config: Uint8Array): InputEntryFunctionData;
|
|
511
527
|
/**
|
|
512
528
|
* Create a payload of send contract function.
|
|
513
529
|
*
|
|
@@ -568,6 +584,18 @@ declare class Counter<AccountType> {
|
|
|
568
584
|
* @returns {Promise<TransactionResponse>} The transaction response.
|
|
569
585
|
*/
|
|
570
586
|
setPeer(signer: AccountType | PrivateKey | MnemonicAndPath, remoteEid: EndpointId, remoteOapp: string, gasOptions?: GasOptions): Promise<TransactionResponse>;
|
|
587
|
+
/**
|
|
588
|
+
* Checks if the counter has a delegate.
|
|
589
|
+
*
|
|
590
|
+
* @returns {Promise<boolean>} True if the counter has a delegate, false otherwise.
|
|
591
|
+
*/
|
|
592
|
+
hasDelegate(): Promise<boolean>;
|
|
593
|
+
/**
|
|
594
|
+
* Gets the delegate address.
|
|
595
|
+
*
|
|
596
|
+
* @returns {Promise<string>} The delegate address, '' if not found.
|
|
597
|
+
*/
|
|
598
|
+
getDelegate(): Promise<string>;
|
|
571
599
|
/**
|
|
572
600
|
* Gets the peer for the specified remote endpoint.
|
|
573
601
|
*
|
|
@@ -593,6 +621,30 @@ declare class Counter<AccountType> {
|
|
|
593
621
|
* @returns {Promise<boolean>} True if the counter is initialized, false otherwise.
|
|
594
622
|
*/
|
|
595
623
|
isInitialized(): Promise<boolean>;
|
|
624
|
+
/**
|
|
625
|
+
* Gets the oapp admin
|
|
626
|
+
*
|
|
627
|
+
* @returns {Promise<string>} The admin address, '' if not found.
|
|
628
|
+
*/
|
|
629
|
+
getAdmin(): Promise<string>;
|
|
630
|
+
/**
|
|
631
|
+
* Create a payload of set peer contract function.
|
|
632
|
+
*
|
|
633
|
+
* @param {EndpointId} remoteEid - The remote endpoint ID.
|
|
634
|
+
* @param {string} remoteOapp - The remote OAPP address.
|
|
635
|
+
* @returns {InputEntryFunctionData} The input entry function data, use to build the transaction.
|
|
636
|
+
*/
|
|
637
|
+
setAdminPayload(newAdmin: string): InputEntryFunctionData;
|
|
638
|
+
/**
|
|
639
|
+
* Sets the peer for the specified remote endpoint.
|
|
640
|
+
*
|
|
641
|
+
* @param {AccountType | PrivateKey | MnemonicAndPath} signer - The signer of the transaction.
|
|
642
|
+
* @param {EndpointId} remoteEid - The remote endpoint ID.
|
|
643
|
+
* @param {string} remoteOapp - The remote OAPP address.
|
|
644
|
+
* @param {GasOptions} [gasOptions] - The gas options.
|
|
645
|
+
* @returns {Promise<TransactionResponse>} The transaction response.
|
|
646
|
+
*/
|
|
647
|
+
setAdmin(signer: AccountType | PrivateKey | MnemonicAndPath, newAdmin: string, gasOptions?: GasOptions): Promise<TransactionResponse>;
|
|
596
648
|
}
|
|
597
649
|
|
|
598
650
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -508,6 +508,22 @@ declare class Counter<AccountType> {
|
|
|
508
508
|
* @param {MoveSdkImpl<AccountType>} sdk - The SDK implementation.
|
|
509
509
|
*/
|
|
510
510
|
constructor(sdk: MoveSdkImpl<AccountType>);
|
|
511
|
+
/**
|
|
512
|
+
* Create a payload of set delegate contract function.
|
|
513
|
+
*
|
|
514
|
+
* @param {string} delegate - The delegate address.
|
|
515
|
+
* @returns {InputEntryFunctionData} The input entry function data, use to build the transaction.
|
|
516
|
+
*/
|
|
517
|
+
setDelegatePayload(delegate: string): InputEntryFunctionData;
|
|
518
|
+
/**
|
|
519
|
+
* Create a payload of set config contract function.
|
|
520
|
+
*
|
|
521
|
+
* @param {number} eid - The endpoint ID.
|
|
522
|
+
* @param {number} config_type - The config type.
|
|
523
|
+
* @param {Uint8Array} config - The config.
|
|
524
|
+
* @returns {InputEntryFunctionData} The input entry function data, use to build the transaction.
|
|
525
|
+
*/
|
|
526
|
+
setConfigPayload(eid: number, config_type: number, config: Uint8Array): InputEntryFunctionData;
|
|
511
527
|
/**
|
|
512
528
|
* Create a payload of send contract function.
|
|
513
529
|
*
|
|
@@ -568,6 +584,18 @@ declare class Counter<AccountType> {
|
|
|
568
584
|
* @returns {Promise<TransactionResponse>} The transaction response.
|
|
569
585
|
*/
|
|
570
586
|
setPeer(signer: AccountType | PrivateKey | MnemonicAndPath, remoteEid: EndpointId, remoteOapp: string, gasOptions?: GasOptions): Promise<TransactionResponse>;
|
|
587
|
+
/**
|
|
588
|
+
* Checks if the counter has a delegate.
|
|
589
|
+
*
|
|
590
|
+
* @returns {Promise<boolean>} True if the counter has a delegate, false otherwise.
|
|
591
|
+
*/
|
|
592
|
+
hasDelegate(): Promise<boolean>;
|
|
593
|
+
/**
|
|
594
|
+
* Gets the delegate address.
|
|
595
|
+
*
|
|
596
|
+
* @returns {Promise<string>} The delegate address, '' if not found.
|
|
597
|
+
*/
|
|
598
|
+
getDelegate(): Promise<string>;
|
|
571
599
|
/**
|
|
572
600
|
* Gets the peer for the specified remote endpoint.
|
|
573
601
|
*
|
|
@@ -593,6 +621,30 @@ declare class Counter<AccountType> {
|
|
|
593
621
|
* @returns {Promise<boolean>} True if the counter is initialized, false otherwise.
|
|
594
622
|
*/
|
|
595
623
|
isInitialized(): Promise<boolean>;
|
|
624
|
+
/**
|
|
625
|
+
* Gets the oapp admin
|
|
626
|
+
*
|
|
627
|
+
* @returns {Promise<string>} The admin address, '' if not found.
|
|
628
|
+
*/
|
|
629
|
+
getAdmin(): Promise<string>;
|
|
630
|
+
/**
|
|
631
|
+
* Create a payload of set peer contract function.
|
|
632
|
+
*
|
|
633
|
+
* @param {EndpointId} remoteEid - The remote endpoint ID.
|
|
634
|
+
* @param {string} remoteOapp - The remote OAPP address.
|
|
635
|
+
* @returns {InputEntryFunctionData} The input entry function data, use to build the transaction.
|
|
636
|
+
*/
|
|
637
|
+
setAdminPayload(newAdmin: string): InputEntryFunctionData;
|
|
638
|
+
/**
|
|
639
|
+
* Sets the peer for the specified remote endpoint.
|
|
640
|
+
*
|
|
641
|
+
* @param {AccountType | PrivateKey | MnemonicAndPath} signer - The signer of the transaction.
|
|
642
|
+
* @param {EndpointId} remoteEid - The remote endpoint ID.
|
|
643
|
+
* @param {string} remoteOapp - The remote OAPP address.
|
|
644
|
+
* @param {GasOptions} [gasOptions] - The gas options.
|
|
645
|
+
* @returns {Promise<TransactionResponse>} The transaction response.
|
|
646
|
+
*/
|
|
647
|
+
setAdmin(signer: AccountType | PrivateKey | MnemonicAndPath, newAdmin: string, gasOptions?: GasOptions): Promise<TransactionResponse>;
|
|
596
648
|
}
|
|
597
649
|
|
|
598
650
|
/**
|
package/dist/index.mjs
CHANGED
|
@@ -141,6 +141,35 @@ var Counter = class {
|
|
|
141
141
|
this.module = [sdk.accounts.counter_v2?.toString() ?? "0x0", "counter"];
|
|
142
142
|
this.oappCoreModule = [sdk.accounts.counter_v2?.toString() ?? "0x0", "oapp_core"];
|
|
143
143
|
}
|
|
144
|
+
/**
|
|
145
|
+
* Create a payload of set delegate contract function.
|
|
146
|
+
*
|
|
147
|
+
* @param {string} delegate - The delegate address.
|
|
148
|
+
* @returns {InputEntryFunctionData} The input entry function data, use to build the transaction.
|
|
149
|
+
*/
|
|
150
|
+
setDelegatePayload(delegate) {
|
|
151
|
+
return {
|
|
152
|
+
function: `${this.oappCoreModule[0]}::${this.oappCoreModule[1]}::set_delegate`,
|
|
153
|
+
functionArguments: [delegate],
|
|
154
|
+
functionArgumentTypes: ["address"]
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Create a payload of set config contract function.
|
|
159
|
+
*
|
|
160
|
+
* @param {number} eid - The endpoint ID.
|
|
161
|
+
* @param {number} config_type - The config type.
|
|
162
|
+
* @param {Uint8Array} config - The config.
|
|
163
|
+
* @returns {InputEntryFunctionData} The input entry function data, use to build the transaction.
|
|
164
|
+
*/
|
|
165
|
+
setConfigPayload(eid, config_type, config) {
|
|
166
|
+
const ulnMsgLibAddr = this.sdk.accounts.uln_message_lib?.toString() ?? "0x0";
|
|
167
|
+
return {
|
|
168
|
+
function: `${this.oappCoreModule[0]}::${this.oappCoreModule[1]}::set_config`,
|
|
169
|
+
functionArguments: [ulnMsgLibAddr, eid, config_type, config],
|
|
170
|
+
functionArgumentTypes: ["address", "u32", "u32", "vector<u8>"]
|
|
171
|
+
};
|
|
172
|
+
}
|
|
144
173
|
/**
|
|
145
174
|
* Create a payload of send contract function.
|
|
146
175
|
*
|
|
@@ -259,6 +288,33 @@ var Counter = class {
|
|
|
259
288
|
gasOptions
|
|
260
289
|
);
|
|
261
290
|
}
|
|
291
|
+
/**
|
|
292
|
+
* Checks if the counter has a delegate.
|
|
293
|
+
*
|
|
294
|
+
* @returns {Promise<boolean>} True if the counter has a delegate, false otherwise.
|
|
295
|
+
*/
|
|
296
|
+
async hasDelegate() {
|
|
297
|
+
const view = await this.sdk.viewFunction({
|
|
298
|
+
functionName: `${this.oappCoreModule[0]}::${this.oappCoreModule[1]}::has_delegate`,
|
|
299
|
+
functionArgs: [],
|
|
300
|
+
functionArgTypes: []
|
|
301
|
+
});
|
|
302
|
+
return view[0];
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* Gets the delegate address.
|
|
306
|
+
*
|
|
307
|
+
* @returns {Promise<string>} The delegate address, '' if not found.
|
|
308
|
+
*/
|
|
309
|
+
async getDelegate() {
|
|
310
|
+
const view = await this.sdk.viewFunction({
|
|
311
|
+
functionName: `${this.oappCoreModule[0]}::${this.oappCoreModule[1]}::get_delegate`,
|
|
312
|
+
functionArgs: [],
|
|
313
|
+
functionArgTypes: []
|
|
314
|
+
});
|
|
315
|
+
const bytes = view[0];
|
|
316
|
+
return ensure0x(bytes);
|
|
317
|
+
}
|
|
262
318
|
/**
|
|
263
319
|
* Gets the peer for the specified remote endpoint.
|
|
264
320
|
*
|
|
@@ -339,6 +395,61 @@ var Counter = class {
|
|
|
339
395
|
return false;
|
|
340
396
|
}
|
|
341
397
|
}
|
|
398
|
+
/**
|
|
399
|
+
* Gets the oapp admin
|
|
400
|
+
*
|
|
401
|
+
* @returns {Promise<string>} The admin address, '' if not found.
|
|
402
|
+
*/
|
|
403
|
+
async getAdmin() {
|
|
404
|
+
try {
|
|
405
|
+
const view = await this.sdk.viewFunction({
|
|
406
|
+
functionName: `${this.oappCoreModule[0]}::${this.oappCoreModule[1]}::get_admin`,
|
|
407
|
+
functionArgs: [],
|
|
408
|
+
functionArgTypes: []
|
|
409
|
+
});
|
|
410
|
+
const bytes = view[0];
|
|
411
|
+
return ensure0x(bytes);
|
|
412
|
+
} catch (e) {
|
|
413
|
+
if (e instanceof MoveResourceNotFoundError) {
|
|
414
|
+
return "";
|
|
415
|
+
} else if (e instanceof MoveAbortError && e.abortCode === 2) {
|
|
416
|
+
return "";
|
|
417
|
+
}
|
|
418
|
+
throw e;
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
/**
|
|
422
|
+
* Create a payload of set peer contract function.
|
|
423
|
+
*
|
|
424
|
+
* @param {EndpointId} remoteEid - The remote endpoint ID.
|
|
425
|
+
* @param {string} remoteOapp - The remote OAPP address.
|
|
426
|
+
* @returns {InputEntryFunctionData} The input entry function data, use to build the transaction.
|
|
427
|
+
*/
|
|
428
|
+
setAdminPayload(newAdmin) {
|
|
429
|
+
return {
|
|
430
|
+
function: `${this.oappCoreModule[0]}::${this.oappCoreModule[1]}::transfer_admin`,
|
|
431
|
+
functionArguments: [newAdmin],
|
|
432
|
+
functionArgumentTypes: ["address"]
|
|
433
|
+
};
|
|
434
|
+
}
|
|
435
|
+
/**
|
|
436
|
+
* Sets the peer for the specified remote endpoint.
|
|
437
|
+
*
|
|
438
|
+
* @param {AccountType | PrivateKey | MnemonicAndPath} signer - The signer of the transaction.
|
|
439
|
+
* @param {EndpointId} remoteEid - The remote endpoint ID.
|
|
440
|
+
* @param {string} remoteOapp - The remote OAPP address.
|
|
441
|
+
* @param {GasOptions} [gasOptions] - The gas options.
|
|
442
|
+
* @returns {Promise<TransactionResponse>} The transaction response.
|
|
443
|
+
*/
|
|
444
|
+
async setAdmin(signer, newAdmin, gasOptions) {
|
|
445
|
+
return this.sdk.sendAndConfirmTransaction(
|
|
446
|
+
signer,
|
|
447
|
+
`${this.oappCoreModule[0]}::${this.oappCoreModule[1]}::transfer_admin`,
|
|
448
|
+
[newAdmin],
|
|
449
|
+
["address"],
|
|
450
|
+
gasOptions
|
|
451
|
+
);
|
|
452
|
+
}
|
|
342
453
|
};
|
|
343
454
|
var DvnUpGrader = class {
|
|
344
455
|
/**
|