-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathspl_token_instruction.h
More file actions
203 lines (179 loc) · 6.91 KB
/
spl_token_instruction.h
File metadata and controls
203 lines (179 loc) · 6.91 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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
#pragma once
#include "sol/print_config.h"
#include "sol/transaction_summary.h"
#include "spl/token.h"
#define SplTokenBody(b) Token_TokenInstruction_Token_##b##_Body
#define SplTokenKind(b) Token_TokenInstruction_##b
#define SplTokenInstructionKind Token_TokenInstruction_Tag
typedef struct SplTokenMultisigners {
const Pubkey* first;
uint8_t count;
} SplTokenMultisigners;
typedef enum {
SplTokenSignKindSingle,
SplTokenSignKindMulti,
} SplTokenSignKind;
typedef struct {
SplTokenSignKind kind;
union {
struct {
const Pubkey* signer;
} single;
struct {
const Pubkey* account;
SplTokenMultisigners signers;
} multi;
};
} SplTokenSign;
extern const Pubkey spl_token_program_id;
extern const Pubkey spl_token_usdt_mint_address;
extern const Pubkey spl_token_usdc_mint_address;
extern const Pubkey spl_token_jup_mint_address;
extern const Pubkey spl_token_ray_mint_address;
extern const Pubkey spl_token_bonk_mint_address;
extern const Pubkey spl_token_wbtc_mint_address;
extern const Pubkey spl_token_link_mint_address;
extern const Pubkey spl_token_usde_mint_address;
extern const Pubkey spl_token_usds_mint_address;
extern const Pubkey spl_token_cbbtc_mint_address;
extern const Pubkey spl_token_susde_mint_address;
extern const Pubkey spl_token_wlfi_mint_address;
extern const Pubkey spl_token_usd1_mint_address;
extern const Pubkey spl_token_pyusd_mint_address;
extern const Pubkey spl_token_jitosol_mint_address;
extern const Pubkey spl_token_wsol_mint_address;
extern const Pubkey spl_token_jlp_mint_address;
extern const Pubkey spl_token_bnsol_mint_address;
extern const Pubkey spl_token_trump_mint_address;
extern const Pubkey spl_token_pump_mint_address;
extern const Pubkey spl_token_syrupusdc_mint_address;
extern const Pubkey spl_token_lbtc_mint_address;
extern const Pubkey spl_token_pengu_mint_address;
extern const Pubkey spl_token_render_mint_address;
extern const Pubkey spl_token_solvbtc_mint_address;
extern const Pubkey spl_token_fdusd_mint_address;
extern const Pubkey spl_token_usdg_mint_address;
extern const Pubkey spl_token_virtual_mint_address;
extern const Pubkey spl_token_jupsol_mint_address;
extern const Pubkey spl_token_spx_mint_address;
extern const Pubkey spl_token_cake_mint_address;
extern const Pubkey spl_token_ousg_mint_address;
extern const Pubkey spl_token_msol_mint_address;
extern const Pubkey spl_token_usdy_mint_address;
extern const Pubkey spl_token_tbtc_mint_address;
extern const Pubkey spl_token_2z_mint_address;
extern const Pubkey spl_token_pyth_mint_address;
extern const Pubkey spl_token_wif_mint_address;
extern const Pubkey spl_token_hnt_mint_address;
extern const Pubkey spl_token_borg_mint_address;
extern const Pubkey spl_token_ath_mint_address;
extern const Pubkey spl_token_axyc_mint_address;
extern const Pubkey spl_token_jto_mint_address;
extern const Pubkey spl_token_zbcn_mint_address;
extern const Pubkey spl_token_fluid_mint_address;
extern const Pubkey spl_token_bbsol_mint_address;
extern const Pubkey spl_token_fartcoin_mint_address;
extern const Pubkey spl_token_lion_mint_address;
extern const Pubkey spl_token_dsol_mint_address;
extern const Pubkey spl_token_w_mint_address;
typedef struct SplTokenInitializeMintInfo {
const Pubkey* mint_account;
const Pubkey* mint_authority;
const Pubkey* freeze_authority;
uint8_t decimals;
} SplTokenInitializeMintInfo;
typedef struct SplTokenInitializeAccountInfo {
const Pubkey* token_account;
const Pubkey* mint_account;
const Pubkey* owner;
} SplTokenInitializeAccountInfo;
typedef struct SplTokenInitializeMultisigInfo {
const Pubkey* multisig_account;
SplTokenMultisigners signers;
SplTokenBody(InitializeMultisig) body;
} SplTokenInitializeMultisigInfo;
typedef struct SplTokenTransferInfo {
const Pubkey* src_account;
const Pubkey* dest_account;
const Pubkey* mint_account;
SplTokenSign sign;
SplTokenBody(TransferChecked) body;
} SplTokenTransferInfo;
typedef struct SplTokenApproveInfo {
const Pubkey* token_account;
const Pubkey* delegate;
const Pubkey* mint_account;
SplTokenSign sign;
SplTokenBody(ApproveChecked) body;
} SplTokenApproveInfo;
typedef struct SplTokenRevokeInfo {
const Pubkey* token_account;
SplTokenSign sign;
} SplTokenRevokeInfo;
typedef struct SplTokenSetAuthorityInfo {
const Pubkey* account;
const Pubkey* new_authority;
Token_AuthorityType authority_type;
SplTokenSign sign;
} SplTokenSetAuthorityInfo;
typedef struct SplTokenMintToInfo {
const Pubkey* mint_account;
const Pubkey* token_account;
SplTokenSign sign;
SplTokenBody(MintToChecked) body;
} SplTokenMintToInfo;
typedef struct SplTokenBurnInfo {
const Pubkey* token_account;
const Pubkey* mint_account;
SplTokenSign sign;
SplTokenBody(BurnChecked) body;
} SplTokenBurnInfo;
typedef struct SplTokenCloseAccountInfo {
const Pubkey* token_account;
const Pubkey* dest_account;
SplTokenSign sign;
} SplTokenCloseAccountInfo;
typedef struct SplTokenFreezeAccountInfo {
const Pubkey* token_account;
const Pubkey* mint_account;
SplTokenSign sign;
} SplTokenFreezeAccountInfo;
typedef struct SplTokenThawAccountInfo {
const Pubkey* token_account;
const Pubkey* mint_account;
SplTokenSign sign;
} SplTokenThawAccountInfo;
typedef struct SplTokenSyncNativeInfo {
const Pubkey* token_account;
} SplTokenSyncNativeInfo;
typedef struct SplTokenInfo {
SplTokenInstructionKind kind;
union {
SplTokenInitializeMintInfo initialize_mint;
SplTokenInitializeAccountInfo initialize_account;
SplTokenInitializeMultisigInfo initialize_multisig;
SplTokenTransferInfo transfer;
SplTokenApproveInfo approve;
SplTokenRevokeInfo revoke;
SplTokenSetAuthorityInfo set_owner;
SplTokenMintToInfo mint_to;
SplTokenBurnInfo burn;
SplTokenCloseAccountInfo close_account;
SplTokenFreezeAccountInfo freeze_account;
SplTokenThawAccountInfo thaw_account;
SplTokenSyncNativeInfo sync_native;
};
} SplTokenInfo;
int parse_spl_token_instructions(const Instruction* instruction,
const MessageHeader* header,
SplTokenInfo* info);
int print_spl_token_info(const SplTokenInfo* info, const PrintConfig* print_config);
void summary_item_set_multisig_m_of_n(SummaryItem* item, uint8_t m, uint8_t n);
#define SplTokenOptionPubkeyKind Token_COption_Pubkey_Tag
#define SplTokenToOptionPubkeyKind(k) Token_COption_Pubkey_##k##_Pubkey
#define SplTokenOptionPubkeyBody Token_COption_Pubkey_Token_Some_Body_Pubkey
#define SplTokenOptionPubkey Token_COption_Pubkey
const Pubkey* spl_token_option_pubkey_get(const SplTokenOptionPubkey* option_pubkey);
int print_spl_token_transfer_info(const SplTokenTransferInfo* info,
const PrintConfig* print_config,
bool primary);