@solana/web3.js 1.50.0 → 1.52.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solana/web3.js",
3
- "version": "1.50.0",
3
+ "version": "1.52.0",
4
4
  "description": "Solana Javascript API",
5
5
  "keywords": [
6
6
  "api",
@@ -73,7 +73,7 @@
73
73
  "rpc-websockets": "^7.5.0",
74
74
  "secp256k1": "^4.0.2",
75
75
  "superstruct": "^0.14.2",
76
- "tweetnacl": "^1.0.0"
76
+ "tweetnacl": "^1.0.3"
77
77
  },
78
78
  "devDependencies": {
79
79
  "@babel/core": "^7.12.13",
package/src/connection.ts CHANGED
@@ -804,6 +804,14 @@ export type TokenBalance = {
804
804
  */
805
805
  export type ParsedConfirmedTransactionMeta = ParsedTransactionMeta;
806
806
 
807
+ /**
808
+ * Collection of addresses loaded by a transaction using address table lookups
809
+ */
810
+ export type LoadedAddresses = {
811
+ writable: Array<PublicKey>;
812
+ readonly: Array<PublicKey>;
813
+ };
814
+
807
815
  /**
808
816
  * Metadata for a parsed transaction on the ledger
809
817
  */
@@ -824,6 +832,8 @@ export type ParsedTransactionMeta = {
824
832
  postTokenBalances?: Array<TokenBalance> | null;
825
833
  /** The error result of transaction processing */
826
834
  err: TransactionError | null;
835
+ /** The collection of addresses loaded using address lookup tables */
836
+ loadedAddresses?: LoadedAddresses;
827
837
  };
828
838
 
829
839
  export type CompiledInnerInstruction = {
@@ -874,6 +884,8 @@ export type TransactionResponse = {
874
884
 
875
885
  /**
876
886
  * A confirmed transaction on the ledger
887
+ *
888
+ * @deprecated Deprecated since Solana v1.8.0.
877
889
  */
878
890
  export type ConfirmedTransaction = {
879
891
  /** The slot during which the transaction was processed */
@@ -1003,7 +1015,9 @@ export type BlockResponse = {
1003
1015
  };
1004
1016
 
1005
1017
  /**
1006
- * A ConfirmedBlock on the ledger
1018
+ * A confirmed block on the ledger
1019
+ *
1020
+ * @deprecated Deprecated since Solana v1.8.0.
1007
1021
  */
1008
1022
  export type ConfirmedBlock = {
1009
1023
  /** Blockhash of this block */
@@ -1794,6 +1808,11 @@ const TokenBalanceResult = pick({
1794
1808
  uiTokenAmount: TokenAmountResult,
1795
1809
  });
1796
1810
 
1811
+ const LoadedAddressesResult = pick({
1812
+ writable: array(PublicKeyFromString),
1813
+ readonly: array(PublicKeyFromString),
1814
+ });
1815
+
1797
1816
  /**
1798
1817
  * @internal
1799
1818
  */
@@ -1821,6 +1840,7 @@ const ConfirmedTransactionMetaResult = pick({
1821
1840
  logMessages: optional(nullable(array(string()))),
1822
1841
  preTokenBalances: optional(nullable(array(TokenBalanceResult))),
1823
1842
  postTokenBalances: optional(nullable(array(TokenBalanceResult))),
1843
+ loadedAddresses: optional(LoadedAddressesResult),
1824
1844
  });
1825
1845
 
1826
1846
  /**
@@ -1844,6 +1864,7 @@ const ParsedConfirmedTransactionMetaResult = pick({
1844
1864
  logMessages: optional(nullable(array(string()))),
1845
1865
  preTokenBalances: optional(nullable(array(TokenBalanceResult))),
1846
1866
  postTokenBalances: optional(nullable(array(TokenBalanceResult))),
1867
+ loadedAddresses: optional(LoadedAddressesResult),
1847
1868
  });
1848
1869
 
1849
1870
  /**
@@ -2850,14 +2871,17 @@ export class Connection {
2850
2871
  */
2851
2872
  async getParsedAccountInfo(
2852
2873
  publicKey: PublicKey,
2853
- commitment?: Commitment,
2874
+ commitmentOrConfig?: Commitment | GetAccountInfoConfig,
2854
2875
  ): Promise<
2855
2876
  RpcResponseAndContext<AccountInfo<Buffer | ParsedAccountData> | null>
2856
2877
  > {
2878
+ const {commitment, config} =
2879
+ extractCommitmentFromConfig(commitmentOrConfig);
2857
2880
  const args = this._buildArgs(
2858
2881
  [publicKey.toBase58()],
2859
2882
  commitment,
2860
2883
  'jsonParsed',
2884
+ config,
2861
2885
  );
2862
2886
  const unsafeRes = await this._rpcRequest('getAccountInfo', args);
2863
2887
  const res = create(
@@ -4577,6 +4601,10 @@ export class Connection {
4577
4601
  _wsOnClose(code: number) {
4578
4602
  this._rpcWebSocketConnected = false;
4579
4603
  this._rpcWebSocketGeneration++;
4604
+ if (this._rpcWebSocketIdleTimeout) {
4605
+ clearTimeout(this._rpcWebSocketIdleTimeout);
4606
+ this._rpcWebSocketIdleTimeout = null;
4607
+ }
4580
4608
  if (this._rpcWebSocketHeartbeat) {
4581
4609
  clearInterval(this._rpcWebSocketHeartbeat);
4582
4610
  this._rpcWebSocketHeartbeat = null;
@@ -9,6 +9,8 @@ export const FeeCalculatorLayout = BufferLayout.nu64('lamportsPerSignature');
9
9
 
10
10
  /**
11
11
  * Calculator for transaction fees.
12
+ *
13
+ * @deprecated Deprecated since Solana v1.8.0.
12
14
  */
13
15
  export interface FeeCalculator {
14
16
  /** Cost in lamports to validate a signature. */