use cleanup

This commit is contained in:
Solana Maintainers 2021-05-04 09:30:37 -07:00 committed by Michael Vines
parent d9fd11a8f3
commit 512497aa39
5 changed files with 49 additions and 39 deletions

View File

@ -1,9 +1,11 @@
use crate::error::NameServiceError; use {
use crate::processor::Processor; crate::error::NameServiceError,
use num_traits::FromPrimitive; crate::processor::Processor,
use solana_program::{ num_traits::FromPrimitive,
account_info::AccountInfo, decode_error::DecodeError, entrypoint, entrypoint::ProgramResult, solana_program::{
msg, program_error::PrintProgramError, pubkey::Pubkey, account_info::AccountInfo, decode_error::DecodeError, entrypoint,
entrypoint::ProgramResult, msg, program_error::PrintProgramError, pubkey::Pubkey,
},
}; };
entrypoint!(process_instruction); entrypoint!(process_instruction);

View File

@ -1,10 +1,12 @@
use num_derive::FromPrimitive; use {
use solana_program::{decode_error::DecodeError, program_error::ProgramError}; num_derive::FromPrimitive,
use thiserror::Error; solana_program::{decode_error::DecodeError, program_error::ProgramError},
thiserror::Error,
};
#[derive(Clone, Debug, Eq, Error, FromPrimitive, PartialEq)] #[derive(Clone, Debug, Eq, Error, FromPrimitive, PartialEq)]
pub enum NameServiceError { pub enum NameServiceError {
#[error("Out of space.")] #[error("Out of space")]
OutOfSpace, OutOfSpace,
} }

View File

@ -1,9 +1,11 @@
use borsh::{BorshDeserialize, BorshSerialize}; use {
use solana_program::{ borsh::{BorshDeserialize, BorshSerialize},
instruction::{AccountMeta, Instruction}, solana_program::{
program_error::ProgramError, instruction::{AccountMeta, Instruction},
pubkey::Pubkey, program_error::ProgramError,
system_program, pubkey::Pubkey,
system_program,
},
}; };
/// Instructions supported by the generic Name Registry program /// Instructions supported by the generic Name Registry program
@ -26,7 +28,7 @@ pub enum NameRegistryInstruction {
/// 3. `[]` Account owner (written into `NameRecordHeader::owner`) /// 3. `[]` Account owner (written into `NameRecordHeader::owner`)
/// 4. `[signer]` Account class (written into `NameRecordHeader::class`). /// 4. `[signer]` Account class (written into `NameRecordHeader::class`).
/// If `Pubkey::default()` then the `signer` bit is not required /// If `Pubkey::default()` then the `signer` bit is not required
/// 5. `[]` Parent name record (written into `NameRecordHeader::parent_name). `Pubkey::default()` is equivalent to no existing parent. /// 5. `[]` Parent name record (written into `NameRecordHeader::parent_name). `Pubkey::default()` is equivalent to no existing parent.
/// 6. `[signer]` Owner of the parent name record. Optional but needed if parent name different than default. /// 6. `[signer]` Owner of the parent name record. Optional but needed if parent name different than default.
/// ///
Create { Create {

View File

@ -1,18 +1,20 @@
use crate::{ use {
instruction::NameRegistryInstruction, crate::{
state::get_seeds_and_key, instruction::NameRegistryInstruction,
state::{write_data, NameRecordHeader}, state::get_seeds_and_key,
}; state::{write_data, NameRecordHeader},
use borsh::BorshDeserialize; },
use solana_program::{ borsh::BorshDeserialize,
account_info::{next_account_info, AccountInfo}, solana_program::{
entrypoint::ProgramResult, account_info::{next_account_info, AccountInfo},
msg, entrypoint::ProgramResult,
program::{invoke, invoke_signed}, msg,
program_error::ProgramError, program::{invoke, invoke_signed},
program_pack::Pack, program_error::ProgramError,
pubkey::Pubkey, program_pack::Pack,
system_instruction, pubkey::Pubkey,
system_instruction,
},
}; };
pub struct Processor {} pub struct Processor {}

View File

@ -1,10 +1,12 @@
use borsh::{BorshDeserialize, BorshSerialize}; use {
use solana_program::{ borsh::{BorshDeserialize, BorshSerialize},
account_info::AccountInfo, solana_program::{
msg, account_info::AccountInfo,
program_error::ProgramError, msg,
program_pack::{IsInitialized, Pack, Sealed}, program_error::ProgramError,
pubkey::Pubkey, program_pack::{IsInitialized, Pack, Sealed},
pubkey::Pubkey,
},
}; };
/// The data for a Name Registry account is always prefixed a `NameRecordHeader` structure. /// The data for a Name Registry account is always prefixed a `NameRecordHeader` structure.