Remove Instruction wrapper structs and name functions after enum fields

This commit is contained in:
Greg Fitzgerald
2019-04-03 09:45:57 -06:00
committed by Grimes
parent 867f6f107b
commit 35298e01a8
53 changed files with 835 additions and 922 deletions

View File

@ -16,7 +16,7 @@ use solana_sdk::message::Message;
use solana_sdk::packet::PACKET_DATA_SIZE;
use solana_sdk::pubkey::Pubkey;
use solana_sdk::signature::{Keypair, KeypairUtil};
use solana_sdk::system_instruction::SystemInstruction;
use solana_sdk::system_instruction;
use solana_sdk::transaction::Transaction;
use std::io;
use std::io::{Error, ErrorKind};
@ -127,7 +127,7 @@ impl Drone {
info!("Requesting airdrop of {} to {:?}", lamports, to);
let create_instruction = SystemInstruction::new_user_account(
let create_instruction = system_instruction::create_user_account(
&self.mint_keypair.pubkey(),
&to,
lamports,
@ -285,6 +285,7 @@ pub fn run_local_drone(mint_keypair: Keypair, sender: Sender<SocketAddr>) {
mod tests {
use super::*;
use bytes::BufMut;
use solana_sdk::system_instruction::SystemInstruction;
use std::time::Duration;
#[test]
@ -394,7 +395,7 @@ mod tests {
let keypair = Keypair::new();
let expected_instruction =
SystemInstruction::new_user_account(&keypair.pubkey(), &to, lamports);
system_instruction::create_user_account(&keypair.pubkey(), &to, lamports);
let message = Message::new(vec![expected_instruction]);
let expected_tx = Transaction::new(&[&keypair], message, blockhash);
let expected_bytes = serialize(&expected_tx).unwrap();

View File

@ -1,7 +1,7 @@
use solana_sdk::hash::Hash;
use solana_sdk::pubkey::Pubkey;
use solana_sdk::signature::{Keypair, KeypairUtil};
use solana_sdk::system_transaction::SystemTransaction;
use solana_sdk::system_transaction;
use solana_sdk::transaction::Transaction;
use std::io::{Error, ErrorKind};
use std::net::SocketAddr;
@ -18,6 +18,6 @@ pub fn request_airdrop_transaction(
let key = Keypair::new();
let to = Pubkey::new_rand();
let blockhash = Hash::default();
let tx = SystemTransaction::new_user_account(&key, &to, lamports, blockhash, 0);
let tx = system_transaction::create_user_account(&key, &to, lamports, blockhash, 0);
Ok(tx)
}

View File

@ -3,7 +3,7 @@ use solana_sdk::hash::Hash;
use solana_sdk::message::Message;
use solana_sdk::pubkey::Pubkey;
use solana_sdk::signature::{Keypair, KeypairUtil};
use solana_sdk::system_instruction::SystemInstruction;
use solana_sdk::system_instruction;
use solana_sdk::transaction::Transaction;
use std::sync::mpsc::channel;
@ -13,7 +13,8 @@ fn test_local_drone() {
let to = Pubkey::new_rand();
let lamports = 50;
let blockhash = Hash::new(&to.as_ref());
let create_instruction = SystemInstruction::new_user_account(&keypair.pubkey(), &to, lamports);
let create_instruction =
system_instruction::create_user_account(&keypair.pubkey(), &to, lamports);
let message = Message::new(vec![create_instruction]);
let expected_tx = Transaction::new(&[&keypair], message, blockhash);