-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathsolana_vote_instruction.hexpat
106 lines (95 loc) · 2.49 KB
/
solana_vote_instruction.hexpat
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
#pragma endian little
struct RustString {
u64 len;
u8 data[len];
};
namespace Solana {
enum VoteInstructionKind : u32 {
InitializeAccount = 0,
Authorize = 1,
Vote = 2,
Withdraw = 3,
UpdateValidatorIdentity = 4,
UpdateCommission = 5,
VoteSwitch = 6,
AuthorizeChecked = 7,
UpdateVoteState = 8,
UpdateVoteStateSwitch = 9,
AuthorizeWithSeed = 10,
AuthorizeCheckedWithSeed = 11,
};
enum VoteAuthorize : u32 {
Voter = 0,
Withdrawer = 1,
};
struct VoteInit {
u8 node_pubkey[32];
u8 authorized_voter[32];
u8 authorized_withdrawer[32];
u8 commission;
};
struct Vote {
u64 slot_cnt;
u64 slots[slot_cnt];
u8 hash[32];
u8 has_timestamp;
if (has_timestamp)
s64 timestamp;
};
struct Lockout {
u64 slot;
u32 confirmation_count;
};
struct VoteStateUpdate {
u64 lockout_cnt;
Lockout lockouts[lockout_cnt];
u8 has_root;
if (has_root)
u64 root_slot;
u8 hash[32];
u8 has_timestamp;
if (has_timestamp)
s64 timestamp;
};
struct VoteAuthorizeWithSeedArgs {
VoteAuthorize authorization_type;
u8 current_authority_derived_key_owner[32];
RustString current_authority_derived_key_seed;
u8 new_authority[32];
};
struct VoteAuthorizeCheckedWithSeedArgs {
VoteAuthorize authorization_type;
u8 current_authority_derived_key_owner[32];
RustString current_authority_derived_key_seed;
};
struct VoteInstruction {
u32 kind;
if (kind == VoteInstructionKind::InitializeAccount) {
VoteInit vote_init;
} else if (kind == VoteInstructionKind::Authorize) {
u8 vote_account_address[32];
VoteAuthorize vote_authorize;
} else if (kind == VoteInstructionKind::Vote) {
Vote vote;
} else if (kind == VoteInstructionKind::Withdraw) {
u64 withdraw;
} else if (kind == VoteInstructionKind::UpdateCommission) {
u8 commission;
} else if (kind == VoteInstructionKind::VoteSwitch) {
Vote vote;
u8 hash[32];
} else if (kind == VoteInstructionKind::AuthorizeChecked) {
VoteAuthorize vote_authorize;
} else if (kind == VoteInstructionKind::UpdateVoteState) {
VoteStateUpdate vote_state_update;
} else if (kind == VoteInstructionKind::UpdateVoteStateSwitch) {
VoteStateUpdate vote_state_update;
u8 hash[32];
} else if (kind == VoteInstructionKind::AuthorizeWithSeed) {
VoteAuthorizeWithSeedArgs vote_authorize_with_seed_args;
} else if (kind == VoteInstructionKind::AuthorizeCheckedWithSeed) {
VoteAuthorizeCheckedWithSeedArgs vote_authorize_checked_with_seed_args;
}
};
}
Solana::VoteInstruction instruction @ 0x00;