|
17 | 17 | SubmitDepositTransactionResponse, |
18 | 18 | SubmitWithdrawalTransactionResponse, |
19 | 19 | ) |
20 | | -from deltadefi.responses.accounts import GetOperationKeyResponse |
| 20 | +from deltadefi.responses.accounts import ( |
| 21 | + BuildTransferalTransactionResponse, |
| 22 | + GetOperationKeyResponse, |
| 23 | + SubmitTransferalTransactionResponse, |
| 24 | +) |
21 | 25 |
|
22 | 26 |
|
23 | 27 | class Accounts(API): |
@@ -147,6 +151,31 @@ def build_withdrawal_transaction( |
147 | 151 | url_path = "/withdrawal/build" |
148 | 152 | return self.send_request("POST", self.group_url_path + url_path, payload) |
149 | 153 |
|
| 154 | + def build_transferal_transaction( |
| 155 | + self, transferal_amount: List[Asset], to_address: str, **kwargs |
| 156 | + ) -> BuildTransferalTransactionResponse: |
| 157 | + """ |
| 158 | + Build a transferal transaction. |
| 159 | +
|
| 160 | + Args: |
| 161 | + data: A BuildTransferalTransactionRequest object containing the transferal transaction details. |
| 162 | +
|
| 163 | + Returns: |
| 164 | + A BuildTransferalTransactionResponse object containing the built transferal transaction. |
| 165 | + """ |
| 166 | + |
| 167 | + check_required_parameter( |
| 168 | + transferal_amount, "transferal_amount", to_address, "to_address" |
| 169 | + ) |
| 170 | + payload = { |
| 171 | + "transferal_amount": transferal_amount, |
| 172 | + "to_address": to_address, |
| 173 | + **kwargs, |
| 174 | + } |
| 175 | + |
| 176 | + url_path = "/transferal/build" |
| 177 | + return self.send_request("POST", self.group_url_path + url_path, payload) |
| 178 | + |
150 | 179 | def submit_deposit_transaction( |
151 | 180 | self, signed_tx: str, **kwargs |
152 | 181 | ) -> SubmitDepositTransactionResponse: |
@@ -184,3 +213,22 @@ def submit_withdrawal_transaction( |
184 | 213 |
|
185 | 214 | url_path = "/withdrawal/submit" |
186 | 215 | return self.send_request("POST", self.group_url_path + url_path, payload) |
| 216 | + |
| 217 | + def submit_transferal_transaction( |
| 218 | + self, signed_tx: str, **kwargs |
| 219 | + ) -> SubmitTransferalTransactionResponse: |
| 220 | + """ |
| 221 | + Submit a transferal transaction. |
| 222 | +
|
| 223 | + Args: |
| 224 | + data: A SubmitTransferalTransactionRequest object containing the transferal transaction details. |
| 225 | +
|
| 226 | + Returns: |
| 227 | + A SubmitTransferalTransactionResponse object containing the submitted transferal transaction. |
| 228 | + """ |
| 229 | + |
| 230 | + check_required_parameter(signed_tx, "signed_tx") |
| 231 | + payload = {"signed_tx": signed_tx, **kwargs} |
| 232 | + |
| 233 | + url_path = "/transferal/submit" |
| 234 | + return self.send_request("POST", self.group_url_path + url_path, payload) |
0 commit comments