@layerzerolabs/lz-solana-sdk-v2 3.0.135 → 3.0.137-sui.0
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 +26 -0
- package/dist/{index-CvZUDmni.d.mts → index-Cl-ICwDK.d.mts} +6 -6
- package/dist/{index-CvZUDmni.d.ts → index-Cl-ICwDK.d.ts} +6 -6
- package/dist/index.cjs +35 -26
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +7 -7
- package/dist/index.d.ts +7 -7
- package/dist/index.mjs +36 -27
- package/dist/index.mjs.map +1 -1
- package/dist/umi.cjs +18 -17
- package/dist/umi.cjs.map +1 -1
- package/dist/umi.d.mts +1 -1
- package/dist/umi.d.ts +1 -1
- package/dist/umi.mjs +18 -17
- package/dist/umi.mjs.map +1 -1
- package/package.json +9 -9
- package/src/solita/utility.ts +23 -12
- package/src/utility.ts +29 -20
package/dist/umi.cjs
CHANGED
|
@@ -10400,9 +10400,9 @@ function closeLookupTable(recipient, authority, lookupTable) {
|
|
|
10400
10400
|
lookupTable
|
|
10401
10401
|
});
|
|
10402
10402
|
}
|
|
10403
|
-
async function txWithAddressLookupTable(connection, payer, instructions, recentBlockHash,
|
|
10403
|
+
async function txWithAddressLookupTable(connection, payer, instructions, recentBlockHash, _tableAddrs) {
|
|
10404
10404
|
recentBlockHash = recentBlockHash ?? (await connection.getLatestBlockhash()).blockhash;
|
|
10405
|
-
if (!
|
|
10405
|
+
if (!_tableAddrs) {
|
|
10406
10406
|
return new web3__namespace.VersionedTransaction(
|
|
10407
10407
|
new web3__namespace.TransactionMessage({
|
|
10408
10408
|
instructions,
|
|
@@ -10411,13 +10411,21 @@ async function txWithAddressLookupTable(connection, payer, instructions, recentB
|
|
|
10411
10411
|
}).compileToV0Message()
|
|
10412
10412
|
);
|
|
10413
10413
|
}
|
|
10414
|
-
const
|
|
10414
|
+
const tableAddrs = Array.isArray(_tableAddrs) ? _tableAddrs : [_tableAddrs];
|
|
10415
|
+
const lookupTableAccountsResult = await connection.getMultipleAccountsInfo(tableAddrs);
|
|
10416
|
+
const lookupTableAccounts = lookupTableAccountsResult.map((result, index) => {
|
|
10417
|
+
if (result === null) return null;
|
|
10418
|
+
return new web3__namespace.AddressLookupTableAccount({
|
|
10419
|
+
key: tableAddrs[index],
|
|
10420
|
+
state: web3__namespace.AddressLookupTableAccount.deserialize(result.data)
|
|
10421
|
+
});
|
|
10422
|
+
}).filter((account) => account !== null);
|
|
10415
10423
|
return new web3__namespace.VersionedTransaction(
|
|
10416
10424
|
new web3__namespace.TransactionMessage({
|
|
10417
10425
|
instructions,
|
|
10418
10426
|
payerKey: payer,
|
|
10419
10427
|
recentBlockhash: recentBlockHash
|
|
10420
|
-
}).compileToV0Message(
|
|
10428
|
+
}).compileToV0Message(lookupTableAccounts.length > 0 ? lookupTableAccounts : void 0)
|
|
10421
10429
|
);
|
|
10422
10430
|
}
|
|
10423
10431
|
async function createNonceAccountTX(connection, auth, lamportsForRent) {
|
|
@@ -10476,9 +10484,9 @@ async function buildMessageV0(connection, payerKey, instructions, commitmentOrCo
|
|
|
10476
10484
|
instructions
|
|
10477
10485
|
}).compileToV0Message();
|
|
10478
10486
|
}
|
|
10479
|
-
async function buildVersionedTransaction(connection, payerKey, instructions, commitmentOrConfig = "confirmed", blockhash,
|
|
10480
|
-
if (
|
|
10481
|
-
return txWithAddressLookupTable(connection, payerKey, instructions, blockhash,
|
|
10487
|
+
async function buildVersionedTransaction(connection, payerKey, instructions, commitmentOrConfig = "confirmed", blockhash, lookupTableAddresses) {
|
|
10488
|
+
if (lookupTableAddresses) {
|
|
10489
|
+
return txWithAddressLookupTable(connection, payerKey, instructions, blockhash, lookupTableAddresses);
|
|
10482
10490
|
}
|
|
10483
10491
|
return new web3__namespace.VersionedTransaction(
|
|
10484
10492
|
await buildMessageV0(connection, payerKey, instructions, commitmentOrConfig, blockhash)
|
|
@@ -10487,7 +10495,7 @@ async function buildVersionedTransaction(connection, payerKey, instructions, com
|
|
|
10487
10495
|
function instructionDiscriminator(method) {
|
|
10488
10496
|
return Buffer.from(lzFoundation.sha2_256(Buffer.from(`global:${method}`))).subarray(0, 8);
|
|
10489
10497
|
}
|
|
10490
|
-
async function simulateWeb3JsTransaction(_connection, _instructions, _programId, _payer, serializer, commitment = "confirmed", blockhash,
|
|
10498
|
+
async function simulateWeb3JsTransaction(_connection, _instructions, _programId, _payer, serializer, commitment = "confirmed", blockhash, _lookupTableAddresses) {
|
|
10491
10499
|
let connection;
|
|
10492
10500
|
if (typeof _connection === "string") {
|
|
10493
10501
|
connection = new web3__namespace.Connection(_connection, commitment);
|
|
@@ -10517,21 +10525,14 @@ async function simulateWeb3JsTransaction(_connection, _instructions, _programId,
|
|
|
10517
10525
|
} else {
|
|
10518
10526
|
payer = umiWeb3jsAdapters.toWeb3JsPublicKey(_payer);
|
|
10519
10527
|
}
|
|
10520
|
-
|
|
10521
|
-
if (_lookupTableAddress) {
|
|
10522
|
-
if (_lookupTableAddress instanceof web3__namespace.PublicKey) {
|
|
10523
|
-
lookupTableAddress = _lookupTableAddress;
|
|
10524
|
-
} else {
|
|
10525
|
-
lookupTableAddress = umiWeb3jsAdapters.toWeb3JsPublicKey(_lookupTableAddress);
|
|
10526
|
-
}
|
|
10527
|
-
}
|
|
10528
|
+
const lookupTableAddresses = _lookupTableAddresses && (Array.isArray(_lookupTableAddresses) ? _lookupTableAddresses.map((addr) => addr instanceof web3__namespace.PublicKey ? addr : umiWeb3jsAdapters.toWeb3JsPublicKey(addr)) : _lookupTableAddresses instanceof web3__namespace.PublicKey ? _lookupTableAddresses : umiWeb3jsAdapters.toWeb3JsPublicKey(_lookupTableAddresses));
|
|
10528
10529
|
const tx = await buildVersionedTransaction(
|
|
10529
10530
|
connection,
|
|
10530
10531
|
payer,
|
|
10531
10532
|
instructions,
|
|
10532
10533
|
commitment,
|
|
10533
10534
|
blockhash,
|
|
10534
|
-
|
|
10535
|
+
lookupTableAddresses
|
|
10535
10536
|
);
|
|
10536
10537
|
const simulateResp = await connection.simulateTransaction(tx, { sigVerify: false, commitment });
|
|
10537
10538
|
const returnPrefix = `Program return: ${programId.toBase58()} `;
|