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
48
use ethereum_types::{H160, U256};

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct AsyncTxn {
	pub seq_number: u64,
	pub txn_type: TxnType,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum TxnType {
	SignWithdraw(Vec<u8>),
	SignMintCml(Vec<u8>),
	SendWithdraw {
		records: Vec<u8>,
		signatures: Vec<u8>,
		nonce: U256,
	},
	SendMintCml {
		records: Vec<u8>,
		signatures: Vec<u8>,
		nonce: U256,
	},
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct UnlockRecordTrans {
	pub token: H160,
	pub recipient: H160,
	pub amount: U256,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct MintCmlRecordTrans {
	pub to: H160,
	pub uri: String,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct SingleSign {
	pub signature: Vec<u8>,
	pub nonce: U256,
}

impl SingleSign {
	pub fn new(signature: Vec<u8>, nonce: U256) -> Self {
		Self { signature, nonce }
	}
}