@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.d.ts CHANGED
@@ -885,11 +885,17 @@ declare module '@solana/web3.js' {
885
885
  /** Optional rent epoch info for account */
886
886
  rentEpoch?: number;
887
887
  };
888
+ export type TransactionReturnDataEncoding = 'base64';
889
+ export type TransactionReturnData = {
890
+ programId: string;
891
+ data: [string, TransactionReturnDataEncoding];
892
+ };
888
893
  export type SimulatedTransactionResponse = {
889
894
  err: TransactionError | string | null;
890
895
  logs: Array<string> | null;
891
896
  accounts?: (SimulatedTransactionAccountInfo | null)[] | null;
892
897
  unitsConsumed?: number;
898
+ returnData?: TransactionReturnData | null;
893
899
  };
894
900
  export type ParsedInnerInstruction = {
895
901
  index: number;
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
  /**
@@ -4422,6 +4441,8 @@ var fastStableStringify = function(val) {
4422
4441
 
4423
4442
  var fastStableStringify$1 = fastStableStringify;
4424
4443
 
4444
+ const URL = globalThis.URL;
4445
+
4425
4446
  const DESTROY_TIMEOUT_MS = 5000;
4426
4447
  class AgentManager {
4427
4448
  static _newAgent(useHttps) {
@@ -4871,7 +4892,11 @@ const SimulatedTransactionResponseStruct = jsonRpcResultAndContext(type({
4871
4892
  data: array(string()),
4872
4893
  rentEpoch: optional(number())
4873
4894
  }))))),
4874
- unitsConsumed: optional(number())
4895
+ unitsConsumed: optional(number()),
4896
+ returnData: optional(nullable(type({
4897
+ programId: string(),
4898
+ data: tuple([string(), literal('base64')])
4899
+ })))
4875
4900
  }));
4876
4901
 
4877
4902
  /**
@@ -6214,16 +6239,6 @@ class Connection {
6214
6239
  reject(err);
6215
6240
  }
6216
6241
  });
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
6242
  const expiryPromise = new Promise(resolve => {
6228
6243
  if (typeof strategy === 'string') {
6229
6244
  let timeoutMs = this._confirmTransactionInitialTimeout || 60 * 1000;
@@ -6247,6 +6262,15 @@ class Connection {
6247
6262
  } else {
6248
6263
  let config = strategy;
6249
6264
 
6265
+ const checkBlockHeight = async () => {
6266
+ try {
6267
+ const blockHeight = await this.getBlockHeight(commitment);
6268
+ return blockHeight;
6269
+ } catch (_e) {
6270
+ return -1;
6271
+ }
6272
+ };
6273
+
6250
6274
  (async () => {
6251
6275
  let currentBlockHeight = await checkBlockHeight();
6252
6276
  if (done) return;
@@ -6610,9 +6634,7 @@ class Connection {
6610
6634
 
6611
6635
 
6612
6636
  async getRecentPerformanceSamples(limit) {
6613
- const args = this._buildArgs(limit ? [limit] : []);
6614
-
6615
- const unsafeRes = await this._rpcRequest('getRecentPerformanceSamples', args);
6637
+ const unsafeRes = await this._rpcRequest('getRecentPerformanceSamples', limit ? [limit] : []);
6616
6638
  const res = create(unsafeRes, GetRecentPerformanceSamplesRpcResult);
6617
6639
 
6618
6640
  if ('error' in res) {