@solana/web3.js 1.93.3 → 1.94.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.93.3",
3
+ "version": "1.94.0",
4
4
  "description": "Solana Javascript API",
5
5
  "keywords": [
6
6
  "api",
package/src/connection.ts CHANGED
@@ -952,6 +952,8 @@ export type SimulateTransactionConfig = {
952
952
  };
953
953
  /** Optional parameter used to specify the minimum block slot that can be used for simulation */
954
954
  minContextSlot?: number;
955
+ /** Optional parameter used to include inner instructions in the simulation */
956
+ innerInstructions?: boolean;
955
957
  };
956
958
 
957
959
  export type SimulatedTransactionResponse = {
@@ -960,7 +962,20 @@ export type SimulatedTransactionResponse = {
960
962
  accounts?: (SimulatedTransactionAccountInfo | null)[] | null;
961
963
  unitsConsumed?: number;
962
964
  returnData?: TransactionReturnData | null;
965
+ innerInstructions?: ParsedInnerInstruction[] | null;
963
966
  };
967
+ const ParsedInstructionStruct = pick({
968
+ program: string(),
969
+ programId: PublicKeyFromString,
970
+ parsed: unknown(),
971
+ });
972
+
973
+ const PartiallyDecodedInstructionStruct = pick({
974
+ programId: PublicKeyFromString,
975
+ accounts: array(PublicKeyFromString),
976
+ data: string(),
977
+ });
978
+
964
979
  const SimulatedTransactionResponseStruct = jsonRpcResultAndContext(
965
980
  pick({
966
981
  err: nullable(union([pick({}), string()])),
@@ -989,6 +1004,21 @@ const SimulatedTransactionResponseStruct = jsonRpcResultAndContext(
989
1004
  }),
990
1005
  ),
991
1006
  ),
1007
+ innerInstructions: optional(
1008
+ nullable(
1009
+ array(
1010
+ pick({
1011
+ index: number(),
1012
+ instructions: array(
1013
+ union([
1014
+ ParsedInstructionStruct,
1015
+ PartiallyDecodedInstructionStruct,
1016
+ ]),
1017
+ ),
1018
+ }),
1019
+ ),
1020
+ ),
1021
+ ),
992
1022
  }),
993
1023
  );
994
1024
 
@@ -1007,7 +1037,7 @@ export type TokenBalance = {
1007
1037
  /**
1008
1038
  * Metadata for a parsed confirmed transaction on the ledger
1009
1039
  *
1010
- * @deprecated Deprecated since Solana v1.8.0. Please use {@link ParsedTransactionMeta} instead.
1040
+ * @deprecated Deprecated since RPC v1.8.0. Please use {@link ParsedTransactionMeta} instead.
1011
1041
  */
1012
1042
  export type ParsedConfirmedTransactionMeta = ParsedTransactionMeta;
1013
1043
 
@@ -1130,7 +1160,7 @@ type MessageResponse = {
1130
1160
  /**
1131
1161
  * A confirmed transaction on the ledger
1132
1162
  *
1133
- * @deprecated Deprecated since Solana v1.8.0.
1163
+ * @deprecated Deprecated since RPC v1.8.0.
1134
1164
  */
1135
1165
  export type ConfirmedTransaction = {
1136
1166
  /** The slot during which the transaction was processed */
@@ -1220,7 +1250,7 @@ export type ParsedTransaction = {
1220
1250
  /**
1221
1251
  * A parsed and confirmed transaction on the ledger
1222
1252
  *
1223
- * @deprecated Deprecated since Solana v1.8.0. Please use {@link ParsedTransactionWithMeta} instead.
1253
+ * @deprecated Deprecated since RPC v1.8.0. Please use {@link ParsedTransactionWithMeta} instead.
1224
1254
  */
1225
1255
  export type ParsedConfirmedTransaction = ParsedTransactionWithMeta;
1226
1256
 
@@ -1427,7 +1457,7 @@ export type VersionedNoneModeBlockResponse = Omit<
1427
1457
  /**
1428
1458
  * A confirmed block on the ledger
1429
1459
  *
1430
- * @deprecated Deprecated since Solana v1.8.0.
1460
+ * @deprecated Deprecated since RPC v1.8.0.
1431
1461
  */
1432
1462
  export type ConfirmedBlock = {
1433
1463
  /** Blockhash of this block */
@@ -2483,7 +2513,7 @@ const GetParsedNoneModeBlockRpcResult = jsonRpcResult(
2483
2513
  /**
2484
2514
  * Expected JSON RPC response for the "getConfirmedBlock" message
2485
2515
  *
2486
- * @deprecated Deprecated since Solana v1.8.0. Please use {@link GetBlockRpcResult} instead.
2516
+ * @deprecated Deprecated since RPC v1.8.0. Please use {@link GetBlockRpcResult} instead.
2487
2517
  */
2488
2518
  const GetConfirmedBlockRpcResult = jsonRpcResult(
2489
2519
  nullable(
@@ -2551,7 +2581,7 @@ const GetParsedTransactionRpcResult = jsonRpcResult(
2551
2581
  /**
2552
2582
  * Expected JSON RPC response for the "getRecentBlockhash" message
2553
2583
  *
2554
- * @deprecated Deprecated since Solana v1.8.0. Please use {@link GetLatestBlockhashRpcResult} instead.
2584
+ * @deprecated Deprecated since RPC v1.8.0. Please use {@link GetLatestBlockhashRpcResult} instead.
2555
2585
  */
2556
2586
  const GetRecentBlockhashAndContextRpcResult = jsonRpcResultAndContext(
2557
2587
  pick({
@@ -3640,6 +3670,8 @@ export class Connection {
3640
3670
 
3641
3671
  /**
3642
3672
  * Returns epoch activation information for a stake account that has been delegated
3673
+ *
3674
+ * @deprecated Deprecated since RPC v1.18; will be removed in a future version.
3643
3675
  */
3644
3676
  async getStakeActivation(
3645
3677
  publicKey: PublicKey,
@@ -4345,7 +4377,7 @@ export class Connection {
4345
4377
  /**
4346
4378
  * Fetch the current total currency supply of the cluster in lamports
4347
4379
  *
4348
- * @deprecated Deprecated since v1.2.8. Please use {@link getSupply} instead.
4380
+ * @deprecated Deprecated since RPC v1.2.8. Please use {@link getSupply} instead.
4349
4381
  */
4350
4382
  async getTotalSupply(commitment?: Commitment): Promise<number> {
4351
4383
  const result = await this.getSupply({
@@ -4488,7 +4520,7 @@ export class Connection {
4488
4520
  * Fetch a recent blockhash from the cluster, return with context
4489
4521
  * @return {Promise<RpcResponseAndContext<{blockhash: Blockhash, feeCalculator: FeeCalculator}>>}
4490
4522
  *
4491
- * @deprecated Deprecated since Solana v1.8.0. Please use {@link getLatestBlockhash} instead.
4523
+ * @deprecated Deprecated since RPC v1.9.0. Please use {@link getLatestBlockhash} instead.
4492
4524
  */
4493
4525
  async getRecentBlockhashAndContext(commitment?: Commitment): Promise<
4494
4526
  RpcResponseAndContext<{
@@ -4530,7 +4562,7 @@ export class Connection {
4530
4562
  /**
4531
4563
  * Fetch the fee calculator for a recent blockhash from the cluster, return with context
4532
4564
  *
4533
- * @deprecated Deprecated since Solana v1.8.0. Please use {@link getFeeForMessage} instead.
4565
+ * @deprecated Deprecated since RPC v1.9.0. Please use {@link getFeeForMessage} instead.
4534
4566
  */
4535
4567
  async getFeeCalculatorForBlockhash(
4536
4568
  blockhash: Blockhash,
@@ -4599,7 +4631,7 @@ export class Connection {
4599
4631
  * Fetch a recent blockhash from the cluster
4600
4632
  * @return {Promise<{blockhash: Blockhash, feeCalculator: FeeCalculator}>}
4601
4633
  *
4602
- * @deprecated Deprecated since Solana v1.8.0. Please use {@link getLatestBlockhash} instead.
4634
+ * @deprecated Deprecated since RPC v1.8.0. Please use {@link getLatestBlockhash} instead.
4603
4635
  */
4604
4636
  async getRecentBlockhash(
4605
4637
  commitment?: Commitment,
@@ -5147,7 +5179,7 @@ export class Connection {
5147
5179
  * Fetch a list of Transactions and transaction statuses from the cluster
5148
5180
  * for a confirmed block.
5149
5181
  *
5150
- * @deprecated Deprecated since v1.13.0. Please use {@link getBlock} instead.
5182
+ * @deprecated Deprecated since RPC v1.7.0. Please use {@link getBlock} instead.
5151
5183
  */
5152
5184
  async getConfirmedBlock(
5153
5185
  slot: number,
@@ -5245,7 +5277,7 @@ export class Connection {
5245
5277
  /**
5246
5278
  * Fetch a list of Signatures from the cluster for a confirmed block, excluding rewards
5247
5279
  *
5248
- * @deprecated Deprecated since Solana v1.8.0. Please use {@link getBlockSignatures} instead.
5280
+ * @deprecated Deprecated since RPC v1.7.0. Please use {@link getBlockSignatures} instead.
5249
5281
  */
5250
5282
  async getConfirmedBlockSignatures(
5251
5283
  slot: number,
@@ -5275,7 +5307,7 @@ export class Connection {
5275
5307
  /**
5276
5308
  * Fetch a transaction details for a confirmed transaction
5277
5309
  *
5278
- * @deprecated Deprecated since Solana v1.8.0. Please use {@link getTransaction} instead.
5310
+ * @deprecated Deprecated since RPC v1.7.0. Please use {@link getTransaction} instead.
5279
5311
  */
5280
5312
  async getConfirmedTransaction(
5281
5313
  signature: TransactionSignature,
@@ -5302,7 +5334,7 @@ export class Connection {
5302
5334
  /**
5303
5335
  * Fetch parsed transaction details for a confirmed transaction
5304
5336
  *
5305
- * @deprecated Deprecated since Solana v1.8.0. Please use {@link getParsedTransaction} instead.
5337
+ * @deprecated Deprecated since RPC v1.7.0. Please use {@link getParsedTransaction} instead.
5306
5338
  */
5307
5339
  async getParsedConfirmedTransaction(
5308
5340
  signature: TransactionSignature,
@@ -5327,7 +5359,7 @@ export class Connection {
5327
5359
  /**
5328
5360
  * Fetch parsed transaction details for a batch of confirmed transactions
5329
5361
  *
5330
- * @deprecated Deprecated since Solana v1.8.0. Please use {@link getParsedTransactions} instead.
5362
+ * @deprecated Deprecated since RPC v1.7.0. Please use {@link getParsedTransactions} instead.
5331
5363
  */
5332
5364
  async getParsedConfirmedTransactions(
5333
5365
  signatures: TransactionSignature[],
@@ -5364,7 +5396,7 @@ export class Connection {
5364
5396
  * Fetch a list of all the confirmed signatures for transactions involving an address
5365
5397
  * within a specified slot range. Max range allowed is 10,000 slots.
5366
5398
  *
5367
- * @deprecated Deprecated since v1.3. Please use {@link getConfirmedSignaturesForAddress2} instead.
5399
+ * @deprecated Deprecated since RPC v1.3. Please use {@link getConfirmedSignaturesForAddress2} instead.
5368
5400
  *
5369
5401
  * @param address queried address
5370
5402
  * @param startSlot start slot, inclusive
@@ -5435,9 +5467,7 @@ export class Connection {
5435
5467
  * Returns confirmed signatures for transactions involving an
5436
5468
  * address backwards in time from the provided signature or most recent confirmed block
5437
5469
  *
5438
- *
5439
- * @param address queried address
5440
- * @param options
5470
+ * @deprecated Deprecated since RPC v1.7.0. Please use {@link getSignaturesForAddress} instead.
5441
5471
  */
5442
5472
  async getConfirmedSignaturesForAddress2(
5443
5473
  address: PublicKey,
@@ -5712,6 +5742,14 @@ export class Connection {
5712
5742
  config.commitment = this.commitment;
5713
5743
  }
5714
5744
 
5745
+ if (
5746
+ configOrSigners &&
5747
+ typeof configOrSigners === 'object' &&
5748
+ 'innerInstructions' in configOrSigners
5749
+ ) {
5750
+ config.innerInstructions = configOrSigners.innerInstructions;
5751
+ }
5752
+
5715
5753
  const args = [encodedTransaction, config];
5716
5754
  const unsafeRes = await this._rpcRequest('simulateTransaction', args);
5717
5755
  const res = create(unsafeRes, SimulatedTransactionResponseStruct);
@@ -5802,6 +5840,14 @@ export class Connection {
5802
5840
  config.sigVerify = true;
5803
5841
  }
5804
5842
 
5843
+ if (
5844
+ configOrSigners &&
5845
+ typeof configOrSigners === 'object' &&
5846
+ 'innerInstructions' in configOrSigners
5847
+ ) {
5848
+ config.innerInstructions = configOrSigners.innerInstructions;
5849
+ }
5850
+
5805
5851
  const args = [encodedTransaction, config];
5806
5852
  const unsafeRes = await this._rpcRequest('simulateTransaction', args);
5807
5853
  const res = create(unsafeRes, SimulatedTransactionResponseStruct);