21
21
*/
22
22
#define Token_MIN_SIGNERS 1
23
23
24
+ /* *
25
+ * Account state.
26
+ */
27
+ enum Token_AccountState
28
+ #ifdef __cplusplus
29
+ : uint8_t
30
+ #endif // __cplusplus
31
+ {
32
+ /* *
33
+ * Account is not yet initialized
34
+ */
35
+ Token_AccountState_Uninitialized,
36
+ /* *
37
+ * Account is initialized; the account owner and/or delegate may perform permitted operations
38
+ * on this account
39
+ */
40
+ Token_AccountState_Initialized,
41
+ /* *
42
+ * Account has been frozen by the mint freeze authority. Neither the account owner nor
43
+ * the delegate are able to perform operations on this account.
44
+ */
45
+ Token_AccountState_Frozen,
46
+ };
47
+ #ifndef __cplusplus
48
+ typedef uint8_t Token_AccountState;
49
+ #endif // __cplusplus
50
+
51
+ /* *
52
+ * Specifies the authority type for SetAuthority instructions
53
+ */
54
+ enum Token_AuthorityType
55
+ #ifdef __cplusplus
56
+ : uint8_t
57
+ #endif // __cplusplus
58
+ {
59
+ /* *
60
+ * Authority to mint new tokens
61
+ */
62
+ Token_AuthorityType_MintTokens,
63
+ /* *
64
+ * Authority to freeze any account associated with the Mint
65
+ */
66
+ Token_AuthorityType_FreezeAccount,
67
+ /* *
68
+ * Holder of a given token account
69
+ */
70
+ Token_AuthorityType_AccountHolder,
71
+ };
72
+ #ifndef __cplusplus
73
+ typedef uint8_t Token_AuthorityType;
74
+ #endif // __cplusplus
75
+
76
+ typedef uint8_t Token_Pubkey[32 ];
77
+
78
+ /* *
79
+ * A C representation of Rust's `std::option::Option`
80
+ */
81
+ typedef enum Token_COption_Pubkey_Tag {
82
+ /* *
83
+ * No value
84
+ */
85
+ Token_COption_Pubkey_None_Pubkey,
86
+ /* *
87
+ * Some value `T`
88
+ */
89
+ Token_COption_Pubkey_Some_Pubkey,
90
+ } Token_COption_Pubkey_Tag;
91
+
92
+ typedef struct Token_COption_Pubkey_Token_Some_Body_Pubkey {
93
+ Token_Pubkey _0;
94
+ } Token_COption_Pubkey_Token_Some_Body_Pubkey;
95
+
96
+ typedef struct Token_COption_Pubkey {
97
+ Token_COption_Pubkey_Tag tag;
98
+ union {
99
+ Token_COption_Pubkey_Token_Some_Body_Pubkey some;
100
+ };
101
+ } Token_COption_Pubkey;
102
+
24
103
/* *
25
104
* Instructions supported by the token program.
26
105
*/
@@ -35,11 +114,7 @@ typedef enum Token_TokenInstruction_Tag {
35
114
* Accounts expected by this instruction:
36
115
*
37
116
* 0. `[writable]` The mint to initialize.
38
- * 1.
39
- * * If supply is non-zero: `[writable]` The account to hold all the newly minted tokens.
40
- * * If supply is zero: `[]` The owner/multisignature of the mint.
41
- * 2. `[]` (optional) The owner/multisignature of the mint if supply is non-zero, if
42
- * present then further minting is supported.
117
+ * 1. If supply is non-zero: `[writable]` The account to hold all the newly minted tokens.
43
118
*
44
119
*/
45
120
Token_TokenInstruction_InitializeMint,
@@ -127,36 +202,34 @@ typedef enum Token_TokenInstruction_Tag {
127
202
*/
128
203
Token_TokenInstruction_Revoke,
129
204
/* *
130
- * Sets a new owner of a mint or account.
205
+ * Sets a new authority of a mint or account.
131
206
*
132
207
* Accounts expected by this instruction:
133
208
*
134
- * * Single owner
135
- * 0. `[writable]` The mint or account to change the owner of.
136
- * 1. `[]` The new owner/delegate/multisignature.
137
- * 2. `[signer]` The owner of the mint or account.
209
+ * * Single authority
210
+ * 0. `[writable]` The mint or account to change the authority of.
211
+ * 1. `[signer]` The current authority of the mint or account.
138
212
*
139
- * * Multisignature owner
140
- * 0. `[writable]` The mint or account to change the owner of.
141
- * 1. `[]` The new owner/delegate/multisignature.
142
- * 2. `[]` The mint's or account's multisignature owner.
213
+ * * Multisignature authority
214
+ * 0. `[writable]` The mint or account to change the authority of.
215
+ * 1. `[]` The mint's or account's multisignature authority.
143
216
* 3. ..3+M '[signer]' M signer accounts
144
217
*/
145
- Token_TokenInstruction_SetOwner ,
218
+ Token_TokenInstruction_SetAuthority ,
146
219
/* *
147
220
* Mints new tokens to an account. The native mint does not support minting.
148
221
*
149
222
* Accounts expected by this instruction:
150
223
*
151
- * * Single owner
224
+ * * Single authority
152
225
* 0. `[writable]` The mint.
153
226
* 1. `[writable]` The account to mint tokens to.
154
- * 2. `[signer]` The mint's owner .
227
+ * 2. `[signer]` The mint's minting authority .
155
228
*
156
- * * Multisignature owner
229
+ * * Multisignature authority
157
230
* 0. `[writable]` The mint.
158
231
* 1. `[writable]` The account to mint tokens to.
159
- * 2. `[]` The mint's multisignature owner .
232
+ * 2. `[]` The mint's multisignature mint-tokens authority .
160
233
* 3. ..3+M '[signer]' M signer accounts.
161
234
*/
162
235
Token_TokenInstruction_MintTo,
@@ -194,6 +267,40 @@ typedef enum Token_TokenInstruction_Tag {
194
267
* 3. ..3+M '[signer]' M signer accounts.
195
268
*/
196
269
Token_TokenInstruction_CloseAccount,
270
+ /* *
271
+ * Freeze an Initialized account using the Mint's freeze_authority (if set).
272
+ *
273
+ * Accounts expected by this instruction:
274
+ *
275
+ * * Single owner
276
+ * 0. `[writable]` The account to freeze.
277
+ * 1. '[]' The token mint.
278
+ * 2. `[signer]` The mint freeze authority.
279
+ *
280
+ * * Multisignature owner
281
+ * 0. `[writable]` The account to freeze.
282
+ * 1. '[]' The token mint.
283
+ * 2. `[]` The mint's multisignature freeze authority.
284
+ * 3. ..3+M '[signer]' M signer accounts.
285
+ */
286
+ Token_TokenInstruction_FreezeAccount,
287
+ /* *
288
+ * Thaw a Frozen account using the Mint's freeze_authority (if set).
289
+ *
290
+ * Accounts expected by this instruction:
291
+ *
292
+ * * Single owner
293
+ * 0. `[writable]` The account to freeze.
294
+ * 1. '[]' The token mint.
295
+ * 2. `[signer]` The mint freeze authority.
296
+ *
297
+ * * Multisignature owner
298
+ * 0. `[writable]` The account to freeze.
299
+ * 1. '[]' The token mint.
300
+ * 2. `[]` The mint's multisignature freeze authority.
301
+ * 3. ..3+M '[signer]' M signer accounts.
302
+ */
303
+ Token_TokenInstruction_ThawAccount,
197
304
} Token_TokenInstruction_Tag;
198
305
199
306
typedef struct Token_TokenInstruction_Token_InitializeMint_Body {
@@ -205,6 +312,15 @@ typedef struct Token_TokenInstruction_Token_InitializeMint_Body {
205
312
* Number of base 10 digits to the right of the decimal place.
206
313
*/
207
314
uint8_t decimals;
315
+ /* *
316
+ * The authority/multisignature to mint tokens, if supply is non-zero. If present,
317
+ * further minting is supported.
318
+ */
319
+ Token_COption_Pubkey mint_authority;
320
+ /* *
321
+ * The freeze authority/multisignature of the mint.
322
+ */
323
+ Token_COption_Pubkey freeze_authority;
208
324
} Token_TokenInstruction_Token_InitializeMint_Body;
209
325
210
326
typedef struct Token_TokenInstruction_Token_InitializeMultisig_Body {
@@ -228,6 +344,17 @@ typedef struct Token_TokenInstruction_Token_Approve_Body {
228
344
uint64_t amount;
229
345
} Token_TokenInstruction_Token_Approve_Body;
230
346
347
+ typedef struct Token_TokenInstruction_Token_SetAuthority_Body {
348
+ /* *
349
+ * The type of authority to update.
350
+ */
351
+ Token_AuthorityType authority_type;
352
+ /* *
353
+ * The new authority
354
+ */
355
+ Token_COption_Pubkey new_authority;
356
+ } Token_TokenInstruction_Token_SetAuthority_Body;
357
+
231
358
typedef struct Token_TokenInstruction_Token_MintTo_Body {
232
359
/* *
233
360
* The amount of new tokens to mint.
@@ -249,48 +376,22 @@ typedef struct Token_TokenInstruction {
249
376
Token_TokenInstruction_Token_InitializeMultisig_Body initialize_multisig;
250
377
Token_TokenInstruction_Token_Transfer_Body transfer;
251
378
Token_TokenInstruction_Token_Approve_Body approve;
379
+ Token_TokenInstruction_Token_SetAuthority_Body set_authority;
252
380
Token_TokenInstruction_Token_MintTo_Body mint_to;
253
381
Token_TokenInstruction_Token_Burn_Body burn;
254
382
};
255
383
} Token_TokenInstruction;
256
384
257
- typedef uint8_t Token_Pubkey[32 ];
258
-
259
- /* *
260
- * A C representation of Rust's `std::option::Option`
261
- */
262
- typedef enum Token_COption_Pubkey_Tag {
263
- /* *
264
- * No value
265
- */
266
- Token_COption_Pubkey_None_Pubkey,
267
- /* *
268
- * Some value `T`
269
- */
270
- Token_COption_Pubkey_Some_Pubkey,
271
- } Token_COption_Pubkey_Tag;
272
-
273
- typedef struct Token_COption_Pubkey_Token_Some_Body_Pubkey {
274
- Token_Pubkey _0;
275
- } Token_COption_Pubkey_Token_Some_Body_Pubkey;
276
-
277
- typedef struct Token_COption_Pubkey {
278
- Token_COption_Pubkey_Tag tag;
279
- union {
280
- Token_COption_Pubkey_Token_Some_Body_Pubkey some;
281
- };
282
- } Token_COption_Pubkey;
283
-
284
385
/* *
285
386
* Mint data.
286
387
*/
287
388
typedef struct Token_Mint {
288
389
/* *
289
- * Optional owner, used to mint new tokens. The owner may only
290
- * be provided during mint creation. If no owner is present then the mint
291
- * has a fixed supply and no further tokens may be minted.
390
+ * Optional authority used to mint new tokens. The mint authority may only be provided during
391
+ * mint creation. If no mint authority is present then the mint has a fixed supply and no
392
+ * further tokens may be minted.
292
393
*/
293
- Token_COption_Pubkey owner ;
394
+ Token_COption_Pubkey mint_authority ;
294
395
/* *
295
396
* Number of base 10 digits to the right of the decimal place.
296
397
*/
@@ -299,6 +400,10 @@ typedef struct Token_Mint {
299
400
* Is `true` if this structure has been initialized
300
401
*/
301
402
bool is_initialized;
403
+ /* *
404
+ * Optional authority to freeze token accounts.
405
+ */
406
+ Token_COption_Pubkey freeze_authority;
302
407
} Token_Mint;
303
408
304
409
/* *
@@ -323,9 +428,9 @@ typedef struct Token_Account {
323
428
*/
324
429
Token_COption_Pubkey delegate;
325
430
/* *
326
- * Is `true` if this structure has been initialized
431
+ * The account's state
327
432
*/
328
- bool is_initialized ;
433
+ Token_AccountState state ;
329
434
/* *
330
435
* Is this a native token
331
436
*/
0 commit comments