zksync_web3_rs/zks_wallet/requests/
transfer_request.rs1use ethers::types::{Address, Eip1559TransactionRequest, U256};
2use std::fmt::Debug;
3
4#[derive(Clone, Debug)]
5pub struct TransferRequest {
6 pub amount: U256,
7 pub to: Address,
8 pub from: Address,
9}
10
11impl TransferRequest {
12 pub fn new(amount: U256) -> Self {
13 Self {
14 amount,
15 to: Default::default(),
16 from: Default::default(),
17 }
18 }
19
20 pub fn from(mut self, from: Address) -> Self {
21 self.from = from;
22 self
23 }
24
25 pub fn to(mut self, to: Address) -> Self {
26 self.to = to;
27 self
28 }
29
30 pub fn amount(mut self, amount: U256) -> Self {
31 self.amount = amount;
32 self
33 }
34}
35
36impl From<TransferRequest> for Eip1559TransactionRequest {
37 fn from(request: TransferRequest) -> Eip1559TransactionRequest {
38 Eip1559TransactionRequest::new()
39 .to(request.to)
40 .value(request.amount)
41 .from(request.from)
42 }
43}