@solana/web3.js 1.44.2 → 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.
package/lib/index.esm.js CHANGED
@@ -2534,24 +2534,27 @@ class Transaction {
2534
2534
  return this._message;
2535
2535
  }
2536
2536
 
2537
- const {
2538
- nonceInfo
2539
- } = this;
2537
+ let recentBlockhash;
2538
+ let instructions;
2540
2539
 
2541
- if (nonceInfo && this.instructions[0] != nonceInfo.nonceInstruction) {
2542
- this.recentBlockhash = nonceInfo.nonce;
2543
- this.instructions.unshift(nonceInfo.nonceInstruction);
2544
- }
2540
+ if (this.nonceInfo) {
2541
+ recentBlockhash = this.nonceInfo.nonce;
2545
2542
 
2546
- const {
2547
- recentBlockhash
2548
- } = this;
2543
+ if (this.instructions[0] != this.nonceInfo.nonceInstruction) {
2544
+ instructions = [this.nonceInfo.nonceInstruction, ...this.instructions];
2545
+ } else {
2546
+ instructions = this.instructions;
2547
+ }
2548
+ } else {
2549
+ recentBlockhash = this.recentBlockhash;
2550
+ instructions = this.instructions;
2551
+ }
2549
2552
 
2550
2553
  if (!recentBlockhash) {
2551
2554
  throw new Error('Transaction recentBlockhash required');
2552
2555
  }
2553
2556
 
2554
- if (this.instructions.length < 1) {
2557
+ if (instructions.length < 1) {
2555
2558
  console.warn('No instructions provided');
2556
2559
  }
2557
2560
 
@@ -2566,15 +2569,15 @@ class Transaction {
2566
2569
  throw new Error('Transaction fee payer required');
2567
2570
  }
2568
2571
 
2569
- for (let i = 0; i < this.instructions.length; i++) {
2570
- if (this.instructions[i].programId === undefined) {
2572
+ for (let i = 0; i < instructions.length; i++) {
2573
+ if (instructions[i].programId === undefined) {
2571
2574
  throw new Error(`Transaction instruction index ${i} has undefined program id`);
2572
2575
  }
2573
2576
  }
2574
2577
 
2575
2578
  const programIds = [];
2576
2579
  const accountMetas = [];
2577
- this.instructions.forEach(instruction => {
2580
+ instructions.forEach(instruction => {
2578
2581
  instruction.keys.forEach(accountMeta => {
2579
2582
  accountMetas.push({ ...accountMeta
2580
2583
  });
@@ -2684,7 +2687,7 @@ class Transaction {
2684
2687
  }
2685
2688
  });
2686
2689
  const accountKeys = signedKeys.concat(unsignedKeys);
2687
- const instructions = this.instructions.map(instruction => {
2690
+ const compiledInstructions = instructions.map(instruction => {
2688
2691
  const {
2689
2692
  data,
2690
2693
  programId
@@ -2695,7 +2698,7 @@ class Transaction {
2695
2698
  data: bs58.encode(data)
2696
2699
  };
2697
2700
  });
2698
- instructions.forEach(instruction => {
2701
+ compiledInstructions.forEach(instruction => {
2699
2702
  assert(instruction.programIdIndex >= 0);
2700
2703
  instruction.accounts.forEach(keyIndex => assert(keyIndex >= 0));
2701
2704
  });
@@ -2707,7 +2710,7 @@ class Transaction {
2707
2710
  },
2708
2711
  accountKeys,
2709
2712
  recentBlockhash,
2710
- instructions
2713
+ instructions: compiledInstructions
2711
2714
  });
2712
2715
  }
2713
2716
  /**