@solana/web3.js 1.47.0 → 1.47.3

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
@@ -2505,15 +2505,34 @@ class Transaction {
2505
2505
 
2506
2506
  if (!opts) {
2507
2507
  return;
2508
- } else if (Object.prototype.hasOwnProperty.call(opts, 'lastValidBlockHeight')) {
2509
- const newOpts = opts;
2510
- Object.assign(this, newOpts);
2511
- this.recentBlockhash = newOpts.blockhash;
2512
- this.lastValidBlockHeight = newOpts.lastValidBlockHeight;
2508
+ }
2509
+
2510
+ if (opts.feePayer) {
2511
+ this.feePayer = opts.feePayer;
2512
+ }
2513
+
2514
+ if (opts.signatures) {
2515
+ this.signatures = opts.signatures;
2516
+ }
2517
+
2518
+ if (Object.prototype.hasOwnProperty.call(opts, 'lastValidBlockHeight')) {
2519
+ const {
2520
+ blockhash,
2521
+ lastValidBlockHeight
2522
+ } = opts;
2523
+ this.recentBlockhash = blockhash;
2524
+ this.lastValidBlockHeight = lastValidBlockHeight;
2513
2525
  } else {
2514
- const oldOpts = opts;
2515
- Object.assign(this, oldOpts);
2516
- this.recentBlockhash = oldOpts.recentBlockhash;
2526
+ const {
2527
+ recentBlockhash,
2528
+ nonceInfo
2529
+ } = opts;
2530
+
2531
+ if (nonceInfo) {
2532
+ this.nonceInfo = nonceInfo;
2533
+ }
2534
+
2535
+ this.recentBlockhash = recentBlockhash;
2517
2536
  }
2518
2537
  }
2519
2538
  /**
@@ -6248,16 +6267,6 @@ class Connection {
6248
6267
  reject(err);
6249
6268
  }
6250
6269
  });
6251
-
6252
- const checkBlockHeight = async () => {
6253
- try {
6254
- const blockHeight = await this.getBlockHeight(commitment);
6255
- return blockHeight;
6256
- } catch (_e) {
6257
- return -1;
6258
- }
6259
- };
6260
-
6261
6270
  const expiryPromise = new Promise(resolve => {
6262
6271
  if (typeof strategy === 'string') {
6263
6272
  let timeoutMs = this._confirmTransactionInitialTimeout || 60 * 1000;
@@ -6281,6 +6290,15 @@ class Connection {
6281
6290
  } else {
6282
6291
  let config = strategy;
6283
6292
 
6293
+ const checkBlockHeight = async () => {
6294
+ try {
6295
+ const blockHeight = await this.getBlockHeight(commitment);
6296
+ return blockHeight;
6297
+ } catch (_e) {
6298
+ return -1;
6299
+ }
6300
+ };
6301
+
6284
6302
  (async () => {
6285
6303
  let currentBlockHeight = await checkBlockHeight();
6286
6304
  if (done) return;
@@ -6644,9 +6662,7 @@ class Connection {
6644
6662
 
6645
6663
 
6646
6664
  async getRecentPerformanceSamples(limit) {
6647
- const args = this._buildArgs(limit ? [limit] : []);
6648
-
6649
- const unsafeRes = await this._rpcRequest('getRecentPerformanceSamples', args);
6665
+ const unsafeRes = await this._rpcRequest('getRecentPerformanceSamples', limit ? [limit] : []);
6650
6666
  const res = superstruct.create(unsafeRes, GetRecentPerformanceSamplesRpcResult);
6651
6667
 
6652
6668
  if ('error' in res) {
@@ -7559,7 +7575,7 @@ class Connection {
7559
7575
  const skipPreflight = options && options.skipPreflight;
7560
7576
  const preflightCommitment = options && options.preflightCommitment || this.commitment;
7561
7577
 
7562
- if (options && options.maxRetries) {
7578
+ if (options && options.maxRetries != null) {
7563
7579
  config.maxRetries = options.maxRetries;
7564
7580
  }
7565
7581