rango_sdk/check/
status.rs1use serde::{Deserialize, Serialize};
2
3use crate::{error::SdkErr, quote::Token};
4
5use super::is_approved::TransactionStatus;
6#[derive(Debug, Deserialize, Serialize)]
7#[serde(rename_all = "camelCase")]
8pub struct StatusRequest {
9 pub request_id: String,
10 pub tx_id: String,
11}
12
13impl StatusRequest {
14 pub fn into_qs(&self) -> Result<String, SdkErr> {
15 let qs: String = serde_urlencoded::to_string(self)?;
16 Ok(qs)
17 }
18}
19
20#[derive(Debug, Deserialize)]
21#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
22pub enum StatusOutputType {
23 RevertedToInput,
24 MiddleAssetInSrc,
25 MiddleAssetInDest,
26 DesiredOutput,
27}
28
29#[derive(Debug, Deserialize)]
30#[serde(rename_all = "camelCase")]
31pub struct StatusOutput {
32 pub amount: String,
33 pub received_token: Token,
34 pub r#type: StatusOutputType,
35}
36
37#[derive(Debug, Deserialize)]
38#[serde(rename_all = "camelCase")]
39pub struct SwapExplorerUrl {
40 pub description: Option<String>,
41 pub url: String,
42}
43
44#[derive(Debug, Deserialize)]
45#[serde(rename_all = "camelCase")]
46pub struct BridgeData {
47 pub src_chain_id: u32,
48 pub src_tx_hash: Option<String>,
49 pub src_token: Option<String>,
50 pub src_token_amt: String,
51 pub src_token_decimals: u32,
52 pub src_token_price: Option<String>,
53 pub dest_chain_id: u32,
54 pub dest_tx_hash: Option<String>,
55 pub dest_token: Option<String>,
56 pub dest_token_amt: Option<String>,
57 pub dest_token_decimals: u32,
58 pub dest_token_price: Option<String>,
59}
60
61#[derive(Debug, Deserialize)]
62#[serde(rename_all = "camelCase")]
63pub struct StatusResponse {
64 pub status: Option<TransactionStatus>,
65 pub error: Option<String>,
66 pub output: Option<StatusOutput>,
67 pub explorer_url: Option<Vec<SwapExplorerUrl>>,
68 pub bridge_data: Option<BridgeData>,
69}