@solana/web3.js 1.55.0 → 1.56.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/lib/index.iife.js CHANGED
@@ -16852,6 +16852,28 @@ var solanaWeb3 = (function (exports) {
16852
16852
  value
16853
16853
  });
16854
16854
  }
16855
+ /**
16856
+ * @internal
16857
+ */
16858
+
16859
+
16860
+ function versionedMessageFromResponse(version, response) {
16861
+ if (version === 0) {
16862
+ return new MessageV0({
16863
+ header: response.header,
16864
+ staticAccountKeys: response.accountKeys.map(accountKey => new PublicKey(accountKey)),
16865
+ recentBlockhash: response.recentBlockhash,
16866
+ compiledInstructions: response.instructions.map(ix => ({
16867
+ programIdIndex: ix.programIdIndex,
16868
+ accountKeyIndexes: ix.accounts,
16869
+ data: bs58$1.decode(ix.data)
16870
+ })),
16871
+ addressTableLookups: response.addressTableLookups
16872
+ });
16873
+ } else {
16874
+ return new Message(response);
16875
+ }
16876
+ }
16855
16877
  /**
16856
16878
  * The level of commitment desired when querying state
16857
16879
  * <pre>
@@ -17407,6 +17429,11 @@ var solanaWeb3 = (function (exports) {
17407
17429
  */
17408
17430
 
17409
17431
  const GetMinimumBalanceForRentExemptionRpcResult = jsonRpcResult(number());
17432
+ const AddressTableLookupStruct = type({
17433
+ accountKey: PublicKeyFromString,
17434
+ writableIndexes: array(number()),
17435
+ readonlyIndexes: array(number())
17436
+ });
17410
17437
  const ConfirmedTransactionResult = type({
17411
17438
  signatures: array(string()),
17412
17439
  message: type({
@@ -17421,7 +17448,8 @@ var solanaWeb3 = (function (exports) {
17421
17448
  data: string(),
17422
17449
  programIdIndex: number()
17423
17450
  })),
17424
- recentBlockhash: string()
17451
+ recentBlockhash: string(),
17452
+ addressTableLookups: optional(array(AddressTableLookupStruct))
17425
17453
  })
17426
17454
  });
17427
17455
  const ParsedInstructionResult = type({
@@ -17464,7 +17492,8 @@ var solanaWeb3 = (function (exports) {
17464
17492
  writable: boolean()
17465
17493
  })),
17466
17494
  instructions: array(ParsedOrRawInstruction),
17467
- recentBlockhash: string()
17495
+ recentBlockhash: string(),
17496
+ addressTableLookups: optional(nullable(array(AddressTableLookupStruct)))
17468
17497
  })
17469
17498
  });
17470
17499
  const TokenBalanceResult = type({
@@ -17517,6 +17546,7 @@ var solanaWeb3 = (function (exports) {
17517
17546
  postTokenBalances: optional(nullable(array(TokenBalanceResult))),
17518
17547
  loadedAddresses: optional(LoadedAddressesResult)
17519
17548
  });
17549
+ const TransactionVersionStruct = union([literal(0), literal('legacy')]);
17520
17550
  /**
17521
17551
  * Expected JSON RPC response for the "getBlock" message
17522
17552
  */
@@ -17527,7 +17557,8 @@ var solanaWeb3 = (function (exports) {
17527
17557
  parentSlot: number(),
17528
17558
  transactions: array(type({
17529
17559
  transaction: ConfirmedTransactionResult,
17530
- meta: nullable(ConfirmedTransactionMetaResult)
17560
+ meta: nullable(ConfirmedTransactionMetaResult),
17561
+ version: optional(TransactionVersionStruct)
17531
17562
  })),
17532
17563
  rewards: optional(array(type({
17533
17564
  pubkey: string(),
@@ -17579,7 +17610,8 @@ var solanaWeb3 = (function (exports) {
17579
17610
  slot: number(),
17580
17611
  meta: ConfirmedTransactionMetaResult,
17581
17612
  blockTime: optional(nullable(number())),
17582
- transaction: ConfirmedTransactionResult
17613
+ transaction: ConfirmedTransactionResult,
17614
+ version: optional(TransactionVersionStruct)
17583
17615
  })));
17584
17616
  /**
17585
17617
  * Expected parsed JSON RPC response for the "getTransaction" message
@@ -17589,7 +17621,8 @@ var solanaWeb3 = (function (exports) {
17589
17621
  slot: number(),
17590
17622
  transaction: ParsedConfirmedTransactionResult,
17591
17623
  meta: nullable(ParsedConfirmedTransactionMetaResult),
17592
- blockTime: optional(nullable(number()))
17624
+ blockTime: optional(nullable(number())),
17625
+ version: optional(TransactionVersionStruct)
17593
17626
  })));
17594
17627
  /**
17595
17628
  * Expected JSON RPC response for the "getRecentBlockhash" message
@@ -18832,9 +18865,16 @@ var solanaWeb3 = (function (exports) {
18832
18865
  }
18833
18866
  /**
18834
18867
  * Fetch a processed block from the cluster.
18868
+ *
18869
+ * @deprecated Instead, call `getBlock` using a `GetVersionedBlockConfig` by
18870
+ * setting the `maxSupportedTransactionVersion` property.
18835
18871
  */
18836
18872
 
18837
18873
 
18874
+ /**
18875
+ * Fetch a processed block from the cluster.
18876
+ */
18877
+ // eslint-disable-next-line no-dupe-class-members
18838
18878
  async getBlock(slot, rawConfig) {
18839
18879
  const {
18840
18880
  commitment,
@@ -18857,16 +18897,15 @@ var solanaWeb3 = (function (exports) {
18857
18897
  return { ...result,
18858
18898
  transactions: result.transactions.map(({
18859
18899
  transaction,
18860
- meta
18861
- }) => {
18862
- const message = new Message(transaction.message);
18863
- return {
18864
- meta,
18865
- transaction: { ...transaction,
18866
- message
18867
- }
18868
- };
18869
- })
18900
+ meta,
18901
+ version
18902
+ }) => ({
18903
+ meta,
18904
+ transaction: { ...transaction,
18905
+ message: versionedMessageFromResponse(version, transaction.message)
18906
+ },
18907
+ version
18908
+ }))
18870
18909
  };
18871
18910
  }
18872
18911
  /*
@@ -18926,9 +18965,17 @@ var solanaWeb3 = (function (exports) {
18926
18965
  }
18927
18966
  /**
18928
18967
  * Fetch a confirmed or finalized transaction from the cluster.
18968
+ *
18969
+ * @deprecated Instead, call `getTransaction` using a
18970
+ * `GetVersionedTransactionConfig` by setting the
18971
+ * `maxSupportedTransactionVersion` property.
18929
18972
  */
18930
18973
 
18931
18974
 
18975
+ /**
18976
+ * Fetch a confirmed or finalized transaction from the cluster.
18977
+ */
18978
+ // eslint-disable-next-line no-dupe-class-members
18932
18979
  async getTransaction(signature, rawConfig) {
18933
18980
  const {
18934
18981
  commitment,
@@ -18950,7 +18997,7 @@ var solanaWeb3 = (function (exports) {
18950
18997
  if (!result) return result;
18951
18998
  return { ...result,
18952
18999
  transaction: { ...result.transaction,
18953
- message: new Message(result.transaction.message)
19000
+ message: versionedMessageFromResponse(result.version, result.transaction.message)
18954
19001
  }
18955
19002
  };
18956
19003
  }
@@ -19009,9 +19056,19 @@ var solanaWeb3 = (function (exports) {
19009
19056
  /**
19010
19057
  * Fetch transaction details for a batch of confirmed transactions.
19011
19058
  * Similar to {@link getParsedTransactions} but returns a {@link TransactionResponse}.
19059
+ *
19060
+ * @deprecated Instead, call `getTransactions` using a
19061
+ * `GetVersionedTransactionConfig` by setting the
19062
+ * `maxSupportedTransactionVersion` property.
19012
19063
  */
19013
19064
 
19014
19065
 
19066
+ /**
19067
+ * Fetch transaction details for a batch of confirmed transactions.
19068
+ * Similar to {@link getParsedTransactions} but returns a {@link
19069
+ * VersionedTransactionResponse}.
19070
+ */
19071
+ // eslint-disable-next-line no-dupe-class-members
19015
19072
  async getTransactions(signatures, commitmentOrConfig) {
19016
19073
  const {
19017
19074
  commitment,
@@ -19039,7 +19096,7 @@ var solanaWeb3 = (function (exports) {
19039
19096
  if (!result) return result;
19040
19097
  return { ...result,
19041
19098
  transaction: { ...result.transaction,
19042
- message: new Message(result.transaction.message)
19099
+ message: versionedMessageFromResponse(result.version, result.transaction.message)
19043
19100
  }
19044
19101
  };
19045
19102
  });