@solana/web3.js 1.61.0 → 1.62.0

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.
@@ -835,7 +835,17 @@ class Message {
835
835
  }
836
836
 
837
837
  isAccountWritable(index) {
838
- return index < this.header.numRequiredSignatures - this.header.numReadonlySignedAccounts || index >= this.header.numRequiredSignatures && index < this.accountKeys.length - this.header.numReadonlyUnsignedAccounts;
838
+ const numSignedAccounts = this.header.numRequiredSignatures;
839
+
840
+ if (index >= this.header.numRequiredSignatures) {
841
+ const unsignedAccountIndex = index - numSignedAccounts;
842
+ const numUnsignedAccounts = this.accountKeys.length - numSignedAccounts;
843
+ const numWritableUnsignedAccounts = numUnsignedAccounts - this.header.numReadonlyUnsignedAccounts;
844
+ return unsignedAccountIndex < numWritableUnsignedAccounts;
845
+ } else {
846
+ const numWritableSignedAccounts = numSignedAccounts - this.header.numReadonlySignedAccounts;
847
+ return index < numWritableSignedAccounts;
848
+ }
839
849
  }
840
850
 
841
851
  isProgramId(index) {
@@ -1008,6 +1018,29 @@ class MessageV0 {
1008
1018
  return new MessageAccountKeys(this.staticAccountKeys, accountKeysFromLookups);
1009
1019
  }
1010
1020
 
1021
+ isAccountSigner(index) {
1022
+ return index < this.header.numRequiredSignatures;
1023
+ }
1024
+
1025
+ isAccountWritable(index) {
1026
+ const numSignedAccounts = this.header.numRequiredSignatures;
1027
+ const numStaticAccountKeys = this.staticAccountKeys.length;
1028
+
1029
+ if (index >= numStaticAccountKeys) {
1030
+ const lookupAccountKeysIndex = index - numStaticAccountKeys;
1031
+ const numWritableLookupAccountKeys = this.addressTableLookups.reduce((count, lookup) => count + lookup.writableIndexes.length, 0);
1032
+ return lookupAccountKeysIndex < numWritableLookupAccountKeys;
1033
+ } else if (index >= this.header.numRequiredSignatures) {
1034
+ const unsignedAccountIndex = index - numSignedAccounts;
1035
+ const numUnsignedAccounts = numStaticAccountKeys - numSignedAccounts;
1036
+ const numWritableUnsignedAccounts = numUnsignedAccounts - this.header.numReadonlyUnsignedAccounts;
1037
+ return unsignedAccountIndex < numWritableUnsignedAccounts;
1038
+ } else {
1039
+ const numWritableSignedAccounts = numSignedAccounts - this.header.numReadonlySignedAccounts;
1040
+ return index < numWritableSignedAccounts;
1041
+ }
1042
+ }
1043
+
1011
1044
  resolveAddressTableLookups(addressLookupTableAccounts) {
1012
1045
  const accountKeysFromLookups = {
1013
1046
  writable: [],
@@ -3504,7 +3537,7 @@ class AddressLookupTableAccount {
3504
3537
  }
3505
3538
 
3506
3539
  isActive() {
3507
- const U64_MAX = 2n ** 64n - 1n;
3540
+ const U64_MAX = 18446744073709551615n;
3508
3541
  return this.state.deactivationSlot === U64_MAX;
3509
3542
  }
3510
3543