-
Notifications
You must be signed in to change notification settings - Fork 3
/
solana_stake_instruction.hexpat
94 lines (85 loc) · 2.01 KB
/
solana_stake_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
#pragma endian little
namespace Solana {
enum StakeInstructionKind : u32 {
Initialize = 0,
Authorize = 1,
DelegateStake = 2,
Split = 3,
Withdraw = 4,
Deactivate = 5,
SetLockup = 6,
Merge = 7,
AuthorizeWithSeed = 8,
InitializeChecked = 9,
AuthorizeChecked = 10,
AuthorizeCheckedWithSeed = 11,
SetLockupChecked = 12,
};
struct Authorized {
u8 staker[32];
u8 withdrawer[32];
};
struct Lockup {
s64 unix_timestamp;
u64 epoch;
u8 custodian[32];
};
enum StakeAuthorize : u32 {
Staker = 0,
Withdrawer = 1,
};
struct LockupArgs {
u8 has_timestamp;
if (has_timestamp)
s64 unix_timestamp;
u8 has_epoch;
if (has_epoch)
u64 epoch;
u8 has_custodian;
if (has_custodian)
u8 custodian[32];
};
struct AuthorizeWithSeedArgs {
u8 new_authorized_pubkey[32];
StakeAuthorize stake_authorize;
u8 authority_seed[32];
u8 authority_owner[32];
};
struct AuthorizeCheckedWithSeedArgs {
StakeAuthorize stake_authorize;
u8 authority_seed[32];
u8 authority_owner[32];
};
struct LockupCheckedArgs {
u8 has_unix_timestamp;
if (has_unix_timestamp)
s64 unix_timestamp;
u8 has_epoch;
if (has_epoch)
u64 epoch;
};
struct StakeInstruction {
u32 kind;
if (kind == StakeInstructionKind::Initialize) {
Authorized authorized;
Lockup lockup;
} else if (kind == StakeInstructionKind::Authorize) {
u8 pubkey[32];
StakeAuthorize stake_authorize;
} else if (kind == StakeInstructionKind::Split) {
u64 lamports;
} else if (kind == StakeInstructionKind::Withdraw) {
u64 lamports;
} else if (kind == StakeInstructionKind::SetLockup) {
LockupArgs lockup_args;
} else if (kind == StakeInstructionKind::AuthorizeWithSeed) {
AuthorizeWithSeedArgs args;
} else if (kind == StakeInstructionKind::AuthorizeChecked) {
StakeAuthorize stake_authorize;
} else if (kind == StakeInstructionKind::AuthorizeCheckedWithSeed) {
AuthorizeCheckedWithSeedArgs args;
} else if (kind == StakeInstructionKind::SetLockupChecked) {
LockupCheckedArgs args;
}
};
};