@layerzerolabs/lz-solana-sdk-v2 3.0.135 → 3.0.136

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 CHANGED
@@ -1,5 +1,18 @@
1
1
  # @layerzerolabs/lz-solana-sdk-v2
2
2
 
3
+ ## 3.0.136
4
+
5
+ ### Patch Changes
6
+
7
+ - 5b7f5c6: Allow multiple ALTs when quoting OFT send
8
+ - Updated dependencies [5b7f5c6]
9
+ - @layerzerolabs/lz-corekit-solana@3.0.136
10
+ - @layerzerolabs/lz-definitions@3.0.136
11
+ - @layerzerolabs/lz-foundation@3.0.136
12
+ - @layerzerolabs/lz-serdes@3.0.136
13
+ - @layerzerolabs/lz-utilities@3.0.136
14
+ - @layerzerolabs/lz-v2-utilities@3.0.136
15
+
3
16
  ## 3.0.135
4
17
 
5
18
  ### Patch Changes
@@ -8410,10 +8410,10 @@ declare function closeLookupTable(recipient: web3.PublicKey, authority: web3.Pub
8410
8410
  * @param {PublicKey} payer - The payer public key.
8411
8411
  * @param {TransactionInstruction[]} instructions - The transaction instructions.
8412
8412
  * @param {Blockhash} [recentBlockHash] - The recent block hash.
8413
- * @param {PublicKey} [tableAddr] - The address lookup table public key.
8413
+ * @param {PublicKey} [_tableAddrs] - The array of address lookup table public keys.
8414
8414
  * @returns {Promise<VersionedTransaction>} A promise that resolves to the versioned transaction.
8415
8415
  */
8416
- declare function txWithAddressLookupTable(connection: web3.Connection, payer: web3.PublicKey, instructions: web3.TransactionInstruction[], recentBlockHash?: web3.Blockhash, tableAddr?: web3.PublicKey): Promise<web3.VersionedTransaction>;
8416
+ declare function txWithAddressLookupTable(connection: web3.Connection, payer: web3.PublicKey, instructions: web3.TransactionInstruction[], recentBlockHash?: web3.Blockhash, _tableAddrs?: web3.PublicKey | web3.PublicKey[]): Promise<web3.VersionedTransaction>;
8417
8417
  /**
8418
8418
  * Creates a nonce account transaction.
8419
8419
  *
@@ -8464,10 +8464,10 @@ declare function buildMessageV0(connection: web3.Connection, payerKey: web3.Publ
8464
8464
  * @param {TransactionInstruction[]} instructions - The transaction instructions.
8465
8465
  * @param {Commitment | GetAccountInfoConfig} [commitmentOrConfig='confirmed'] - The commitment level or account info configuration.
8466
8466
  * @param {Blockhash} [blockhash] - The blockhash.
8467
- * @param {PublicKey} [lookupTableAddress] - The lookup table address.
8467
+ * @param {PublicKey} [lookupTableAddresses] - The array of lookup table addresses.
8468
8468
  * @returns {Promise<VersionedTransaction>} A promise that resolves to the versioned transaction.
8469
8469
  */
8470
- declare function buildVersionedTransaction(connection: web3.Connection, payerKey: web3.PublicKey, instructions: web3.TransactionInstruction[], commitmentOrConfig?: web3.Commitment | web3.GetAccountInfoConfig, blockhash?: web3.Blockhash, lookupTableAddress?: web3.PublicKey): Promise<web3.VersionedTransaction>;
8470
+ declare function buildVersionedTransaction(connection: web3.Connection, payerKey: web3.PublicKey, instructions: web3.TransactionInstruction[], commitmentOrConfig?: web3.Commitment | web3.GetAccountInfoConfig, blockhash?: web3.Blockhash, lookupTableAddresses?: web3.PublicKey | web3.PublicKey[]): Promise<web3.VersionedTransaction>;
8471
8471
  /**
8472
8472
  * Generates an instruction discriminator.
8473
8473
  *
@@ -8485,11 +8485,11 @@ declare function instructionDiscriminator(method: string): Buffer;
8485
8485
  * @param {Serializer<From, To>} serializer - The serializer.
8486
8486
  * @param {web3.Commitment} [commitment='confirmed'] - The commitment level.
8487
8487
  * @param {web3.Blockhash} [blockhash] - The blockhash.
8488
- * @param {web3.PublicKey | PublicKey} [_lookupTableAddress] - The lookup table address.
8488
+ * @param {web3.PublicKey | PublicKey} [_lookupTableAddresses] - The array of lookup table addresses.
8489
8489
  * @returns {Promise<Buffer>} A promise that resolves to the simulation result.
8490
8490
  * @throws {Error} If the simulation fails.
8491
8491
  */
8492
- declare function simulateWeb3JsTransaction<From, To extends From = From>(_connection: string | web3.Connection | RpcInterface, _instructions: web3.TransactionInstruction[] | WrappedInstruction[] | Instruction[], _programId: web3.PublicKey | PublicKey, _payer: web3.PublicKey | PublicKey, serializer: Serializer<From, To>, commitment?: web3.Commitment, blockhash?: web3.Blockhash, _lookupTableAddress?: web3.PublicKey | PublicKey): Promise<To>;
8492
+ declare function simulateWeb3JsTransaction<From, To extends From = From>(_connection: string | web3.Connection | RpcInterface, _instructions: web3.TransactionInstruction[] | WrappedInstruction[] | Instruction[], _programId: web3.PublicKey | PublicKey, _payer: web3.PublicKey | PublicKey, serializer: Serializer<From, To>, commitment?: web3.Commitment, blockhash?: web3.Blockhash, _lookupTableAddresses?: web3.PublicKey | PublicKey | web3.PublicKey[] | PublicKey[]): Promise<To>;
8493
8493
  declare function toWeb3Connection(rpc: RpcInterface | web3.Connection): web3.Connection;
8494
8494
 
8495
8495
  /**
@@ -8410,10 +8410,10 @@ declare function closeLookupTable(recipient: web3.PublicKey, authority: web3.Pub
8410
8410
  * @param {PublicKey} payer - The payer public key.
8411
8411
  * @param {TransactionInstruction[]} instructions - The transaction instructions.
8412
8412
  * @param {Blockhash} [recentBlockHash] - The recent block hash.
8413
- * @param {PublicKey} [tableAddr] - The address lookup table public key.
8413
+ * @param {PublicKey} [_tableAddrs] - The array of address lookup table public keys.
8414
8414
  * @returns {Promise<VersionedTransaction>} A promise that resolves to the versioned transaction.
8415
8415
  */
8416
- declare function txWithAddressLookupTable(connection: web3.Connection, payer: web3.PublicKey, instructions: web3.TransactionInstruction[], recentBlockHash?: web3.Blockhash, tableAddr?: web3.PublicKey): Promise<web3.VersionedTransaction>;
8416
+ declare function txWithAddressLookupTable(connection: web3.Connection, payer: web3.PublicKey, instructions: web3.TransactionInstruction[], recentBlockHash?: web3.Blockhash, _tableAddrs?: web3.PublicKey | web3.PublicKey[]): Promise<web3.VersionedTransaction>;
8417
8417
  /**
8418
8418
  * Creates a nonce account transaction.
8419
8419
  *
@@ -8464,10 +8464,10 @@ declare function buildMessageV0(connection: web3.Connection, payerKey: web3.Publ
8464
8464
  * @param {TransactionInstruction[]} instructions - The transaction instructions.
8465
8465
  * @param {Commitment | GetAccountInfoConfig} [commitmentOrConfig='confirmed'] - The commitment level or account info configuration.
8466
8466
  * @param {Blockhash} [blockhash] - The blockhash.
8467
- * @param {PublicKey} [lookupTableAddress] - The lookup table address.
8467
+ * @param {PublicKey} [lookupTableAddresses] - The array of lookup table addresses.
8468
8468
  * @returns {Promise<VersionedTransaction>} A promise that resolves to the versioned transaction.
8469
8469
  */
8470
- declare function buildVersionedTransaction(connection: web3.Connection, payerKey: web3.PublicKey, instructions: web3.TransactionInstruction[], commitmentOrConfig?: web3.Commitment | web3.GetAccountInfoConfig, blockhash?: web3.Blockhash, lookupTableAddress?: web3.PublicKey): Promise<web3.VersionedTransaction>;
8470
+ declare function buildVersionedTransaction(connection: web3.Connection, payerKey: web3.PublicKey, instructions: web3.TransactionInstruction[], commitmentOrConfig?: web3.Commitment | web3.GetAccountInfoConfig, blockhash?: web3.Blockhash, lookupTableAddresses?: web3.PublicKey | web3.PublicKey[]): Promise<web3.VersionedTransaction>;
8471
8471
  /**
8472
8472
  * Generates an instruction discriminator.
8473
8473
  *
@@ -8485,11 +8485,11 @@ declare function instructionDiscriminator(method: string): Buffer;
8485
8485
  * @param {Serializer<From, To>} serializer - The serializer.
8486
8486
  * @param {web3.Commitment} [commitment='confirmed'] - The commitment level.
8487
8487
  * @param {web3.Blockhash} [blockhash] - The blockhash.
8488
- * @param {web3.PublicKey | PublicKey} [_lookupTableAddress] - The lookup table address.
8488
+ * @param {web3.PublicKey | PublicKey} [_lookupTableAddresses] - The array of lookup table addresses.
8489
8489
  * @returns {Promise<Buffer>} A promise that resolves to the simulation result.
8490
8490
  * @throws {Error} If the simulation fails.
8491
8491
  */
8492
- declare function simulateWeb3JsTransaction<From, To extends From = From>(_connection: string | web3.Connection | RpcInterface, _instructions: web3.TransactionInstruction[] | WrappedInstruction[] | Instruction[], _programId: web3.PublicKey | PublicKey, _payer: web3.PublicKey | PublicKey, serializer: Serializer<From, To>, commitment?: web3.Commitment, blockhash?: web3.Blockhash, _lookupTableAddress?: web3.PublicKey | PublicKey): Promise<To>;
8492
+ declare function simulateWeb3JsTransaction<From, To extends From = From>(_connection: string | web3.Connection | RpcInterface, _instructions: web3.TransactionInstruction[] | WrappedInstruction[] | Instruction[], _programId: web3.PublicKey | PublicKey, _payer: web3.PublicKey | PublicKey, serializer: Serializer<From, To>, commitment?: web3.Commitment, blockhash?: web3.Blockhash, _lookupTableAddresses?: web3.PublicKey | PublicKey | web3.PublicKey[] | PublicKey[]): Promise<To>;
8493
8493
  declare function toWeb3Connection(rpc: RpcInterface | web3.Connection): web3.Connection;
8494
8494
 
8495
8495
  /**
package/dist/index.cjs CHANGED
@@ -12097,9 +12097,9 @@ function closeLookupTable(recipient, authority, lookupTable) {
12097
12097
  lookupTable
12098
12098
  });
12099
12099
  }
12100
- async function txWithAddressLookupTable(connection, payer, instructions, recentBlockHash, tableAddr) {
12100
+ async function txWithAddressLookupTable(connection, payer, instructions, recentBlockHash, _tableAddrs) {
12101
12101
  recentBlockHash = recentBlockHash ?? (await connection.getLatestBlockhash()).blockhash;
12102
- if (!tableAddr) {
12102
+ if (!_tableAddrs) {
12103
12103
  return new web3108.VersionedTransaction(
12104
12104
  new web3108.TransactionMessage({
12105
12105
  instructions,
@@ -12108,13 +12108,21 @@ async function txWithAddressLookupTable(connection, payer, instructions, recentB
12108
12108
  }).compileToV0Message()
12109
12109
  );
12110
12110
  }
12111
- const { value: lookupTableAccount } = await connection.getAddressLookupTable(tableAddr);
12111
+ const tableAddrs = Array.isArray(_tableAddrs) ? _tableAddrs : [_tableAddrs];
12112
+ const lookupTableAccountsResult = await connection.getMultipleAccountsInfo(tableAddrs);
12113
+ const lookupTableAccounts = lookupTableAccountsResult.map((result, index) => {
12114
+ if (result === null) return null;
12115
+ return new web3108.AddressLookupTableAccount({
12116
+ key: tableAddrs[index],
12117
+ state: web3108.AddressLookupTableAccount.deserialize(result.data)
12118
+ });
12119
+ }).filter((account) => account !== null);
12112
12120
  return new web3108.VersionedTransaction(
12113
12121
  new web3108.TransactionMessage({
12114
12122
  instructions,
12115
12123
  payerKey: payer,
12116
12124
  recentBlockhash: recentBlockHash
12117
- }).compileToV0Message(lookupTableAccount ? [lookupTableAccount] : void 0)
12125
+ }).compileToV0Message(lookupTableAccounts.length > 0 ? lookupTableAccounts : void 0)
12118
12126
  );
12119
12127
  }
12120
12128
  async function createNonceAccountTX(connection, auth, lamportsForRent) {
@@ -12173,9 +12181,9 @@ async function buildMessageV0(connection, payerKey, instructions, commitmentOrCo
12173
12181
  instructions
12174
12182
  }).compileToV0Message();
12175
12183
  }
12176
- async function buildVersionedTransaction(connection, payerKey, instructions, commitmentOrConfig = "confirmed", blockhash, lookupTableAddress) {
12177
- if (lookupTableAddress) {
12178
- return txWithAddressLookupTable(connection, payerKey, instructions, blockhash, lookupTableAddress);
12184
+ async function buildVersionedTransaction(connection, payerKey, instructions, commitmentOrConfig = "confirmed", blockhash, lookupTableAddresses) {
12185
+ if (lookupTableAddresses) {
12186
+ return txWithAddressLookupTable(connection, payerKey, instructions, blockhash, lookupTableAddresses);
12179
12187
  }
12180
12188
  return new web3108.VersionedTransaction(
12181
12189
  await buildMessageV0(connection, payerKey, instructions, commitmentOrConfig, blockhash)
@@ -12184,14 +12192,14 @@ async function buildVersionedTransaction(connection, payerKey, instructions, com
12184
12192
  function instructionDiscriminator(method) {
12185
12193
  return Buffer.from(lzFoundation.sha2_256(Buffer.from(`global:${method}`))).subarray(0, 8);
12186
12194
  }
12187
- async function simulateTransaction(connection, instructions, programId, payer, commitment = "confirmed", blockhash, lookupTableAddress) {
12195
+ async function simulateTransaction(connection, instructions, programId, payer, commitment = "confirmed", blockhash, lookupTableAddresses) {
12188
12196
  const tx = await buildVersionedTransaction(
12189
12197
  connection,
12190
12198
  payer,
12191
12199
  instructions,
12192
12200
  commitment,
12193
12201
  blockhash,
12194
- lookupTableAddress
12202
+ lookupTableAddresses
12195
12203
  );
12196
12204
  const simulateResp = await connection.simulateTransaction(tx, { sigVerify: false, commitment });
12197
12205
  const returnPrefix = `Program return: ${programId.toBase58()} `;
@@ -29820,9 +29828,9 @@ function closeLookupTable2(recipient, authority, lookupTable) {
29820
29828
  lookupTable
29821
29829
  });
29822
29830
  }
29823
- async function txWithAddressLookupTable2(connection, payer, instructions, recentBlockHash, tableAddr) {
29831
+ async function txWithAddressLookupTable2(connection, payer, instructions, recentBlockHash, _tableAddrs) {
29824
29832
  recentBlockHash = recentBlockHash ?? (await connection.getLatestBlockhash()).blockhash;
29825
- if (!tableAddr) {
29833
+ if (!_tableAddrs) {
29826
29834
  return new web3108__namespace.VersionedTransaction(
29827
29835
  new web3108__namespace.TransactionMessage({
29828
29836
  instructions,
@@ -29831,13 +29839,21 @@ async function txWithAddressLookupTable2(connection, payer, instructions, recent
29831
29839
  }).compileToV0Message()
29832
29840
  );
29833
29841
  }
29834
- const { value: lookupTableAccount } = await connection.getAddressLookupTable(tableAddr);
29842
+ const tableAddrs = Array.isArray(_tableAddrs) ? _tableAddrs : [_tableAddrs];
29843
+ const lookupTableAccountsResult = await connection.getMultipleAccountsInfo(tableAddrs);
29844
+ const lookupTableAccounts = lookupTableAccountsResult.map((result, index) => {
29845
+ if (result === null) return null;
29846
+ return new web3108__namespace.AddressLookupTableAccount({
29847
+ key: tableAddrs[index],
29848
+ state: web3108__namespace.AddressLookupTableAccount.deserialize(result.data)
29849
+ });
29850
+ }).filter((account) => account !== null);
29835
29851
  return new web3108__namespace.VersionedTransaction(
29836
29852
  new web3108__namespace.TransactionMessage({
29837
29853
  instructions,
29838
29854
  payerKey: payer,
29839
29855
  recentBlockhash: recentBlockHash
29840
- }).compileToV0Message(lookupTableAccount ? [lookupTableAccount] : void 0)
29856
+ }).compileToV0Message(lookupTableAccounts.length > 0 ? lookupTableAccounts : void 0)
29841
29857
  );
29842
29858
  }
29843
29859
  async function createNonceAccountTX2(connection, auth, lamportsForRent) {
@@ -29896,9 +29912,9 @@ async function buildMessageV02(connection, payerKey, instructions, commitmentOrC
29896
29912
  instructions
29897
29913
  }).compileToV0Message();
29898
29914
  }
29899
- async function buildVersionedTransaction2(connection, payerKey, instructions, commitmentOrConfig = "confirmed", blockhash, lookupTableAddress) {
29900
- if (lookupTableAddress) {
29901
- return txWithAddressLookupTable2(connection, payerKey, instructions, blockhash, lookupTableAddress);
29915
+ async function buildVersionedTransaction2(connection, payerKey, instructions, commitmentOrConfig = "confirmed", blockhash, lookupTableAddresses) {
29916
+ if (lookupTableAddresses) {
29917
+ return txWithAddressLookupTable2(connection, payerKey, instructions, blockhash, lookupTableAddresses);
29902
29918
  }
29903
29919
  return new web3108__namespace.VersionedTransaction(
29904
29920
  await buildMessageV02(connection, payerKey, instructions, commitmentOrConfig, blockhash)
@@ -29907,7 +29923,7 @@ async function buildVersionedTransaction2(connection, payerKey, instructions, co
29907
29923
  function instructionDiscriminator2(method) {
29908
29924
  return Buffer.from(lzFoundation.sha2_256(Buffer.from(`global:${method}`))).subarray(0, 8);
29909
29925
  }
29910
- async function simulateWeb3JsTransaction(_connection, _instructions, _programId, _payer, serializer, commitment = "confirmed", blockhash, _lookupTableAddress) {
29926
+ async function simulateWeb3JsTransaction(_connection, _instructions, _programId, _payer, serializer, commitment = "confirmed", blockhash, _lookupTableAddresses) {
29911
29927
  let connection;
29912
29928
  if (typeof _connection === "string") {
29913
29929
  connection = new web3108__namespace.Connection(_connection, commitment);
@@ -29937,21 +29953,14 @@ async function simulateWeb3JsTransaction(_connection, _instructions, _programId,
29937
29953
  } else {
29938
29954
  payer = umiWeb3jsAdapters.toWeb3JsPublicKey(_payer);
29939
29955
  }
29940
- let lookupTableAddress;
29941
- if (_lookupTableAddress) {
29942
- if (_lookupTableAddress instanceof web3108__namespace.PublicKey) {
29943
- lookupTableAddress = _lookupTableAddress;
29944
- } else {
29945
- lookupTableAddress = umiWeb3jsAdapters.toWeb3JsPublicKey(_lookupTableAddress);
29946
- }
29947
- }
29956
+ const lookupTableAddresses = _lookupTableAddresses && (Array.isArray(_lookupTableAddresses) ? _lookupTableAddresses.map((addr) => addr instanceof web3108__namespace.PublicKey ? addr : umiWeb3jsAdapters.toWeb3JsPublicKey(addr)) : _lookupTableAddresses instanceof web3108__namespace.PublicKey ? _lookupTableAddresses : umiWeb3jsAdapters.toWeb3JsPublicKey(_lookupTableAddresses));
29948
29957
  const tx = await buildVersionedTransaction2(
29949
29958
  connection,
29950
29959
  payer,
29951
29960
  instructions,
29952
29961
  commitment,
29953
29962
  blockhash,
29954
- lookupTableAddress
29963
+ lookupTableAddresses
29955
29964
  );
29956
29965
  const simulateResp = await connection.simulateTransaction(tx, { sigVerify: false, commitment });
29957
29966
  const returnPrefix = `Program return: ${programId.toBase58()} `;