@solana/web3.js 1.44.0 → 1.44.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.
@@ -2541,24 +2541,27 @@ class Transaction {
2541
2541
  return this._message;
2542
2542
  }
2543
2543
 
2544
- const {
2545
- nonceInfo
2546
- } = this;
2544
+ let recentBlockhash;
2545
+ let instructions;
2547
2546
 
2548
- if (nonceInfo && this.instructions[0] != nonceInfo.nonceInstruction) {
2549
- this.recentBlockhash = nonceInfo.nonce;
2550
- this.instructions.unshift(nonceInfo.nonceInstruction);
2551
- }
2547
+ if (this.nonceInfo) {
2548
+ recentBlockhash = this.nonceInfo.nonce;
2552
2549
 
2553
- const {
2554
- recentBlockhash
2555
- } = this;
2550
+ if (this.instructions[0] != this.nonceInfo.nonceInstruction) {
2551
+ instructions = [this.nonceInfo.nonceInstruction, ...this.instructions];
2552
+ } else {
2553
+ instructions = this.instructions;
2554
+ }
2555
+ } else {
2556
+ recentBlockhash = this.recentBlockhash;
2557
+ instructions = this.instructions;
2558
+ }
2556
2559
 
2557
2560
  if (!recentBlockhash) {
2558
2561
  throw new Error('Transaction recentBlockhash required');
2559
2562
  }
2560
2563
 
2561
- if (this.instructions.length < 1) {
2564
+ if (instructions.length < 1) {
2562
2565
  console.warn('No instructions provided');
2563
2566
  }
2564
2567
 
@@ -2573,15 +2576,15 @@ class Transaction {
2573
2576
  throw new Error('Transaction fee payer required');
2574
2577
  }
2575
2578
 
2576
- for (let i = 0; i < this.instructions.length; i++) {
2577
- if (this.instructions[i].programId === undefined) {
2579
+ for (let i = 0; i < instructions.length; i++) {
2580
+ if (instructions[i].programId === undefined) {
2578
2581
  throw new Error(`Transaction instruction index ${i} has undefined program id`);
2579
2582
  }
2580
2583
  }
2581
2584
 
2582
2585
  const programIds = [];
2583
2586
  const accountMetas = [];
2584
- this.instructions.forEach(instruction => {
2587
+ instructions.forEach(instruction => {
2585
2588
  instruction.keys.forEach(accountMeta => {
2586
2589
  accountMetas.push({ ...accountMeta
2587
2590
  });
@@ -2691,7 +2694,7 @@ class Transaction {
2691
2694
  }
2692
2695
  });
2693
2696
  const accountKeys = signedKeys.concat(unsignedKeys);
2694
- const instructions = this.instructions.map(instruction => {
2697
+ const compiledInstructions = instructions.map(instruction => {
2695
2698
  const {
2696
2699
  data,
2697
2700
  programId
@@ -2702,7 +2705,7 @@ class Transaction {
2702
2705
  data: bs58__default["default"].encode(data)
2703
2706
  };
2704
2707
  });
2705
- instructions.forEach(instruction => {
2708
+ compiledInstructions.forEach(instruction => {
2706
2709
  assert(instruction.programIdIndex >= 0);
2707
2710
  instruction.accounts.forEach(keyIndex => assert(keyIndex >= 0));
2708
2711
  });
@@ -2714,7 +2717,7 @@ class Transaction {
2714
2717
  },
2715
2718
  accountKeys,
2716
2719
  recentBlockhash,
2717
- instructions
2720
+ instructions: compiledInstructions
2718
2721
  });
2719
2722
  }
2720
2723
  /**
@@ -6757,7 +6760,13 @@ class Connection {
6757
6760
  throw new Error('failed to get transactions: ' + res.error.message);
6758
6761
  }
6759
6762
 
6760
- return res.result;
6763
+ const result = res.result;
6764
+ if (!result) return result;
6765
+ return { ...result,
6766
+ transaction: { ...result.transaction,
6767
+ message: new Message(result.transaction.message)
6768
+ }
6769
+ };
6761
6770
  });
6762
6771
  return res;
6763
6772
  }
@@ -9857,6 +9866,8 @@ exports.Struct = Struct;
9857
9866
  exports.SystemInstruction = SystemInstruction;
9858
9867
  exports.SystemProgram = SystemProgram;
9859
9868
  exports.Transaction = Transaction;
9869
+ exports.TransactionExpiredBlockheightExceededError = TransactionExpiredBlockheightExceededError;
9870
+ exports.TransactionExpiredTimeoutError = TransactionExpiredTimeoutError;
9860
9871
  exports.TransactionInstruction = TransactionInstruction;
9861
9872
  exports.VALIDATOR_INFO_KEY = VALIDATOR_INFO_KEY;
9862
9873
  exports.VOTE_PROGRAM_ID = VOTE_PROGRAM_ID;