@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/index.d.mts
CHANGED
|
@@ -7,7 +7,7 @@ import * as beetSolana from '@metaplex-foundation/beet-solana';
|
|
|
7
7
|
import BN from 'bn.js';
|
|
8
8
|
import { EndpointId, Environment, Network } from '@layerzerolabs/lz-definitions';
|
|
9
9
|
import { HashSigner } from '@layerzerolabs/lz-foundation';
|
|
10
|
-
export { i as UMI } from './index-
|
|
10
|
+
export { i as UMI } from './index-Cl-ICwDK.mjs';
|
|
11
11
|
import '@metaplex-foundation/umi';
|
|
12
12
|
import '@metaplex-foundation/umi/serializers';
|
|
13
13
|
|
|
@@ -15427,10 +15427,10 @@ declare function closeLookupTable(recipient: PublicKey, authority: PublicKey, lo
|
|
|
15427
15427
|
* @param {PublicKey} payer - The payer public key.
|
|
15428
15428
|
* @param {TransactionInstruction[]} instructions - The transaction instructions.
|
|
15429
15429
|
* @param {Blockhash} [recentBlockHash] - The recent block hash.
|
|
15430
|
-
* @param {PublicKey} [
|
|
15430
|
+
* @param {PublicKey} [_tableAddrs] - The array of address lookup table public keys.
|
|
15431
15431
|
* @returns {Promise<VersionedTransaction>} A promise that resolves to the versioned transaction.
|
|
15432
15432
|
*/
|
|
15433
|
-
declare function txWithAddressLookupTable(connection: Connection, payer: PublicKey, instructions: TransactionInstruction[], recentBlockHash?: Blockhash,
|
|
15433
|
+
declare function txWithAddressLookupTable(connection: Connection, payer: PublicKey, instructions: TransactionInstruction[], recentBlockHash?: Blockhash, _tableAddrs?: PublicKey | PublicKey[]): Promise<VersionedTransaction>;
|
|
15434
15434
|
/**
|
|
15435
15435
|
* Creates a nonce account transaction.
|
|
15436
15436
|
*
|
|
@@ -15481,10 +15481,10 @@ declare function buildMessageV0(connection: Connection, payerKey: PublicKey, ins
|
|
|
15481
15481
|
* @param {TransactionInstruction[]} instructions - The transaction instructions.
|
|
15482
15482
|
* @param {Commitment | GetAccountInfoConfig} [commitmentOrConfig='confirmed'] - The commitment level or account info configuration.
|
|
15483
15483
|
* @param {Blockhash} [blockhash] - The blockhash.
|
|
15484
|
-
* @param {PublicKey} [
|
|
15484
|
+
* @param {PublicKey} [lookupTableAddresses] - The array of lookup table addresses.
|
|
15485
15485
|
* @returns {Promise<VersionedTransaction>} A promise that resolves to the versioned transaction.
|
|
15486
15486
|
*/
|
|
15487
|
-
declare function buildVersionedTransaction(connection: Connection, payerKey: PublicKey, instructions: TransactionInstruction[], commitmentOrConfig?: Commitment | GetAccountInfoConfig, blockhash?: Blockhash,
|
|
15487
|
+
declare function buildVersionedTransaction(connection: Connection, payerKey: PublicKey, instructions: TransactionInstruction[], commitmentOrConfig?: Commitment | GetAccountInfoConfig, blockhash?: Blockhash, lookupTableAddresses?: PublicKey | PublicKey[]): Promise<VersionedTransaction>;
|
|
15488
15488
|
/**
|
|
15489
15489
|
* Generates an instruction discriminator.
|
|
15490
15490
|
*
|
|
@@ -15501,11 +15501,11 @@ declare function instructionDiscriminator(method: string): Buffer;
|
|
|
15501
15501
|
* @param {PublicKey} payer - The payer public key.
|
|
15502
15502
|
* @param {Commitment} [commitment='confirmed'] - The commitment level.
|
|
15503
15503
|
* @param {Blockhash} [blockhash] - The blockhash.
|
|
15504
|
-
* @param {PublicKey} [
|
|
15504
|
+
* @param {PublicKey} [lookupTableAddresses] - The array of lookup table addresses.
|
|
15505
15505
|
* @returns {Promise<Buffer>} A promise that resolves to the simulation result.
|
|
15506
15506
|
* @throws {Error} If the simulation fails.
|
|
15507
15507
|
*/
|
|
15508
|
-
declare function simulateTransaction(connection: Connection, instructions: TransactionInstruction[], programId: PublicKey, payer: PublicKey, commitment?: Commitment, blockhash?: Blockhash,
|
|
15508
|
+
declare function simulateTransaction(connection: Connection, instructions: TransactionInstruction[], programId: PublicKey, payer: PublicKey, commitment?: Commitment, blockhash?: Blockhash, lookupTableAddresses?: PublicKey | PublicKey[]): Promise<Buffer>;
|
|
15509
15509
|
|
|
15510
15510
|
/**
|
|
15511
15511
|
* Array of IDL types.
|
package/dist/index.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ import * as beetSolana from '@metaplex-foundation/beet-solana';
|
|
|
7
7
|
import BN from 'bn.js';
|
|
8
8
|
import { EndpointId, Environment, Network } from '@layerzerolabs/lz-definitions';
|
|
9
9
|
import { HashSigner } from '@layerzerolabs/lz-foundation';
|
|
10
|
-
export { i as UMI } from './index-
|
|
10
|
+
export { i as UMI } from './index-Cl-ICwDK.js';
|
|
11
11
|
import '@metaplex-foundation/umi';
|
|
12
12
|
import '@metaplex-foundation/umi/serializers';
|
|
13
13
|
|
|
@@ -15427,10 +15427,10 @@ declare function closeLookupTable(recipient: PublicKey, authority: PublicKey, lo
|
|
|
15427
15427
|
* @param {PublicKey} payer - The payer public key.
|
|
15428
15428
|
* @param {TransactionInstruction[]} instructions - The transaction instructions.
|
|
15429
15429
|
* @param {Blockhash} [recentBlockHash] - The recent block hash.
|
|
15430
|
-
* @param {PublicKey} [
|
|
15430
|
+
* @param {PublicKey} [_tableAddrs] - The array of address lookup table public keys.
|
|
15431
15431
|
* @returns {Promise<VersionedTransaction>} A promise that resolves to the versioned transaction.
|
|
15432
15432
|
*/
|
|
15433
|
-
declare function txWithAddressLookupTable(connection: Connection, payer: PublicKey, instructions: TransactionInstruction[], recentBlockHash?: Blockhash,
|
|
15433
|
+
declare function txWithAddressLookupTable(connection: Connection, payer: PublicKey, instructions: TransactionInstruction[], recentBlockHash?: Blockhash, _tableAddrs?: PublicKey | PublicKey[]): Promise<VersionedTransaction>;
|
|
15434
15434
|
/**
|
|
15435
15435
|
* Creates a nonce account transaction.
|
|
15436
15436
|
*
|
|
@@ -15481,10 +15481,10 @@ declare function buildMessageV0(connection: Connection, payerKey: PublicKey, ins
|
|
|
15481
15481
|
* @param {TransactionInstruction[]} instructions - The transaction instructions.
|
|
15482
15482
|
* @param {Commitment | GetAccountInfoConfig} [commitmentOrConfig='confirmed'] - The commitment level or account info configuration.
|
|
15483
15483
|
* @param {Blockhash} [blockhash] - The blockhash.
|
|
15484
|
-
* @param {PublicKey} [
|
|
15484
|
+
* @param {PublicKey} [lookupTableAddresses] - The array of lookup table addresses.
|
|
15485
15485
|
* @returns {Promise<VersionedTransaction>} A promise that resolves to the versioned transaction.
|
|
15486
15486
|
*/
|
|
15487
|
-
declare function buildVersionedTransaction(connection: Connection, payerKey: PublicKey, instructions: TransactionInstruction[], commitmentOrConfig?: Commitment | GetAccountInfoConfig, blockhash?: Blockhash,
|
|
15487
|
+
declare function buildVersionedTransaction(connection: Connection, payerKey: PublicKey, instructions: TransactionInstruction[], commitmentOrConfig?: Commitment | GetAccountInfoConfig, blockhash?: Blockhash, lookupTableAddresses?: PublicKey | PublicKey[]): Promise<VersionedTransaction>;
|
|
15488
15488
|
/**
|
|
15489
15489
|
* Generates an instruction discriminator.
|
|
15490
15490
|
*
|
|
@@ -15501,11 +15501,11 @@ declare function instructionDiscriminator(method: string): Buffer;
|
|
|
15501
15501
|
* @param {PublicKey} payer - The payer public key.
|
|
15502
15502
|
* @param {Commitment} [commitment='confirmed'] - The commitment level.
|
|
15503
15503
|
* @param {Blockhash} [blockhash] - The blockhash.
|
|
15504
|
-
* @param {PublicKey} [
|
|
15504
|
+
* @param {PublicKey} [lookupTableAddresses] - The array of lookup table addresses.
|
|
15505
15505
|
* @returns {Promise<Buffer>} A promise that resolves to the simulation result.
|
|
15506
15506
|
* @throws {Error} If the simulation fails.
|
|
15507
15507
|
*/
|
|
15508
|
-
declare function simulateTransaction(connection: Connection, instructions: TransactionInstruction[], programId: PublicKey, payer: PublicKey, commitment?: Commitment, blockhash?: Blockhash,
|
|
15508
|
+
declare function simulateTransaction(connection: Connection, instructions: TransactionInstruction[], programId: PublicKey, payer: PublicKey, commitment?: Commitment, blockhash?: Blockhash, lookupTableAddresses?: PublicKey | PublicKey[]): Promise<Buffer>;
|
|
15509
15509
|
|
|
15510
15510
|
/**
|
|
15511
15511
|
* Array of IDL types.
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as web3108 from '@solana/web3.js';
|
|
2
|
-
import { PublicKey, TransactionInstruction, AddressLookupTableProgram, VersionedTransaction, TransactionMessage, Keypair, NONCE_ACCOUNT_LENGTH, Transaction, SystemProgram, NonceAccount } from '@solana/web3.js';
|
|
2
|
+
import { PublicKey, TransactionInstruction, AddressLookupTableProgram, VersionedTransaction, TransactionMessage, AddressLookupTableAccount, Keypair, NONCE_ACCOUNT_LENGTH, Transaction, SystemProgram, NonceAccount } from '@solana/web3.js';
|
|
3
3
|
import BN from 'bn.js';
|
|
4
4
|
import invariant6 from 'tiny-invariant';
|
|
5
5
|
import { keccak_256, sha2_256 } from '@layerzerolabs/lz-foundation';
|
|
@@ -12070,9 +12070,9 @@ function closeLookupTable(recipient, authority, lookupTable) {
|
|
|
12070
12070
|
lookupTable
|
|
12071
12071
|
});
|
|
12072
12072
|
}
|
|
12073
|
-
async function txWithAddressLookupTable(connection, payer, instructions, recentBlockHash,
|
|
12073
|
+
async function txWithAddressLookupTable(connection, payer, instructions, recentBlockHash, _tableAddrs) {
|
|
12074
12074
|
recentBlockHash = recentBlockHash ?? (await connection.getLatestBlockhash()).blockhash;
|
|
12075
|
-
if (!
|
|
12075
|
+
if (!_tableAddrs) {
|
|
12076
12076
|
return new VersionedTransaction(
|
|
12077
12077
|
new TransactionMessage({
|
|
12078
12078
|
instructions,
|
|
@@ -12081,13 +12081,21 @@ async function txWithAddressLookupTable(connection, payer, instructions, recentB
|
|
|
12081
12081
|
}).compileToV0Message()
|
|
12082
12082
|
);
|
|
12083
12083
|
}
|
|
12084
|
-
const
|
|
12084
|
+
const tableAddrs = Array.isArray(_tableAddrs) ? _tableAddrs : [_tableAddrs];
|
|
12085
|
+
const lookupTableAccountsResult = await connection.getMultipleAccountsInfo(tableAddrs);
|
|
12086
|
+
const lookupTableAccounts = lookupTableAccountsResult.map((result, index) => {
|
|
12087
|
+
if (result === null) return null;
|
|
12088
|
+
return new AddressLookupTableAccount({
|
|
12089
|
+
key: tableAddrs[index],
|
|
12090
|
+
state: AddressLookupTableAccount.deserialize(result.data)
|
|
12091
|
+
});
|
|
12092
|
+
}).filter((account) => account !== null);
|
|
12085
12093
|
return new VersionedTransaction(
|
|
12086
12094
|
new TransactionMessage({
|
|
12087
12095
|
instructions,
|
|
12088
12096
|
payerKey: payer,
|
|
12089
12097
|
recentBlockhash: recentBlockHash
|
|
12090
|
-
}).compileToV0Message(
|
|
12098
|
+
}).compileToV0Message(lookupTableAccounts.length > 0 ? lookupTableAccounts : void 0)
|
|
12091
12099
|
);
|
|
12092
12100
|
}
|
|
12093
12101
|
async function createNonceAccountTX(connection, auth, lamportsForRent) {
|
|
@@ -12146,9 +12154,9 @@ async function buildMessageV0(connection, payerKey, instructions, commitmentOrCo
|
|
|
12146
12154
|
instructions
|
|
12147
12155
|
}).compileToV0Message();
|
|
12148
12156
|
}
|
|
12149
|
-
async function buildVersionedTransaction(connection, payerKey, instructions, commitmentOrConfig = "confirmed", blockhash,
|
|
12150
|
-
if (
|
|
12151
|
-
return txWithAddressLookupTable(connection, payerKey, instructions, blockhash,
|
|
12157
|
+
async function buildVersionedTransaction(connection, payerKey, instructions, commitmentOrConfig = "confirmed", blockhash, lookupTableAddresses) {
|
|
12158
|
+
if (lookupTableAddresses) {
|
|
12159
|
+
return txWithAddressLookupTable(connection, payerKey, instructions, blockhash, lookupTableAddresses);
|
|
12152
12160
|
}
|
|
12153
12161
|
return new VersionedTransaction(
|
|
12154
12162
|
await buildMessageV0(connection, payerKey, instructions, commitmentOrConfig, blockhash)
|
|
@@ -12157,14 +12165,14 @@ async function buildVersionedTransaction(connection, payerKey, instructions, com
|
|
|
12157
12165
|
function instructionDiscriminator(method) {
|
|
12158
12166
|
return Buffer.from(sha2_256(Buffer.from(`global:${method}`))).subarray(0, 8);
|
|
12159
12167
|
}
|
|
12160
|
-
async function simulateTransaction(connection, instructions, programId, payer, commitment = "confirmed", blockhash,
|
|
12168
|
+
async function simulateTransaction(connection, instructions, programId, payer, commitment = "confirmed", blockhash, lookupTableAddresses) {
|
|
12161
12169
|
const tx = await buildVersionedTransaction(
|
|
12162
12170
|
connection,
|
|
12163
12171
|
payer,
|
|
12164
12172
|
instructions,
|
|
12165
12173
|
commitment,
|
|
12166
12174
|
blockhash,
|
|
12167
|
-
|
|
12175
|
+
lookupTableAddresses
|
|
12168
12176
|
);
|
|
12169
12177
|
const simulateResp = await connection.simulateTransaction(tx, { sigVerify: false, commitment });
|
|
12170
12178
|
const returnPrefix = `Program return: ${programId.toBase58()} `;
|
|
@@ -29793,9 +29801,9 @@ function closeLookupTable2(recipient, authority, lookupTable) {
|
|
|
29793
29801
|
lookupTable
|
|
29794
29802
|
});
|
|
29795
29803
|
}
|
|
29796
|
-
async function txWithAddressLookupTable2(connection, payer, instructions, recentBlockHash,
|
|
29804
|
+
async function txWithAddressLookupTable2(connection, payer, instructions, recentBlockHash, _tableAddrs) {
|
|
29797
29805
|
recentBlockHash = recentBlockHash ?? (await connection.getLatestBlockhash()).blockhash;
|
|
29798
|
-
if (!
|
|
29806
|
+
if (!_tableAddrs) {
|
|
29799
29807
|
return new web3108.VersionedTransaction(
|
|
29800
29808
|
new web3108.TransactionMessage({
|
|
29801
29809
|
instructions,
|
|
@@ -29804,13 +29812,21 @@ async function txWithAddressLookupTable2(connection, payer, instructions, recent
|
|
|
29804
29812
|
}).compileToV0Message()
|
|
29805
29813
|
);
|
|
29806
29814
|
}
|
|
29807
|
-
const
|
|
29815
|
+
const tableAddrs = Array.isArray(_tableAddrs) ? _tableAddrs : [_tableAddrs];
|
|
29816
|
+
const lookupTableAccountsResult = await connection.getMultipleAccountsInfo(tableAddrs);
|
|
29817
|
+
const lookupTableAccounts = lookupTableAccountsResult.map((result, index) => {
|
|
29818
|
+
if (result === null) return null;
|
|
29819
|
+
return new web3108.AddressLookupTableAccount({
|
|
29820
|
+
key: tableAddrs[index],
|
|
29821
|
+
state: web3108.AddressLookupTableAccount.deserialize(result.data)
|
|
29822
|
+
});
|
|
29823
|
+
}).filter((account) => account !== null);
|
|
29808
29824
|
return new web3108.VersionedTransaction(
|
|
29809
29825
|
new web3108.TransactionMessage({
|
|
29810
29826
|
instructions,
|
|
29811
29827
|
payerKey: payer,
|
|
29812
29828
|
recentBlockhash: recentBlockHash
|
|
29813
|
-
}).compileToV0Message(
|
|
29829
|
+
}).compileToV0Message(lookupTableAccounts.length > 0 ? lookupTableAccounts : void 0)
|
|
29814
29830
|
);
|
|
29815
29831
|
}
|
|
29816
29832
|
async function createNonceAccountTX2(connection, auth, lamportsForRent) {
|
|
@@ -29869,9 +29885,9 @@ async function buildMessageV02(connection, payerKey, instructions, commitmentOrC
|
|
|
29869
29885
|
instructions
|
|
29870
29886
|
}).compileToV0Message();
|
|
29871
29887
|
}
|
|
29872
|
-
async function buildVersionedTransaction2(connection, payerKey, instructions, commitmentOrConfig = "confirmed", blockhash,
|
|
29873
|
-
if (
|
|
29874
|
-
return txWithAddressLookupTable2(connection, payerKey, instructions, blockhash,
|
|
29888
|
+
async function buildVersionedTransaction2(connection, payerKey, instructions, commitmentOrConfig = "confirmed", blockhash, lookupTableAddresses) {
|
|
29889
|
+
if (lookupTableAddresses) {
|
|
29890
|
+
return txWithAddressLookupTable2(connection, payerKey, instructions, blockhash, lookupTableAddresses);
|
|
29875
29891
|
}
|
|
29876
29892
|
return new web3108.VersionedTransaction(
|
|
29877
29893
|
await buildMessageV02(connection, payerKey, instructions, commitmentOrConfig, blockhash)
|
|
@@ -29880,7 +29896,7 @@ async function buildVersionedTransaction2(connection, payerKey, instructions, co
|
|
|
29880
29896
|
function instructionDiscriminator2(method) {
|
|
29881
29897
|
return Buffer.from(sha2_256(Buffer.from(`global:${method}`))).subarray(0, 8);
|
|
29882
29898
|
}
|
|
29883
|
-
async function simulateWeb3JsTransaction(_connection, _instructions, _programId, _payer, serializer, commitment = "confirmed", blockhash,
|
|
29899
|
+
async function simulateWeb3JsTransaction(_connection, _instructions, _programId, _payer, serializer, commitment = "confirmed", blockhash, _lookupTableAddresses) {
|
|
29884
29900
|
let connection;
|
|
29885
29901
|
if (typeof _connection === "string") {
|
|
29886
29902
|
connection = new web3108.Connection(_connection, commitment);
|
|
@@ -29910,21 +29926,14 @@ async function simulateWeb3JsTransaction(_connection, _instructions, _programId,
|
|
|
29910
29926
|
} else {
|
|
29911
29927
|
payer = toWeb3JsPublicKey(_payer);
|
|
29912
29928
|
}
|
|
29913
|
-
|
|
29914
|
-
if (_lookupTableAddress) {
|
|
29915
|
-
if (_lookupTableAddress instanceof web3108.PublicKey) {
|
|
29916
|
-
lookupTableAddress = _lookupTableAddress;
|
|
29917
|
-
} else {
|
|
29918
|
-
lookupTableAddress = toWeb3JsPublicKey(_lookupTableAddress);
|
|
29919
|
-
}
|
|
29920
|
-
}
|
|
29929
|
+
const lookupTableAddresses = _lookupTableAddresses && (Array.isArray(_lookupTableAddresses) ? _lookupTableAddresses.map((addr) => addr instanceof web3108.PublicKey ? addr : toWeb3JsPublicKey(addr)) : _lookupTableAddresses instanceof web3108.PublicKey ? _lookupTableAddresses : toWeb3JsPublicKey(_lookupTableAddresses));
|
|
29921
29930
|
const tx = await buildVersionedTransaction2(
|
|
29922
29931
|
connection,
|
|
29923
29932
|
payer,
|
|
29924
29933
|
instructions,
|
|
29925
29934
|
commitment,
|
|
29926
29935
|
blockhash,
|
|
29927
|
-
|
|
29936
|
+
lookupTableAddresses
|
|
29928
29937
|
);
|
|
29929
29938
|
const simulateResp = await connection.simulateTransaction(tx, { sigVerify: false, commitment });
|
|
29930
29939
|
const returnPrefix = `Program return: ${programId.toBase58()} `;
|