@solana/web3.js 1.55.0 → 1.56.2

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({
@@ -17497,7 +17526,8 @@ var solanaWeb3 = (function (exports) {
17497
17526
  logMessages: optional(nullable(array(string()))),
17498
17527
  preTokenBalances: optional(nullable(array(TokenBalanceResult))),
17499
17528
  postTokenBalances: optional(nullable(array(TokenBalanceResult))),
17500
- loadedAddresses: optional(LoadedAddressesResult)
17529
+ loadedAddresses: optional(LoadedAddressesResult),
17530
+ computeUnitsConsumed: optional(number())
17501
17531
  });
17502
17532
  /**
17503
17533
  * @internal
@@ -17515,8 +17545,10 @@ var solanaWeb3 = (function (exports) {
17515
17545
  logMessages: optional(nullable(array(string()))),
17516
17546
  preTokenBalances: optional(nullable(array(TokenBalanceResult))),
17517
17547
  postTokenBalances: optional(nullable(array(TokenBalanceResult))),
17518
- loadedAddresses: optional(LoadedAddressesResult)
17548
+ loadedAddresses: optional(LoadedAddressesResult),
17549
+ computeUnitsConsumed: optional(number())
17519
17550
  });
17551
+ const TransactionVersionStruct = union([literal(0), literal('legacy')]);
17520
17552
  /**
17521
17553
  * Expected JSON RPC response for the "getBlock" message
17522
17554
  */
@@ -17527,7 +17559,8 @@ var solanaWeb3 = (function (exports) {
17527
17559
  parentSlot: number(),
17528
17560
  transactions: array(type({
17529
17561
  transaction: ConfirmedTransactionResult,
17530
- meta: nullable(ConfirmedTransactionMetaResult)
17562
+ meta: nullable(ConfirmedTransactionMetaResult),
17563
+ version: optional(TransactionVersionStruct)
17531
17564
  })),
17532
17565
  rewards: optional(array(type({
17533
17566
  pubkey: string(),
@@ -17579,7 +17612,8 @@ var solanaWeb3 = (function (exports) {
17579
17612
  slot: number(),
17580
17613
  meta: ConfirmedTransactionMetaResult,
17581
17614
  blockTime: optional(nullable(number())),
17582
- transaction: ConfirmedTransactionResult
17615
+ transaction: ConfirmedTransactionResult,
17616
+ version: optional(TransactionVersionStruct)
17583
17617
  })));
17584
17618
  /**
17585
17619
  * Expected parsed JSON RPC response for the "getTransaction" message
@@ -17589,7 +17623,8 @@ var solanaWeb3 = (function (exports) {
17589
17623
  slot: number(),
17590
17624
  transaction: ParsedConfirmedTransactionResult,
17591
17625
  meta: nullable(ParsedConfirmedTransactionMetaResult),
17592
- blockTime: optional(nullable(number()))
17626
+ blockTime: optional(nullable(number())),
17627
+ version: optional(TransactionVersionStruct)
17593
17628
  })));
17594
17629
  /**
17595
17630
  * Expected JSON RPC response for the "getRecentBlockhash" message
@@ -18832,9 +18867,16 @@ var solanaWeb3 = (function (exports) {
18832
18867
  }
18833
18868
  /**
18834
18869
  * Fetch a processed block from the cluster.
18870
+ *
18871
+ * @deprecated Instead, call `getBlock` using a `GetVersionedBlockConfig` by
18872
+ * setting the `maxSupportedTransactionVersion` property.
18835
18873
  */
18836
18874
 
18837
18875
 
18876
+ /**
18877
+ * Fetch a processed block from the cluster.
18878
+ */
18879
+ // eslint-disable-next-line no-dupe-class-members
18838
18880
  async getBlock(slot, rawConfig) {
18839
18881
  const {
18840
18882
  commitment,
@@ -18857,16 +18899,15 @@ var solanaWeb3 = (function (exports) {
18857
18899
  return { ...result,
18858
18900
  transactions: result.transactions.map(({
18859
18901
  transaction,
18860
- meta
18861
- }) => {
18862
- const message = new Message(transaction.message);
18863
- return {
18864
- meta,
18865
- transaction: { ...transaction,
18866
- message
18867
- }
18868
- };
18869
- })
18902
+ meta,
18903
+ version
18904
+ }) => ({
18905
+ meta,
18906
+ transaction: { ...transaction,
18907
+ message: versionedMessageFromResponse(version, transaction.message)
18908
+ },
18909
+ version
18910
+ }))
18870
18911
  };
18871
18912
  }
18872
18913
  /*
@@ -18926,9 +18967,17 @@ var solanaWeb3 = (function (exports) {
18926
18967
  }
18927
18968
  /**
18928
18969
  * Fetch a confirmed or finalized transaction from the cluster.
18970
+ *
18971
+ * @deprecated Instead, call `getTransaction` using a
18972
+ * `GetVersionedTransactionConfig` by setting the
18973
+ * `maxSupportedTransactionVersion` property.
18929
18974
  */
18930
18975
 
18931
18976
 
18977
+ /**
18978
+ * Fetch a confirmed or finalized transaction from the cluster.
18979
+ */
18980
+ // eslint-disable-next-line no-dupe-class-members
18932
18981
  async getTransaction(signature, rawConfig) {
18933
18982
  const {
18934
18983
  commitment,
@@ -18950,7 +18999,7 @@ var solanaWeb3 = (function (exports) {
18950
18999
  if (!result) return result;
18951
19000
  return { ...result,
18952
19001
  transaction: { ...result.transaction,
18953
- message: new Message(result.transaction.message)
19002
+ message: versionedMessageFromResponse(result.version, result.transaction.message)
18954
19003
  }
18955
19004
  };
18956
19005
  }
@@ -19009,9 +19058,19 @@ var solanaWeb3 = (function (exports) {
19009
19058
  /**
19010
19059
  * Fetch transaction details for a batch of confirmed transactions.
19011
19060
  * Similar to {@link getParsedTransactions} but returns a {@link TransactionResponse}.
19061
+ *
19062
+ * @deprecated Instead, call `getTransactions` using a
19063
+ * `GetVersionedTransactionConfig` by setting the
19064
+ * `maxSupportedTransactionVersion` property.
19012
19065
  */
19013
19066
 
19014
19067
 
19068
+ /**
19069
+ * Fetch transaction details for a batch of confirmed transactions.
19070
+ * Similar to {@link getParsedTransactions} but returns a {@link
19071
+ * VersionedTransactionResponse}.
19072
+ */
19073
+ // eslint-disable-next-line no-dupe-class-members
19015
19074
  async getTransactions(signatures, commitmentOrConfig) {
19016
19075
  const {
19017
19076
  commitment,
@@ -19039,7 +19098,7 @@ var solanaWeb3 = (function (exports) {
19039
19098
  if (!result) return result;
19040
19099
  return { ...result,
19041
19100
  transaction: { ...result.transaction,
19042
- message: new Message(result.transaction.message)
19101
+ message: versionedMessageFromResponse(result.version, result.transaction.message)
19043
19102
  }
19044
19103
  };
19045
19104
  });