@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.
@@ -2447,15 +2447,34 @@ class Transaction {
2447
2447
 
2448
2448
  if (!opts) {
2449
2449
  return;
2450
- } else if (Object.prototype.hasOwnProperty.call(opts, 'lastValidBlockHeight')) {
2451
- const newOpts = opts;
2452
- Object.assign(this, newOpts);
2453
- this.recentBlockhash = newOpts.blockhash;
2454
- this.lastValidBlockHeight = newOpts.lastValidBlockHeight;
2450
+ }
2451
+
2452
+ if (opts.feePayer) {
2453
+ this.feePayer = opts.feePayer;
2454
+ }
2455
+
2456
+ if (opts.signatures) {
2457
+ this.signatures = opts.signatures;
2458
+ }
2459
+
2460
+ if (Object.prototype.hasOwnProperty.call(opts, 'lastValidBlockHeight')) {
2461
+ const {
2462
+ blockhash,
2463
+ lastValidBlockHeight
2464
+ } = opts;
2465
+ this.recentBlockhash = blockhash;
2466
+ this.lastValidBlockHeight = lastValidBlockHeight;
2455
2467
  } else {
2456
- const oldOpts = opts;
2457
- Object.assign(this, oldOpts);
2458
- this.recentBlockhash = oldOpts.recentBlockhash;
2468
+ const {
2469
+ recentBlockhash,
2470
+ nonceInfo
2471
+ } = opts;
2472
+
2473
+ if (nonceInfo) {
2474
+ this.nonceInfo = nonceInfo;
2475
+ }
2476
+
2477
+ this.recentBlockhash = recentBlockhash;
2459
2478
  }
2460
2479
  }
2461
2480
  /**
@@ -6132,16 +6151,6 @@ class Connection {
6132
6151
  reject(err);
6133
6152
  }
6134
6153
  });
6135
-
6136
- const checkBlockHeight = async () => {
6137
- try {
6138
- const blockHeight = await this.getBlockHeight(commitment);
6139
- return blockHeight;
6140
- } catch (_e) {
6141
- return -1;
6142
- }
6143
- };
6144
-
6145
6154
  const expiryPromise = new Promise(resolve => {
6146
6155
  if (typeof strategy === 'string') {
6147
6156
  let timeoutMs = this._confirmTransactionInitialTimeout || 60 * 1000;
@@ -6165,6 +6174,15 @@ class Connection {
6165
6174
  } else {
6166
6175
  let config = strategy;
6167
6176
 
6177
+ const checkBlockHeight = async () => {
6178
+ try {
6179
+ const blockHeight = await this.getBlockHeight(commitment);
6180
+ return blockHeight;
6181
+ } catch (_e) {
6182
+ return -1;
6183
+ }
6184
+ };
6185
+
6168
6186
  (async () => {
6169
6187
  let currentBlockHeight = await checkBlockHeight();
6170
6188
  if (done) return;
@@ -6528,9 +6546,7 @@ class Connection {
6528
6546
 
6529
6547
 
6530
6548
  async getRecentPerformanceSamples(limit) {
6531
- const args = this._buildArgs(limit ? [limit] : []);
6532
-
6533
- const unsafeRes = await this._rpcRequest('getRecentPerformanceSamples', args);
6549
+ const unsafeRes = await this._rpcRequest('getRecentPerformanceSamples', limit ? [limit] : []);
6534
6550
  const res = create(unsafeRes, GetRecentPerformanceSamplesRpcResult);
6535
6551
 
6536
6552
  if ('error' in res) {
@@ -7443,7 +7459,7 @@ class Connection {
7443
7459
  const skipPreflight = options && options.skipPreflight;
7444
7460
  const preflightCommitment = options && options.preflightCommitment || this.commitment;
7445
7461
 
7446
- if (options && options.maxRetries) {
7462
+ if (options && options.maxRetries != null) {
7447
7463
  config.maxRetries = options.maxRetries;
7448
7464
  }
7449
7465