@layerzerolabs/lz-aptos-sdk-v1 1.5.19-rc2 → 1.5.19

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.cjs CHANGED
@@ -75,24 +75,24 @@ var LAYERZERO_ADDRESS = {
75
75
  [lzDefinitions.Stage.MAINNET]: "0x54ad3d30af77b60d939ae356e6606de9a4da67583f02b962d2d3f2e481484e90",
76
76
  // MAINNET
77
77
  [lzDefinitions.Stage.TESTNET]: "0x1759cc0d3161f1eb79f65847d4feb9d1f74fb79014698a23b16b28b9cd4c37e3",
78
- [lzDefinitions.Stage.SANDBOX]: "0x88cb10d5573e2aa38ed9a92763535ed6828c193567906a56c0f3b9158b1decb7"
78
+ [lzDefinitions.Stage.SANDBOX]: "0xcdc2c5597e2a96faf08135db560e3846e8c8c5683b0db868f6ad68f143906b3e"
79
79
  };
80
80
  var LAYERZERO_APPS_ADDRESS = {
81
81
  [lzDefinitions.Stage.MAINNET]: "0x43d8cad89263e6936921a0adb8d5d49f0e236c229460f01b14dca073114df2b9",
82
82
  [lzDefinitions.Stage.TESTNET]: "0x2f972c173927006c83277b6e6ae38f83482eba560f343d022f145979020d3621",
83
- [lzDefinitions.Stage.SANDBOX]: "0x3afbb2e0e598c6a6b1d694ae3ab6517a6d9941c99f8bb06257e1109b571bb823"
83
+ [lzDefinitions.Stage.SANDBOX]: "0x43d8cad89263e6936921a0adb8d5d49f0e236c229460f01b14dca073114df2b9"
84
84
  };
85
85
  var ORACLE_ADDRESS = {
86
86
  [lzDefinitions.Stage.MAINNET]: "0xc2846ea05319c339b3b52186ceae40b43d4e9cf6c7350336c3eb0b351d9394eb",
87
87
  // MAINNET
88
88
  [lzDefinitions.Stage.TESTNET]: "0x8ab85d94bf34808386b3ce0f9516db74d2b6d2f1166aa48f75ca641f3adb6c63",
89
- [lzDefinitions.Stage.SANDBOX]: "0x22be7b12e214d4f9f96dc3638fb8d9e3f760e483102c4b48b04a2a656de5a24a"
89
+ [lzDefinitions.Stage.SANDBOX]: "0x38ee7e8bc9d2601ec0934a5d6e23182a266380d87840e5f0850bfeb647297d3a"
90
90
  };
91
91
  var ORACLE_SIGNER_ADDRESS = {
92
92
  [lzDefinitions.Stage.MAINNET]: "0x12e12de0af996d9611b0b78928cd9f4cbf50d94d972043cdd829baa77a78929b",
93
93
  // MAINNET
94
94
  [lzDefinitions.Stage.TESTNET]: "0x47a30bcdb5b5bdbf6af883c7325827f3e40b3f52c3538e9e677e68cf0c0db060",
95
- [lzDefinitions.Stage.SANDBOX]: "0xbccf3169d417448997cb4928e2b8e33e97067871b8564b20c5c2ef6c3a7bf377"
95
+ [lzDefinitions.Stage.SANDBOX]: "0x760b1ad2811b7c3e7e04a9dc38520320dc30850fbf001db61c18d1e36221d5c8"
96
96
  };
97
97
  var RELAYER_SIGNER_ADDRESS = {
98
98
  [lzDefinitions.Stage.MAINNET]: "0x1d8727df513fa2a8785d0834e40b34223daff1affc079574082baadb74b66ee4",
@@ -110,19 +110,19 @@ var EXECUTOR_EXT_ADDRESS = {
110
110
  [lzDefinitions.Stage.MAINNET]: "0xd122ac52d43736e0f524a334fc37b6750884559da7ddf1aee0b11b6ae62643d7",
111
111
  // MAINNET
112
112
  [lzDefinitions.Stage.TESTNET]: "0x39942f4bd78e899f162644b5ec5998a19cb6de1ff8b7321070cb75cf96e5cf6c",
113
- [lzDefinitions.Stage.SANDBOX]: "0xeed8a91797cdfcbe0d33f92b57b76830f1ff6b4613db00f0c33035e31f77c936"
113
+ [lzDefinitions.Stage.SANDBOX]: ""
114
114
  };
115
115
  var LAYERZERO_APPS_PUBKEY = {
116
116
  [lzDefinitions.Stage.MAINNET]: "0xf57e5a95ae0e2b5f999ac14abd0ff73daf64e6e7e2a1fad024f2e44422e88d76",
117
117
  // MAINNET
118
118
  [lzDefinitions.Stage.TESTNET]: "0xa6d39a1f522da0298a387032952393b1dd2f88ea75423de05c26792930c60ac0",
119
- [lzDefinitions.Stage.SANDBOX]: "0x3378e95c0f5f245208d3b330815eccdf704df522ccdebceabb4310354dd22e06"
119
+ [lzDefinitions.Stage.SANDBOX]: "0xf57e5a95ae0e2b5f999ac14abd0ff73daf64e6e7e2a1fad024f2e44422e88d76"
120
120
  };
121
121
  var BRIDGE_ADDRESS = {
122
122
  [lzDefinitions.Stage.MAINNET]: "0xf22bede237a07e121b56d91a491eb7bcdfd1f5907926a9e58338f964a01b17fa",
123
123
  // MAINNET
124
124
  [lzDefinitions.Stage.TESTNET]: "0xec84c05cc40950c86d8a8bed19552f1e8ebb783196bb021c916161d22dc179f7",
125
- [lzDefinitions.Stage.SANDBOX]: "0x96a9b4d53a6cb4f4fe2c43a82ab71b52624396f0792b64b5f23a1085690d8edb"
125
+ [lzDefinitions.Stage.SANDBOX]: "0x808b4ffe04011cd20327a910518b4bff661f73fa907e9fc41ad690f84fa6f83e"
126
126
  };
127
127
 
128
128
  // src/utils.ts
@@ -2122,17 +2122,6 @@ var MsgLibConfig = class {
2122
2122
  }
2123
2123
  };
2124
2124
 
2125
- // src/modules/uln/index.ts
2126
- var uln_exports = {};
2127
- __export(uln_exports, {
2128
- MsgLibV1_0: () => MsgLibV1_0,
2129
- PacketEvent: () => PacketEvent,
2130
- Uln: () => Uln,
2131
- UlnConfig: () => UlnConfig,
2132
- UlnReceive: () => UlnReceive,
2133
- UlnSigner: () => UlnSigner
2134
- });
2135
-
2136
2125
  // src/modules/uln/msglib_v1_0.ts
2137
2126
  var MsgLibV1_0 = class {
2138
2127
  constructor(sdk) {
@@ -2546,7 +2535,7 @@ var UlnSigner = class {
2546
2535
  }
2547
2536
  };
2548
2537
 
2549
- // src/modules/uln/uln.ts
2538
+ // src/modules/uln/index.ts
2550
2539
  var Uln = class {
2551
2540
  constructor(sdk) {
2552
2541
  this.Receive = new UlnReceive(sdk);
@@ -2580,7 +2569,6 @@ __export(apps_exports, {
2580
2569
  Counter: () => Counter,
2581
2570
  LzApp: () => LzApp,
2582
2571
  MultisigOracle: () => MultisigOracle,
2583
- MultisigOracleTss: () => MultisigOracleTss,
2584
2572
  OFT: () => OFT,
2585
2573
  Oracle: () => Oracle,
2586
2574
  bridge: () => bridge_exports
@@ -2658,13 +2646,6 @@ var LzApp = class {
2658
2646
  const transaction = this.setRemotePaylaod(remoteChainId, remoteAddress);
2659
2647
  return this.sdk.sendAndConfirmTransaction(signer, transaction);
2660
2648
  }
2661
- setConfigPayload(uaType, majorVersion, minorVersion, remoteChainId, configType, configBytes) {
2662
- return {
2663
- function: `${this.lzApp}::lzapp::set_config`,
2664
- type_arguments: [uaType],
2665
- arguments: [majorVersion, minorVersion, remoteChainId, configType, Array.from(configBytes)]
2666
- };
2667
- }
2668
2649
  async setConfig(signer, uaType, majorVersion, minorVersion, remoteChainId, configType, configBytes) {
2669
2650
  console.log(`configType: ${configType}, configBytes: ${configBytes}`);
2670
2651
  const transaction = {
@@ -3224,33 +3205,17 @@ var Counter = class {
3224
3205
  const { i } = resource.data;
3225
3206
  return BigInt(i);
3226
3207
  }
3227
- createCounterPayload(i) {
3228
- return {
3208
+ async createCounter(signer, i) {
3209
+ const transaction = {
3229
3210
  function: `${this.address}::counter::create_counter`,
3230
3211
  type_arguments: [],
3231
3212
  arguments: [i]
3232
3213
  };
3233
- }
3234
- async createCounter(signer, i) {
3235
- const transaction = this.createCounterPayload(i);
3236
3214
  return this.sdk.sendAndConfirmTransaction(signer, transaction);
3237
3215
  }
3238
- setRemotePayload(remoteChainId, remoteAddress) {
3239
- return this.lzApp.setRemotePaylaod(remoteChainId, remoteAddress);
3240
- }
3241
3216
  async setRemote(signer, remoteChainId, remoteAddress) {
3242
3217
  return this.lzApp.setRemote(signer, remoteChainId, remoteAddress);
3243
3218
  }
3244
- setAppConfigPayload(majorVersion, minorVersion, remoteChainId, configType, configBytes) {
3245
- return this.lzApp.setConfigPayload(
3246
- this.uaType,
3247
- majorVersion,
3248
- minorVersion,
3249
- remoteChainId,
3250
- configType,
3251
- configBytes
3252
- );
3253
- }
3254
3219
  async setAppConfig(signer, majorVersion, minorVersion, remoteChainId, configType, configBytes) {
3255
3220
  console.log(`configType: ${configType}, configBytes: ${configBytes}`);
3256
3221
  return this.lzApp.setConfig(
@@ -3266,13 +3231,6 @@ var Counter = class {
3266
3231
  async setAppConfigBundle(signer, majorVersion, minorVersion, remoteChainId, config) {
3267
3232
  await this.lzApp.setConfigBundle(signer, this.uaType, majorVersion, minorVersion, remoteChainId, config);
3268
3233
  }
3269
- sendToRemotePayload(remoteChainId, fee, adapterParams) {
3270
- return {
3271
- function: `${this.address}::counter::send_to_remote`,
3272
- type_arguments: [],
3273
- arguments: [remoteChainId, fee, Array.from(adapterParams)]
3274
- };
3275
- }
3276
3234
  async sendToRemote(signer, remoteChainId, fee, adapterParams) {
3277
3235
  const transaction = {
3278
3236
  function: `${this.address}::counter::send_to_remote`,
@@ -3426,193 +3384,6 @@ var MultisigOracle = class {
3426
3384
  return fullAddress(resource_addr).toString();
3427
3385
  }
3428
3386
  };
3429
- var MultisigOracleTss = class {
3430
- constructor(sdk, address) {
3431
- this.sdk = sdk;
3432
- this.address = address;
3433
- this.module = `${this.address}::oracle`;
3434
- this.moduleName = "oracle::oracle";
3435
- }
3436
- // Validator Functions
3437
- getProposePayload(hash, confirmations, expiration, signatures) {
3438
- return {
3439
- function: `${this.module}::mso_propose`,
3440
- type_arguments: [],
3441
- arguments: [Array.from(hash), confirmations, expiration, Array.from(signatures)]
3442
- };
3443
- }
3444
- async propose(signer, hash, confirmations, expiration, signatures) {
3445
- const transaction = this.getProposePayload(hash, confirmations, expiration, signatures);
3446
- return this.sdk.sendAndConfirmTransaction(signer, transaction);
3447
- }
3448
- getSetValidatorPayload(validator, active, expiration, signatures) {
3449
- return {
3450
- function: `${this.module}::mso_set_validator`,
3451
- type_arguments: [],
3452
- arguments: [Array.from(validator), active, expiration, Array.from(signatures)]
3453
- };
3454
- }
3455
- async setValidator(signer, validator, active, expiration, signatures) {
3456
- const transaction = this.getSetValidatorPayload(validator, active, expiration, signatures);
3457
- return this.sdk.sendAndConfirmTransaction(signer, transaction);
3458
- }
3459
- getSetThresholdPayload(threshold, expiration, signatures) {
3460
- return {
3461
- function: `${this.module}::mso_set_threshold`,
3462
- type_arguments: [],
3463
- arguments: [threshold, expiration, Array.from(signatures)]
3464
- };
3465
- }
3466
- async setThreshold(signer, threshold, expiration, signatures) {
3467
- const transaction = this.getSetThresholdPayload(threshold, expiration, signatures);
3468
- return this.sdk.sendAndConfirmTransaction(signer, transaction);
3469
- }
3470
- getSetAdminPayload(candidate, active, expiration, signatures) {
3471
- return {
3472
- function: `${this.module}::mso_set_admin`,
3473
- type_arguments: [],
3474
- arguments: [candidate, active, expiration, Array.from(signatures)]
3475
- };
3476
- }
3477
- async setAdmin(signer, candidate, active, expiration, signatures) {
3478
- const transaction = this.getSetAdminPayload(candidate, active, expiration, signatures);
3479
- return this.sdk.sendAndConfirmTransaction(signer, transaction);
3480
- }
3481
- getAllowlistPayload(ua, expiration, signatures) {
3482
- return {
3483
- function: `${this.module}::mso_allowlist`,
3484
- type_arguments: [],
3485
- arguments: [ua, expiration, Array.from(signatures)]
3486
- };
3487
- }
3488
- async allowlist(signer, ua, expiration, signatures) {
3489
- const transaction = this.getAllowlistPayload(ua, expiration, signatures);
3490
- return this.sdk.sendAndConfirmTransaction(signer, transaction);
3491
- }
3492
- getDenylistPayload(ua, expiration, signatures) {
3493
- return {
3494
- function: `${this.module}::mso_denylist`,
3495
- type_arguments: [],
3496
- arguments: [ua, expiration, Array.from(signatures)]
3497
- };
3498
- }
3499
- async denylist(signer, ua, expiration, signatures) {
3500
- const transaction = this.getDenylistPayload(ua, expiration, signatures);
3501
- return this.sdk.sendAndConfirmTransaction(signer, transaction);
3502
- }
3503
- // Admin Functions
3504
- getSetFeePayload(remoteChainId, baseFee) {
3505
- return {
3506
- function: `${this.module}::mso_set_fee`,
3507
- type_arguments: [],
3508
- arguments: [remoteChainId, baseFee]
3509
- };
3510
- }
3511
- async setFee(signer, remoteChainId, baseFee) {
3512
- const transaction = this.getSetFeePayload(remoteChainId, baseFee);
3513
- return this.sdk.sendAndConfirmTransaction(signer, transaction);
3514
- }
3515
- getWithdrawFeePayload(receiver, amount) {
3516
- return {
3517
- function: `${this.module}::mso_withdraw_fee`,
3518
- type_arguments: [],
3519
- arguments: [receiver, amount]
3520
- };
3521
- }
3522
- async withdrawFee(signer, receiver, amount) {
3523
- const transaction = this.getWithdrawFeePayload(receiver, amount);
3524
- return this.sdk.sendAndConfirmTransaction(signer, transaction);
3525
- }
3526
- // View Functions
3527
- async getAdmins() {
3528
- const resource = await this.sdk.client.getAccountResource(
3529
- this.address,
3530
- `${this.module}::MsoConfig`
3531
- );
3532
- return resource.data.admins;
3533
- }
3534
- async getValidators() {
3535
- const resource = await this.sdk.client.getAccountResource(
3536
- this.address,
3537
- `${this.module}::MsoConfig`
3538
- );
3539
- return resource.data.validators;
3540
- }
3541
- async getThreshold() {
3542
- const resource = await this.sdk.client.getAccountResource(
3543
- this.address,
3544
- `${this.module}::MsoConfig`
3545
- );
3546
- return parseInt(resource.data.threshold);
3547
- }
3548
- async getResourceAddress() {
3549
- const resource = await this.sdk.client.getAccountResource(this.address, `${this.module}::Config`);
3550
- const { resource_addr } = resource.data;
3551
- return fullAddress(resource_addr).toString();
3552
- }
3553
- async isAdmin(account) {
3554
- const admins = await this.getAdmins();
3555
- const _admins = admins.map((a) => a.toString().toLowerCase());
3556
- const acc = aptos2__namespace.HexString.ensure(account).toShortString();
3557
- return _admins.includes(acc.toString().toLowerCase());
3558
- }
3559
- async isValidator(validator) {
3560
- const validators = await this.getValidators();
3561
- const _validators = validators.map((v) => v.toString().toLowerCase());
3562
- const val = aptos2__namespace.HexString.ensure(validator);
3563
- return _validators.includes(val.toString().toLowerCase());
3564
- }
3565
- // Hashing functions
3566
- hashPropose(hash, blockConfirmation, expiration) {
3567
- const encoded_data = new extendedBuffer.ExtendedBuffer();
3568
- encoded_data.writeBuffer(Buffer.from(stringToUint8Array(getAptosFunctionSignature("propose"))));
3569
- encoded_data.writeBuffer(Buffer.from(stringToUint8Array(hash.toString())));
3570
- encoded_data.writeBuffer(new BN__default.default(blockConfirmation.toString()).toArrayLike(Buffer, "be", 8));
3571
- encoded_data.writeBuffer(new BN__default.default(expiration.toString()).toArrayLike(Buffer, "be", 8));
3572
- return keccak256Hash(encoded_data.buffer.toString("hex"));
3573
- }
3574
- hashSetValidator(validator, active, expiration) {
3575
- const encoded_data = new extendedBuffer.ExtendedBuffer();
3576
- encoded_data.writeBuffer(Buffer.from(stringToUint8Array(getAptosFunctionSignature("set_validator"))));
3577
- encoded_data.writeBuffer(Buffer.from(stringToUint8Array(validator.toString())));
3578
- encoded_data.writeUInt8(active ? 1 : 0);
3579
- encoded_data.writeBuffer(new BN__default.default(expiration.toString()).toArrayLike(Buffer, "be", 8));
3580
- return keccak256Hash(encoded_data.buffer.toString("hex"));
3581
- }
3582
- hashSetThreshold(threshold, expiration) {
3583
- const encoded_data = new extendedBuffer.ExtendedBuffer();
3584
- encoded_data.writeBuffer(Buffer.from(stringToUint8Array(getAptosFunctionSignature("set_threshold"))));
3585
- encoded_data.writeBuffer(new BN__default.default(threshold).toArrayLike(Buffer, "be", 8));
3586
- encoded_data.writeBuffer(new BN__default.default(expiration.toString()).toArrayLike(Buffer, "be", 8));
3587
- return keccak256Hash(encoded_data.buffer.toString("hex"));
3588
- }
3589
- hashAllowlist(ua, expiration) {
3590
- const encoded_data = new extendedBuffer.ExtendedBuffer();
3591
- encoded_data.writeBuffer(Buffer.from(stringToUint8Array(getAptosFunctionSignature("allowlist"))));
3592
- encoded_data.writeBuffer(Buffer.from(stringToUint8Array(ua.toString())));
3593
- encoded_data.writeBuffer(new BN__default.default(expiration.toString()).toArrayLike(Buffer, "be", 8));
3594
- return keccak256Hash(encoded_data.buffer.toString("hex"));
3595
- }
3596
- hashDenylist(ua, expiration) {
3597
- const encoded_data = new extendedBuffer.ExtendedBuffer();
3598
- encoded_data.writeBuffer(Buffer.from(stringToUint8Array(getAptosFunctionSignature("denylist"))));
3599
- encoded_data.writeBuffer(Buffer.from(stringToUint8Array(ua.toString())));
3600
- encoded_data.writeBuffer(new BN__default.default(expiration.toString()).toArrayLike(Buffer, "be", 8));
3601
- return keccak256Hash(encoded_data.buffer.toString("hex"));
3602
- }
3603
- };
3604
- function getAptosFunctionSignature(funcName) {
3605
- const encoded_data = new extendedBuffer.ExtendedBuffer();
3606
- const funcNameHexStr = Buffer.from(funcName).toString("hex");
3607
- const funcNameBcs = aptos2__namespace.BCS.bcsSerializeBytes(stringToUint8Array(funcNameHexStr));
3608
- encoded_data.writeBuffer(Buffer.from(funcNameBcs));
3609
- return utils.bytesToHex(sha3.keccak_256(encoded_data.buffer)).slice(0, 8);
3610
- }
3611
- function keccak256Hash(data) {
3612
- const encoded_data = new extendedBuffer.ExtendedBuffer();
3613
- encoded_data.writeBuffer(Buffer.from(stringToUint8Array(data)));
3614
- return utils.bytesToHex(sha3.keccak_256(encoded_data.buffer));
3615
- }
3616
3387
  var OFT = class {
3617
3388
  constructor(sdk) {
3618
3389
  this.SEND_PAYLOAD_LENGTH = 41;
@@ -4125,7 +3896,6 @@ exports.SDK = SDK;
4125
3896
  exports.apps = apps_exports;
4126
3897
  exports.constants = constants_exports;
4127
3898
  exports.types = types_exports;
4128
- exports.uln = uln_exports;
4129
3899
  exports.utils = utils_exports;
4130
3900
  //# sourceMappingURL=out.js.map
4131
3901
  //# sourceMappingURL=index.cjs.map