1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
use crate::{
api::{generated::api::balances::calls::Transfer as TransferCall, signer::Signer},
result::Result,
};
use structopt::StructOpt;
use subxt::{sp_core::crypto::Ss58Codec, sp_runtime::AccountId32};
#[derive(Debug, StructOpt)]
pub struct Transfer {
destination: String,
value: u128,
}
impl Transfer {
pub async fn exec(&self, signer: Signer) -> Result<()> {
let address = signer.signer.account_id();
println!("From: {}", address.to_ss58check());
println!("To: {}", self.destination);
println!("Value: {}", self.value);
signer
.transfer(TransferCall {
dest: AccountId32::from_ss58check(&self.destination)?.into(),
value: self.value,
})
.await?;
Ok(())
}
}