Move mock request_airdrop_transaction into drone/, closer to the real impl
This commit is contained in:
23
drone/src/drone_mock.rs
Normal file
23
drone/src/drone_mock.rs
Normal file
@ -0,0 +1,23 @@
|
||||
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::transaction::Transaction;
|
||||
use std::io::{Error, ErrorKind};
|
||||
use std::net::SocketAddr;
|
||||
|
||||
pub fn request_airdrop_transaction(
|
||||
_drone_addr: &SocketAddr,
|
||||
_id: &Pubkey,
|
||||
lamports: u64,
|
||||
_blockhash: Hash,
|
||||
) -> Result<Transaction, Error> {
|
||||
if lamports == 0 {
|
||||
Err(Error::new(ErrorKind::Other, "Airdrop failed"))?
|
||||
}
|
||||
let key = Keypair::new();
|
||||
let to = Keypair::new().pubkey();
|
||||
let blockhash = Hash::default();
|
||||
let tx = SystemTransaction::new_account(&key, &to, lamports, blockhash, 0);
|
||||
Ok(tx)
|
||||
}
|
@ -1 +1,2 @@
|
||||
pub mod drone;
|
||||
pub mod drone_mock;
|
||||
|
Reference in New Issue
Block a user