@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.
@@ -2478,15 +2478,34 @@ class Transaction {
2478
2478
 
2479
2479
  if (!opts) {
2480
2480
  return;
2481
- } else if (Object.prototype.hasOwnProperty.call(opts, 'lastValidBlockHeight')) {
2482
- const newOpts = opts;
2483
- Object.assign(this, newOpts);
2484
- this.recentBlockhash = newOpts.blockhash;
2485
- this.lastValidBlockHeight = newOpts.lastValidBlockHeight;
2481
+ }
2482
+
2483
+ if (opts.feePayer) {
2484
+ this.feePayer = opts.feePayer;
2485
+ }
2486
+
2487
+ if (opts.signatures) {
2488
+ this.signatures = opts.signatures;
2489
+ }
2490
+
2491
+ if (Object.prototype.hasOwnProperty.call(opts, 'lastValidBlockHeight')) {
2492
+ const {
2493
+ blockhash,
2494
+ lastValidBlockHeight
2495
+ } = opts;
2496
+ this.recentBlockhash = blockhash;
2497
+ this.lastValidBlockHeight = lastValidBlockHeight;
2486
2498
  } else {
2487
- const oldOpts = opts;
2488
- Object.assign(this, oldOpts);
2489
- this.recentBlockhash = oldOpts.recentBlockhash;
2499
+ const {
2500
+ recentBlockhash,
2501
+ nonceInfo
2502
+ } = opts;
2503
+
2504
+ if (nonceInfo) {
2505
+ this.nonceInfo = nonceInfo;
2506
+ }
2507
+
2508
+ this.recentBlockhash = recentBlockhash;
2490
2509
  }
2491
2510
  }
2492
2511
  /**
@@ -6163,16 +6182,6 @@ class Connection {
6163
6182
  reject(err);
6164
6183
  }
6165
6184
  });
6166
-
6167
- const checkBlockHeight = async () => {
6168
- try {
6169
- const blockHeight = await this.getBlockHeight(commitment);
6170
- return blockHeight;
6171
- } catch (_e) {
6172
- return -1;
6173
- }
6174
- };
6175
-
6176
6185
  const expiryPromise = new Promise(resolve => {
6177
6186
  if (typeof strategy === 'string') {
6178
6187
  let timeoutMs = this._confirmTransactionInitialTimeout || 60 * 1000;
@@ -6196,6 +6205,15 @@ class Connection {
6196
6205
  } else {
6197
6206
  let config = strategy;
6198
6207
 
6208
+ const checkBlockHeight = async () => {
6209
+ try {
6210
+ const blockHeight = await this.getBlockHeight(commitment);
6211
+ return blockHeight;
6212
+ } catch (_e) {
6213
+ return -1;
6214
+ }
6215
+ };
6216
+
6199
6217
  (async () => {
6200
6218
  let currentBlockHeight = await checkBlockHeight();
6201
6219
  if (done) return;
@@ -6559,9 +6577,7 @@ class Connection {
6559
6577
 
6560
6578
 
6561
6579
  async getRecentPerformanceSamples(limit) {
6562
- const args = this._buildArgs(limit ? [limit] : []);
6563
-
6564
- const unsafeRes = await this._rpcRequest('getRecentPerformanceSamples', args);
6580
+ const unsafeRes = await this._rpcRequest('getRecentPerformanceSamples', limit ? [limit] : []);
6565
6581
  const res = superstruct.create(unsafeRes, GetRecentPerformanceSamplesRpcResult);
6566
6582
 
6567
6583
  if ('error' in res) {
@@ -7474,7 +7490,7 @@ class Connection {
7474
7490
  const skipPreflight = options && options.skipPreflight;
7475
7491
  const preflightCommitment = options && options.preflightCommitment || this.commitment;
7476
7492
 
7477
- if (options && options.maxRetries) {
7493
+ if (options && options.maxRetries != null) {
7478
7494
  config.maxRetries = options.maxRetries;
7479
7495
  }
7480
7496