@solana/web3.js 1.36.0 → 1.37.2
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 +9848 -0
- package/lib/index.browser.cjs.js.map +1 -0
- package/lib/index.browser.esm.js +168 -52
- package/lib/index.browser.esm.js.map +1 -1
- package/lib/index.cjs.js +169 -51
- package/lib/index.cjs.js.map +1 -1
- package/lib/index.d.ts +52 -13
- package/lib/index.esm.js +169 -51
- package/lib/index.esm.js.map +1 -1
- package/lib/index.iife.js +1593 -1238
- package/lib/index.iife.js.map +1 -1
- package/lib/index.iife.min.js +5 -4
- package/lib/index.iife.min.js.map +1 -1
- package/module.flow.js +83 -14
- package/package.json +5 -4
- package/src/connection.ts +106 -8
- package/src/ed25519-program.ts +21 -4
- package/src/instruction.ts +15 -5
- package/src/layout.ts +59 -19
- package/src/loader.ts +16 -3
- package/src/message.ts +21 -4
- package/src/nonce-account.ts +15 -2
- package/src/secp256k1-program.ts +15 -1
- package/src/stake-program.ts +83 -21
- package/src/system-program.ts +100 -36
- package/src/transaction.ts +8 -0
- package/src/vote-account.ts +55 -27
- package/src/vote-program.ts +37 -10
package/src/vote-program.ts
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import * as BufferLayout from '@solana/buffer-layout';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
encodeData,
|
|
5
|
+
decodeData,
|
|
6
|
+
InstructionType,
|
|
7
|
+
IInstructionInputData,
|
|
8
|
+
} from './instruction';
|
|
4
9
|
import * as Layout from './layout';
|
|
5
10
|
import {PublicKey} from './publickey';
|
|
6
11
|
import {SystemProgram} from './system-program';
|
|
@@ -202,23 +207,45 @@ export class VoteInstruction {
|
|
|
202
207
|
* An enumeration of valid VoteInstructionType's
|
|
203
208
|
*/
|
|
204
209
|
export type VoteInstructionType =
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
210
|
+
// FIXME
|
|
211
|
+
// It would be preferable for this type to be `keyof VoteInstructionInputData`
|
|
212
|
+
// but Typedoc does not transpile `keyof` expressions.
|
|
213
|
+
// See https://github.com/TypeStrong/typedoc/issues/1894
|
|
214
|
+
'Authorize' | 'InitializeAccount' | 'Withdraw';
|
|
215
|
+
|
|
216
|
+
type VoteInstructionInputData = {
|
|
217
|
+
Authorize: IInstructionInputData & {
|
|
218
|
+
newAuthorized: Uint8Array;
|
|
219
|
+
voteAuthorizationType: number;
|
|
220
|
+
};
|
|
221
|
+
InitializeAccount: IInstructionInputData & {
|
|
222
|
+
voteInit: Readonly<{
|
|
223
|
+
authorizedVoter: Uint8Array;
|
|
224
|
+
authorizedWithdrawer: Uint8Array;
|
|
225
|
+
commission: number;
|
|
226
|
+
nodePubkey: Uint8Array;
|
|
227
|
+
}>;
|
|
228
|
+
};
|
|
229
|
+
Withdraw: IInstructionInputData & {
|
|
230
|
+
lamports: number;
|
|
231
|
+
};
|
|
232
|
+
};
|
|
208
233
|
|
|
209
|
-
const VOTE_INSTRUCTION_LAYOUTS
|
|
210
|
-
[
|
|
211
|
-
|
|
234
|
+
const VOTE_INSTRUCTION_LAYOUTS = Object.freeze<{
|
|
235
|
+
[Instruction in VoteInstructionType]: InstructionType<
|
|
236
|
+
VoteInstructionInputData[Instruction]
|
|
237
|
+
>;
|
|
238
|
+
}>({
|
|
212
239
|
InitializeAccount: {
|
|
213
240
|
index: 0,
|
|
214
|
-
layout: BufferLayout.struct([
|
|
241
|
+
layout: BufferLayout.struct<VoteInstructionInputData['InitializeAccount']>([
|
|
215
242
|
BufferLayout.u32('instruction'),
|
|
216
243
|
Layout.voteInit(),
|
|
217
244
|
]),
|
|
218
245
|
},
|
|
219
246
|
Authorize: {
|
|
220
247
|
index: 1,
|
|
221
|
-
layout: BufferLayout.struct([
|
|
248
|
+
layout: BufferLayout.struct<VoteInstructionInputData['Authorize']>([
|
|
222
249
|
BufferLayout.u32('instruction'),
|
|
223
250
|
Layout.publicKey('newAuthorized'),
|
|
224
251
|
BufferLayout.u32('voteAuthorizationType'),
|
|
@@ -226,7 +253,7 @@ const VOTE_INSTRUCTION_LAYOUTS: {
|
|
|
226
253
|
},
|
|
227
254
|
Withdraw: {
|
|
228
255
|
index: 3,
|
|
229
|
-
layout: BufferLayout.struct([
|
|
256
|
+
layout: BufferLayout.struct<VoteInstructionInputData['Withdraw']>([
|
|
230
257
|
BufferLayout.u32('instruction'),
|
|
231
258
|
BufferLayout.ns64('lamports'),
|
|
232
259
|
]),
|