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
pub use crate::processor::{
allocate_and_post_record, allocate_record, delete_record, edit_record, unverify_roa,
validate_ethereum_signature, validate_solana_signature, write_roa,
};
use {
bonfida_utils::InstructionsAccount,
borsh::{BorshDeserialize, BorshSerialize},
num_derive::FromPrimitive,
solana_program::{instruction::Instruction, pubkey::Pubkey},
};
#[allow(missing_docs)]
#[derive(BorshDeserialize, BorshSerialize, FromPrimitive)]
pub enum ProgramInstruction {
/// Allocate record account
///
/// | Index | Writable | Signer | Description |
/// | ------------------------------------------------------------- |
/// | 0 | ❌ | ❌ | The system program account |
/// | 1 | ❌ | ❌ | The SPL token program account |
/// | 2 | ✅ | ✅ | The fee payer account |
/// | 3 | ✅ | ❌ | The record account to create |
/// | 4 | ✅ | ❌ | The domain name owning the record |
/// | 5 | ✅ | ✅ | The domain owner |
/// | 6 | ❌ | ❌ | The SNS Record central state |
AllocateRecord,
/// Allocate record account
///
/// | Index | Writable | Signer | Description |
/// | ----------------------------------------------------------------- |
/// | 0 | ❌ | ❌ | The system program account |
/// | 1 | ❌ | ❌ | The SPL token program account |
/// | 2 | ✅ | ✅ | The fee payer account |
/// | 3 | ✅ | ❌ | The record account to create and post |
/// | 4 | ✅ | ❌ | The domain name owning the record |
/// | 5 | ✅ | ✅ | The domain owner |
/// | 6 | ❌ | ❌ | The SNS Record central state |
AllocateAndPostRecord,
/// Edit the record content
///
/// | Index | Writable | Signer | Description |
/// | --------------------------------------------------------- |
/// | 0 | ❌ | ❌ | The system program account |
/// | 1 | ❌ | ❌ | The SPL token program account |
/// | 2 | ✅ | ✅ | The fee payer account |
/// | 3 | ✅ | ❌ | The record account to edit |
/// | 4 | ✅ | ❌ | |
/// | 5 | ✅ | ✅ | |
/// | 6 | ❌ | ❌ | |
EditRecord,
/// Validate a RoA or Staleness via Solana signature
///
/// | Index | Writable | Signer | Description |
/// | ----------------------------------------------------------------- |
/// | 0 | ❌ | ❌ | The system program account |
/// | 1 | ❌ | ❌ | The SPL token program account |
/// | 2 | ✅ | ✅ | The fee payer account |
/// | 3 | ✅ | ❌ | The record account to create and post |
/// | 4 | ✅ | ❌ | The domain name owning the record |
/// | 5 | ✅ | ❌ | The domain owner |
/// | 6 | ❌ | ❌ | The SNS Record central state |
/// | 7 | ✅ | ✅ | The RoA/Staleness verifier public key |
ValidateSolanaSignature,
/// Validate and ETH signature
///
/// | Index | Writable | Signer | Description |
/// | ----------------------------------------------------------------- |
/// | 0 | ❌ | ❌ | The system program account |
/// | 1 | ❌ | ❌ | The SPL token program account |
/// | 2 | ✅ | ✅ | The fee payer account |
/// | 3 | ✅ | ❌ | The record account to create and post |
/// | 4 | ✅ | ❌ | The domain name owning the record |
/// | 5 | ✅ | ✅ | The domain owner |
/// | 6 | ❌ | ❌ | The SNS Record central state |
ValidateEthereumSignature,
/// Delete a record account
///
/// | Index | Writable | Signer | Description |
/// | ------------------------------------------------------------- |
/// | 0 | ❌ | ❌ | The system program account |
/// | 1 | ❌ | ❌ | The SPL token program account |
/// | 2 | ✅ | ✅ | The fee payer account |
/// | 3 | ✅ | ❌ | The record account to delete |
/// | 4 | ✅ | ❌ | The domain name owning the record |
/// | 5 | ✅ | ✅ | The domain owner |
/// | 6 | ❌ | ❌ | The SNS Record central state |
DeleteRecord,
/// Write a RoA in the record
///
/// | Index | Writable | Signer | Description |
/// | ----------------------------------------------------------------- |
/// | 0 | ❌ | ❌ | The system program account |
/// | 1 | ❌ | ❌ | The SPL token program account |
/// | 2 | ✅ | ✅ | The fee payer account |
/// | 3 | ✅ | ❌ | The record account to create and post |
/// | 4 | ✅ | ❌ | The domain name owning the record |
/// | 5 | ✅ | ✅ | The domain owner |
/// | 6 | ❌ | ❌ | The SNS Record central state |
WriteRoa,
/// Unverify a RoA in the record
///
/// | Index | Writable | Signer | Description |
/// | ----------------------------------------------------------------- |
/// | 0 | ❌ | ❌ | The system program account |
/// | 1 | ❌ | ❌ | The SPL token program account |
/// | 2 | ✅ | ✅ | The fee payer account |
/// | 3 | ✅ | ❌ | The record account to create and post |
/// | 4 | ✅ | ❌ | The domain name owning the record |
/// | 5 | ❌ | ❌ | The SNS Record central state |
/// | 6 | ✅ | ✅ | The current ROA verifier |
UnverifyRoa,
}
#[allow(missing_docs)]
pub fn allocate_record(
accounts: allocate_record::Accounts<Pubkey>,
params: allocate_record::Params,
) -> Instruction {
accounts.get_instruction(crate::ID, ProgramInstruction::AllocateRecord as u8, params)
}
#[allow(missing_docs)]
pub fn allocate_and_post_record(
accounts: allocate_and_post_record::Accounts<Pubkey>,
params: allocate_and_post_record::Params,
) -> Instruction {
accounts.get_instruction(
crate::ID,
ProgramInstruction::AllocateAndPostRecord as u8,
params,
)
}
pub fn edit_record(
accounts: edit_record::Accounts<Pubkey>,
params: edit_record::Params,
) -> Instruction {
accounts.get_instruction(crate::ID, ProgramInstruction::EditRecord as u8, params)
}
pub fn validate_ethereum_signature(
accounts: validate_ethereum_signature::Accounts<Pubkey>,
params: validate_ethereum_signature::Params,
) -> Instruction {
accounts.get_instruction(
crate::ID,
ProgramInstruction::ValidateEthereumSignature as u8,
params,
)
}
pub fn validate_solana_signature(
accounts: validate_solana_signature::Accounts<Pubkey>,
params: validate_solana_signature::Params,
) -> Instruction {
accounts.get_instruction(
crate::ID,
ProgramInstruction::ValidateSolanaSignature as u8,
params,
)
}
pub fn delete_record(
accounts: delete_record::Accounts<Pubkey>,
params: delete_record::Params,
) -> Instruction {
accounts.get_instruction(crate::ID, ProgramInstruction::DeleteRecord as u8, params)
}
pub fn write_roa(accounts: write_roa::Accounts<Pubkey>, params: write_roa::Params) -> Instruction {
accounts.get_instruction(crate::ID, ProgramInstruction::WriteRoa as u8, params)
}
pub fn unverify_roa(
accounts: unverify_roa::Accounts<Pubkey>,
params: unverify_roa::Params,
) -> Instruction {
accounts.get_instruction(crate::ID, ProgramInstruction::UnverifyRoa as u8, params)
}