@solana/web3.js 1.54.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.d.ts CHANGED
@@ -141,7 +141,9 @@ declare module '@solana/web3.js' {
141
141
  */
142
142
  get publicKey(): PublicKey;
143
143
  /**
144
- * The **unencrypted** secret key for this account
144
+ * The **unencrypted** secret key for this account. The first 32 bytes
145
+ * is the private scalar and the last 32 bytes is the public key.
146
+ * Read more: https://blog.mozilla.org/warner/2011/11/29/ed25519-keys/
145
147
  */
146
148
  get secretKey(): Buffer;
147
149
  }
@@ -218,17 +220,24 @@ declare module '@solana/web3.js' {
218
220
  }
219
221
 
220
222
  /**
221
- * Keypair signer interface
223
+ * A 64 byte secret key, the first 32 bytes of which is the
224
+ * private scalar and the last 32 bytes is the public key.
225
+ * Read more: https://blog.mozilla.org/warner/2011/11/29/ed25519-keys/
222
226
  */
223
- interface Signer {
224
- publicKey: PublicKey;
225
- secretKey: Uint8Array;
226
- }
227
+ export type Ed25519SecretKey = Uint8Array;
227
228
  /**
228
229
  * Ed25519 Keypair
229
230
  */
230
231
  interface Ed25519Keypair {
231
232
  publicKey: Uint8Array;
233
+ secretKey: Ed25519SecretKey;
234
+ }
235
+
236
+ /**
237
+ * Keypair signer interface
238
+ */
239
+ interface Signer {
240
+ publicKey: PublicKey;
232
241
  secretKey: Uint8Array;
233
242
  }
234
243
  /**
@@ -386,6 +395,7 @@ declare module '@solana/web3.js' {
386
395
 
387
396
  export type VersionedMessage = Message | MessageV0;
388
397
  export const VersionedMessage: {
398
+ deserializeMessageVersion(serializedMessage: Uint8Array): 'legacy' | number;
389
399
  deserialize: (serializedMessage: Uint8Array) => VersionedMessage;
390
400
  };
391
401
 
@@ -825,6 +835,13 @@ declare module '@solana/web3.js' {
825
835
  export type GetBlockConfig = {
826
836
  /** The level of finality desired */
827
837
  commitment?: Finality;
838
+ };
839
+ /**
840
+ * Configuration object for changing `getBlock` query behavior
841
+ */
842
+ export type GetVersionedBlockConfig = {
843
+ /** The level of finality desired */
844
+ commitment?: Finality;
828
845
  /** The max transaction version to return in responses. If the requested transaction is a higher version, an error will be returned */
829
846
  maxSupportedTransactionVersion?: number;
830
847
  };
@@ -897,6 +914,13 @@ declare module '@solana/web3.js' {
897
914
  export type GetTransactionConfig = {
898
915
  /** The level of finality desired */
899
916
  commitment?: Finality;
917
+ };
918
+ /**
919
+ * Configuration object for changing `getTransaction` query behavior
920
+ */
921
+ export type GetVersionedTransactionConfig = {
922
+ /** The level of finality desired */
923
+ commitment?: Finality;
900
924
  /** The max transaction version to return in responses. If the requested transaction is a higher version, an error will be returned */
901
925
  maxSupportedTransactionVersion?: number;
902
926
  };
@@ -1112,6 +1136,8 @@ declare module '@solana/web3.js' {
1112
1136
  postTokenBalances?: Array<TokenBalance> | null;
1113
1137
  /** The error result of transaction processing */
1114
1138
  err: TransactionError | null;
1139
+ /** The collection of addresses loaded using address lookup tables */
1140
+ loadedAddresses?: LoadedAddresses;
1115
1141
  };
1116
1142
  /**
1117
1143
  * A processed transaction from the RPC API
@@ -1131,6 +1157,26 @@ declare module '@solana/web3.js' {
1131
1157
  /** The unix timestamp of when the transaction was processed */
1132
1158
  blockTime?: number | null;
1133
1159
  };
1160
+ /**
1161
+ * A processed transaction from the RPC API
1162
+ */
1163
+ export type VersionedTransactionResponse = {
1164
+ /** The slot during which the transaction was processed */
1165
+ slot: number;
1166
+ /** The transaction */
1167
+ transaction: {
1168
+ /** The transaction message */
1169
+ message: VersionedMessage;
1170
+ /** The transaction signatures */
1171
+ signatures: string[];
1172
+ };
1173
+ /** Metadata produced from the transaction */
1174
+ meta: ConfirmedTransactionMeta | null;
1175
+ /** The unix timestamp of when the transaction was processed */
1176
+ blockTime?: number | null;
1177
+ /** The transaction version */
1178
+ version?: TransactionVersion;
1179
+ };
1134
1180
  /**
1135
1181
  * A confirmed transaction on the ledger
1136
1182
  *
@@ -1179,6 +1225,17 @@ declare module '@solana/web3.js' {
1179
1225
  /** Parsed instruction info */
1180
1226
  parsed: any;
1181
1227
  };
1228
+ /**
1229
+ * A parsed address table lookup
1230
+ */
1231
+ export type ParsedAddressTableLookup = {
1232
+ /** Address lookup table account key */
1233
+ accountKey: PublicKey;
1234
+ /** Parsed instruction info */
1235
+ writableIndexes: number[];
1236
+ /** Parsed instruction info */
1237
+ readonlyIndexes: number[];
1238
+ };
1182
1239
  /**
1183
1240
  * A parsed transaction message
1184
1241
  */
@@ -1189,6 +1246,8 @@ declare module '@solana/web3.js' {
1189
1246
  instructions: (ParsedInstruction | PartiallyDecodedInstruction)[];
1190
1247
  /** Recent blockhash */
1191
1248
  recentBlockhash: string;
1249
+ /** Address table lookups used to load additional accounts */
1250
+ addressTableLookups?: ParsedAddressTableLookup[] | null;
1192
1251
  };
1193
1252
  /**
1194
1253
  * A parsed transaction
@@ -1217,6 +1276,8 @@ declare module '@solana/web3.js' {
1217
1276
  meta: ParsedTransactionMeta | null;
1218
1277
  /** The unix timestamp of when the transaction was processed */
1219
1278
  blockTime?: number | null;
1279
+ /** The version of the transaction message */
1280
+ version?: TransactionVersion;
1220
1281
  };
1221
1282
  /**
1222
1283
  * A processed block fetched from the RPC API
@@ -1239,6 +1300,46 @@ declare module '@solana/web3.js' {
1239
1300
  };
1240
1301
  /** Metadata produced from the transaction */
1241
1302
  meta: ConfirmedTransactionMeta | null;
1303
+ /** The transaction version */
1304
+ version?: TransactionVersion;
1305
+ }>;
1306
+ /** Vector of block rewards */
1307
+ rewards?: Array<{
1308
+ /** Public key of reward recipient */
1309
+ pubkey: string;
1310
+ /** Reward value in lamports */
1311
+ lamports: number;
1312
+ /** Account balance after reward is applied */
1313
+ postBalance: number | null;
1314
+ /** Type of reward received */
1315
+ rewardType: string | null;
1316
+ }>;
1317
+ /** The unix timestamp of when the block was processed */
1318
+ blockTime: number | null;
1319
+ };
1320
+ /**
1321
+ * A processed block fetched from the RPC API
1322
+ */
1323
+ export type VersionedBlockResponse = {
1324
+ /** Blockhash of this block */
1325
+ blockhash: Blockhash;
1326
+ /** Blockhash of this block's parent */
1327
+ previousBlockhash: Blockhash;
1328
+ /** Slot index of this block's parent */
1329
+ parentSlot: number;
1330
+ /** Vector of transactions with status meta and original message */
1331
+ transactions: Array<{
1332
+ /** The transaction */
1333
+ transaction: {
1334
+ /** The transaction message */
1335
+ message: VersionedMessage;
1336
+ /** The transaction signatures */
1337
+ signatures: string[];
1338
+ };
1339
+ /** Metadata produced from the transaction */
1340
+ meta: ConfirmedTransactionMeta | null;
1341
+ /** The transaction version */
1342
+ version?: TransactionVersion;
1242
1343
  }>;
1243
1344
  /** Vector of block rewards */
1244
1345
  rewards?: Array<{
@@ -2112,11 +2213,21 @@ declare module '@solana/web3.js' {
2112
2213
  getGenesisHash(): Promise<string>;
2113
2214
  /**
2114
2215
  * Fetch a processed block from the cluster.
2216
+ *
2217
+ * @deprecated Instead, call `getBlock` using a `GetVersionedBlockConfig` by
2218
+ * setting the `maxSupportedTransactionVersion` property.
2115
2219
  */
2116
2220
  getBlock(
2117
2221
  slot: number,
2118
2222
  rawConfig?: GetBlockConfig,
2119
2223
  ): Promise<BlockResponse | null>;
2224
+ /**
2225
+ * Fetch a processed block from the cluster.
2226
+ */
2227
+ getBlock(
2228
+ slot: number,
2229
+ rawConfig?: GetVersionedBlockConfig,
2230
+ ): Promise<VersionedBlockResponse | null>;
2120
2231
  getBlockHeight(
2121
2232
  commitmentOrConfig?: Commitment | GetBlockHeightConfig,
2122
2233
  ): Promise<number>;
@@ -2125,33 +2236,57 @@ declare module '@solana/web3.js' {
2125
2236
  ): Promise<RpcResponseAndContext<BlockProduction>>;
2126
2237
  /**
2127
2238
  * Fetch a confirmed or finalized transaction from the cluster.
2239
+ *
2240
+ * @deprecated Instead, call `getTransaction` using a
2241
+ * `GetVersionedTransactionConfig` by setting the
2242
+ * `maxSupportedTransactionVersion` property.
2128
2243
  */
2129
2244
  getTransaction(
2130
2245
  signature: string,
2131
2246
  rawConfig?: GetTransactionConfig,
2132
2247
  ): Promise<TransactionResponse | null>;
2248
+ /**
2249
+ * Fetch a confirmed or finalized transaction from the cluster.
2250
+ */
2251
+ getTransaction(
2252
+ signature: string,
2253
+ rawConfig: GetVersionedTransactionConfig,
2254
+ ): Promise<VersionedTransactionResponse | null>;
2133
2255
  /**
2134
2256
  * Fetch parsed transaction details for a confirmed or finalized transaction
2135
2257
  */
2136
2258
  getParsedTransaction(
2137
2259
  signature: TransactionSignature,
2138
- commitmentOrConfig?: GetTransactionConfig | Finality,
2139
- ): Promise<ParsedConfirmedTransaction | null>;
2260
+ commitmentOrConfig?: GetVersionedTransactionConfig | Finality,
2261
+ ): Promise<ParsedTransactionWithMeta | null>;
2140
2262
  /**
2141
2263
  * Fetch parsed transaction details for a batch of confirmed transactions
2142
2264
  */
2143
2265
  getParsedTransactions(
2144
2266
  signatures: TransactionSignature[],
2145
- commitmentOrConfig?: GetTransactionConfig | Finality,
2146
- ): Promise<(ParsedConfirmedTransaction | null)[]>;
2267
+ commitmentOrConfig?: GetVersionedTransactionConfig | Finality,
2268
+ ): Promise<(ParsedTransactionWithMeta | null)[]>;
2147
2269
  /**
2148
2270
  * Fetch transaction details for a batch of confirmed transactions.
2149
2271
  * Similar to {@link getParsedTransactions} but returns a {@link TransactionResponse}.
2272
+ *
2273
+ * @deprecated Instead, call `getTransactions` using a
2274
+ * `GetVersionedTransactionConfig` by setting the
2275
+ * `maxSupportedTransactionVersion` property.
2150
2276
  */
2151
2277
  getTransactions(
2152
2278
  signatures: TransactionSignature[],
2153
2279
  commitmentOrConfig?: GetTransactionConfig | Finality,
2154
2280
  ): Promise<(TransactionResponse | null)[]>;
2281
+ /**
2282
+ * Fetch transaction details for a batch of confirmed transactions.
2283
+ * Similar to {@link getParsedTransactions} but returns a {@link
2284
+ * VersionedTransactionResponse}.
2285
+ */
2286
+ getTransactions(
2287
+ signatures: TransactionSignature[],
2288
+ commitmentOrConfig: GetVersionedTransactionConfig | Finality,
2289
+ ): Promise<(VersionedTransactionResponse | null)[]>;
2155
2290
  /**
2156
2291
  * Fetch a list of Transactions and transaction statuses from the cluster
2157
2292
  * for a confirmed block.