@@ -4,19 +4,21 @@ use axum::{extract::State, Json};
4
4
use axum_macros:: debug_handler;
5
5
use namada_sdk:: {
6
6
args:: InputAmount ,
7
- core:: types:: {
8
- address:: Address ,
9
- masp:: { TransferSource , TransferTarget } ,
10
- } ,
11
7
rpc,
12
8
signing:: default_sign,
13
9
tendermint:: abci:: Code ,
10
+ tx:: data:: ResultCode ,
11
+ types:: {
12
+ address:: Address ,
13
+ masp:: { TransferSource , TransferTarget } ,
14
+ } ,
14
15
Namada ,
15
- core:: types:: transaction:: ResultCode
16
16
} ;
17
17
18
18
use crate :: {
19
- dto:: faucet:: { FaucetRequestDto , FaucetResponseDto , FaucetResponseStatusDto , FaucetSettingResponse } ,
19
+ dto:: faucet:: {
20
+ FaucetRequestDto , FaucetResponseDto , FaucetResponseStatusDto , FaucetSettingResponse ,
21
+ } ,
20
22
error:: { api:: ApiError , faucet:: FaucetError , validate:: ValidatedRequest } ,
21
23
repository:: faucet:: FaucetRepositoryTrait ,
22
24
state:: faucet:: FaucetState ,
@@ -32,7 +34,10 @@ pub async fn faucet_settings(
32
34
chain_id : state. chain_id ,
33
35
start_at : state. chain_start ,
34
36
withdraw_limit : state. withdraw_limit ,
35
- tokens_alias_to_address : HashMap :: from ( [ ( "NAM" . to_string ( ) , nam_token_address. to_string ( ) ) ] )
37
+ tokens_alias_to_address : HashMap :: from ( [ (
38
+ "NAM" . to_string ( ) ,
39
+ nam_token_address. to_string ( ) ,
40
+ ) ] ) ,
36
41
} ;
37
42
38
43
Ok ( Json ( response) )
@@ -58,7 +63,7 @@ pub async fn request_transfer(
58
63
let auth_key: String = state. auth_key . clone ( ) ;
59
64
60
65
if payload. transfer . amount > state. withdraw_limit {
61
- return Err ( FaucetError :: InvalidWithdrawLimit ( state. withdraw_limit ) . into ( ) )
66
+ return Err ( FaucetError :: InvalidWithdrawLimit ( state. withdraw_limit ) . into ( ) ) ;
62
67
}
63
68
64
69
let token_address = Address :: decode ( payload. transfer . token . clone ( ) ) ;
@@ -133,7 +138,9 @@ pub async fn request_transfer(
133
138
134
139
let ( transfer_result, tx_hash) = if let Ok ( response) = process_tx_response {
135
140
match response {
136
- namada_sdk:: tx:: ProcessTxResponse :: Applied ( r) => ( r. code . eq ( & ResultCode :: Ok ) , Some ( r. hash ) ) ,
141
+ namada_sdk:: tx:: ProcessTxResponse :: Applied ( r) => {
142
+ ( r. code . eq ( & ResultCode :: Ok ) , Some ( r. hash ) )
143
+ }
137
144
namada_sdk:: tx:: ProcessTxResponse :: Broadcast ( r) => {
138
145
( r. code . eq ( & Code :: Ok ) , Some ( r. hash . to_string ( ) ) )
139
146
}
0 commit comments