@solana/web3.js 1.63.1 → 1.65.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.63.1",
3
+ "version": "1.65.0",
4
4
  "description": "Solana Javascript API",
5
5
  "keywords": [
6
6
  "api",
package/src/connection.ts CHANGED
@@ -470,6 +470,8 @@ export type GetAccountInfoConfig = {
470
470
  commitment?: Commitment;
471
471
  /** The minimum slot that the request can be evaluated at */
472
472
  minContextSlot?: number;
473
+ /** Optional data slice to limit the returned account data */
474
+ dataSlice?: DataSlice;
473
475
  };
474
476
 
475
477
  /**
@@ -1143,6 +1145,42 @@ export type BlockResponse = {
1143
1145
  blockTime: number | null;
1144
1146
  };
1145
1147
 
1148
+ /**
1149
+ * A block with parsed transactions
1150
+ */
1151
+ export type ParsedBlockResponse = {
1152
+ /** Blockhash of this block */
1153
+ blockhash: Blockhash;
1154
+ /** Blockhash of this block's parent */
1155
+ previousBlockhash: Blockhash;
1156
+ /** Slot index of this block's parent */
1157
+ parentSlot: number;
1158
+ /** Vector of transactions with status meta and original message */
1159
+ transactions: Array<{
1160
+ /** The details of the transaction */
1161
+ transaction: ParsedTransaction;
1162
+ /** Metadata produced from the transaction */
1163
+ meta: ParsedTransactionMeta | null;
1164
+ /** The transaction version */
1165
+ version?: TransactionVersion;
1166
+ }>;
1167
+ /** Vector of block rewards */
1168
+ rewards?: Array<{
1169
+ /** Public key of reward recipient */
1170
+ pubkey: string;
1171
+ /** Reward value in lamports */
1172
+ lamports: number;
1173
+ /** Account balance after reward is applied */
1174
+ postBalance: number | null;
1175
+ /** Type of reward received */
1176
+ rewardType: string | null;
1177
+ }>;
1178
+ /** The unix timestamp of when the block was processed */
1179
+ blockTime: number | null;
1180
+ /** The number of blocks beneath this block */
1181
+ blockHeight: number | null;
1182
+ };
1183
+
1146
1184
  /**
1147
1185
  * A processed block fetched from the RPC API
1148
1186
  */
@@ -2081,6 +2119,38 @@ const GetBlockRpcResult = jsonRpcResult(
2081
2119
  ),
2082
2120
  );
2083
2121
 
2122
+ /**
2123
+ * Expected parsed JSON RPC response for the "getBlock" message
2124
+ */
2125
+ const GetParsedBlockRpcResult = jsonRpcResult(
2126
+ nullable(
2127
+ pick({
2128
+ blockhash: string(),
2129
+ previousBlockhash: string(),
2130
+ parentSlot: number(),
2131
+ transactions: array(
2132
+ pick({
2133
+ transaction: ParsedConfirmedTransactionResult,
2134
+ meta: nullable(ParsedConfirmedTransactionMetaResult),
2135
+ version: optional(TransactionVersionStruct),
2136
+ }),
2137
+ ),
2138
+ rewards: optional(
2139
+ array(
2140
+ pick({
2141
+ pubkey: string(),
2142
+ lamports: number(),
2143
+ postBalance: nullable(number()),
2144
+ rewardType: nullable(string()),
2145
+ }),
2146
+ ),
2147
+ ),
2148
+ blockTime: nullable(number()),
2149
+ blockHeight: nullable(number()),
2150
+ }),
2151
+ ),
2152
+ );
2153
+
2084
2154
  /**
2085
2155
  * Expected JSON RPC response for the "getConfirmedBlock" message
2086
2156
  *
@@ -2328,6 +2398,8 @@ export type GetMultipleAccountsConfig = {
2328
2398
  commitment?: Commitment;
2329
2399
  /** The minimum slot that the request can be evaluated at */
2330
2400
  minContextSlot?: number;
2401
+ /** Optional data slice to limit the returned account data */
2402
+ dataSlice?: DataSlice;
2331
2403
  };
2332
2404
 
2333
2405
  /**
@@ -3878,6 +3950,28 @@ export class Connection {
3878
3950
  };
3879
3951
  }
3880
3952
 
3953
+ /**
3954
+ * Fetch parsed transaction details for a confirmed or finalized block
3955
+ */
3956
+ async getParsedBlock(
3957
+ slot: number,
3958
+ rawConfig?: GetVersionedBlockConfig,
3959
+ ): Promise<ParsedBlockResponse | null> {
3960
+ const {commitment, config} = extractCommitmentFromConfig(rawConfig);
3961
+ const args = this._buildArgsAtLeastConfirmed(
3962
+ [slot],
3963
+ commitment as Finality,
3964
+ 'jsonParsed',
3965
+ config,
3966
+ );
3967
+ const unsafeRes = await this._rpcRequest('getBlock', args);
3968
+ const res = create(unsafeRes, GetParsedBlockRpcResult);
3969
+ if ('error' in res) {
3970
+ throw new SolanaJSONRPCError(res.error, 'failed to get block');
3971
+ }
3972
+ return res.result;
3973
+ }
3974
+
3881
3975
  /*
3882
3976
  * Returns the current block height of the node
3883
3977
  */
package/src/publickey.ts CHANGED
@@ -85,7 +85,8 @@ export class PublicKey extends Struct {
85
85
  }
86
86
 
87
87
  /**
88
- * Default public key value. (All zeros)
88
+ * Default public key value. The base58-encoded string representation is all ones (as seen below)
89
+ * The underlying BN number is 32 bytes that are all zeros
89
90
  */
90
91
  static default: PublicKey = new PublicKey('11111111111111111111111111111111');
91
92