bybit/models/withdraw_request.rs
1use crate::prelude::*;
2
3/// Request for creating a withdrawal
4#[derive(Debug, Serialize, Deserialize, Clone)]
5pub struct WithdrawRequest<'a> {
6 /// Coin, uppercase only
7 pub coin: &'a str,
8
9 /// Chain
10 /// - `forceChain`=0 or 1: this field is **required**
11 /// - `forceChain`=2: this field can be null
12 #[serde(skip_serializing_if = "Option::is_none")]
13 pub chain: Option<&'a str>,
14
15 /// Address
16 /// - `forceChain`=0 or 1: fill wallet address, and make sure you add address in the address book first.
17 /// Please note that the address is case sensitive, so use the exact same address added in address book
18 /// - `forceChain`=2: fill Bybit UID, and it can only be another Bybit **main** account UID.
19 /// Make sure you add UID in the address book first
20 pub address: &'a str,
21
22 /// Tag
23 /// - **Required** if tag exists in the wallet address list.
24 /// - **Note**: please do not set a tag/memo in the address book if the chain does not support tag
25 #[serde(skip_serializing_if = "Option::is_none")]
26 pub tag: Option<&'a str>,
27
28 /// Withdraw amount
29 pub amount: &'a str,
30
31 /// Current timestamp (ms). Used for preventing from withdraw replay
32 pub timestamp: u64,
33
34 /// Whether or not to force an on-chain withdrawal
35 /// - `0`(default): If the address is parsed out to be an internal address, then internal transfer (**Bybit main account only**)
36 /// - `1`: Force the withdrawal to occur on-chain
37 /// - `2`: Use UID to withdraw
38 #[serde(rename = "forceChain", skip_serializing_if = "Option::is_none")]
39 pub force_chain: Option<i32>,
40
41 /// Select the wallet to be withdrawn from
42 /// - `FUND`: Funding wallet
43 /// - `UTA`: System transfers the funds to Funding wallet to withdraw
44 /// - `FUND,UTA`: For combo withdrawals, funds will be deducted from the Funding wallet first.
45 /// If the balance is insufficient, the remaining amount will be deducted from the UTA wallet.
46 #[serde(rename = "accountType")]
47 pub account_type: &'a str,
48
49 /// Handling fee option
50 /// - `0`(default): input amount is the actual amount received, so you have to calculate handling fee manually
51 /// - `1`: input amount is not the actual amount you received, the system will help to deduct the handling fee automatically
52 #[serde(rename = "feeType", skip_serializing_if = "Option::is_none")]
53 pub fee_type: Option<i32>,
54
55 /// Customised ID, globally unique, it is used for idempotent verification
56 /// - A combination of letters (case sensitive) and numbers, which can be pure letters or pure numbers
57 /// and the length must be between 1 and 32 digits
58 #[serde(rename = "requestId", skip_serializing_if = "Option::is_none")]
59 pub request_id: Option<&'a str>,
60
61 /// Travel rule info. It is required for kyc/kyb=KOR (Korean), kyc=IND (India) users,
62 /// and users who registered in Bybit Turkey(TR), Bybit Kazakhstan(KZ), Bybit Indonesia (ID)
63 #[serde(skip_serializing_if = "Option::is_none")]
64 pub beneficiary: Option<BeneficiaryInfo<'a>>,
65}
66
67/// Travel rule beneficiary information
68#[derive(Debug, Serialize, Deserialize, Clone)]
69pub struct BeneficiaryInfo<'a> {
70 /// Purpose of the withdrawal transaction, Required when KR users withdraw funds to a company via Korean CODE channel
71 #[serde(
72 rename = "beneficiaryTransactionPurpose",
73 skip_serializing_if = "Option::is_none"
74 )]
75 pub beneficiary_transaction_purpose: Option<&'a str>,
76
77 /// First name of the beneficiary company's representative, Required when KR users withdraw funds to a company via Korean CODE channel
78 #[serde(
79 rename = "beneficiaryRepresentativeFirstName",
80 skip_serializing_if = "Option::is_none"
81 )]
82 pub beneficiary_representative_first_name: Option<&'a str>,
83
84 /// Last name of the beneficiary company's representative, Required when KR users withdraw funds to a company via Korean CODE channel
85 #[serde(
86 rename = "beneficiaryRepresentativeLastName",
87 skip_serializing_if = "Option::is_none"
88 )]
89 pub beneficiary_representative_last_name: Option<&'a str>,
90
91 /// Receiver exchange entity Id. Please call this endpoint to get this ID.
92 /// - Required param for Korean users
93 /// - Ignored by TR, KZ users
94 #[serde(rename = "vaspEntityId", skip_serializing_if = "Option::is_none")]
95 pub vasp_entity_id: Option<&'a str>,
96
97 /// Receiver exchange user KYC name
98 /// Rules for Korean users:
99 /// - Please refer to target exchange kyc name
100 /// - When vaspEntityId="others", this field can be null
101 /// Rules for TR, KZ, kyc=IND users: it is a required param, fill with individual name or company name
102 #[serde(rename = "beneficiaryName", skip_serializing_if = "Option::is_none")]
103 pub beneficiary_name: Option<&'a str>,
104
105 /// Beneficiary legal type, `individual`(default), `company`
106 /// - Required param for TR, KZ, kyc=IND users
107 /// - Korean users can ignore
108 #[serde(
109 rename = "beneficiaryLegalType",
110 skip_serializing_if = "Option::is_none"
111 )]
112 pub beneficiary_legal_type: Option<&'a str>,
113
114 /// Beneficiary wallet type, `0`: custodial/exchange wallet (default), `1`: non custodial/exchange wallet
115 /// - Required param for TR, KZ, kyc=IND users
116 /// - Korean users can ignore
117 #[serde(
118 rename = "beneficiaryWalletType",
119 skip_serializing_if = "Option::is_none"
120 )]
121 pub beneficiary_wallet_type: Option<&'a str>,
122
123 /// Beneficiary unhosted wallet type, `0`: Your own wallet, `1`: others' wallet
124 /// - Required param for TR, KZ, kyc=IND users when "beneficiaryWalletType=1"
125 /// - Korean users can ignore
126 #[serde(
127 rename = "beneficiaryUnhostedWalletType",
128 skip_serializing_if = "Option::is_none"
129 )]
130 pub beneficiary_unhosted_wallet_type: Option<&'a str>,
131
132 /// Beneficiary document number
133 /// - Required param for TR, KZ users
134 /// - Korean users can ignore
135 #[serde(
136 rename = "beneficiaryPoiNumber",
137 skip_serializing_if = "Option::is_none"
138 )]
139 pub beneficiary_poi_number: Option<&'a str>,
140
141 /// Beneficiary document type
142 /// - Required param for TR, KZ users: ID card, Passport, driver license, residence permit, Business ID, etc
143 /// - Korean users can ignore
144 #[serde(rename = "beneficiaryPoiType", skip_serializing_if = "Option::is_none")]
145 pub beneficiary_poi_type: Option<&'a str>,
146
147 /// Beneficiary document issuing country
148 /// - Required param for TR, KZ users: refer to Alpha-3 country code
149 /// - Korean users can ignore
150 #[serde(
151 rename = "beneficiaryPoiIssuingCountry",
152 skip_serializing_if = "Option::is_none"
153 )]
154 pub beneficiary_poi_issuing_country: Option<&'a str>,
155
156 /// Beneficiary document expiry date
157 /// - Required param for TR, KZ users: yyyy-mm-dd format, e.g., "1990-02-15"
158 /// - Korean users can ignore
159 #[serde(
160 rename = "beneficiaryPoiExpiredDate",
161 skip_serializing_if = "Option::is_none"
162 )]
163 pub beneficiary_poi_expired_date: Option<&'a str>,
164
165 /// Beneficiary country
166 /// - Required param for UAE users only, e.g.,`IDN`
167 #[serde(
168 rename = "beneficiaryAddressCountry",
169 skip_serializing_if = "Option::is_none"
170 )]
171 pub beneficiary_address_country: Option<&'a str>,
172
173 /// Beneficiary state
174 /// - Required param for UAE users only, e.g., "ABC"
175 #[serde(
176 rename = "beneficiaryAddressState",
177 skip_serializing_if = "Option::is_none"
178 )]
179 pub beneficiary_address_state: Option<&'a str>,
180
181 /// Beneficiary city
182 /// - Required param for UAE users only, e.g., "Jakarta"
183 #[serde(
184 rename = "beneficiaryAddressCity",
185 skip_serializing_if = "Option::is_none"
186 )]
187 pub beneficiary_address_city: Option<&'a str>,
188
189 /// Beneficiary building address
190 /// - Required param for UAE users only
191 #[serde(
192 rename = "beneficiaryAddressBuilding",
193 skip_serializing_if = "Option::is_none"
194 )]
195 pub beneficiary_address_building: Option<&'a str>,
196
197 /// Beneficiary street address
198 /// - Required param for UAE users only
199 #[serde(
200 rename = "beneficiaryAddressStreet",
201 skip_serializing_if = "Option::is_none"
202 )]
203 pub beneficiary_address_street: Option<&'a str>,
204
205 /// Beneficiary address post code
206 /// - Required param for UAE users only
207 #[serde(
208 rename = "beneficiaryAddressPostalCode",
209 skip_serializing_if = "Option::is_none"
210 )]
211 pub beneficiary_address_postal_code: Option<&'a str>,
212
213 /// Beneficiary date of birth
214 /// - Required param for UAE users only
215 #[serde(
216 rename = "beneficiaryDateOfBirth",
217 skip_serializing_if = "Option::is_none"
218 )]
219 pub beneficiary_date_of_birth: Option<&'a str>,
220
221 /// Beneficiary birth place
222 /// - Required param for UAE users only
223 #[serde(
224 rename = "beneficiaryPlaceOfBirth",
225 skip_serializing_if = "Option::is_none"
226 )]
227 pub beneficiary_place_of_birth: Option<&'a str>,
228}