Skip to content

Commit 7d757f0

Browse files
committed
allow transfers on mainnet
1 parent 17b0f9e commit 7d757f0

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

src/subcommands/transfer.rs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,13 @@
11
use crate::workspace::Workspace;
22
use anchor_client::Cluster;
3-
use anyhow::{format_err, Result};
3+
use anyhow::Result;
44

55
pub fn process(workspace: &Workspace, cluster: Cluster, to_raw: &str, amount: &str) -> Result<()> {
6-
if cluster == Cluster::Mainnet {
7-
return Err(format_err!("cannot request an airdrop from mainnet"));
8-
}
9-
106
let ctx = workspace.new_upgrader_context(&cluster);
11-
127
let to = match to_raw {
138
"deployer" => ctx.get_deployer_kp_path().display().to_string(),
149
_ => to_raw.to_string(),
1510
};
16-
1711
ctx.exec_args(&["transfer", &to, amount])?;
18-
1912
Ok(())
2013
}

src/utils.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,3 +106,15 @@ pub fn sha256_digest<R: Read>(reader: &mut R) -> Result<(u64, String)> {
106106
let hash_bytes = hasher.finalize();
107107
Ok((num_bytes, HEXLOWER.encode(hash_bytes.as_ref())))
108108
}
109+
110+
pub fn pause(message: &str) {
111+
let mut stdin = io::stdin();
112+
let mut stdout = io::stdout();
113+
114+
// We want the cursor to stay at the end of the line, so we print without a newline and flush manually.
115+
write!(stdout, "{}", message).unwrap();
116+
stdout.flush().unwrap();
117+
118+
// Read a single byte and discard
119+
let _ = stdin.read(&mut [0u8]).unwrap();
120+
}

0 commit comments

Comments
 (0)