make a withdrawal :param str code: unified currency code :param float amount: the amount to withdraw :param str address: the address to withdraw to :param str [tag]: :param dict [params]: extra parameters specific to the exchange API endpoint
(self, code: str, amount: float, address: str, tag: Str = None, params={})
| 2625 | return self.safe_string(statuses, status, status) |
| 2626 | |
| 2627 | def withdraw(self, code: str, amount: float, address: str, tag: Str = None, params={}) -> Transaction: |
| 2628 | """ |
| 2629 | make a withdrawal |
| 2630 | :param str code: unified currency code |
| 2631 | :param float amount: the amount to withdraw |
| 2632 | :param str address: the address to withdraw to |
| 2633 | :param str [tag]: |
| 2634 | :param dict [params]: extra parameters specific to the exchange API endpoint |
| 2635 | :param str [params.accountIndex]: account index |
| 2636 | :param str [params.apiKeyIndex]: api key index |
| 2637 | :param int [params.routeType]: wallet type, 0: perp, 1: spot, default is 0 |
| 2638 | :returns dict: a `transaction structure <https://docs.ccxt.com/?id=transaction-structure>` |
| 2639 | """ |
| 2640 | self.load_markets() |
| 2641 | apiKeyIndex = None |
| 2642 | apiKeyIndex, params = self.handle_api_key_index(params, 'withdraw', 'apiKeyIndex', 'api_key_index') |
| 2643 | accountIndex = None |
| 2644 | accountIndex, params = self.handle_account_index(params, 'withdraw', 'accountIndex', 'account_index') |
| 2645 | strAccountIndex = self.number_to_string(accountIndex) |
| 2646 | strApiKeyIndex = self.number_to_string(apiKeyIndex) |
| 2647 | signer = self.load_account(self.options['chainId'], self.get_lighter_private_key(strAccountIndex, strApiKeyIndex), strApiKeyIndex, strAccountIndex, params) |
| 2648 | currency = self.currency(code) |
| 2649 | if currency['code'] == 'USDC': |
| 2650 | amount = self.parse_to_int(Precise.string_mul(self.pow('10', '6'), self.currency_to_precision(code, amount))) |
| 2651 | elif currency['code'] == 'ETH': |
| 2652 | amount = self.parse_to_int(Precise.string_mul(self.pow('10', '8'), self.currency_to_precision(code, amount))) |
| 2653 | else: |
| 2654 | raise ExchangeError(self.id + ' withdraw() only supports USDC and ETH transfers') |
| 2655 | routeType = self.safe_integer(params, 'routeType', 0) # 0: perp, 1: spot |
| 2656 | params = self.omit(params, 'routeType') |
| 2657 | nonce = self.fetch_nonce(accountIndex, apiKeyIndex, params) |
| 2658 | signRaw = { |
| 2659 | 'asset_index': self.parse_to_int(currency['id']), |
| 2660 | 'route_type': routeType, |
| 2661 | 'amount': amount, |
| 2662 | 'nonce': nonce, |
| 2663 | 'api_key_index': apiKeyIndex, |
| 2664 | 'account_index': accountIndex, |
| 2665 | } |
| 2666 | txType, txInfo = self.lighter_sign_withdraw(signer, self.extend(signRaw, params)) |
| 2667 | request = { |
| 2668 | 'tx_type': txType, |
| 2669 | 'tx_info': txInfo, |
| 2670 | } |
| 2671 | response = self.publicPostSendTx(request) |
| 2672 | return self.parse_transaction(response) |
| 2673 | |
| 2674 | def fetch_my_trades(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}): |
| 2675 | """ |
nothing calls this directly
no test coverage detected