Add native program account constructor
This commit is contained in:
@ -1,3 +1,4 @@
|
||||
use crate::account::Account;
|
||||
use crate::pubkey::Pubkey;
|
||||
|
||||
pub const NATIVE_LOADER_PROGRAM_ID: [u8; 32] = [
|
||||
@ -11,3 +12,14 @@ pub fn id() -> Pubkey {
|
||||
pub fn check_id(program_id: &Pubkey) -> bool {
|
||||
program_id.as_ref() == NATIVE_LOADER_PROGRAM_ID
|
||||
}
|
||||
|
||||
/// Create an executable account owned by the given program_id and shared object name.
|
||||
pub fn create_program_account(program_id: Pubkey, name: &str) -> Account {
|
||||
Account {
|
||||
tokens: 1,
|
||||
owner: program_id,
|
||||
userdata: name.as_bytes().to_vec(),
|
||||
executable: true,
|
||||
loader: id(),
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user