@solana/web3.js 1.61.1 → 1.62.1

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
@@ -841,7 +841,17 @@ class Message {
841
841
  }
842
842
 
843
843
  isAccountWritable(index) {
844
- return index < this.header.numRequiredSignatures - this.header.numReadonlySignedAccounts || index >= this.header.numRequiredSignatures && index < this.accountKeys.length - this.header.numReadonlyUnsignedAccounts;
844
+ const numSignedAccounts = this.header.numRequiredSignatures;
845
+
846
+ if (index >= this.header.numRequiredSignatures) {
847
+ const unsignedAccountIndex = index - numSignedAccounts;
848
+ const numUnsignedAccounts = this.accountKeys.length - numSignedAccounts;
849
+ const numWritableUnsignedAccounts = numUnsignedAccounts - this.header.numReadonlyUnsignedAccounts;
850
+ return unsignedAccountIndex < numWritableUnsignedAccounts;
851
+ } else {
852
+ const numWritableSignedAccounts = numSignedAccounts - this.header.numReadonlySignedAccounts;
853
+ return index < numWritableSignedAccounts;
854
+ }
845
855
  }
846
856
 
847
857
  isProgramId(index) {
@@ -1014,6 +1024,29 @@ class MessageV0 {
1014
1024
  return new MessageAccountKeys(this.staticAccountKeys, accountKeysFromLookups);
1015
1025
  }
1016
1026
 
1027
+ isAccountSigner(index) {
1028
+ return index < this.header.numRequiredSignatures;
1029
+ }
1030
+
1031
+ isAccountWritable(index) {
1032
+ const numSignedAccounts = this.header.numRequiredSignatures;
1033
+ const numStaticAccountKeys = this.staticAccountKeys.length;
1034
+
1035
+ if (index >= numStaticAccountKeys) {
1036
+ const lookupAccountKeysIndex = index - numStaticAccountKeys;
1037
+ const numWritableLookupAccountKeys = this.addressTableLookups.reduce((count, lookup) => count + lookup.writableIndexes.length, 0);
1038
+ return lookupAccountKeysIndex < numWritableLookupAccountKeys;
1039
+ } else if (index >= this.header.numRequiredSignatures) {
1040
+ const unsignedAccountIndex = index - numSignedAccounts;
1041
+ const numUnsignedAccounts = numStaticAccountKeys - numSignedAccounts;
1042
+ const numWritableUnsignedAccounts = numUnsignedAccounts - this.header.numReadonlyUnsignedAccounts;
1043
+ return unsignedAccountIndex < numWritableUnsignedAccounts;
1044
+ } else {
1045
+ const numWritableSignedAccounts = numSignedAccounts - this.header.numReadonlySignedAccounts;
1046
+ return index < numWritableSignedAccounts;
1047
+ }
1048
+ }
1049
+
1017
1050
  resolveAddressTableLookups(addressLookupTableAccounts) {
1018
1051
  const accountKeysFromLookups = {
1019
1052
  writable: [],
@@ -3562,7 +3595,7 @@ class AddressLookupTableAccount {
3562
3595
  }
3563
3596
 
3564
3597
  isActive() {
3565
- const U64_MAX = 18446744073709551615n;
3598
+ const U64_MAX = BigInt('0xffffffffffffffff');
3566
3599
  return this.state.deactivationSlot === U64_MAX;
3567
3600
  }
3568
3601