Add TransactionBuilder

This commit is contained in:
Greg Fitzgerald
2019-02-28 04:48:44 -07:00
parent 4610706d9f
commit 404aa63147
7 changed files with 289 additions and 45 deletions

View File

@ -1,4 +1,6 @@
use crate::pubkey::Pubkey;
use crate::system_program;
use crate::transaction_builder::BuilderInstruction;
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq)]
pub enum SystemInstruction {
@ -21,3 +23,13 @@ pub enum SystemInstruction {
/// * Transaction::keys[1] - destination
Move { tokens: u64 },
}
impl SystemInstruction {
pub fn new_move(from_id: Pubkey, to_id: Pubkey, tokens: u64) -> BuilderInstruction {
BuilderInstruction::new(
system_program::id(),
&SystemInstruction::Move { tokens },
vec![(from_id, true), (to_id, false)],
)
}
}