Skip to content
This repository was archived by the owner on Mar 11, 2025. It is now read-only.

Commit aebc693

Browse files
committed
token: Get COption and Pubkey C bindings from solana-program crate
1 parent bc7edce commit aebc693

File tree

2 files changed

+14
-18
lines changed

2 files changed

+14
-18
lines changed

token/program/inc/token.h

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -89,14 +89,12 @@ typedef enum Token_COption_Pubkey_Tag {
8989
Token_COption_Pubkey_Some_Pubkey,
9090
} Token_COption_Pubkey_Tag;
9191

92-
typedef struct Token_COption_Pubkey_Token_Some_Body_Pubkey {
93-
Token_Pubkey _0;
94-
} Token_COption_Pubkey_Token_Some_Body_Pubkey;
95-
9692
typedef struct Token_COption_Pubkey {
9793
Token_COption_Pubkey_Tag tag;
9894
union {
99-
Token_COption_Pubkey_Token_Some_Body_Pubkey some;
95+
struct {
96+
Token_Pubkey some;
97+
};
10098
};
10199
} Token_COption_Pubkey;
102100

@@ -430,7 +428,7 @@ typedef struct Token_TokenInstruction_Token_InitializeMint_Body {
430428
/**
431429
* The freeze authority/multisignature of the mint.
432430
*/
433-
Token_COption_Pubkey freeze_authority;
431+
struct Token_COption_Pubkey freeze_authority;
434432
} Token_TokenInstruction_Token_InitializeMint_Body;
435433

436434
typedef struct Token_TokenInstruction_Token_InitializeMultisig_Body {
@@ -463,7 +461,7 @@ typedef struct Token_TokenInstruction_Token_SetAuthority_Body {
463461
/**
464462
* The new authority
465463
*/
466-
Token_COption_Pubkey new_authority;
464+
struct Token_COption_Pubkey new_authority;
467465
} Token_TokenInstruction_Token_SetAuthority_Body;
468466

469467
typedef struct Token_TokenInstruction_Token_MintTo_Body {
@@ -550,7 +548,7 @@ typedef struct Token_Mint {
550548
* mint creation. If no mint authority is present then the mint has a fixed supply and no
551549
* further tokens may be minted.
552550
*/
553-
Token_COption_Pubkey mint_authority;
551+
struct Token_COption_Pubkey mint_authority;
554552
/**
555553
* Total supply of tokens.
556554
*/
@@ -566,7 +564,7 @@ typedef struct Token_Mint {
566564
/**
567565
* Optional authority to freeze token accounts.
568566
*/
569-
Token_COption_Pubkey freeze_authority;
567+
struct Token_COption_Pubkey freeze_authority;
570568
} Token_Mint;
571569

572570
/**
@@ -583,14 +581,12 @@ typedef enum Token_COption_u64_Tag {
583581
Token_COption_u64_Some_u64,
584582
} Token_COption_u64_Tag;
585583

586-
typedef struct Token_COption_u64_Token_Some_Body_u64 {
587-
uint64_t _0;
588-
} Token_COption_u64_Token_Some_Body_u64;
589-
590584
typedef struct Token_COption_u64 {
591585
Token_COption_u64_Tag tag;
592586
union {
593-
Token_COption_u64_Token_Some_Body_u64 some;
587+
struct {
588+
uint64_t some;
589+
};
594590
};
595591
} Token_COption_u64;
596592

@@ -614,7 +610,7 @@ typedef struct Token_Account {
614610
* If `delegate` is `Some` then `delegated_amount` represents
615611
* the amount authorized by the delegate
616612
*/
617-
Token_COption_Pubkey delegate;
613+
struct Token_COption_Pubkey delegate;
618614
/**
619615
* The account's state
620616
*/
@@ -624,15 +620,15 @@ typedef struct Token_Account {
624620
* is required to be rent-exempt, so the value is used by the Processor to ensure that wrapped
625621
* SOL accounts do not drop below this threshold.
626622
*/
627-
Token_COption_u64 is_native;
623+
struct Token_COption_u64 is_native;
628624
/**
629625
* The amount delegated
630626
*/
631627
uint64_t delegated_amount;
632628
/**
633629
* Optional authority to close the account.
634630
*/
635-
Token_COption_Pubkey close_authority;
631+
struct Token_COption_Pubkey close_authority;
636632
} Token_Account;
637633

638634
/**

utils/cgen/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ fn token<P: AsRef<Path>>(crate_dir: P) {
3232
},
3333
parse: cbindgen::ParseConfig {
3434
parse_deps: true,
35-
include: Some(vec!["solana-sdk".to_string()]),
35+
include: Some(vec!["solana-program".to_string(), "solana-sdk".to_string()]),
3636
..cbindgen::ParseConfig::default()
3737
},
3838
..cbindgen::Config::default()

0 commit comments

Comments
 (0)