fetch all withdrawals made from an account https://apidocs.lighter.xyz/reference/withdraw_history :param str [code]: unified currency code :param int [since]: the earliest time in ms to fetch withdrawals for :param int [limit]: the maximum number of withdra
(self, code: Str = None, since: Int = None, limit: Int = None, params={})
| 2506 | return self.parse_transactions(data, currency, since, limit) |
| 2507 | |
| 2508 | def fetch_withdrawals(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Transaction]: |
| 2509 | """ |
| 2510 | fetch all withdrawals made from an account |
| 2511 | |
| 2512 | https://apidocs.lighter.xyz/reference/withdraw_history |
| 2513 | |
| 2514 | :param str [code]: unified currency code |
| 2515 | :param int [since]: the earliest time in ms to fetch withdrawals for |
| 2516 | :param int [limit]: the maximum number of withdrawals structures to retrieve |
| 2517 | :param dict [params]: extra parameters specific to the exchange API endpoint |
| 2518 | :param str [params.accountIndex]: account index |
| 2519 | :param boolean [params.paginate]: default False, when True will automatically paginate by calling self endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) |
| 2520 | :returns dict[]: a list of `transaction structures <https://docs.ccxt.com/?id=transaction-structure>` |
| 2521 | """ |
| 2522 | paginate = False |
| 2523 | paginate, params = self.handle_option_and_params(params, 'fetchWithdrawals', 'paginate') |
| 2524 | if paginate: |
| 2525 | return self.fetch_paginated_call_cursor('fetchWithdrawals', code, since, limit, params, 'cursor', 'cursor', None, 50) |
| 2526 | accountIndex = None |
| 2527 | accountIndex, params = self.handle_account_index(params, 'fetchWithdrawals', 'accountIndex', 'account_index') |
| 2528 | self.load_markets() |
| 2529 | request = { |
| 2530 | 'account_index': accountIndex, |
| 2531 | } |
| 2532 | apiKeyIndex = None |
| 2533 | apiKeyIndex, params = self.handle_api_key_index(params, 'fetchWithdrawals', 'apiKeyIndex', 'api_key_index') |
| 2534 | strAccountIndex = self.number_to_string(accountIndex) |
| 2535 | strApiKeyIndex = self.number_to_string(apiKeyIndex) |
| 2536 | self.load_account(self.options['chainId'], self.get_lighter_private_key(strAccountIndex, strApiKeyIndex), strApiKeyIndex, strAccountIndex, params) |
| 2537 | currency = None |
| 2538 | if code is not None: |
| 2539 | currency = self.currency(code) |
| 2540 | request['coin'] = currency['id'] |
| 2541 | response = self.privateGetWithdrawHistory(self.extend(request, params)) |
| 2542 | # |
| 2543 | # { |
| 2544 | # "code": "200", |
| 2545 | # "message": "string", |
| 2546 | # "withdraws": [ |
| 2547 | # { |
| 2548 | # "id": "string", |
| 2549 | # "amount": "0.1", |
| 2550 | # "timestamp": "1640995200", |
| 2551 | # "status": "failed", |
| 2552 | # "type": "secure", |
| 2553 | # "l1_tx_hash": "0x70997970C51812dc3A010C7d01b50e0d17dc79C8" |
| 2554 | # } |
| 2555 | # ], |
| 2556 | # "cursor": "string" |
| 2557 | # } |
| 2558 | # |
| 2559 | data = self.safe_list(response, 'withdraws', []) |
| 2560 | cursor = self.safe_string(response, 'cursor') |
| 2561 | first = self.safe_dict(data, 0) |
| 2562 | if (first is not None) and (cursor is not None): |
| 2563 | data[0]['cursor'] = cursor |
| 2564 | return self.parse_transactions(data, currency, since, limit) |
| 2565 |
nothing calls this directly
no test coverage detected