@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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solana/web3.js",
3
- "version": "1.47.0",
3
+ "version": "1.47.3",
4
4
  "description": "Solana Javascript API",
5
5
  "keywords": [
6
6
  "api",
package/src/connection.ts CHANGED
@@ -3051,15 +3051,6 @@ export class Connection {
3051
3051
  }
3052
3052
  });
3053
3053
 
3054
- const checkBlockHeight = async () => {
3055
- try {
3056
- const blockHeight = await this.getBlockHeight(commitment);
3057
- return blockHeight;
3058
- } catch (_e) {
3059
- return -1;
3060
- }
3061
- };
3062
-
3063
3054
  const expiryPromise = new Promise<
3064
3055
  | {__type: TransactionStatus.BLOCKHEIGHT_EXCEEDED}
3065
3056
  | {__type: TransactionStatus.TIMED_OUT; timeoutMs: number}
@@ -3088,6 +3079,14 @@ export class Connection {
3088
3079
  } else {
3089
3080
  let config =
3090
3081
  strategy as BlockheightBasedTransactionConfirmationStrategy;
3082
+ const checkBlockHeight = async () => {
3083
+ try {
3084
+ const blockHeight = await this.getBlockHeight(commitment);
3085
+ return blockHeight;
3086
+ } catch (_e) {
3087
+ return -1;
3088
+ }
3089
+ };
3091
3090
  (async () => {
3092
3091
  let currentBlockHeight = await checkBlockHeight();
3093
3092
  if (done) return;
@@ -3431,10 +3430,9 @@ export class Connection {
3431
3430
  async getRecentPerformanceSamples(
3432
3431
  limit?: number,
3433
3432
  ): Promise<Array<PerfSample>> {
3434
- const args = this._buildArgs(limit ? [limit] : []);
3435
3433
  const unsafeRes = await this._rpcRequest(
3436
3434
  'getRecentPerformanceSamples',
3437
- args,
3435
+ limit ? [limit] : [],
3438
3436
  );
3439
3437
  const res = create(unsafeRes, GetRecentPerformanceSamplesRpcResult);
3440
3438
  if ('error' in res) {
@@ -4442,7 +4440,7 @@ export class Connection {
4442
4440
  const preflightCommitment =
4443
4441
  (options && options.preflightCommitment) || this.commitment;
4444
4442
 
4445
- if (options && options.maxRetries) {
4443
+ if (options && options.maxRetries != null) {
4446
4444
  config.maxRetries = options.maxRetries;
4447
4445
  }
4448
4446
  if (options && options.minContextSlot != null) {
@@ -258,17 +258,25 @@ export class Transaction {
258
258
  ) {
259
259
  if (!opts) {
260
260
  return;
261
- } else if (
262
- Object.prototype.hasOwnProperty.call(opts, 'lastValidBlockHeight')
263
- ) {
264
- const newOpts = opts as TransactionBlockhashCtor;
265
- Object.assign(this, newOpts);
266
- this.recentBlockhash = newOpts.blockhash;
267
- this.lastValidBlockHeight = newOpts.lastValidBlockHeight;
261
+ }
262
+ if (opts.feePayer) {
263
+ this.feePayer = opts.feePayer;
264
+ }
265
+ if (opts.signatures) {
266
+ this.signatures = opts.signatures;
267
+ }
268
+ if (Object.prototype.hasOwnProperty.call(opts, 'lastValidBlockHeight')) {
269
+ const {blockhash, lastValidBlockHeight} =
270
+ opts as TransactionBlockhashCtor;
271
+ this.recentBlockhash = blockhash;
272
+ this.lastValidBlockHeight = lastValidBlockHeight;
268
273
  } else {
269
- const oldOpts = opts as TransactionCtorFields_DEPRECATED;
270
- Object.assign(this, oldOpts);
271
- this.recentBlockhash = oldOpts.recentBlockhash;
274
+ const {recentBlockhash, nonceInfo} =
275
+ opts as TransactionCtorFields_DEPRECATED;
276
+ if (nonceInfo) {
277
+ this.nonceInfo = nonceInfo;
278
+ }
279
+ this.recentBlockhash = recentBlockhash;
272
280
  }
273
281
  }
274
282