@@ -111,10 +111,9 @@ pub enum InstructionError {
111
111
UnsupportedSplTokenInstruction ( String ) ,
112
112
InvalidAssociatedTokenAccountInstruction ( String ) ,
113
113
UnsupportedAssociatedTokenAccountInstruction ( AssociatedTokenAccountInstruction ) ,
114
- TransferInstructionNotAllowed ,
115
114
CloseAccountInstructionNotAllowed ,
116
- InvalidTransferInstructionsCount ,
117
- InvalidFromAccountTransferInstruction { expected : Pubkey , found : Pubkey } ,
115
+ InvalidUserTransferInstructionsCount { found : usize } ,
116
+ InvalidUserAccountTransferInstruction ,
118
117
InvalidToAccountTransferInstruction { expected : Pubkey , found : Pubkey } ,
119
118
InvalidAmountTransferInstruction { expected : u64 , found : u64 } ,
120
119
InvalidSyncNativeInstructionCount ( Pubkey ) ,
@@ -129,8 +128,7 @@ pub enum InstructionError {
129
128
InvalidTokenProgramInCreateAtaInstruction { expected : Pubkey , found : Pubkey } ,
130
129
InvalidSystemProgramInCreateAtaInstruction ( Pubkey ) ,
131
130
MissingCreateAtaInstruction ( Pubkey ) ,
132
- InvalidMemoInstructionCount { expected : usize , found : usize } ,
133
- InvalidMemoString { expected : String , found : String } ,
131
+ MissingMemoInstruction { expected : String } ,
134
132
UnapprovedProgramId ( Pubkey ) ,
135
133
}
136
134
@@ -155,21 +153,17 @@ impl std::fmt::Display for InstructionError {
155
153
"Unsupported associated token account instruction {:?}" ,
156
154
instruction
157
155
) ,
158
- InstructionError :: TransferInstructionNotAllowed => {
159
- write ! ( f, "Transfer instruction is not allowed" )
160
- }
161
156
InstructionError :: CloseAccountInstructionNotAllowed => {
162
157
write ! ( f, "Close account instruction is not allowed" )
163
158
}
164
- InstructionError :: InvalidTransferInstructionsCount => {
165
- write ! ( f, "Exactly one sol transfer instruction is required" )
159
+ InstructionError :: InvalidUserTransferInstructionsCount { found } => {
160
+ match found {
161
+ 0 => write ! ( f, "At least one sol transfer instruction from the user wallet account is required" ) ,
162
+ _ => write ! ( f, "Invalid number ({}) of sol transfer instructions from the user wallet account" , found) ,
163
+ }
166
164
}
167
- InstructionError :: InvalidFromAccountTransferInstruction { expected, found } => {
168
- write ! (
169
- f,
170
- "Invalid from account in sol transfer instruction. Expected: {:?} found: {:?}" ,
171
- expected, found
172
- )
165
+ InstructionError :: InvalidUserAccountTransferInstruction => {
166
+ write ! ( f, "Invalid sol transfer instruction from the user account." )
173
167
}
174
168
InstructionError :: InvalidToAccountTransferInstruction { expected, found } => {
175
169
write ! (
@@ -261,18 +255,11 @@ impl std::fmt::Display for InstructionError {
261
255
ata
262
256
)
263
257
}
264
- InstructionError :: InvalidMemoInstructionCount { expected, found } => {
258
+ InstructionError :: MissingMemoInstruction { expected } => {
265
259
write ! (
266
260
f,
267
- "Invalid memo instruction count. Expected: {:?} found: {:?}" ,
268
- expected, found
269
- )
270
- }
271
- InstructionError :: InvalidMemoString { expected, found } => {
272
- write ! (
273
- f,
274
- "Invalid memo string in memo instruction. Expected: {:?} found: {:?}" ,
275
- expected, found
261
+ "Missing memo instruction with string: {:?}" ,
262
+ expected,
276
263
)
277
264
}
278
265
InstructionError :: UnapprovedProgramId ( program_id) => {
0 commit comments