-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathsystem_instruction.h
More file actions
116 lines (101 loc) · 3.68 KB
/
system_instruction.h
File metadata and controls
116 lines (101 loc) · 3.68 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
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
107
108
109
110
111
112
113
114
115
116
#pragma once
#include "sol/parser.h"
#include "sol/print_config.h"
extern const Pubkey system_program_id;
enum SystemInstructionKind {
SystemCreateAccount,
SystemAssign,
SystemTransfer,
SystemCreateAccountWithSeed,
SystemAdvanceNonceAccount,
SystemWithdrawNonceAccount,
SystemInitializeNonceAccount,
SystemAuthorizeNonceAccount,
SystemAllocate,
SystemAllocateWithSeed,
SystemAssignWithSeed
};
typedef struct SystemCreateAccountInfo {
const Pubkey* from;
const Pubkey* to;
uint64_t lamports;
} SystemCreateAccountInfo;
typedef struct SystemCreateAccountWithSeedInfo {
const Pubkey* from;
const Pubkey* to;
const Pubkey* base;
SizedString seed;
uint64_t lamports;
} SystemCreateAccountWithSeedInfo;
typedef struct SystemTransferInfo {
const Pubkey* from;
const Pubkey* to;
uint64_t lamports;
} SystemTransferInfo;
typedef struct SystemAdvanceNonceInfo {
const Pubkey* account;
const Pubkey* authority;
} SystemAdvanceNonceInfo;
typedef struct SystemInitializeNonceInfo {
const Pubkey* account;
const Pubkey* authority;
} SystemInitializeNonceInfo;
typedef struct SystemWithdrawNonceInfo {
const Pubkey* account;
const Pubkey* authority;
const Pubkey* to;
uint64_t lamports;
} SystemWithdrawNonceInfo;
typedef struct SystemAuthorizeNonceInfo {
const Pubkey* account;
const Pubkey* authority;
const Pubkey* new_authority;
} SystemAuthorizeNonceInfo;
typedef struct SystemAllocateInfo {
const Pubkey* account;
uint64_t space;
} SystemAllocateInfo;
typedef struct SystemAssignInfo {
const Pubkey* account;
const Pubkey* program_id;
} SystemAssignInfo;
typedef struct SystemAllocateWithSeedInfo {
const Pubkey* account;
const Pubkey* base;
SizedString seed;
uint64_t space;
const Pubkey* program_id;
} SystemAllocateWithSeedInfo;
typedef struct SystemInfo {
enum SystemInstructionKind kind;
union {
SystemTransferInfo transfer;
SystemCreateAccountInfo create_account;
SystemCreateAccountWithSeedInfo create_account_with_seed;
SystemAdvanceNonceInfo advance_nonce;
SystemInitializeNonceInfo initialize_nonce;
SystemWithdrawNonceInfo withdraw_nonce;
SystemAuthorizeNonceInfo authorize_nonce;
SystemAllocateInfo allocate;
SystemAssignInfo assign;
SystemAllocateWithSeedInfo allocate_with_seed;
};
} SystemInfo;
int parse_system_instructions(const Instruction* instruction,
const MessageHeader* header,
SystemInfo* info);
int print_system_info(const SystemInfo* info, const PrintConfig* print_config);
int print_system_nonced_transaction_sentinel(const SystemInfo* info,
const PrintConfig* print_config);
int print_system_create_account_info(const char* primary_title,
const SystemCreateAccountInfo* info,
const PrintConfig* print_config);
int print_system_create_account_with_seed_info(const char* primary_title,
const SystemCreateAccountWithSeedInfo* info,
const PrintConfig* print_config);
int print_system_initialize_nonce_info(const char* primary_title,
const SystemInitializeNonceInfo* info,
const PrintConfig* print_config);
int print_system_allocate_with_seed_info(const char* primary_title,
const SystemAllocateWithSeedInfo* info,
const PrintConfig* print_config);