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
+ * Authority to close a token account
73
+ */
74
+ Token_AuthorityType_CloseAccount,
75
+ };
76
+ #ifndef __cplusplus
77
+ typedef uint8_t Token_AuthorityType;
78
+ #endif // __cplusplus
79
+
80
+ typedef uint8_t Token_Pubkey[32 ];
81
+
82
+ /* *
83
+ * A C representation of Rust's `std::option::Option`
84
+ */
85
+ typedef enum Token_COption_Pubkey_Tag {
86
+ /* *
87
+ * No value
88
+ */
89
+ Token_COption_Pubkey_None_Pubkey,
90
+ /* *
91
+ * Some value `T`
92
+ */
93
+ Token_COption_Pubkey_Some_Pubkey,
94
+ } Token_COption_Pubkey_Tag;
95
+
96
+ typedef struct Token_COption_Pubkey_Token_Some_Body_Pubkey {
97
+ Token_Pubkey _0;
98
+ } Token_COption_Pubkey_Token_Some_Body_Pubkey;
99
+
100
+ typedef struct Token_COption_Pubkey {
101
+ Token_COption_Pubkey_Tag tag;
102
+ union {
103
+ Token_COption_Pubkey_Token_Some_Body_Pubkey some;
104
+ };
105
+ } Token_COption_Pubkey;
106
+
24
107
/* *
25
108
* Instructions supported by the token program.
26
109
*/
@@ -35,11 +118,6 @@ typedef enum Token_TokenInstruction_Tag {
35
118
* Accounts expected by this instruction:
36
119
*
37
120
* 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.
43
121
*
44
122
*/
45
123
Token_TokenInstruction_InitializeMint,
@@ -127,36 +205,34 @@ typedef enum Token_TokenInstruction_Tag {
127
205
*/
128
206
Token_TokenInstruction_Revoke,
129
207
/* *
130
- * Sets a new owner of a mint or account.
208
+ * Sets a new authority of a mint or account.
131
209
*
132
210
* Accounts expected by this instruction:
133
211
*
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.
212
+ * * Single authority
213
+ * 0. `[writable]` The mint or account to change the authority of.
214
+ * 1. `[signer]` The current authority of the mint or account.
138
215
*
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.
216
+ * * Multisignature authority
217
+ * 0. `[writable]` The mint or account to change the authority of.
218
+ * 1. `[]` The mint's or account's multisignature authority.
143
219
* 3. ..3+M '[signer]' M signer accounts
144
220
*/
145
- Token_TokenInstruction_SetOwner ,
221
+ Token_TokenInstruction_SetAuthority ,
146
222
/* *
147
223
* Mints new tokens to an account. The native mint does not support minting.
148
224
*
149
225
* Accounts expected by this instruction:
150
226
*
151
- * * Single owner
227
+ * * Single authority
152
228
* 0. `[writable]` The mint.
153
229
* 1. `[writable]` The account to mint tokens to.
154
- * 2. `[signer]` The mint's owner .
230
+ * 2. `[signer]` The mint's minting authority .
155
231
*
156
- * * Multisignature owner
232
+ * * Multisignature authority
157
233
* 0. `[writable]` The mint.
158
234
* 1. `[writable]` The account to mint tokens to.
159
- * 2. `[]` The mint's multisignature owner .
235
+ * 2. `[]` The mint's multisignature mint-tokens authority .
160
236
* 3. ..3+M '[signer]' M signer accounts.
161
237
*/
162
238
Token_TokenInstruction_MintTo,
@@ -194,17 +270,55 @@ typedef enum Token_TokenInstruction_Tag {
194
270
* 3. ..3+M '[signer]' M signer accounts.
195
271
*/
196
272
Token_TokenInstruction_CloseAccount,
273
+ /* *
274
+ * Freeze an Initialized account using the Mint's freeze_authority (if set).
275
+ *
276
+ * Accounts expected by this instruction:
277
+ *
278
+ * * Single owner
279
+ * 0. `[writable]` The account to freeze.
280
+ * 1. '[]' The token mint.
281
+ * 2. `[signer]` The mint freeze authority.
282
+ *
283
+ * * Multisignature owner
284
+ * 0. `[writable]` The account to freeze.
285
+ * 1. '[]' The token mint.
286
+ * 2. `[]` The mint's multisignature freeze authority.
287
+ * 3. ..3+M '[signer]' M signer accounts.
288
+ */
289
+ Token_TokenInstruction_FreezeAccount,
290
+ /* *
291
+ * Thaw a Frozen account using the Mint's freeze_authority (if set).
292
+ *
293
+ * Accounts expected by this instruction:
294
+ *
295
+ * * Single owner
296
+ * 0. `[writable]` The account to freeze.
297
+ * 1. '[]' The token mint.
298
+ * 2. `[signer]` The mint freeze authority.
299
+ *
300
+ * * Multisignature owner
301
+ * 0. `[writable]` The account to freeze.
302
+ * 1. '[]' The token mint.
303
+ * 2. `[]` The mint's multisignature freeze authority.
304
+ * 3. ..3+M '[signer]' M signer accounts.
305
+ */
306
+ Token_TokenInstruction_ThawAccount,
197
307
} Token_TokenInstruction_Tag;
198
308
199
309
typedef struct Token_TokenInstruction_Token_InitializeMint_Body {
200
- /* *
201
- * Initial amount of tokens to mint.
202
- */
203
- uint64_t amount;
204
310
/* *
205
311
* Number of base 10 digits to the right of the decimal place.
206
312
*/
207
313
uint8_t decimals;
314
+ /* *
315
+ * The authority/multisignature to mint tokens.
316
+ */
317
+ Token_Pubkey mint_authority;
318
+ /* *
319
+ * The freeze authority/multisignature of the mint.
320
+ */
321
+ Token_COption_Pubkey freeze_authority;
208
322
} Token_TokenInstruction_Token_InitializeMint_Body;
209
323
210
324
typedef struct Token_TokenInstruction_Token_InitializeMultisig_Body {
@@ -228,6 +342,17 @@ typedef struct Token_TokenInstruction_Token_Approve_Body {
228
342
uint64_t amount;
229
343
} Token_TokenInstruction_Token_Approve_Body;
230
344
345
+ typedef struct Token_TokenInstruction_Token_SetAuthority_Body {
346
+ /* *
347
+ * The type of authority to update.
348
+ */
349
+ Token_AuthorityType authority_type;
350
+ /* *
351
+ * The new authority
352
+ */
353
+ Token_COption_Pubkey new_authority;
354
+ } Token_TokenInstruction_Token_SetAuthority_Body;
355
+
231
356
typedef struct Token_TokenInstruction_Token_MintTo_Body {
232
357
/* *
233
358
* The amount of new tokens to mint.
@@ -249,48 +374,22 @@ typedef struct Token_TokenInstruction {
249
374
Token_TokenInstruction_Token_InitializeMultisig_Body initialize_multisig;
250
375
Token_TokenInstruction_Token_Transfer_Body transfer;
251
376
Token_TokenInstruction_Token_Approve_Body approve;
377
+ Token_TokenInstruction_Token_SetAuthority_Body set_authority;
252
378
Token_TokenInstruction_Token_MintTo_Body mint_to;
253
379
Token_TokenInstruction_Token_Burn_Body burn;
254
380
};
255
381
} Token_TokenInstruction;
256
382
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
383
/* *
285
384
* Mint data.
286
385
*/
287
386
typedef struct Token_Mint {
288
387
/* *
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.
388
+ * Optional authority used to mint new tokens. The mint authority may only be provided during
389
+ * mint creation. If no mint authority is present then the mint has a fixed supply and no
390
+ * further tokens may be minted.
292
391
*/
293
- Token_COption_Pubkey owner ;
392
+ Token_COption_Pubkey mint_authority ;
294
393
/* *
295
394
* Number of base 10 digits to the right of the decimal place.
296
395
*/
@@ -299,6 +398,10 @@ typedef struct Token_Mint {
299
398
* Is `true` if this structure has been initialized
300
399
*/
301
400
bool is_initialized;
401
+ /* *
402
+ * Optional authority to freeze token accounts.
403
+ */
404
+ Token_COption_Pubkey freeze_authority;
302
405
} Token_Mint;
303
406
304
407
/* *
@@ -323,9 +426,9 @@ typedef struct Token_Account {
323
426
*/
324
427
Token_COption_Pubkey delegate;
325
428
/* *
326
- * Is `true` if this structure has been initialized
429
+ * The account's state
327
430
*/
328
- bool is_initialized ;
431
+ Token_AccountState state ;
329
432
/* *
330
433
* Is this a native token
331
434
*/
@@ -334,6 +437,10 @@ typedef struct Token_Account {
334
437
* The amount delegated
335
438
*/
336
439
uint64_t delegated_amount;
440
+ /* *
441
+ * Optional authority to close the account.
442
+ */
443
+ Token_COption_Pubkey close_authority;
337
444
} Token_Account;
338
445
339
446
/* *
0 commit comments