@solana/web3.js 1.61.1 → 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.
- package/lib/index.browser.cjs.js +34 -1
- package/lib/index.browser.cjs.js.map +1 -1
- package/lib/index.browser.esm.js +34 -1
- package/lib/index.browser.esm.js.map +1 -1
- package/lib/index.cjs.js +34 -1
- package/lib/index.cjs.js.map +1 -1
- package/lib/index.d.ts +2 -0
- package/lib/index.esm.js +34 -1
- package/lib/index.esm.js.map +1 -1
- package/lib/index.iife.js +34 -1
- package/lib/index.iife.js.map +1 -1
- package/lib/index.iife.min.js +1 -1
- package/lib/index.iife.min.js.map +1 -1
- package/lib/index.native.js +34 -1
- package/lib/index.native.js.map +1 -1
- package/package.json +1 -1
- package/src/message/legacy.ts +12 -8
- package/src/message/v0.ts +27 -0
package/package.json
CHANGED
package/src/message/legacy.ts
CHANGED
|
@@ -130,14 +130,18 @@ export class Message {
|
|
|
130
130
|
}
|
|
131
131
|
|
|
132
132
|
isAccountWritable(index: number): boolean {
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
133
|
+
const numSignedAccounts = this.header.numRequiredSignatures;
|
|
134
|
+
if (index >= this.header.numRequiredSignatures) {
|
|
135
|
+
const unsignedAccountIndex = index - numSignedAccounts;
|
|
136
|
+
const numUnsignedAccounts = this.accountKeys.length - numSignedAccounts;
|
|
137
|
+
const numWritableUnsignedAccounts =
|
|
138
|
+
numUnsignedAccounts - this.header.numReadonlyUnsignedAccounts;
|
|
139
|
+
return unsignedAccountIndex < numWritableUnsignedAccounts;
|
|
140
|
+
} else {
|
|
141
|
+
const numWritableSignedAccounts =
|
|
142
|
+
numSignedAccounts - this.header.numReadonlySignedAccounts;
|
|
143
|
+
return index < numWritableSignedAccounts;
|
|
144
|
+
}
|
|
141
145
|
}
|
|
142
146
|
|
|
143
147
|
isProgramId(index: number): boolean {
|
package/src/message/v0.ts
CHANGED
|
@@ -103,6 +103,33 @@ export class MessageV0 {
|
|
|
103
103
|
);
|
|
104
104
|
}
|
|
105
105
|
|
|
106
|
+
isAccountSigner(index: number): boolean {
|
|
107
|
+
return index < this.header.numRequiredSignatures;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
isAccountWritable(index: number): boolean {
|
|
111
|
+
const numSignedAccounts = this.header.numRequiredSignatures;
|
|
112
|
+
const numStaticAccountKeys = this.staticAccountKeys.length;
|
|
113
|
+
if (index >= numStaticAccountKeys) {
|
|
114
|
+
const lookupAccountKeysIndex = index - numStaticAccountKeys;
|
|
115
|
+
const numWritableLookupAccountKeys = this.addressTableLookups.reduce(
|
|
116
|
+
(count, lookup) => count + lookup.writableIndexes.length,
|
|
117
|
+
0,
|
|
118
|
+
);
|
|
119
|
+
return lookupAccountKeysIndex < numWritableLookupAccountKeys;
|
|
120
|
+
} else if (index >= this.header.numRequiredSignatures) {
|
|
121
|
+
const unsignedAccountIndex = index - numSignedAccounts;
|
|
122
|
+
const numUnsignedAccounts = numStaticAccountKeys - numSignedAccounts;
|
|
123
|
+
const numWritableUnsignedAccounts =
|
|
124
|
+
numUnsignedAccounts - this.header.numReadonlyUnsignedAccounts;
|
|
125
|
+
return unsignedAccountIndex < numWritableUnsignedAccounts;
|
|
126
|
+
} else {
|
|
127
|
+
const numWritableSignedAccounts =
|
|
128
|
+
numSignedAccounts - this.header.numReadonlySignedAccounts;
|
|
129
|
+
return index < numWritableSignedAccounts;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
106
133
|
resolveAddressTableLookups(
|
|
107
134
|
addressLookupTableAccounts: AddressLookupTableAccount[],
|
|
108
135
|
): AccountKeysFromLookups {
|