-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathvote_instruction.h
More file actions
79 lines (67 loc) · 2.01 KB
/
vote_instruction.h
File metadata and controls
79 lines (67 loc) · 2.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#pragma once
#include "sol/parser.h"
#include "sol/print_config.h"
extern const Pubkey vote_program_id;
enum VoteInstructionKind {
VoteInitialize,
VoteAuthorize,
VoteVote,
VoteWithdraw,
VoteUpdateValidatorId,
VoteUpdateCommission,
VoteSwitchVote,
VoteAuthorizeChecked,
};
typedef struct VoteInitData {
const Pubkey* validator_id;
const Pubkey* vote_authority;
const Pubkey* withdraw_authority;
uint64_t commission;
} VoteInitData;
typedef struct VoteInitializeInfo {
const Pubkey* account;
VoteInitData vote_init;
} VoteInitializeInfo;
typedef struct VoteWithdrawInfo {
const Pubkey* account;
const Pubkey* authority;
const Pubkey* to;
uint64_t lamports;
} VoteWithdrawInfo;
enum VoteAuthorize {
VoteAuthorizeVoter,
VoteAuthorizeWithdrawer,
};
typedef struct VoteAuthorizeInfo {
const Pubkey* account;
const Pubkey* authority;
const Pubkey* new_authority;
enum VoteAuthorize authorize;
} VoteAuthorizeInfo;
typedef struct VoteUpdateValidatorIdInfo {
const Pubkey* account;
const Pubkey* authority;
const Pubkey* new_validator_id;
} VoteUpdateValidatorIdInfo;
typedef struct VoteUpdateCommissionInfo {
const Pubkey* account;
const Pubkey* authority;
uint8_t commission;
} VoteUpdateCommissionInfo;
typedef struct VoteInfo {
enum VoteInstructionKind kind;
union {
VoteInitializeInfo initialize;
VoteWithdrawInfo withdraw;
VoteAuthorizeInfo authorize;
VoteUpdateValidatorIdInfo update_validator_id;
VoteUpdateCommissionInfo update_commission;
};
} VoteInfo;
int parse_vote_instructions(const Instruction* instruction,
const MessageHeader* header,
VoteInfo* info);
int print_vote_info(const VoteInfo* info, const PrintConfig* print_config);
int print_vote_initialize_info(const char* primary_title,
const VoteInitializeInfo* info,
const PrintConfig* print_config);