Add next_keyed_account() to instruction_processor_utils (#6309)
* Cleanup KeyedArguments traversal * Better error message * Fix clippy warning * Rename next_arg to next_keyed_account * Fix clippy warning * Shorter
This commit is contained in:
@ -67,6 +67,9 @@ pub enum InstructionError {
|
||||
/// Rent_epoch account changed, but shouldn't have
|
||||
RentEpochModified,
|
||||
|
||||
/// The instruction expected additional account keys
|
||||
NotEnoughAccountKeys,
|
||||
|
||||
/// CustomError allows on-chain programs to implement program-specific error types and see
|
||||
/// them returned by the Solana runtime. A CustomError may be any type that is represented
|
||||
/// as or serialized to a u32 integer.
|
||||
|
@ -38,6 +38,11 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
/// Return the next KeyedAccount or a NotEnoughAccountKeys instruction error
|
||||
pub fn next_keyed_account<I: Iterator>(iter: &mut I) -> Result<I::Item, InstructionError> {
|
||||
iter.next().ok_or(InstructionError::NotEnoughAccountKeys)
|
||||
}
|
||||
|
||||
pub trait DecodeError<E> {
|
||||
fn decode_custom_error_to_enum(custom: u32) -> Option<E>
|
||||
where
|
||||
|
Reference in New Issue
Block a user