name_tokenizer/
instruction.rs

1pub use crate::processor::{
2    create_collection, create_mint, create_nft, edit_data, redeem_nft, unverify_nft,
3    withdraw_tokens,
4};
5use {
6    bonfida_utils::InstructionsAccount,
7    borsh::{BorshDeserialize, BorshSerialize},
8    num_derive::FromPrimitive,
9    solana_program::{instruction::Instruction, pubkey::Pubkey},
10};
11#[allow(missing_docs)]
12#[derive(BorshDeserialize, BorshSerialize, FromPrimitive)]
13pub enum ProgramInstruction {
14    /// Create the NFT mint
15    ///
16    /// | Index | Writable | Signer | Description                   |
17    /// | --------------------------------------------------------- |
18    /// | 0     | ✅        | ❌      | The mint of the NFT           |
19    /// | 1     | ✅        | ❌      | The domain name account       |
20    /// | 2     | ❌        | ❌      | The central state account     |
21    /// | 3     | ❌        | ❌      | The SPL token program account |
22    /// | 4     | ❌        | ❌      | The system program account    |
23    /// | 5     | ❌        | ❌      | Rent sysvar account           |
24    /// | 6     | ❌        | ❌      | Fee payer account             |
25    CreateMint,
26    /// Create a verified collection
27    ///
28    /// | Index | Writable | Signer | Description                                                   |
29    /// | ----------------------------------------------------------------------------------------- |
30    /// | 0     | ✅        | ❌      | The mint of the collection                                    |
31    /// | 1     | ✅        | ❌      |                                                               |
32    /// | 2     | ✅        | ❌      | The metadata account                                          |
33    /// | 3     | ❌        | ❌      | The central state account                                     |
34    /// | 4     | ✅        | ❌      | Token account of the central state to hold the master edition |
35    /// | 5     | ❌        | ❌      | The fee payer account                                         |
36    /// | 6     | ❌        | ❌      | The SPL token program account                                 |
37    /// | 7     | ❌        | ❌      | The metadata program account                                  |
38    /// | 8     | ❌        | ❌      | The system program account                                    |
39    /// | 9     | ❌        | ❌      | The SPL name service program account                          |
40    /// | 10    | ❌        | ❌      |                                                               |
41    /// | 11    | ❌        | ❌      | Rent sysvar account                                           |
42    CreateCollection,
43    /// Tokenize a domain name
44    ///
45    /// | Index | Writable | Signer | Description                          |
46    /// | ---------------------------------------------------------------- |
47    /// | 0     | ✅        | ❌      | The mint of the NFT                  |
48    /// | 1     | ✅        | ❌      | The NFT token destination            |
49    /// | 2     | ✅        | ❌      | The domain name account              |
50    /// | 3     | ✅        | ❌      | The NFT record account               |
51    /// | 4     | ✅        | ✅      | The domain name owner                |
52    /// | 5     | ✅        | ❌      | The metadata account                 |
53    /// | 6     | ❌        | ❌      | Master edition account               |
54    /// | 7     | ❌        | ❌      | Collection                           |
55    /// | 8     | ❌        | ❌      | Mint of the collection               |
56    /// | 9     | ✅        | ❌      | The central state account            |
57    /// | 10    | ✅        | ✅      | The fee payer account                |
58    /// | 11    | ❌        | ❌      | The SPL token program account        |
59    /// | 12    | ❌        | ❌      | The metadata program account         |
60    /// | 13    | ❌        | ❌      | The system program account           |
61    /// | 14    | ❌        | ❌      | The SPL name service program account |
62    /// | 15    | ❌        | ❌      | Rent sysvar account                  |
63    /// | 16    | ❌        | ✅      | The metadata signer                  |
64    CreateNft,
65    /// Redeem a tokenized domain name
66    ///
67    /// | Index | Writable | Signer | Description                               |
68    /// | --------------------------------------------------------------------- |
69    /// | 0     | ✅        | ❌      | The mint of the NFT                       |
70    /// | 1     | ✅        | ❌      | The current token account holding the NFT |
71    /// | 2     | ✅        | ✅      | The NFT owner account                     |
72    /// | 3     | ✅        | ❌      | The NFT record account                    |
73    /// | 4     | ✅        | ❌      | The domain name account                   |
74    /// | 5     | ❌        | ❌      | The SPL token program account             |
75    /// | 6     | ❌        | ❌      | The SPL name service program account      |
76    RedeemNft,
77    /// Withdraw funds that have been sent to the escrow
78    /// while the domain was tokenized
79    ///
80    /// | Index | Writable | Signer | Description                                |
81    /// | ---------------------------------------------------------------------- |
82    /// | 0     | ✅        | ❌      | The token account holding the NFT          |
83    /// | 1     | ✅        | ✅      | The owner of the NFT token account         |
84    /// | 2     | ✅        | ❌      | The NFT record account                     |
85    /// | 3     | ✅        | ❌      | The destination for tokens being withdrawn |
86    /// | 4     | ✅        | ❌      | The source for tokens being withdrawn      |
87    /// | 5     | ❌        | ❌      | The SPL token program account              |
88    /// | 6     | ❌        | ❌      | The system program account                 |
89    WithdrawTokens,
90    /// Edit the data registry of a tokenized domain name
91    ///
92    /// | Index | Writable | Signer | Description                          |
93    /// | ---------------------------------------------------------------- |
94    /// | 0     | ❌        | ✅      | The NFT owner account                |
95    /// | 1     | ❌        | ❌      | The NFT account                      |
96    /// | 2     | ❌        | ❌      | The NFT record account               |
97    /// | 3     | ✅        | ❌      | The domain name account              |
98    /// | 4     | ❌        | ❌      | The SPL token program account        |
99    /// | 5     | ❌        | ❌      | The SPL name service program account |
100    EditData,
101    /// Unverify an NFT
102    ///
103    /// | Index | Writable | Signer | Description                  |
104    /// | -------------------------------------------------------- |
105    /// | 0     | ✅        | ❌      | The metadata account         |
106    /// | 1     | ❌        | ❌      | Master edition account       |
107    /// | 2     | ❌        | ❌      | Collection                   |
108    /// | 3     | ❌        | ❌      | Mint of the collection       |
109    /// | 4     | ✅        | ❌      | The central state account    |
110    /// | 5     | ✅        | ✅      | The fee payer account        |
111    /// | 6     | ❌        | ❌      | The metadata program account |
112    /// | 7     | ❌        | ❌      | The system program account   |
113    /// | 8     | ❌        | ❌      | Rent sysvar account          |
114    /// | 9     | ❌        | ✅      | The metadata signer          |
115    UnverifyNft,
116}
117#[allow(missing_docs)]
118pub fn create_mint(
119    accounts: create_mint::Accounts<Pubkey>,
120    params: create_mint::Params,
121) -> Instruction {
122    accounts.get_instruction(crate::ID, ProgramInstruction::CreateMint as u8, params)
123}
124#[allow(missing_docs)]
125pub fn create_nft(
126    accounts: create_nft::Accounts<Pubkey>,
127    params: create_nft::Params,
128) -> Instruction {
129    accounts.get_instruction(crate::ID, ProgramInstruction::CreateNft as u8, params)
130}
131#[allow(missing_docs)]
132pub fn redeem_nft(
133    accounts: redeem_nft::Accounts<Pubkey>,
134    params: redeem_nft::Params,
135) -> Instruction {
136    accounts.get_instruction(crate::ID, ProgramInstruction::RedeemNft as u8, params)
137}
138#[allow(missing_docs)]
139pub fn withdraw_tokens(
140    accounts: withdraw_tokens::Accounts<Pubkey>,
141    params: withdraw_tokens::Params,
142) -> Instruction {
143    accounts.get_instruction(crate::ID, ProgramInstruction::WithdrawTokens as u8, params)
144}
145#[allow(missing_docs)]
146pub fn create_collection(
147    accounts: create_collection::Accounts<Pubkey>,
148    params: create_collection::Params,
149) -> Instruction {
150    accounts.get_instruction(
151        crate::ID,
152        ProgramInstruction::CreateCollection as u8,
153        params,
154    )
155}
156#[allow(missing_docs)]
157pub fn edit_data(accounts: edit_data::Accounts<Pubkey>, params: edit_data::Params) -> Instruction {
158    accounts.get_instruction(crate::ID, ProgramInstruction::EditData as u8, params)
159}
160
161#[allow(missing_docs)]
162pub fn unverify_nft(
163    accounts: unverify_nft::Accounts<Pubkey>,
164    params: unverify_nft::Params,
165) -> Instruction {
166    accounts.get_instruction(crate::ID, ProgramInstruction::UnverifyNft as u8, params)
167}