@solana/web3.js 1.77.2 → 1.78.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.cjs.js CHANGED
@@ -62,6 +62,10 @@ var WebsocketFactory__default = /*#__PURE__*/_interopDefaultCompat(WebsocketFact
62
62
  * Read more: https://blog.mozilla.org/warner/2011/11/29/ed25519-keys/
63
63
  */
64
64
 
65
+ /**
66
+ * Ed25519 Keypair
67
+ */
68
+
65
69
  const generatePrivateKey = ed25519.ed25519.utils.randomPrivateKey;
66
70
  const generateKeypair = () => {
67
71
  const privateScalar = ed25519.ed25519.utils.randomPrivateKey();
@@ -144,6 +148,10 @@ const PUBLIC_KEY_LENGTH = 32;
144
148
  * Value to be converted into public key
145
149
  */
146
150
 
151
+ /**
152
+ * JSON object representation of PublicKey class
153
+ */
154
+
147
155
  function isPublicKeyData(value) {
148
156
  return value._bn !== undefined;
149
157
  }
@@ -156,14 +164,13 @@ let uniquePublicKeyCounter = 1;
156
164
  */
157
165
  _Symbol$toStringTag = Symbol.toStringTag;
158
166
  class PublicKey extends Struct {
159
- /** @internal */
160
-
161
167
  /**
162
168
  * Create a new PublicKey object
163
169
  * @param value ed25519 public key as buffer or base-58 encoded string
164
170
  */
165
171
  constructor(value) {
166
172
  super({});
173
+ /** @internal */
167
174
  this._bn = void 0;
168
175
  if (isPublicKeyData(value)) {
169
176
  this._bn = value._bn;
@@ -345,10 +352,6 @@ SOLANA_SCHEMA.set(PublicKey, {
345
352
  * @deprecated since v1.10.0, please use {@link Keypair} instead.
346
353
  */
347
354
  class Account {
348
- /** @internal */
349
-
350
- /** @internal */
351
-
352
355
  /**
353
356
  * Create a new Account object
354
357
  *
@@ -358,7 +361,9 @@ class Account {
358
361
  * @param secretKey Secret key for the account
359
362
  */
360
363
  constructor(secretKey) {
364
+ /** @internal */
361
365
  this._publicKey = void 0;
366
+ /** @internal */
362
367
  this._secretKey = void 0;
363
368
  if (secretKey) {
364
369
  const secretKeyBuffer = toBuffer(secretKey);
@@ -715,6 +720,10 @@ class CompiledKeys {
715
720
  * @property {string} data
716
721
  */
717
722
 
723
+ /**
724
+ * Message constructor arguments
725
+ */
726
+
718
727
  /**
719
728
  * List of instructions to be processed atomically
720
729
  */
@@ -1159,17 +1168,17 @@ const VersionedMessage = {
1159
1168
  * Transaction signature as base-58 encoded string
1160
1169
  */
1161
1170
 
1162
- exports.TransactionStatus = void 0;
1163
-
1164
- /**
1165
- * Default (empty) signature
1166
- */
1167
- (function (TransactionStatus) {
1171
+ let TransactionStatus = /*#__PURE__*/function (TransactionStatus) {
1168
1172
  TransactionStatus[TransactionStatus["BLOCKHEIGHT_EXCEEDED"] = 0] = "BLOCKHEIGHT_EXCEEDED";
1169
1173
  TransactionStatus[TransactionStatus["PROCESSED"] = 1] = "PROCESSED";
1170
1174
  TransactionStatus[TransactionStatus["TIMED_OUT"] = 2] = "TIMED_OUT";
1171
1175
  TransactionStatus[TransactionStatus["NONCE_INVALID"] = 3] = "NONCE_INVALID";
1172
- })(exports.TransactionStatus || (exports.TransactionStatus = {}));
1176
+ return TransactionStatus;
1177
+ }({});
1178
+
1179
+ /**
1180
+ * Default (empty) signature
1181
+ */
1173
1182
  const DEFAULT_SIGNATURE = buffer.Buffer.alloc(SIGNATURE_LENGTH_IN_BYTES).fill(0);
1174
1183
 
1175
1184
  /**
@@ -1177,25 +1186,34 @@ const DEFAULT_SIGNATURE = buffer.Buffer.alloc(SIGNATURE_LENGTH_IN_BYTES).fill(0)
1177
1186
  */
1178
1187
 
1179
1188
  /**
1180
- * Transaction Instruction class
1189
+ * List of TransactionInstruction object fields that may be initialized at construction
1181
1190
  */
1182
- class TransactionInstruction {
1183
- /**
1184
- * Public keys to include in this transaction
1185
- * Boolean represents whether this pubkey needs to sign the transaction
1186
- */
1187
1191
 
1188
- /**
1189
- * Program Id to execute
1190
- */
1192
+ /**
1193
+ * Configuration object for Transaction.serialize()
1194
+ */
1191
1195
 
1192
- /**
1193
- * Program input
1194
- */
1196
+ /**
1197
+ * @internal
1198
+ */
1195
1199
 
1200
+ /**
1201
+ * Transaction Instruction class
1202
+ */
1203
+ class TransactionInstruction {
1196
1204
  constructor(opts) {
1205
+ /**
1206
+ * Public keys to include in this transaction
1207
+ * Boolean represents whether this pubkey needs to sign the transaction
1208
+ */
1197
1209
  this.keys = void 0;
1210
+ /**
1211
+ * Program Id to execute
1212
+ */
1198
1213
  this.programId = void 0;
1214
+ /**
1215
+ * Program input
1216
+ */
1199
1217
  this.data = buffer.Buffer.alloc(0);
1200
1218
  this.programId = opts.programId;
1201
1219
  this.keys = opts.keys;
@@ -1228,15 +1246,31 @@ class TransactionInstruction {
1228
1246
  * Pair of signature and corresponding public key
1229
1247
  */
1230
1248
 
1249
+ /**
1250
+ * List of Transaction object fields that may be initialized at construction
1251
+ */
1252
+
1253
+ // For backward compatibility; an unfortunate consequence of being
1254
+ // forced to over-export types by the documentation generator.
1255
+ // See https://github.com/solana-labs/solana/pull/25820
1256
+ /**
1257
+ * Blockhash-based transactions have a lifetime that are defined by
1258
+ * the blockhash they include. Any transaction whose blockhash is
1259
+ * too old will be rejected.
1260
+ */
1261
+ /**
1262
+ * Use these options to construct a durable nonce transaction.
1263
+ */
1264
+ /**
1265
+ * Nonce information to be used to build an offline Transaction.
1266
+ */
1267
+ /**
1268
+ * @internal
1269
+ */
1231
1270
  /**
1232
1271
  * Transaction class
1233
1272
  */
1234
1273
  class Transaction {
1235
- /**
1236
- * Signatures for the transaction. Typically created by invoking the
1237
- * `sign()` method
1238
- */
1239
-
1240
1274
  /**
1241
1275
  * The first (payer) Transaction signature
1242
1276
  */
@@ -1251,18 +1285,57 @@ class Transaction {
1251
1285
  * The transaction fee payer
1252
1286
  */
1253
1287
 
1288
+ // Construct a transaction with a blockhash and lastValidBlockHeight
1289
+
1290
+ // Construct a transaction using a durable nonce
1291
+
1292
+ /**
1293
+ * @deprecated `TransactionCtorFields` has been deprecated and will be removed in a future version.
1294
+ * Please supply a `TransactionBlockhashCtor` instead.
1295
+ */
1296
+
1254
1297
  /**
1255
1298
  * Construct an empty Transaction
1256
1299
  */
1257
1300
  constructor(opts) {
1301
+ /**
1302
+ * Signatures for the transaction. Typically created by invoking the
1303
+ * `sign()` method
1304
+ */
1258
1305
  this.signatures = [];
1259
1306
  this.feePayer = void 0;
1307
+ /**
1308
+ * The instructions to atomically execute
1309
+ */
1260
1310
  this.instructions = [];
1311
+ /**
1312
+ * A recent transaction id. Must be populated by the caller
1313
+ */
1261
1314
  this.recentBlockhash = void 0;
1315
+ /**
1316
+ * the last block chain can advance to before tx is declared expired
1317
+ * */
1262
1318
  this.lastValidBlockHeight = void 0;
1319
+ /**
1320
+ * Optional Nonce information. If populated, transaction will use a durable
1321
+ * Nonce hash instead of a recentBlockhash. Must be populated by the caller
1322
+ */
1263
1323
  this.nonceInfo = void 0;
1324
+ /**
1325
+ * If this is a nonce transaction this represents the minimum slot from which
1326
+ * to evaluate if the nonce has advanced when attempting to confirm the
1327
+ * transaction. This protects against a case where the transaction confirmation
1328
+ * logic loads the nonce account from an old slot and assumes the mismatch in
1329
+ * nonce value implies that the nonce has been advanced.
1330
+ */
1264
1331
  this.minNonceContextSlot = void 0;
1332
+ /**
1333
+ * @internal
1334
+ */
1265
1335
  this._message = void 0;
1336
+ /**
1337
+ * @internal
1338
+ */
1266
1339
  this._json = void 0;
1267
1340
  if (!opts) {
1268
1341
  return;
@@ -2077,6 +2150,10 @@ function sleep(ms) {
2077
2150
  return new Promise(resolve => setTimeout(resolve, ms));
2078
2151
  }
2079
2152
 
2153
+ /**
2154
+ * @internal
2155
+ */
2156
+
2080
2157
  /**
2081
2158
  * Populate a buffer of instruction data using an InstructionType
2082
2159
  * @internal
@@ -2196,6 +2273,62 @@ const u64 = bigInt(8);
2196
2273
  * Create account system transaction params
2197
2274
  */
2198
2275
 
2276
+ /**
2277
+ * Transfer system transaction params
2278
+ */
2279
+
2280
+ /**
2281
+ * Assign system transaction params
2282
+ */
2283
+
2284
+ /**
2285
+ * Create account with seed system transaction params
2286
+ */
2287
+
2288
+ /**
2289
+ * Create nonce account system transaction params
2290
+ */
2291
+
2292
+ /**
2293
+ * Create nonce account with seed system transaction params
2294
+ */
2295
+
2296
+ /**
2297
+ * Initialize nonce account system instruction params
2298
+ */
2299
+
2300
+ /**
2301
+ * Advance nonce account system instruction params
2302
+ */
2303
+
2304
+ /**
2305
+ * Withdraw nonce account system transaction params
2306
+ */
2307
+
2308
+ /**
2309
+ * Authorize nonce account system transaction params
2310
+ */
2311
+
2312
+ /**
2313
+ * Allocate account system transaction params
2314
+ */
2315
+
2316
+ /**
2317
+ * Allocate account with seed system transaction params
2318
+ */
2319
+
2320
+ /**
2321
+ * Assign account with seed system transaction params
2322
+ */
2323
+
2324
+ /**
2325
+ * Transfer with seed system transaction params
2326
+ */
2327
+
2328
+ /** Decoded transfer system transaction instruction */
2329
+
2330
+ /** Decoded transferWithSeed system transaction instruction */
2331
+
2199
2332
  /**
2200
2333
  * System Instruction class
2201
2334
  */
@@ -3099,11 +3232,7 @@ function getDefaultExportFromCjs (x) {
3099
3232
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
3100
3233
  }
3101
3234
 
3102
- var agentkeepaliveExports = {};
3103
- var agentkeepalive = {
3104
- get exports(){ return agentkeepaliveExports; },
3105
- set exports(v){ agentkeepaliveExports = v; },
3106
- };
3235
+ var agentkeepalive = {exports: {}};
3107
3236
 
3108
3237
  /**
3109
3238
  * Helpers.
@@ -3291,17 +3420,9 @@ var humanizeMs = function (t) {
3291
3420
  return r;
3292
3421
  };
3293
3422
 
3294
- var srcExports = {};
3295
- var src = {
3296
- get exports(){ return srcExports; },
3297
- set exports(v){ srcExports = v; },
3298
- };
3423
+ var src = {exports: {}};
3299
3424
 
3300
- var browserExports = {};
3301
- var browser$1 = {
3302
- get exports(){ return browserExports; },
3303
- set exports(v){ browserExports = v; },
3304
- };
3425
+ var browser$1 = {exports: {}};
3305
3426
 
3306
3427
  /**
3307
3428
  * Helpers.
@@ -3761,7 +3882,7 @@ function requireCommon () {
3761
3882
  var hasRequiredBrowser$1;
3762
3883
 
3763
3884
  function requireBrowser$1 () {
3764
- if (hasRequiredBrowser$1) return browserExports;
3885
+ if (hasRequiredBrowser$1) return browser$1.exports;
3765
3886
  hasRequiredBrowser$1 = 1;
3766
3887
  (function (module, exports) {
3767
3888
  /**
@@ -4030,16 +4151,12 @@ function requireBrowser$1 () {
4030
4151
  } catch (error) {
4031
4152
  return '[UnexpectedJSONParseError]: ' + error.message;
4032
4153
  }
4033
- };
4034
- } (browser$1, browserExports));
4035
- return browserExports;
4154
+ };
4155
+ } (browser$1, browser$1.exports));
4156
+ return browser$1.exports;
4036
4157
  }
4037
4158
 
4038
- var nodeExports = {};
4039
- var node = {
4040
- get exports(){ return nodeExports; },
4041
- set exports(v){ nodeExports = v; },
4042
- };
4159
+ var node = {exports: {}};
4043
4160
 
4044
4161
  /* eslint-env browser */
4045
4162
 
@@ -4081,7 +4198,7 @@ function requireBrowser () {
4081
4198
  var hasRequiredNode;
4082
4199
 
4083
4200
  function requireNode () {
4084
- if (hasRequiredNode) return nodeExports;
4201
+ if (hasRequiredNode) return node.exports;
4085
4202
  hasRequiredNode = 1;
4086
4203
  (function (module, exports) {
4087
4204
  const tty = require$$0__default$1.default;
@@ -4342,9 +4459,9 @@ function requireNode () {
4342
4459
  formatters.O = function (v) {
4343
4460
  this.inspectOpts.colors = this.useColors;
4344
4461
  return util.inspect(v, this.inspectOpts);
4345
- };
4346
- } (node, nodeExports));
4347
- return nodeExports;
4462
+ };
4463
+ } (node, node.exports));
4464
+ return node.exports;
4348
4465
  }
4349
4466
 
4350
4467
  /**
@@ -4352,19 +4469,15 @@ function requireNode () {
4352
4469
  * treat as a browser.
4353
4470
  */
4354
4471
 
4355
- (function (module) {
4356
- if (typeof process === 'undefined' || process.type === 'renderer' || process.browser === true || process.__nwjs) {
4357
- module.exports = requireBrowser$1();
4358
- } else {
4359
- module.exports = requireNode();
4360
- }
4361
- } (src));
4472
+ if (typeof process === 'undefined' || process.type === 'renderer' || process.browser === true || process.__nwjs) {
4473
+ src.exports = requireBrowser$1();
4474
+ } else {
4475
+ src.exports = requireNode();
4476
+ }
4362
4477
 
4363
- var compatExports = {};
4364
- var compat = {
4365
- get exports(){ return compatExports; },
4366
- set exports(v){ compatExports = v; },
4367
- };
4478
+ var srcExports = src.exports;
4479
+
4480
+ var compat = {exports: {}};
4368
4481
 
4369
4482
  /*!
4370
4483
  * depd
@@ -4585,9 +4698,11 @@ function requireEventListenerCount () {
4585
4698
 
4586
4699
  function toString (obj) {
4587
4700
  return obj.toString()
4588
- }
4701
+ }
4589
4702
  } (compat));
4590
4703
 
4704
+ var compatExports = compat.exports;
4705
+
4591
4706
  /*!
4592
4707
  * depd
4593
4708
  * Copyright(c) 2014-2017 Douglas Christopher Wilson
@@ -5527,7 +5642,7 @@ const {
5527
5642
  CREATE_HTTPS_CONNECTION,
5528
5643
  } = constants;
5529
5644
 
5530
- class HttpsAgent extends HttpAgent {
5645
+ let HttpsAgent$1 = class HttpsAgent extends HttpAgent {
5531
5646
  constructor(options) {
5532
5647
  super(options);
5533
5648
 
@@ -5550,10 +5665,10 @@ class HttpsAgent extends HttpAgent {
5550
5665
  this[INIT_SOCKET](socket, options);
5551
5666
  return socket;
5552
5667
  }
5553
- }
5668
+ };
5554
5669
 
5555
5670
  // https://github.com/nodejs/node/blob/master/lib/https.js#L89
5556
- HttpsAgent.prototype[CREATE_HTTPS_CONNECTION] = OriginalHttpsAgent.prototype.createConnection;
5671
+ HttpsAgent$1.prototype[CREATE_HTTPS_CONNECTION] = OriginalHttpsAgent.prototype.createConnection;
5557
5672
 
5558
5673
  [
5559
5674
  'getName',
@@ -5564,19 +5679,17 @@ HttpsAgent.prototype[CREATE_HTTPS_CONNECTION] = OriginalHttpsAgent.prototype.cre
5564
5679
  ].forEach(function(method) {
5565
5680
  /* istanbul ignore next */
5566
5681
  if (typeof OriginalHttpsAgent.prototype[method] === 'function') {
5567
- HttpsAgent.prototype[method] = OriginalHttpsAgent.prototype[method];
5682
+ HttpsAgent$1.prototype[method] = OriginalHttpsAgent.prototype[method];
5568
5683
  }
5569
5684
  });
5570
5685
 
5571
- var https_agent = HttpsAgent;
5572
-
5573
- (function (module) {
5686
+ var https_agent = HttpsAgent$1;
5574
5687
 
5575
- module.exports = agent;
5576
- module.exports.HttpsAgent = https_agent;
5577
- module.exports.constants = constants;
5578
- } (agentkeepalive));
5688
+ agentkeepalive.exports = agent;
5689
+ var HttpsAgent = agentkeepalive.exports.HttpsAgent = https_agent;
5690
+ agentkeepalive.exports.constants = constants;
5579
5691
 
5692
+ var agentkeepaliveExports = agentkeepalive.exports;
5580
5693
  var HttpKeepAliveAgent = /*@__PURE__*/getDefaultExportFromCjs(agentkeepaliveExports);
5581
5694
 
5582
5695
  var objToString = Object.prototype.toString;
@@ -5653,7 +5766,7 @@ var fastStableStringify = function(val) {
5653
5766
  }
5654
5767
  };
5655
5768
 
5656
- var fastStableStringify$1 = fastStableStringify;
5769
+ var fastStableStringify$1 = /*@__PURE__*/getDefaultExportFromCjs(fastStableStringify);
5657
5770
 
5658
5771
  const MINIMUM_SLOT_PER_EPOCH = 32;
5659
5772
 
@@ -5686,21 +5799,16 @@ function nextPowerOfTwo(n) {
5686
5799
  * Can be retrieved with the {@link Connection.getEpochSchedule} method
5687
5800
  */
5688
5801
  class EpochSchedule {
5689
- /** The maximum number of slots in each epoch */
5690
-
5691
- /** The number of slots before beginning of an epoch to calculate a leader schedule for that epoch */
5692
-
5693
- /** Indicates whether epochs start short and grow */
5694
-
5695
- /** The first epoch with `slotsPerEpoch` slots */
5696
-
5697
- /** The first slot of `firstNormalEpoch` */
5698
-
5699
5802
  constructor(slotsPerEpoch, leaderScheduleSlotOffset, warmup, firstNormalEpoch, firstNormalSlot) {
5803
+ /** The maximum number of slots in each epoch */
5700
5804
  this.slotsPerEpoch = void 0;
5805
+ /** The number of slots before beginning of an epoch to calculate a leader schedule for that epoch */
5701
5806
  this.leaderScheduleSlotOffset = void 0;
5807
+ /** Indicates whether epochs start short and grow */
5702
5808
  this.warmup = void 0;
5809
+ /** The first epoch with `slotsPerEpoch` slots */
5703
5810
  this.firstNormalEpoch = void 0;
5811
+ /** The first slot of `firstNormalEpoch` */
5704
5812
  this.firstNormalSlot = void 0;
5705
5813
  this.slotsPerEpoch = slotsPerEpoch;
5706
5814
  this.leaderScheduleSlotOffset = leaderScheduleSlotOffset;
@@ -5926,6 +6034,92 @@ const BLOCKHASH_CACHE_TIMEOUT_MS = 30 * 1000;
5926
6034
  * https://gist.github.com/steveluscher/c057eca81d479ef705cdb53162f9971d
5927
6035
  */
5928
6036
 
6037
+ /** @internal */
6038
+ /** @internal */
6039
+ /** @internal */
6040
+ /** @internal */
6041
+
6042
+ /** @internal */
6043
+ /**
6044
+ * @internal
6045
+ * Every subscription contains the args used to open the subscription with
6046
+ * the server, and a list of callers interested in notifications.
6047
+ */
6048
+
6049
+ /**
6050
+ * @internal
6051
+ * A subscription may be in various states of connectedness. Only when it is
6052
+ * fully connected will it have a server subscription id associated with it.
6053
+ * This id can be returned to the server to unsubscribe the client entirely.
6054
+ */
6055
+
6056
+ /**
6057
+ * A type that encapsulates a subscription's RPC method
6058
+ * names and notification (callback) signature.
6059
+ */
6060
+
6061
+ /**
6062
+ * @internal
6063
+ * Utility type that keeps tagged unions intact while omitting properties.
6064
+ */
6065
+
6066
+ /**
6067
+ * @internal
6068
+ * This type represents a single subscribable 'topic.' It's made up of:
6069
+ *
6070
+ * - The args used to open the subscription with the server,
6071
+ * - The state of the subscription, in terms of its connectedness, and
6072
+ * - The set of callbacks to call when the server publishes notifications
6073
+ *
6074
+ * This record gets indexed by `SubscriptionConfigHash` and is used to
6075
+ * set up subscriptions, fan out notifications, and track subscription state.
6076
+ */
6077
+
6078
+ /**
6079
+ * @internal
6080
+ */
6081
+
6082
+ /**
6083
+ * Extra contextual information for RPC responses
6084
+ */
6085
+
6086
+ /**
6087
+ * Options for sending transactions
6088
+ */
6089
+
6090
+ /**
6091
+ * Options for confirming transactions
6092
+ */
6093
+
6094
+ /**
6095
+ * Options for getConfirmedSignaturesForAddress2
6096
+ */
6097
+
6098
+ /**
6099
+ * Options for getSignaturesForAddress
6100
+ */
6101
+
6102
+ /**
6103
+ * RPC Response with extra contextual information
6104
+ */
6105
+
6106
+ /**
6107
+ * A strategy for confirming transactions that uses the last valid
6108
+ * block height for a given blockhash to check for transaction expiration.
6109
+ */
6110
+
6111
+ /**
6112
+ * A strategy for confirming durable nonce transactions.
6113
+ */
6114
+
6115
+ /**
6116
+ * Properties shared by all transaction confirmation strategies
6117
+ */
6118
+
6119
+ /**
6120
+ * This type represents all transaction confirmation strategies
6121
+ */
6122
+
5929
6123
  /* @internal */
5930
6124
  function assertEndpointUrl(putativeUrl) {
5931
6125
  if (/^https?:/.test(putativeUrl) === false) {
@@ -6044,53 +6238,137 @@ function versionedMessageFromResponse(version, response) {
6044
6238
  * </pre>
6045
6239
  */
6046
6240
 
6047
- const GetInflationGovernorResult = superstruct.type({
6048
- foundation: superstruct.number(),
6049
- foundationTerm: superstruct.number(),
6050
- initial: superstruct.number(),
6051
- taper: superstruct.number(),
6052
- terminal: superstruct.number()
6053
- });
6054
-
6241
+ // Deprecated as of v1.5.5
6055
6242
  /**
6056
- * The inflation reward for an epoch
6243
+ * A subset of Commitment levels, which are at least optimistically confirmed
6244
+ * <pre>
6245
+ * 'confirmed': Query the most recent block which has reached 1 confirmation by the cluster
6246
+ * 'finalized': Query the most recent block which has been finalized by the cluster
6247
+ * </pre>
6057
6248
  */
6058
-
6059
6249
  /**
6060
- * Expected JSON RPC response for the "getInflationReward" message
6250
+ * Filter for largest accounts query
6251
+ * <pre>
6252
+ * 'circulating': Return the largest accounts that are part of the circulating supply
6253
+ * 'nonCirculating': Return the largest accounts that are not part of the circulating supply
6254
+ * </pre>
6061
6255
  */
6062
- const GetInflationRewardResult = jsonRpcResult(superstruct.array(superstruct.nullable(superstruct.type({
6063
- epoch: superstruct.number(),
6064
- effectiveSlot: superstruct.number(),
6065
- amount: superstruct.number(),
6066
- postBalance: superstruct.number(),
6067
- commission: superstruct.optional(superstruct.nullable(superstruct.number()))
6068
- }))));
6069
6256
  /**
6070
- * Expected JSON RPC response for the "getRecentPrioritizationFees" message
6257
+ * Configuration object for changing `getAccountInfo` query behavior
6071
6258
  */
6072
- const GetRecentPrioritizationFeesResult = superstruct.array(superstruct.type({
6073
- slot: superstruct.number(),
6074
- prioritizationFee: superstruct.number()
6075
- }));
6076
6259
  /**
6077
- * Expected JSON RPC response for the "getInflationRate" message
6260
+ * Configuration object for changing `getBalance` query behavior
6078
6261
  */
6079
- const GetInflationRateResult = superstruct.type({
6080
- total: superstruct.number(),
6081
- validator: superstruct.number(),
6082
- foundation: superstruct.number(),
6083
- epoch: superstruct.number()
6084
- });
6085
-
6086
6262
  /**
6087
- * Information about the current epoch
6263
+ * Configuration object for changing `getBlock` query behavior
6088
6264
  */
6089
-
6090
- const GetEpochInfoResult = superstruct.type({
6091
- epoch: superstruct.number(),
6092
- slotIndex: superstruct.number(),
6093
- slotsInEpoch: superstruct.number(),
6265
+ /**
6266
+ * Configuration object for changing `getBlock` query behavior
6267
+ */
6268
+ /**
6269
+ * Configuration object for changing `getStakeMinimumDelegation` query behavior
6270
+ */
6271
+ /**
6272
+ * Configuration object for changing `getBlockHeight` query behavior
6273
+ */
6274
+ /**
6275
+ * Configuration object for changing `getEpochInfo` query behavior
6276
+ */
6277
+ /**
6278
+ * Configuration object for changing `getInflationReward` query behavior
6279
+ */
6280
+ /**
6281
+ * Configuration object for changing `getLatestBlockhash` query behavior
6282
+ */
6283
+ /**
6284
+ * Configuration object for changing `isBlockhashValid` query behavior
6285
+ */
6286
+ /**
6287
+ * Configuration object for changing `getSlot` query behavior
6288
+ */
6289
+ /**
6290
+ * Configuration object for changing `getSlotLeader` query behavior
6291
+ */
6292
+ /**
6293
+ * Configuration object for changing `getTransaction` query behavior
6294
+ */
6295
+ /**
6296
+ * Configuration object for changing `getTransaction` query behavior
6297
+ */
6298
+ /**
6299
+ * Configuration object for changing `getLargestAccounts` query behavior
6300
+ */
6301
+ /**
6302
+ * Configuration object for changing `getSupply` request behavior
6303
+ */
6304
+ /**
6305
+ * Configuration object for changing query behavior
6306
+ */
6307
+ /**
6308
+ * Information describing a cluster node
6309
+ */
6310
+ /**
6311
+ * Information describing a vote account
6312
+ */
6313
+ /**
6314
+ * A collection of cluster vote accounts
6315
+ */
6316
+ /**
6317
+ * Network Inflation
6318
+ * (see https://docs.solana.com/implemented-proposals/ed_overview)
6319
+ */
6320
+ const GetInflationGovernorResult = superstruct.type({
6321
+ foundation: superstruct.number(),
6322
+ foundationTerm: superstruct.number(),
6323
+ initial: superstruct.number(),
6324
+ taper: superstruct.number(),
6325
+ terminal: superstruct.number()
6326
+ });
6327
+
6328
+ /**
6329
+ * The inflation reward for an epoch
6330
+ */
6331
+
6332
+ /**
6333
+ * Expected JSON RPC response for the "getInflationReward" message
6334
+ */
6335
+ const GetInflationRewardResult = jsonRpcResult(superstruct.array(superstruct.nullable(superstruct.type({
6336
+ epoch: superstruct.number(),
6337
+ effectiveSlot: superstruct.number(),
6338
+ amount: superstruct.number(),
6339
+ postBalance: superstruct.number(),
6340
+ commission: superstruct.optional(superstruct.nullable(superstruct.number()))
6341
+ }))));
6342
+
6343
+ /**
6344
+ * Configuration object for changing `getRecentPrioritizationFees` query behavior
6345
+ */
6346
+
6347
+ /**
6348
+ * Expected JSON RPC response for the "getRecentPrioritizationFees" message
6349
+ */
6350
+ const GetRecentPrioritizationFeesResult = superstruct.array(superstruct.type({
6351
+ slot: superstruct.number(),
6352
+ prioritizationFee: superstruct.number()
6353
+ }));
6354
+ /**
6355
+ * Expected JSON RPC response for the "getInflationRate" message
6356
+ */
6357
+ const GetInflationRateResult = superstruct.type({
6358
+ total: superstruct.number(),
6359
+ validator: superstruct.number(),
6360
+ foundation: superstruct.number(),
6361
+ epoch: superstruct.number()
6362
+ });
6363
+
6364
+ /**
6365
+ * Information about the current epoch
6366
+ */
6367
+
6368
+ const GetEpochInfoResult = superstruct.type({
6369
+ epoch: superstruct.number(),
6370
+ slotIndex: superstruct.number(),
6371
+ slotsInEpoch: superstruct.number(),
6094
6372
  absoluteSlot: superstruct.number(),
6095
6373
  blockHeight: superstruct.optional(superstruct.number()),
6096
6374
  transactionCount: superstruct.optional(superstruct.number())
@@ -6151,6 +6429,127 @@ const SimulatedTransactionResponseStruct = jsonRpcResultAndContext(superstruct.t
6151
6429
  data: superstruct.tuple([superstruct.string(), superstruct.literal('base64')])
6152
6430
  })))
6153
6431
  }));
6432
+
6433
+ /**
6434
+ * Metadata for a parsed confirmed transaction on the ledger
6435
+ *
6436
+ * @deprecated Deprecated since Solana v1.8.0. Please use {@link ParsedTransactionMeta} instead.
6437
+ */
6438
+
6439
+ /**
6440
+ * Collection of addresses loaded by a transaction using address table lookups
6441
+ */
6442
+
6443
+ /**
6444
+ * Metadata for a parsed transaction on the ledger
6445
+ */
6446
+
6447
+ /**
6448
+ * Metadata for a confirmed transaction on the ledger
6449
+ */
6450
+
6451
+ /**
6452
+ * A processed transaction from the RPC API
6453
+ */
6454
+
6455
+ /**
6456
+ * A processed transaction from the RPC API
6457
+ */
6458
+
6459
+ /**
6460
+ * A processed transaction message from the RPC API
6461
+ */
6462
+
6463
+ /**
6464
+ * A confirmed transaction on the ledger
6465
+ *
6466
+ * @deprecated Deprecated since Solana v1.8.0.
6467
+ */
6468
+
6469
+ /**
6470
+ * A partially decoded transaction instruction
6471
+ */
6472
+
6473
+ /**
6474
+ * A parsed transaction message account
6475
+ */
6476
+
6477
+ /**
6478
+ * A parsed transaction instruction
6479
+ */
6480
+
6481
+ /**
6482
+ * A parsed address table lookup
6483
+ */
6484
+
6485
+ /**
6486
+ * A parsed transaction message
6487
+ */
6488
+
6489
+ /**
6490
+ * A parsed transaction
6491
+ */
6492
+
6493
+ /**
6494
+ * A parsed and confirmed transaction on the ledger
6495
+ *
6496
+ * @deprecated Deprecated since Solana v1.8.0. Please use {@link ParsedTransactionWithMeta} instead.
6497
+ */
6498
+
6499
+ /**
6500
+ * A parsed transaction on the ledger with meta
6501
+ */
6502
+
6503
+ /**
6504
+ * A processed block fetched from the RPC API
6505
+ */
6506
+
6507
+ /**
6508
+ * A processed block fetched from the RPC API where the `transactionDetails` mode is `accounts`
6509
+ */
6510
+
6511
+ /**
6512
+ * A processed block fetched from the RPC API where the `transactionDetails` mode is `none`
6513
+ */
6514
+
6515
+ /**
6516
+ * A block with parsed transactions
6517
+ */
6518
+
6519
+ /**
6520
+ * A block with parsed transactions where the `transactionDetails` mode is `accounts`
6521
+ */
6522
+
6523
+ /**
6524
+ * A block with parsed transactions where the `transactionDetails` mode is `none`
6525
+ */
6526
+
6527
+ /**
6528
+ * A processed block fetched from the RPC API
6529
+ */
6530
+
6531
+ /**
6532
+ * A processed block fetched from the RPC API where the `transactionDetails` mode is `accounts`
6533
+ */
6534
+
6535
+ /**
6536
+ * A processed block fetched from the RPC API where the `transactionDetails` mode is `none`
6537
+ */
6538
+
6539
+ /**
6540
+ * A confirmed block on the ledger
6541
+ *
6542
+ * @deprecated Deprecated since Solana v1.8.0.
6543
+ */
6544
+
6545
+ /**
6546
+ * A Block on the ledger with signatures only
6547
+ */
6548
+
6549
+ /**
6550
+ * recent block production information
6551
+ */
6552
+
6154
6553
  /**
6155
6554
  * Expected JSON RPC response for the "getBlockProduction" message
6156
6555
  */
@@ -6180,7 +6579,7 @@ function createRpcClient(url, httpHeaders, customFetch, fetchMiddleware, disable
6180
6579
  maxSockets: 25
6181
6580
  };
6182
6581
  if (url.startsWith('https:')) {
6183
- agent = new agentkeepaliveExports.HttpsAgent(agentOptions);
6582
+ agent = new HttpsAgent(agentOptions);
6184
6583
  } else {
6185
6584
  agent = new HttpKeepAliveAgent(agentOptions);
6186
6585
  }
@@ -6931,6 +7330,11 @@ const GetLatestBlockhashRpcResult = jsonRpcResultAndContext(superstruct.type({
6931
7330
  blockhash: superstruct.string(),
6932
7331
  lastValidBlockHeight: superstruct.number()
6933
7332
  }));
7333
+
7334
+ /**
7335
+ * Expected JSON RPC response for the "isBlockhashValid" message
7336
+ */
7337
+ const IsBlockhashValidRpcResult = jsonRpcResultAndContext(superstruct.boolean());
6934
7338
  const PerfSampleResult = superstruct.type({
6935
7339
  slot: superstruct.number(),
6936
7340
  numTransactions: superstruct.number(),
@@ -6966,6 +7370,110 @@ const SendTransactionRpcResult = jsonRpcResult(superstruct.string());
6966
7370
  * Information about the latest slot being processed by a node
6967
7371
  */
6968
7372
 
7373
+ /**
7374
+ * Parsed account data
7375
+ */
7376
+
7377
+ /**
7378
+ * Stake Activation data
7379
+ */
7380
+
7381
+ /**
7382
+ * Data slice argument for getProgramAccounts
7383
+ */
7384
+
7385
+ /**
7386
+ * Memory comparison filter for getProgramAccounts
7387
+ */
7388
+
7389
+ /**
7390
+ * Data size comparison filter for getProgramAccounts
7391
+ */
7392
+
7393
+ /**
7394
+ * A filter object for getProgramAccounts
7395
+ */
7396
+
7397
+ /**
7398
+ * Configuration object for getProgramAccounts requests
7399
+ */
7400
+
7401
+ /**
7402
+ * Configuration object for getParsedProgramAccounts
7403
+ */
7404
+
7405
+ /**
7406
+ * Configuration object for getMultipleAccounts
7407
+ */
7408
+
7409
+ /**
7410
+ * Configuration object for `getStakeActivation`
7411
+ */
7412
+
7413
+ /**
7414
+ * Configuration object for `getStakeActivation`
7415
+ */
7416
+
7417
+ /**
7418
+ * Configuration object for `getStakeActivation`
7419
+ */
7420
+
7421
+ /**
7422
+ * Configuration object for `getNonce`
7423
+ */
7424
+
7425
+ /**
7426
+ * Configuration object for `getNonceAndContext`
7427
+ */
7428
+
7429
+ /**
7430
+ * Information describing an account
7431
+ */
7432
+
7433
+ /**
7434
+ * Account information identified by pubkey
7435
+ */
7436
+
7437
+ /**
7438
+ * Callback function for account change notifications
7439
+ */
7440
+
7441
+ /**
7442
+ * Callback function for program account change notifications
7443
+ */
7444
+
7445
+ /**
7446
+ * Callback function for slot change notifications
7447
+ */
7448
+
7449
+ /**
7450
+ * Callback function for slot update notifications
7451
+ */
7452
+
7453
+ /**
7454
+ * Callback function for signature status notifications
7455
+ */
7456
+
7457
+ /**
7458
+ * Signature status notification with transaction result
7459
+ */
7460
+
7461
+ /**
7462
+ * Signature received notification
7463
+ */
7464
+
7465
+ /**
7466
+ * Callback function for signature notifications
7467
+ */
7468
+
7469
+ /**
7470
+ * Signature subscription options
7471
+ */
7472
+
7473
+ /**
7474
+ * Callback function for root change notifications
7475
+ */
7476
+
6969
7477
  /**
6970
7478
  * @internal
6971
7479
  */
@@ -6991,66 +7499,60 @@ const LogsNotificationResult = superstruct.type({
6991
7499
  * Filter for log subscriptions.
6992
7500
  */
6993
7501
 
6994
- /** @internal */
6995
- const COMMON_HTTP_HEADERS = {
6996
- 'solana-client': `js/${"0.0.0-development" }`
6997
- };
7502
+ /**
7503
+ * Callback function for log notifications.
7504
+ */
6998
7505
 
6999
7506
  /**
7000
- * A connection to a fullnode JSON RPC endpoint
7507
+ * Signature result
7001
7508
  */
7002
- class Connection {
7003
- /** @internal */
7004
- /** @internal */
7005
- /** @internal */
7006
- /** @internal */
7007
- /** @internal */
7008
- /** @internal */
7009
- /** @internal */
7010
- /** @internal */
7011
- /** @internal */
7012
- /** @internal */
7013
7509
 
7014
- /** @internal */
7510
+ /**
7511
+ * Transaction error
7512
+ */
7015
7513
 
7016
- /** @internal
7017
- * A number that we increment every time an active connection closes.
7018
- * Used to determine whether the same socket connection that was open
7019
- * when an async operation started is the same one that's active when
7020
- * its continuation fires.
7021
- *
7022
- */
7514
+ /**
7515
+ * Transaction confirmation status
7516
+ * <pre>
7517
+ * 'processed': Transaction landed in a block which has reached 1 confirmation by the connected node
7518
+ * 'confirmed': Transaction landed in a block which has reached 1 confirmation by the cluster
7519
+ * 'finalized': Transaction landed in a block which has been finalized by the cluster
7520
+ * </pre>
7521
+ */
7023
7522
 
7024
- /** @internal */
7025
- /** @internal */
7026
- /** @internal */
7523
+ /**
7524
+ * Signature status
7525
+ */
7027
7526
 
7028
- /** @internal */
7029
- /** @internal */
7527
+ /**
7528
+ * A confirmed signature with its status
7529
+ */
7030
7530
 
7031
- /** @internal */
7531
+ /**
7532
+ * An object defining headers to be passed to the RPC server
7533
+ */
7032
7534
 
7033
- /** @internal */
7535
+ /**
7536
+ * The type of the JavaScript `fetch()` API
7537
+ */
7034
7538
 
7035
- /** @internal */
7539
+ /**
7540
+ * A callback used to augment the outgoing HTTP request
7541
+ */
7036
7542
 
7037
- /** @internal */
7543
+ /**
7544
+ * Configuration for instantiating a Connection
7545
+ */
7038
7546
 
7039
- /**
7040
- * Special case.
7041
- * After a signature is processed, RPCs automatically dispose of the
7042
- * subscription on the server side. We need to track which of these
7043
- * subscriptions have been disposed in such a way, so that we know
7044
- * whether the client is dealing with a not-yet-processed signature
7045
- * (in which case we must tear down the server subscription) or an
7046
- * already-processed signature (in which case the client can simply
7047
- * clear out the subscription locally without telling the server).
7048
- *
7049
- * NOTE: There is a proposal to eliminate this special case, here:
7050
- * https://github.com/solana-labs/solana/issues/18892
7051
- */
7052
- /** @internal */
7547
+ /** @internal */
7548
+ const COMMON_HTTP_HEADERS = {
7549
+ 'solana-client': `js/${"0.0.0-development" }`
7550
+ };
7053
7551
 
7552
+ /**
7553
+ * A connection to a fullnode JSON RPC endpoint
7554
+ */
7555
+ class Connection {
7054
7556
  /**
7055
7557
  * Establish a JSON RPC connection
7056
7558
  *
@@ -7058,33 +7560,77 @@ class Connection {
7058
7560
  * @param commitmentOrConfig optional default commitment level or optional ConnectionConfig configuration object
7059
7561
  */
7060
7562
  constructor(endpoint, _commitmentOrConfig) {
7563
+ /** @internal */
7061
7564
  this._commitment = void 0;
7565
+ /** @internal */
7062
7566
  this._confirmTransactionInitialTimeout = void 0;
7567
+ /** @internal */
7063
7568
  this._rpcEndpoint = void 0;
7569
+ /** @internal */
7064
7570
  this._rpcWsEndpoint = void 0;
7571
+ /** @internal */
7065
7572
  this._rpcClient = void 0;
7573
+ /** @internal */
7066
7574
  this._rpcRequest = void 0;
7575
+ /** @internal */
7067
7576
  this._rpcBatchRequest = void 0;
7577
+ /** @internal */
7068
7578
  this._rpcWebSocket = void 0;
7579
+ /** @internal */
7069
7580
  this._rpcWebSocketConnected = false;
7581
+ /** @internal */
7070
7582
  this._rpcWebSocketHeartbeat = null;
7583
+ /** @internal */
7071
7584
  this._rpcWebSocketIdleTimeout = null;
7585
+ /** @internal
7586
+ * A number that we increment every time an active connection closes.
7587
+ * Used to determine whether the same socket connection that was open
7588
+ * when an async operation started is the same one that's active when
7589
+ * its continuation fires.
7590
+ *
7591
+ */
7072
7592
  this._rpcWebSocketGeneration = 0;
7593
+ /** @internal */
7073
7594
  this._disableBlockhashCaching = false;
7595
+ /** @internal */
7074
7596
  this._pollingBlockhash = false;
7597
+ /** @internal */
7075
7598
  this._blockhashInfo = {
7076
7599
  latestBlockhash: null,
7077
7600
  lastFetch: 0,
7078
7601
  transactionSignatures: [],
7079
7602
  simulatedSignatures: []
7080
7603
  };
7604
+ /** @internal */
7081
7605
  this._nextClientSubscriptionId = 0;
7606
+ /** @internal */
7082
7607
  this._subscriptionDisposeFunctionsByClientSubscriptionId = {};
7608
+ /** @internal */
7083
7609
  this._subscriptionHashByClientSubscriptionId = {};
7610
+ /** @internal */
7084
7611
  this._subscriptionStateChangeCallbacksByHash = {};
7612
+ /** @internal */
7085
7613
  this._subscriptionCallbacksByServerSubscriptionId = {};
7614
+ /** @internal */
7086
7615
  this._subscriptionsByHash = {};
7616
+ /**
7617
+ * Special case.
7618
+ * After a signature is processed, RPCs automatically dispose of the
7619
+ * subscription on the server side. We need to track which of these
7620
+ * subscriptions have been disposed in such a way, so that we know
7621
+ * whether the client is dealing with a not-yet-processed signature
7622
+ * (in which case we must tear down the server subscription) or an
7623
+ * already-processed signature (in which case the client can simply
7624
+ * clear out the subscription locally without telling the server).
7625
+ *
7626
+ * NOTE: There is a proposal to eliminate this special case, here:
7627
+ * https://github.com/solana-labs/solana/issues/18892
7628
+ */
7629
+ /** @internal */
7087
7630
  this._subscriptionsAutoDisposedByRpc = new Set();
7631
+ /*
7632
+ * Returns the current block height of the node
7633
+ */
7088
7634
  this.getBlockHeight = (() => {
7089
7635
  const requestPromises = {};
7090
7636
  return async commitmentOrConfig => {
@@ -7480,6 +8026,8 @@ class Connection {
7480
8026
  * @return {Promise<Array<{pubkey: PublicKey, account: AccountInfo<Buffer>}>>}
7481
8027
  */
7482
8028
 
8029
+ // eslint-disable-next-line no-dupe-class-members
8030
+
7483
8031
  // eslint-disable-next-line no-dupe-class-members
7484
8032
  async getProgramAccounts(programId, configOrCommitment) {
7485
8033
  const {
@@ -7518,6 +8066,8 @@ class Connection {
7518
8066
  }
7519
8067
  return res.result;
7520
8068
  }
8069
+
8070
+ /** @deprecated Instead, call `confirmTransaction` and pass in {@link TransactionConfirmationStrategy} */ // eslint-disable-next-line no-dupe-class-members
7521
8071
  // eslint-disable-next-line no-dupe-class-members
7522
8072
  async confirmTransaction(strategy, commitment) {
7523
8073
  let rawSignature;
@@ -7584,7 +8134,7 @@ class Connection {
7584
8134
  value: result
7585
8135
  };
7586
8136
  resolve({
7587
- __type: exports.TransactionStatus.PROCESSED,
8137
+ __type: TransactionStatus.PROCESSED,
7588
8138
  response
7589
8139
  });
7590
8140
  }, commitment);
@@ -7642,7 +8192,7 @@ class Connection {
7642
8192
  }
7643
8193
  done = true;
7644
8194
  resolve({
7645
- __type: exports.TransactionStatus.PROCESSED,
8195
+ __type: TransactionStatus.PROCESSED,
7646
8196
  response: {
7647
8197
  context,
7648
8198
  value
@@ -7697,7 +8247,7 @@ class Connection {
7697
8247
  if (done) return;
7698
8248
  }
7699
8249
  resolve({
7700
- __type: exports.TransactionStatus.BLOCKHEIGHT_EXCEEDED
8250
+ __type: TransactionStatus.BLOCKHEIGHT_EXCEEDED
7701
8251
  });
7702
8252
  })();
7703
8253
  });
@@ -7712,7 +8262,7 @@ class Connection {
7712
8262
  let result;
7713
8263
  try {
7714
8264
  const outcome = await Promise.race([cancellationPromise, confirmationPromise, expiryPromise]);
7715
- if (outcome.__type === exports.TransactionStatus.PROCESSED) {
8265
+ if (outcome.__type === TransactionStatus.PROCESSED) {
7716
8266
  result = outcome.response;
7717
8267
  } else {
7718
8268
  throw new TransactionExpiredBlockheightExceededError(signature);
@@ -7761,7 +8311,7 @@ class Connection {
7761
8311
  ) {
7762
8312
  if (nonceValue !== currentNonceValue) {
7763
8313
  resolve({
7764
- __type: exports.TransactionStatus.NONCE_INVALID,
8314
+ __type: TransactionStatus.NONCE_INVALID,
7765
8315
  slotInWhichNonceDidAdvance: lastCheckedSlot
7766
8316
  });
7767
8317
  return;
@@ -7784,7 +8334,7 @@ class Connection {
7784
8334
  let result;
7785
8335
  try {
7786
8336
  const outcome = await Promise.race([cancellationPromise, confirmationPromise, expiryPromise]);
7787
- if (outcome.__type === exports.TransactionStatus.PROCESSED) {
8337
+ if (outcome.__type === TransactionStatus.PROCESSED) {
7788
8338
  result = outcome.response;
7789
8339
  } else {
7790
8340
  // Double check that the transaction is indeed unconfirmed.
@@ -7868,7 +8418,7 @@ class Connection {
7868
8418
  }
7869
8419
  }
7870
8420
  timeoutId = setTimeout(() => resolve({
7871
- __type: exports.TransactionStatus.TIMED_OUT,
8421
+ __type: TransactionStatus.TIMED_OUT,
7872
8422
  timeoutMs
7873
8423
  }), timeoutMs);
7874
8424
  });
@@ -7882,7 +8432,7 @@ class Connection {
7882
8432
  let result;
7883
8433
  try {
7884
8434
  const outcome = await Promise.race([confirmationPromise, expiryPromise]);
7885
- if (outcome.__type === exports.TransactionStatus.PROCESSED) {
8435
+ if (outcome.__type === TransactionStatus.PROCESSED) {
7886
8436
  result = outcome.response;
7887
8437
  } else {
7888
8438
  throw new TransactionExpiredTimeoutError(signature, outcome.timeoutMs / 1000);
@@ -8261,6 +8811,23 @@ class Connection {
8261
8811
  return res.result;
8262
8812
  }
8263
8813
 
8814
+ /**
8815
+ * Returns whether a blockhash is still valid or not
8816
+ */
8817
+ async isBlockhashValid(blockhash, rawConfig) {
8818
+ const {
8819
+ commitment,
8820
+ config
8821
+ } = extractCommitmentFromConfig(rawConfig);
8822
+ const args = this._buildArgs([blockhash], commitment, undefined /* encoding */, config);
8823
+ const unsafeRes = await this._rpcRequest('isBlockhashValid', args);
8824
+ const res = superstruct.create(unsafeRes, IsBlockhashValidRpcResult);
8825
+ if ('error' in res) {
8826
+ throw new SolanaJSONRPCError(res.error, 'failed to determine if the blockhash `' + blockhash + '`is valid');
8827
+ }
8828
+ return res.result;
8829
+ }
8830
+
8264
8831
  /**
8265
8832
  * Fetch the node version
8266
8833
  */
@@ -8292,10 +8859,24 @@ class Connection {
8292
8859
  * setting the `maxSupportedTransactionVersion` property.
8293
8860
  */
8294
8861
 
8862
+ /**
8863
+ * @deprecated Instead, call `getBlock` using a `GetVersionedBlockConfig` by
8864
+ * setting the `maxSupportedTransactionVersion` property.
8865
+ */ // eslint-disable-next-line no-dupe-class-members
8866
+ /**
8867
+ * @deprecated Instead, call `getBlock` using a `GetVersionedBlockConfig` by
8868
+ * setting the `maxSupportedTransactionVersion` property.
8869
+ */
8870
+ // eslint-disable-next-line no-dupe-class-members
8295
8871
  /**
8296
8872
  * Fetch a processed block from the cluster.
8297
8873
  */
8298
8874
  // eslint-disable-next-line no-dupe-class-members
8875
+ // eslint-disable-next-line no-dupe-class-members
8876
+ // eslint-disable-next-line no-dupe-class-members
8877
+ /**
8878
+ * Fetch a processed block from the cluster.
8879
+ */ // eslint-disable-next-line no-dupe-class-members
8299
8880
  async getBlock(slot, rawConfig) {
8300
8881
  const {
8301
8882
  commitment,
@@ -8356,6 +8937,10 @@ class Connection {
8356
8937
  * Fetch parsed transaction details for a confirmed or finalized block
8357
8938
  */
8358
8939
 
8940
+ // eslint-disable-next-line no-dupe-class-members
8941
+
8942
+ // eslint-disable-next-line no-dupe-class-members
8943
+
8359
8944
  // eslint-disable-next-line no-dupe-class-members
8360
8945
  async getParsedBlock(slot, rawConfig) {
8361
8946
  const {
@@ -8395,11 +8980,6 @@ class Connection {
8395
8980
  throw new SolanaJSONRPCError(e, 'failed to get block');
8396
8981
  }
8397
8982
  }
8398
-
8399
- /*
8400
- * Returns the current block height of the node
8401
- */
8402
-
8403
8983
  /*
8404
8984
  * Returns recent block production information from the current or previous epoch
8405
8985
  */
@@ -8435,8 +9015,10 @@ class Connection {
8435
9015
 
8436
9016
  /**
8437
9017
  * Fetch a confirmed or finalized transaction from the cluster.
8438
- */
8439
- // eslint-disable-next-line no-dupe-class-members
9018
+ */ // eslint-disable-next-line no-dupe-class-members
9019
+ /**
9020
+ * Fetch a confirmed or finalized transaction from the cluster.
9021
+ */ // eslint-disable-next-line no-dupe-class-members
8440
9022
  async getTransaction(signature, rawConfig) {
8441
9023
  const {
8442
9024
  commitment,
@@ -8515,8 +9097,12 @@ class Connection {
8515
9097
  * Fetch transaction details for a batch of confirmed transactions.
8516
9098
  * Similar to {@link getParsedTransactions} but returns a {@link
8517
9099
  * VersionedTransactionResponse}.
8518
- */
8519
- // eslint-disable-next-line no-dupe-class-members
9100
+ */ // eslint-disable-next-line no-dupe-class-members
9101
+ /**
9102
+ * Fetch transaction details for a batch of confirmed transactions.
9103
+ * Similar to {@link getParsedTransactions} but returns a {@link
9104
+ * VersionedTransactionResponse}.
9105
+ */ // eslint-disable-next-line no-dupe-class-members
8520
9106
  async getTransactions(signatures, commitmentOrConfig) {
8521
9107
  const {
8522
9108
  commitment,
@@ -8942,8 +9528,10 @@ class Connection {
8942
9528
 
8943
9529
  /**
8944
9530
  * Simulate a transaction
8945
- */
8946
- // eslint-disable-next-line no-dupe-class-members
9531
+ */ // eslint-disable-next-line no-dupe-class-members
9532
+ /**
9533
+ * Simulate a transaction
9534
+ */ // eslint-disable-next-line no-dupe-class-members
8947
9535
  async simulateTransaction(transactionOrMessage, configOrSigners, includeAccounts) {
8948
9536
  if ('message' in transactionOrMessage) {
8949
9537
  const versionedTx = transactionOrMessage;
@@ -9054,10 +9642,12 @@ class Connection {
9054
9642
  * VersionedTransaction}
9055
9643
  */
9056
9644
 
9645
+ /**
9646
+ * Send a signed transaction
9647
+ */ // eslint-disable-next-line no-dupe-class-members
9057
9648
  /**
9058
9649
  * Sign and send a transaction
9059
- */
9060
- // eslint-disable-next-line no-dupe-class-members
9650
+ */ // eslint-disable-next-line no-dupe-class-members
9061
9651
  async sendTransaction(transaction, signersOrOptions, options) {
9062
9652
  if ('version' in transaction) {
9063
9653
  if (signersOrOptions && Array.isArray(signersOrOptions)) {
@@ -9465,7 +10055,7 @@ class Connection {
9465
10055
  */
9466
10056
  args) {
9467
10057
  const clientSubscriptionId = this._nextClientSubscriptionId++;
9468
- const hash = fastStableStringify$1([subscriptionConfig.method, args]);
10058
+ const hash = fastStableStringify$1([subscriptionConfig.method, args], true /* isArrayProp */);
9469
10059
 
9470
10060
  const existingSubscription = this._subscriptionsByHash[hash];
9471
10061
  if (existingSubscription === undefined) {
@@ -9947,6 +10537,10 @@ class Keypair {
9947
10537
  }
9948
10538
  }
9949
10539
 
10540
+ /**
10541
+ * An enumeration of valid LookupTableInstructionType's
10542
+ */
10543
+
9950
10544
  /**
9951
10545
  * An enumeration of valid address lookup table InstructionType's
9952
10546
  * @internal
@@ -10288,6 +10882,22 @@ class ComputeBudgetInstruction {
10288
10882
  * An enumeration of valid ComputeBudgetInstructionType's
10289
10883
  */
10290
10884
 
10885
+ /**
10886
+ * Request units instruction params
10887
+ */
10888
+
10889
+ /**
10890
+ * Request heap frame instruction params
10891
+ */
10892
+
10893
+ /**
10894
+ * Set compute unit limit instruction params
10895
+ */
10896
+
10897
+ /**
10898
+ * Set compute unit price instruction params
10899
+ */
10900
+
10291
10901
  /**
10292
10902
  * An enumeration of valid ComputeBudget InstructionType's
10293
10903
  * @internal
@@ -10376,6 +10986,10 @@ const SIGNATURE_BYTES = 64;
10376
10986
  * Params for creating an ed25519 instruction using a public key
10377
10987
  */
10378
10988
 
10989
+ /**
10990
+ * Params for creating an ed25519 instruction using a private key
10991
+ */
10992
+
10379
10993
  const ED25519_INSTRUCTION_LAYOUT = BufferLayout__namespace.struct([BufferLayout__namespace.u8('numSignatures'), BufferLayout__namespace.u8('padding'), BufferLayout__namespace.u16('signatureOffset'), BufferLayout__namespace.u16('signatureInstructionIndex'), BufferLayout__namespace.u16('publicKeyOffset'), BufferLayout__namespace.u16('publicKeyInstructionIndex'), BufferLayout__namespace.u16('messageDataOffset'), BufferLayout__namespace.u16('messageDataSize'), BufferLayout__namespace.u16('messageInstructionIndex')]);
10380
10994
  class Ed25519Program {
10381
10995
  /**
@@ -10473,6 +11087,14 @@ const SIGNATURE_OFFSETS_SERIALIZED_SIZE = 11;
10473
11087
  * Params for creating an secp256k1 instruction using a public key
10474
11088
  */
10475
11089
 
11090
+ /**
11091
+ * Params for creating an secp256k1 instruction using an Ethereum address
11092
+ */
11093
+
11094
+ /**
11095
+ * Params for creating an secp256k1 instruction using a private key
11096
+ */
11097
+
10476
11098
  const SECP256K1_INSTRUCTION_LAYOUT = BufferLayout__namespace.struct([BufferLayout__namespace.u8('numSignatures'), BufferLayout__namespace.u16('signatureOffset'), BufferLayout__namespace.u8('signatureInstructionIndex'), BufferLayout__namespace.u16('ethAddressOffset'), BufferLayout__namespace.u8('ethAddressInstructionIndex'), BufferLayout__namespace.u16('messageDataOffset'), BufferLayout__namespace.u16('messageDataSize'), BufferLayout__namespace.u8('messageInstructionIndex'), BufferLayout__namespace.blob(20, 'ethAddress'), BufferLayout__namespace.blob(64, 'signature'), BufferLayout__namespace.u8('recoveryId')]);
10477
11099
  class Secp256k1Program {
10478
11100
  /**
@@ -10608,17 +11230,15 @@ const STAKE_CONFIG_ID = new PublicKey('StakeConfig111111111111111111111111111111
10608
11230
  * Stake account authority info
10609
11231
  */
10610
11232
  class Authorized {
10611
- /** stake authority */
10612
-
10613
- /** withdraw authority */
10614
-
10615
11233
  /**
10616
11234
  * Create a new Authorized object
10617
11235
  * @param staker the stake authority
10618
11236
  * @param withdrawer the withdraw authority
10619
11237
  */
10620
11238
  constructor(staker, withdrawer) {
11239
+ /** stake authority */
10621
11240
  this.staker = void 0;
11241
+ /** withdraw authority */
10622
11242
  this.withdrawer = void 0;
10623
11243
  this.staker = staker;
10624
11244
  this.withdrawer = withdrawer;
@@ -10628,18 +11248,15 @@ class Authorized {
10628
11248
  * Stake account lockup info
10629
11249
  */
10630
11250
  class Lockup {
10631
- /** Unix timestamp of lockup expiration */
10632
-
10633
- /** Epoch of lockup expiration */
10634
-
10635
- /** Lockup custodian authority */
10636
-
10637
11251
  /**
10638
11252
  * Create a new Lockup object
10639
11253
  */
10640
11254
  constructor(unixTimestamp, epoch, custodian) {
11255
+ /** Unix timestamp of lockup expiration */
10641
11256
  this.unixTimestamp = void 0;
11257
+ /** Epoch of lockup expiration */
10642
11258
  this.epoch = void 0;
11259
+ /** Lockup custodian authority */
10643
11260
  this.custodian = void 0;
10644
11261
  this.unixTimestamp = unixTimestamp;
10645
11262
  this.epoch = epoch;
@@ -10651,6 +11268,39 @@ class Lockup {
10651
11268
  */
10652
11269
  }
10653
11270
  Lockup.default = new Lockup(0, 0, PublicKey.default);
11271
+ /**
11272
+ * Create stake account transaction params
11273
+ */
11274
+ /**
11275
+ * Create stake account with seed transaction params
11276
+ */
11277
+ /**
11278
+ * Initialize stake instruction params
11279
+ */
11280
+ /**
11281
+ * Delegate stake instruction params
11282
+ */
11283
+ /**
11284
+ * Authorize stake instruction params
11285
+ */
11286
+ /**
11287
+ * Authorize stake instruction params using a derived key
11288
+ */
11289
+ /**
11290
+ * Split stake instruction params
11291
+ */
11292
+ /**
11293
+ * Split with seed transaction params
11294
+ */
11295
+ /**
11296
+ * Withdraw stake instruction params
11297
+ */
11298
+ /**
11299
+ * Deactivate stake instruction params
11300
+ */
11301
+ /**
11302
+ * Merge stake instruction params
11303
+ */
10654
11304
  /**
10655
11305
  * Stake Instruction class
10656
11306
  */
@@ -11339,6 +11989,13 @@ class StakeProgram {
11339
11989
  }
11340
11990
  }
11341
11991
  StakeProgram.programId = new PublicKey('Stake11111111111111111111111111111111111111');
11992
+ /**
11993
+ * Max space of a Stake account
11994
+ *
11995
+ * This is generated from the solana-stake-program StakeState struct as
11996
+ * `StakeState::size_of()`:
11997
+ * https://docs.rs/solana-stake-program/latest/solana_stake_program/stake_state/enum.StakeState.html
11998
+ */
11342
11999
  StakeProgram.space = 200;
11343
12000
 
11344
12001
  /**
@@ -11363,6 +12020,22 @@ class VoteInit {
11363
12020
  * Create vote account transaction params
11364
12021
  */
11365
12022
 
12023
+ /**
12024
+ * InitializeAccount instruction params
12025
+ */
12026
+
12027
+ /**
12028
+ * Authorize instruction params
12029
+ */
12030
+
12031
+ /**
12032
+ * AuthorizeWithSeed instruction params
12033
+ */
12034
+
12035
+ /**
12036
+ * Withdraw from vote account transaction params
12037
+ */
12038
+
11366
12039
  /**
11367
12040
  * Vote Instruction class
11368
12041
  */
@@ -11494,6 +12167,8 @@ class VoteInstruction {
11494
12167
  * An enumeration of valid VoteInstructionType's
11495
12168
  */
11496
12169
 
12170
+ /** @internal */
12171
+
11497
12172
  const VOTE_INSTRUCTION_LAYOUTS = Object.freeze({
11498
12173
  InitializeAccount: {
11499
12174
  index: 0,
@@ -11730,6 +12405,15 @@ class VoteProgram {
11730
12405
  }
11731
12406
  }
11732
12407
  VoteProgram.programId = new PublicKey('Vote111111111111111111111111111111111111111');
12408
+ /**
12409
+ * Max space of a Vote account
12410
+ *
12411
+ * This is generated from the solana-vote-program VoteState struct as
12412
+ * `VoteState::size_of()`:
12413
+ * https://docs.rs/solana-vote-program/1.9.5/solana_vote_program/vote_state/struct.VoteState.html#method.size_of
12414
+ *
12415
+ * KEEP IN SYNC WITH `VoteState::size_of()` in https://github.com/solana-labs/solana/blob/a474cb24b9238f5edcc982f65c0b37d4a1046f7e/sdk/program/src/vote/state/mod.rs#L340-L342
12416
+ */
11733
12417
  VoteProgram.space = 3731;
11734
12418
 
11735
12419
  const VALIDATOR_INFO_KEY = new PublicKey('Va1idator1nfo111111111111111111111111111111');
@@ -11738,6 +12422,10 @@ const VALIDATOR_INFO_KEY = new PublicKey('Va1idator1nfo1111111111111111111111111
11738
12422
  * @internal
11739
12423
  */
11740
12424
 
12425
+ /**
12426
+ * Info used to identity validators.
12427
+ */
12428
+
11741
12429
  const InfoString = superstruct.type({
11742
12430
  name: superstruct.string(),
11743
12431
  website: superstruct.optional(superstruct.string()),
@@ -11749,14 +12437,6 @@ const InfoString = superstruct.type({
11749
12437
  * ValidatorInfo class
11750
12438
  */
11751
12439
  class ValidatorInfo {
11752
- /**
11753
- * validator public key
11754
- */
11755
-
11756
- /**
11757
- * validator information
11758
- */
11759
-
11760
12440
  /**
11761
12441
  * Construct a valid ValidatorInfo
11762
12442
  *
@@ -11764,7 +12444,13 @@ class ValidatorInfo {
11764
12444
  * @param info validator information
11765
12445
  */
11766
12446
  constructor(key, info) {
12447
+ /**
12448
+ * validator public key
12449
+ */
11767
12450
  this.key = void 0;
12451
+ /**
12452
+ * validator information
12453
+ */
11768
12454
  this.info = void 0;
11769
12455
  this.key = key;
11770
12456
  this.info = info;
@@ -11805,6 +12491,11 @@ class ValidatorInfo {
11805
12491
  }
11806
12492
 
11807
12493
  const VOTE_PROGRAM_ID = new PublicKey('Vote111111111111111111111111111111111111111');
12494
+
12495
+ /**
12496
+ * History of how many credits earned by the end of each epoch
12497
+ */
12498
+
11808
12499
  /**
11809
12500
  * See https://github.com/solana-labs/solana/blob/8a12ed029cfa38d4a45400916c2463fb82bbec8c/programs/vote_api/src/vote_state.rs#L68-L88
11810
12501
  *
@@ -11944,9 +12635,7 @@ function clusterApiUrl(cluster, tls) {
11944
12635
  /**
11945
12636
  * @deprecated Calling `sendAndConfirmRawTransaction()` without a `confirmationStrategy`
11946
12637
  * is no longer supported and will be removed in a future version.
11947
- */
11948
- // eslint-disable-next-line no-redeclare
11949
-
12638
+ */ // eslint-disable-next-line no-redeclare
11950
12639
  // eslint-disable-next-line no-redeclare
11951
12640
  async function sendAndConfirmRawTransaction(connection, rawTransaction, confirmationStrategyOrConfirmOptions, maybeConfirmOptions) {
11952
12641
  let confirmationStrategy;
@@ -12041,6 +12730,7 @@ exports.TransactionExpiredNonceInvalidError = TransactionExpiredNonceInvalidErro
12041
12730
  exports.TransactionExpiredTimeoutError = TransactionExpiredTimeoutError;
12042
12731
  exports.TransactionInstruction = TransactionInstruction;
12043
12732
  exports.TransactionMessage = TransactionMessage;
12733
+ exports.TransactionStatus = TransactionStatus;
12044
12734
  exports.VALIDATOR_INFO_KEY = VALIDATOR_INFO_KEY;
12045
12735
  exports.VERSION_PREFIX_MASK = VERSION_PREFIX_MASK;
12046
12736
  exports.VOTE_PROGRAM_ID = VOTE_PROGRAM_ID;