@solana/web3.js 1.43.3 → 1.43.6

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
@@ -2644,10 +2644,18 @@ class Transaction {
2644
2644
  }); // Sort. Prioritizing first by signer, then by writable
2645
2645
 
2646
2646
  uniqueMetas.sort(function (x, y) {
2647
- const pubkeySorting = x.pubkey.toBase58().localeCompare(y.pubkey.toBase58());
2648
- const checkSigner = x.isSigner === y.isSigner ? 0 : x.isSigner ? -1 : 1;
2649
- const checkWritable = x.isWritable === y.isWritable ? pubkeySorting : x.isWritable ? -1 : 1;
2650
- return checkSigner || checkWritable;
2647
+ if (x.isSigner !== y.isSigner) {
2648
+ // Signers always come before non-signers
2649
+ return x.isSigner ? -1 : 1;
2650
+ }
2651
+
2652
+ if (x.isWritable !== y.isWritable) {
2653
+ // Writable accounts always come before read-only accounts
2654
+ return x.isWritable ? -1 : 1;
2655
+ } // Otherwise, sort by pubkey, stringwise.
2656
+
2657
+
2658
+ return x.pubkey.toBase58().localeCompare(y.pubkey.toBase58());
2651
2659
  }); // Move fee payer to the front
2652
2660
 
2653
2661
  const feePayerIndex = uniqueMetas.findIndex(x => {