@solana/web3.js 1.47.1 → 1.47.4

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
  /**
@@ -4456,6 +4475,8 @@ var fastStableStringify = function(val) {
4456
4475
 
4457
4476
  var fastStableStringify$1 = fastStableStringify;
4458
4477
 
4478
+ const URL = globalThis.URL;
4479
+
4459
4480
  const DESTROY_TIMEOUT_MS = 5000;
4460
4481
  class AgentManager {
4461
4482
  static _newAgent(useHttps) {
@@ -4905,7 +4926,11 @@ const SimulatedTransactionResponseStruct = jsonRpcResultAndContext(superstruct.t
4905
4926
  data: superstruct.array(superstruct.string()),
4906
4927
  rentEpoch: superstruct.optional(superstruct.number())
4907
4928
  }))))),
4908
- unitsConsumed: superstruct.optional(superstruct.number())
4929
+ unitsConsumed: superstruct.optional(superstruct.number()),
4930
+ returnData: superstruct.optional(superstruct.nullable(superstruct.type({
4931
+ programId: superstruct.string(),
4932
+ data: superstruct.tuple([superstruct.string(), superstruct.literal('base64')])
4933
+ })))
4909
4934
  }));
4910
4935
 
4911
4936
  /**
@@ -6248,16 +6273,6 @@ class Connection {
6248
6273
  reject(err);
6249
6274
  }
6250
6275
  });
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
6276
  const expiryPromise = new Promise(resolve => {
6262
6277
  if (typeof strategy === 'string') {
6263
6278
  let timeoutMs = this._confirmTransactionInitialTimeout || 60 * 1000;
@@ -6281,6 +6296,15 @@ class Connection {
6281
6296
  } else {
6282
6297
  let config = strategy;
6283
6298
 
6299
+ const checkBlockHeight = async () => {
6300
+ try {
6301
+ const blockHeight = await this.getBlockHeight(commitment);
6302
+ return blockHeight;
6303
+ } catch (_e) {
6304
+ return -1;
6305
+ }
6306
+ };
6307
+
6284
6308
  (async () => {
6285
6309
  let currentBlockHeight = await checkBlockHeight();
6286
6310
  if (done) return;
@@ -6644,9 +6668,7 @@ class Connection {
6644
6668
 
6645
6669
 
6646
6670
  async getRecentPerformanceSamples(limit) {
6647
- const args = this._buildArgs(limit ? [limit] : []);
6648
-
6649
- const unsafeRes = await this._rpcRequest('getRecentPerformanceSamples', args);
6671
+ const unsafeRes = await this._rpcRequest('getRecentPerformanceSamples', limit ? [limit] : []);
6650
6672
  const res = superstruct.create(unsafeRes, GetRecentPerformanceSamplesRpcResult);
6651
6673
 
6652
6674
  if ('error' in res) {