Move KeyedAccount into Account
Now programs don't need to depend on dynamic_program and its dependencies.
This commit is contained in:
parent
b7ae5b712a
commit
874addc51a
|
@ -2,7 +2,7 @@ extern crate bincode;
|
||||||
extern crate solana;
|
extern crate solana;
|
||||||
|
|
||||||
use bincode::deserialize;
|
use bincode::deserialize;
|
||||||
use solana::dynamic_program::KeyedAccount;
|
use solana::account::KeyedAccount;
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn process(infos: &mut Vec<KeyedAccount>, data: &[u8]) {
|
pub extern "C" fn process(infos: &mut Vec<KeyedAccount>, data: &[u8]) {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
extern crate solana;
|
extern crate solana;
|
||||||
|
|
||||||
use solana::dynamic_program::KeyedAccount;
|
use solana::account::KeyedAccount;
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn process(_infos: &mut Vec<KeyedAccount>, _data: &[u8]) {}
|
pub extern "C" fn process(_infos: &mut Vec<KeyedAccount>, _data: &[u8]) {}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
extern crate solana;
|
extern crate solana;
|
||||||
|
|
||||||
use solana::dynamic_program::KeyedAccount;
|
use solana::account::KeyedAccount;
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn process(infos: &mut Vec<KeyedAccount>, _data: &[u8]) {
|
pub extern "C" fn process(infos: &mut Vec<KeyedAccount>, _data: &[u8]) {
|
||||||
|
|
|
@ -21,3 +21,9 @@ impl Account {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
|
pub struct KeyedAccount<'a> {
|
||||||
|
pub key: &'a Pubkey,
|
||||||
|
pub account: &'a mut Account,
|
||||||
|
}
|
||||||
|
|
|
@ -3,13 +3,13 @@
|
||||||
//! on behalf of the caller, and a low-level API for when they have
|
//! on behalf of the caller, and a low-level API for when they have
|
||||||
//! already been signed and verified.
|
//! already been signed and verified.
|
||||||
|
|
||||||
use account::Account;
|
use account::{Account, KeyedAccount};
|
||||||
use bincode::deserialize;
|
use bincode::deserialize;
|
||||||
use bincode::serialize;
|
use bincode::serialize;
|
||||||
use budget_program::BudgetState;
|
use budget_program::BudgetState;
|
||||||
use budget_transaction::BudgetTransaction;
|
use budget_transaction::BudgetTransaction;
|
||||||
use counter::Counter;
|
use counter::Counter;
|
||||||
use dynamic_program::{DynamicProgram, KeyedAccount};
|
use dynamic_program::DynamicProgram;
|
||||||
use entry::Entry;
|
use entry::Entry;
|
||||||
use hash::{hash, Hash};
|
use hash::{hash, Hash};
|
||||||
use itertools::Itertools;
|
use itertools::Itertools;
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
extern crate bincode;
|
extern crate bincode;
|
||||||
extern crate generic_array;
|
extern crate generic_array;
|
||||||
|
|
||||||
use account::Account;
|
use account::KeyedAccount;
|
||||||
use libc;
|
use libc;
|
||||||
use libloading;
|
use libloading;
|
||||||
use pubkey::Pubkey;
|
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
|
||||||
#[cfg(debug_assertions)]
|
#[cfg(debug_assertions)]
|
||||||
|
@ -40,12 +39,6 @@ fn create_library_path(name: &str) -> PathBuf {
|
||||||
path
|
path
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
|
||||||
pub struct KeyedAccount<'a> {
|
|
||||||
pub key: &'a Pubkey,
|
|
||||||
pub account: &'a mut Account,
|
|
||||||
}
|
|
||||||
|
|
||||||
// All programs export a symbol named process()
|
// All programs export a symbol named process()
|
||||||
const ENTRYPOINT: &str = "process";
|
const ENTRYPOINT: &str = "process";
|
||||||
type Entrypoint = unsafe extern "C" fn(infos: &mut Vec<KeyedAccount>, data: &[u8]);
|
type Entrypoint = unsafe extern "C" fn(infos: &mut Vec<KeyedAccount>, data: &[u8]);
|
||||||
|
|
|
@ -97,9 +97,8 @@ impl SystemProgram {
|
||||||
}
|
}
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test {
|
mod test {
|
||||||
use account::Account;
|
use account::{Account, KeyedAccount};
|
||||||
use bincode::serialize;
|
use bincode::serialize;
|
||||||
use dynamic_program::KeyedAccount;
|
|
||||||
use hash::Hash;
|
use hash::Hash;
|
||||||
use pubkey::Pubkey;
|
use pubkey::Pubkey;
|
||||||
use signature::{Keypair, KeypairUtil};
|
use signature::{Keypair, KeypairUtil};
|
||||||
|
|
Loading…
Reference in New Issue