@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.esm.js CHANGED
@@ -2471,15 +2471,34 @@ class Transaction {
2471
2471
 
2472
2472
  if (!opts) {
2473
2473
  return;
2474
- } else if (Object.prototype.hasOwnProperty.call(opts, 'lastValidBlockHeight')) {
2475
- const newOpts = opts;
2476
- Object.assign(this, newOpts);
2477
- this.recentBlockhash = newOpts.blockhash;
2478
- this.lastValidBlockHeight = newOpts.lastValidBlockHeight;
2474
+ }
2475
+
2476
+ if (opts.feePayer) {
2477
+ this.feePayer = opts.feePayer;
2478
+ }
2479
+
2480
+ if (opts.signatures) {
2481
+ this.signatures = opts.signatures;
2482
+ }
2483
+
2484
+ if (Object.prototype.hasOwnProperty.call(opts, 'lastValidBlockHeight')) {
2485
+ const {
2486
+ blockhash,
2487
+ lastValidBlockHeight
2488
+ } = opts;
2489
+ this.recentBlockhash = blockhash;
2490
+ this.lastValidBlockHeight = lastValidBlockHeight;
2479
2491
  } else {
2480
- const oldOpts = opts;
2481
- Object.assign(this, oldOpts);
2482
- this.recentBlockhash = oldOpts.recentBlockhash;
2492
+ const {
2493
+ recentBlockhash,
2494
+ nonceInfo
2495
+ } = opts;
2496
+
2497
+ if (nonceInfo) {
2498
+ this.nonceInfo = nonceInfo;
2499
+ }
2500
+
2501
+ this.recentBlockhash = recentBlockhash;
2483
2502
  }
2484
2503
  }
2485
2504
  /**
@@ -6214,16 +6233,6 @@ class Connection {
6214
6233
  reject(err);
6215
6234
  }
6216
6235
  });
6217
-
6218
- const checkBlockHeight = async () => {
6219
- try {
6220
- const blockHeight = await this.getBlockHeight(commitment);
6221
- return blockHeight;
6222
- } catch (_e) {
6223
- return -1;
6224
- }
6225
- };
6226
-
6227
6236
  const expiryPromise = new Promise(resolve => {
6228
6237
  if (typeof strategy === 'string') {
6229
6238
  let timeoutMs = this._confirmTransactionInitialTimeout || 60 * 1000;
@@ -6247,6 +6256,15 @@ class Connection {
6247
6256
  } else {
6248
6257
  let config = strategy;
6249
6258
 
6259
+ const checkBlockHeight = async () => {
6260
+ try {
6261
+ const blockHeight = await this.getBlockHeight(commitment);
6262
+ return blockHeight;
6263
+ } catch (_e) {
6264
+ return -1;
6265
+ }
6266
+ };
6267
+
6250
6268
  (async () => {
6251
6269
  let currentBlockHeight = await checkBlockHeight();
6252
6270
  if (done) return;
@@ -6610,9 +6628,7 @@ class Connection {
6610
6628
 
6611
6629
 
6612
6630
  async getRecentPerformanceSamples(limit) {
6613
- const args = this._buildArgs(limit ? [limit] : []);
6614
-
6615
- const unsafeRes = await this._rpcRequest('getRecentPerformanceSamples', args);
6631
+ const unsafeRes = await this._rpcRequest('getRecentPerformanceSamples', limit ? [limit] : []);
6616
6632
  const res = create(unsafeRes, GetRecentPerformanceSamplesRpcResult);
6617
6633
 
6618
6634
  if ('error' in res) {
@@ -7525,7 +7541,7 @@ class Connection {
7525
7541
  const skipPreflight = options && options.skipPreflight;
7526
7542
  const preflightCommitment = options && options.preflightCommitment || this.commitment;
7527
7543
 
7528
- if (options && options.maxRetries) {
7544
+ if (options && options.maxRetries != null) {
7529
7545
  config.maxRetries = options.maxRetries;
7530
7546
  }
7531
7547