@layerzerolabs/lz-aptos-sdk-v1 2.3.7 → 2.3.9
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 +16 -0
- package/dist/index.cjs +30 -30
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +13 -13
- package/dist/index.d.ts +13 -13
- package/dist/index.mjs +30 -30
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @layerzerolabs/lz-aptos-sdk-v1
|
|
2
2
|
|
|
3
|
+
## 2.3.9
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- c208955: minor update & fix some bugs
|
|
8
|
+
- Updated dependencies [c208955]
|
|
9
|
+
- @layerzerolabs/lz-definitions@2.3.9
|
|
10
|
+
|
|
11
|
+
## 2.3.8
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- e0f5d04: deploy contracts to Ebi mainnet
|
|
16
|
+
- Updated dependencies [e0f5d04]
|
|
17
|
+
- @layerzerolabs/lz-definitions@2.3.8
|
|
18
|
+
|
|
3
19
|
## 2.3.7
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/dist/index.cjs
CHANGED
|
@@ -389,7 +389,7 @@ function hexToAscii(hex) {
|
|
|
389
389
|
let str = "";
|
|
390
390
|
let i = 0;
|
|
391
391
|
const l = hex.length;
|
|
392
|
-
if (hex.
|
|
392
|
+
if (hex.startsWith("0x")) {
|
|
393
393
|
i = 2;
|
|
394
394
|
}
|
|
395
395
|
for (; i < l; i += 2) {
|
|
@@ -519,13 +519,13 @@ async function getLzReceiveTypeArguments(bytecode, sdk, publicKey, dstAddress, s
|
|
|
519
519
|
const address = getAddressFromPublicKey(publicKey);
|
|
520
520
|
const rawTransaction = await sdk.client.generateRawTransaction(address, transaction, {});
|
|
521
521
|
const txns = await sdk.client.simulateTransaction(publicKey, rawTransaction);
|
|
522
|
-
if (txns[0].success
|
|
522
|
+
if (!txns[0].success) {
|
|
523
523
|
throw new Error(txns[0].vm_status);
|
|
524
524
|
}
|
|
525
525
|
const result = txns.flatMap((txn) => txn.changes).filter(
|
|
526
526
|
(change) => change.type === "write_resource" && change.data.type.match(/::executor_ext::TypeArguments$/)
|
|
527
527
|
).map((change) => change.data.data).flatMap((r) => {
|
|
528
|
-
return r
|
|
528
|
+
return r.types;
|
|
529
529
|
}).map((t) => {
|
|
530
530
|
const account_address = fullAddress(t.account_address).toString();
|
|
531
531
|
const module_name = hexToAscii(t.module_name);
|
|
@@ -764,7 +764,7 @@ var Endpoint = class {
|
|
|
764
764
|
}
|
|
765
765
|
async registerExecutor(signer, executorType) {
|
|
766
766
|
const transaction = this.registerExecutorPayload(executorType);
|
|
767
|
-
return
|
|
767
|
+
return this.sdk.sendAndConfirmTransaction(signer, transaction);
|
|
768
768
|
}
|
|
769
769
|
};
|
|
770
770
|
|
|
@@ -1553,27 +1553,27 @@ var CompiledScriptRaw = class _CompiledScriptRaw {
|
|
|
1553
1553
|
}
|
|
1554
1554
|
};
|
|
1555
1555
|
var CompiledScript = class _CompiledScript {
|
|
1556
|
-
// @ts-
|
|
1556
|
+
// @ts-expect-error
|
|
1557
1557
|
header;
|
|
1558
|
-
// @ts-
|
|
1558
|
+
// @ts-expect-error
|
|
1559
1559
|
table;
|
|
1560
1560
|
moduleHandles = [];
|
|
1561
1561
|
structHandles = [];
|
|
1562
1562
|
functionHandles = [];
|
|
1563
1563
|
functionInstatiations = [];
|
|
1564
|
-
// @ts-
|
|
1564
|
+
// @ts-expect-error
|
|
1565
1565
|
signatures;
|
|
1566
|
-
// @ts-
|
|
1566
|
+
// @ts-expect-error
|
|
1567
1567
|
constantPool;
|
|
1568
|
-
// @ts-
|
|
1568
|
+
// @ts-expect-error
|
|
1569
1569
|
metadata;
|
|
1570
1570
|
identifiers = [];
|
|
1571
1571
|
addressIdentifiers = [];
|
|
1572
|
-
// @ts-
|
|
1572
|
+
// @ts-expect-error
|
|
1573
1573
|
typeParameters;
|
|
1574
|
-
// @ts-
|
|
1574
|
+
// @ts-expect-error
|
|
1575
1575
|
parameters;
|
|
1576
|
-
// @ts-
|
|
1576
|
+
// @ts-expect-error
|
|
1577
1577
|
code;
|
|
1578
1578
|
static from(raw) {
|
|
1579
1579
|
const script = new _CompiledScript();
|
|
@@ -2520,7 +2520,7 @@ var UlnReceive = class {
|
|
|
2520
2520
|
serializer.serializeBytes(Uint8Array.from(hash));
|
|
2521
2521
|
const payloadEntryFunction = new aptos2__namespace.TxnBuilderTypes.TransactionPayloadEntryFunction(
|
|
2522
2522
|
aptos2__namespace.TxnBuilderTypes.EntryFunction.natural(
|
|
2523
|
-
|
|
2523
|
+
this.module,
|
|
2524
2524
|
"oracle_propose",
|
|
2525
2525
|
[],
|
|
2526
2526
|
[serializer.getBytes(), aptos2__namespace.BCS.bcsSerializeUint64(confirmations)]
|
|
@@ -2549,7 +2549,7 @@ var UlnReceive = class {
|
|
|
2549
2549
|
}
|
|
2550
2550
|
async oracleProposeMS(multisigAccountAddress, multisigAccountPubkey, signFunc, hash, confirmations) {
|
|
2551
2551
|
const payload = await this.oracleProposePayloadMS(multisigAccountAddress, hash, confirmations);
|
|
2552
|
-
return
|
|
2552
|
+
return this.sdk.sendAndConfirmMultiSigTransaction(
|
|
2553
2553
|
this.sdk.client,
|
|
2554
2554
|
multisigAccountAddress,
|
|
2555
2555
|
multisigAccountPubkey,
|
|
@@ -2568,12 +2568,12 @@ var UlnSigner = class {
|
|
|
2568
2568
|
moduleName;
|
|
2569
2569
|
async register_TransactionPayload() {
|
|
2570
2570
|
return new aptos2__namespace.TxnBuilderTypes.TransactionPayloadEntryFunction(
|
|
2571
|
-
aptos2__namespace.TxnBuilderTypes.EntryFunction.natural(
|
|
2571
|
+
aptos2__namespace.TxnBuilderTypes.EntryFunction.natural(this.module, "register", [], [])
|
|
2572
2572
|
);
|
|
2573
2573
|
}
|
|
2574
2574
|
async registerMS(multisigAccountAddress, multisigAccountPubkey, signFunc) {
|
|
2575
2575
|
const payload = await this.register_TransactionPayload();
|
|
2576
|
-
return
|
|
2576
|
+
return this.sdk.sendAndConfirmMultiSigTransaction(
|
|
2577
2577
|
this.sdk.client,
|
|
2578
2578
|
multisigAccountAddress,
|
|
2579
2579
|
multisigAccountPubkey,
|
|
@@ -2606,7 +2606,7 @@ var UlnSigner = class {
|
|
|
2606
2606
|
async getSetFee_TransactionPayload(dstChainId, baseFee, feePerByte) {
|
|
2607
2607
|
return new aptos2__namespace.TxnBuilderTypes.TransactionPayloadEntryFunction(
|
|
2608
2608
|
aptos2__namespace.TxnBuilderTypes.EntryFunction.natural(
|
|
2609
|
-
|
|
2609
|
+
this.module,
|
|
2610
2610
|
"set_fee",
|
|
2611
2611
|
[],
|
|
2612
2612
|
[
|
|
@@ -2630,7 +2630,7 @@ var UlnSigner = class {
|
|
|
2630
2630
|
}
|
|
2631
2631
|
async setFeeMS(multisigAccountAddress, multisigAccountPubkey, signFunc, dstChainId, baseFee, feePerByte) {
|
|
2632
2632
|
const payload = await this.getSetFee_TransactionPayload(dstChainId, baseFee, feePerByte);
|
|
2633
|
-
return
|
|
2633
|
+
return this.sdk.sendAndConfirmMultiSigTransaction(
|
|
2634
2634
|
this.sdk.client,
|
|
2635
2635
|
multisigAccountAddress,
|
|
2636
2636
|
multisigAccountPubkey,
|
|
@@ -3060,7 +3060,7 @@ var Bridge = class {
|
|
|
3060
3060
|
Buffer.from(aptos2__namespace.HexString.ensure(remoteCoin.remote_address).noPrefix(), "hex")
|
|
3061
3061
|
);
|
|
3062
3062
|
const tvlSD = BigInt(remoteCoin.tvl_sd);
|
|
3063
|
-
const unwrappable = remoteCoin
|
|
3063
|
+
const { unwrappable } = remoteCoin;
|
|
3064
3064
|
return {
|
|
3065
3065
|
address,
|
|
3066
3066
|
tvlSD,
|
|
@@ -3068,7 +3068,7 @@ var Bridge = class {
|
|
|
3068
3068
|
};
|
|
3069
3069
|
}
|
|
3070
3070
|
async getCoinStore(coin) {
|
|
3071
|
-
return
|
|
3071
|
+
return this.sdk.client.getAccountResource(
|
|
3072
3072
|
this.address,
|
|
3073
3073
|
`${this.module}::CoinStore<${this.coin.getCoinType(coin)}>`
|
|
3074
3074
|
);
|
|
@@ -3152,7 +3152,7 @@ var Bridge = class {
|
|
|
3152
3152
|
return this.sdk.sendAndConfirmTransaction(signer, transaction);
|
|
3153
3153
|
}
|
|
3154
3154
|
async getCoinTypeStore() {
|
|
3155
|
-
return
|
|
3155
|
+
return this.sdk.client.getAccountResource(this.address, `${this.module}::CoinTypeStore`);
|
|
3156
3156
|
}
|
|
3157
3157
|
async getCoinTypes() {
|
|
3158
3158
|
const resource = await this.getCoinTypeStore();
|
|
@@ -3172,9 +3172,9 @@ var Bridge = class {
|
|
|
3172
3172
|
const typeInfo = `0x1::coin::CoinInfo<${coinStructTag}>`;
|
|
3173
3173
|
const resource = await this.sdk.client.getAccountResource(this.address, typeInfo);
|
|
3174
3174
|
const coinInfo = resource;
|
|
3175
|
-
const name = coinInfo.data
|
|
3176
|
-
const symbol = coinInfo.data
|
|
3177
|
-
const decimals = coinInfo.data
|
|
3175
|
+
const { name } = coinInfo.data;
|
|
3176
|
+
const { symbol } = coinInfo.data;
|
|
3177
|
+
const { decimals } = coinInfo.data;
|
|
3178
3178
|
const supply = coinInfo.data.supply.vec[0].integer.vec[0].value;
|
|
3179
3179
|
return {
|
|
3180
3180
|
name,
|
|
@@ -3563,7 +3563,7 @@ var MultisigOracle = class {
|
|
|
3563
3563
|
// View Functions
|
|
3564
3564
|
async isAdmin(account) {
|
|
3565
3565
|
const resource = await this.sdk.client.getAccountResource(this.address, `${this.module}::Config`);
|
|
3566
|
-
const admins = resource.data
|
|
3566
|
+
const { admins } = resource.data;
|
|
3567
3567
|
const acc = aptos2__namespace.HexString.ensure(account).toShortString();
|
|
3568
3568
|
return admins.includes(acc);
|
|
3569
3569
|
}
|
|
@@ -3578,7 +3578,7 @@ var MultisigOracle = class {
|
|
|
3578
3578
|
}
|
|
3579
3579
|
async getMultisigPubKeyAndAddress(validatorPubKeys) {
|
|
3580
3580
|
const pubKeys = Object.keys(validatorPubKeys).map((key) => stringToUint8Array(key));
|
|
3581
|
-
return
|
|
3581
|
+
return generateMultisig([...pubKeys], pubKeys.length);
|
|
3582
3582
|
}
|
|
3583
3583
|
async getResourceAddress() {
|
|
3584
3584
|
const resource = await this.sdk.client.getAccountResource(this.address, `${this.module}::Config`);
|
|
@@ -4019,16 +4019,16 @@ var OFT = class {
|
|
|
4019
4019
|
if (!match) {
|
|
4020
4020
|
throw new Error(`Invalid oft type: ${oftType}`);
|
|
4021
4021
|
}
|
|
4022
|
-
const address = match.groups
|
|
4022
|
+
const { address } = match.groups;
|
|
4023
4023
|
return address;
|
|
4024
4024
|
}
|
|
4025
4025
|
async getGlobalStore(oftType) {
|
|
4026
4026
|
const address = this.getTypeAddress(oftType);
|
|
4027
|
-
return
|
|
4027
|
+
return this.sdk.client.getAccountResource(address, `${this.module}::GlobalStore<${oftType}>`);
|
|
4028
4028
|
}
|
|
4029
4029
|
async getCoinStore(oftType) {
|
|
4030
4030
|
const address = this.getTypeAddress(oftType);
|
|
4031
|
-
return
|
|
4031
|
+
return this.sdk.client.getAccountResource(address, `${this.module}::CoinStore<${oftType}>`);
|
|
4032
4032
|
}
|
|
4033
4033
|
transferPayload(oftType, to, amount) {
|
|
4034
4034
|
return {
|
|
@@ -4113,7 +4113,7 @@ var Oracle = class {
|
|
|
4113
4113
|
}
|
|
4114
4114
|
async isValidator(validator) {
|
|
4115
4115
|
const resource = await this.sdk.client.getAccountResource(this.address, `${this.module}::Config`);
|
|
4116
|
-
const validators = resource.data
|
|
4116
|
+
const { validators } = resource.data;
|
|
4117
4117
|
const val = aptos2__namespace.HexString.ensure(validator).toShortString();
|
|
4118
4118
|
return validators.includes(val);
|
|
4119
4119
|
}
|