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
43
44
45
46
47
use crate::core_types::{Coin, Msg};
use serde::{Deserialize, Serialize};
#[derive(Deserialize, Serialize, Debug)]
#[allow(missing_docs)]
pub struct MsgSend2 {
pub(crate) amount: Vec<Coin>,
pub(crate) from_address: String,
pub(crate) to_address: String,
}
#[derive(Deserialize, Serialize, Debug)]
pub struct MsgSend {
#[allow(missing_docs)]
#[serde(rename = "type")]
stype: String,
#[allow(missing_docs)]
value: MsgSend2,
}
impl Msg for MsgSend {}
impl MsgSend {
pub fn create_single(from_address: String, to_address: String, amount: Coin) -> MsgSend {
let msg = MsgSend2 {
from_address,
to_address,
amount: vec![amount],
};
MsgSend {
stype: String::from("bank/MsgSend"),
value: msg,
}
}
pub fn create(from_address: String, to_address: String, amount: Vec<Coin>) -> MsgSend {
let msg = MsgSend2 {
from_address,
to_address,
amount,
};
MsgSend {
stype: String::from("bank/MsgSend"),
value: msg,
}
}
}