Instruction name swap

* Instruction -> GenericInstruction
* Instruction<u8, u8> -> CompiledInstruction
* Instruction<Pubkey, (Pubkey, bool)> -> Instruction
This commit is contained in:
Greg Fitzgerald
2019-03-15 09:47:25 -06:00
parent 66fb1bbb2e
commit 968022a1b0
13 changed files with 97 additions and 94 deletions

View File

@ -1,7 +1,7 @@
use crate::id;
use serde_derive::{Deserialize, Serialize};
use solana_sdk::pubkey::Pubkey;
use solana_sdk::transaction_builder::BuilderInstruction;
use solana_sdk::transaction::Instruction;
#[derive(Serialize, Default, Deserialize, Debug, PartialEq, Eq, Clone)]
pub struct Vote {
@ -32,34 +32,31 @@ pub enum VoteInstruction {
}
impl VoteInstruction {
pub fn new_clear_credits(vote_id: &Pubkey) -> BuilderInstruction {
BuilderInstruction::new(id(), &VoteInstruction::ClearCredits, vec![(*vote_id, true)])
pub fn new_clear_credits(vote_id: &Pubkey) -> Instruction {
Instruction::new(id(), &VoteInstruction::ClearCredits, vec![(*vote_id, true)])
}
pub fn new_delegate_stake(vote_id: &Pubkey, delegate_id: &Pubkey) -> BuilderInstruction {
BuilderInstruction::new(
pub fn new_delegate_stake(vote_id: &Pubkey, delegate_id: &Pubkey) -> Instruction {
Instruction::new(
id(),
&VoteInstruction::DelegateStake(*delegate_id),
vec![(*vote_id, true)],
)
}
pub fn new_authorize_voter(
vote_id: &Pubkey,
authorized_voter_id: &Pubkey,
) -> BuilderInstruction {
BuilderInstruction::new(
pub fn new_authorize_voter(vote_id: &Pubkey, authorized_voter_id: &Pubkey) -> Instruction {
Instruction::new(
id(),
&VoteInstruction::AuthorizeVoter(*authorized_voter_id),
vec![(*vote_id, true)],
)
}
pub fn new_initialize_account(vote_id: &Pubkey) -> BuilderInstruction {
BuilderInstruction::new(
pub fn new_initialize_account(vote_id: &Pubkey) -> Instruction {
Instruction::new(
id(),
&VoteInstruction::InitializeAccount,
vec![(*vote_id, false)],
)
}
pub fn new_vote(vote_id: &Pubkey, vote: Vote) -> BuilderInstruction {
BuilderInstruction::new(id(), &VoteInstruction::Vote(vote), vec![(*vote_id, true)])
pub fn new_vote(vote_id: &Pubkey, vote: Vote) -> Instruction {
Instruction::new(id(), &VoteInstruction::Vote(vote), vec![(*vote_id, true)])
}
}