MCPcopy Create free account
hub / github.com/ccxt/ccxt / fetch_deposits

Method fetch_deposits

python/ccxt/lighter.py:2445–2506  ·  view source on GitHub ↗

fetch all deposits made to an account https://apidocs.lighter.xyz/reference/deposit_history :param str [code]: unified currency code :param int [since]: the earliest time in ms to fetch deposits for :param int [limit]: the maximum number of deposits structu

(self, code: Str = None, since: Int = None, limit: Int = None, params={})

Source from the content-addressed store, hash-verified

2443 }
2444
2445 def fetch_deposits(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Transaction]:
2446 """
2447 fetch all deposits made to an account
2448
2449 https://apidocs.lighter.xyz/reference/deposit_history
2450
2451 :param str [code]: unified currency code
2452 :param int [since]: the earliest time in ms to fetch deposits for
2453 :param int [limit]: the maximum number of deposits structures to retrieve
2454 :param dict [params]: extra parameters specific to the exchange API endpoint
2455 :param str [params.accountIndex]: account index
2456 :param str [params.address]: l1_address
2457 :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)
2458 :returns dict[]: a list of `transaction structures <https://docs.ccxt.com/?id=transaction-structure>`
2459 """
2460 self.load_markets()
2461 paginate = False
2462 paginate, params = self.handle_option_and_params(params, 'fetchDeposits', 'paginate')
2463 if paginate:
2464 return self.fetch_paginated_call_cursor('fetchDeposits', code, since, limit, params, 'cursor', 'cursor', None, 50)
2465 address = None
2466 address, params = self.handle_option_and_params_2(params, 'fetchDeposits', 'address', 'l1_address')
2467 if address is None:
2468 raise ArgumentsRequired(self.id + ' fetchDeposits() requires an address parameter')
2469 accountIndex = None
2470 accountIndex, params = self.handle_account_index(params, 'fetchDeposits', 'accountIndex', 'account_index')
2471 request = {
2472 'account_index': accountIndex,
2473 'l1_address': address,
2474 }
2475 apiKeyIndex = None
2476 apiKeyIndex, params = self.handle_api_key_index(params, 'fetchDeposits', 'apiKeyIndex', 'api_key_index')
2477 strAccountIndex = self.number_to_string(accountIndex)
2478 strApiKeyIndex = self.number_to_string(apiKeyIndex)
2479 self.load_account(self.options['chainId'], self.get_lighter_private_key(strAccountIndex, strApiKeyIndex), strApiKeyIndex, strAccountIndex, params)
2480 currency = None
2481 if code is not None:
2482 currency = self.currency(code)
2483 request['coin'] = currency['id']
2484 response = self.privateGetDepositHistory(self.extend(request, params))
2485 #
2486 # {
2487 # "code": 200,
2488 # "deposits": [
2489 # {
2490 # "id": "2901843",
2491 # "asset_id": 5,
2492 # "amount": "100000.0",
2493 # "timestamp": 1766112729741,
2494 # "status": "completed",
2495 # "l1_tx_hash": "0xa24d83d58e1fd72b2a44a12d1ec766fb061fa0b806de2fed940b5d8ecd50744d"
2496 # }
2497 # ],
2498 # "cursor": "eyJpbmRleCI6MjkwMTg0MH0="
2499 # }
2500 #
2501 data = self.safe_list(response, 'deposits', [])
2502 cursor = self.safe_string(response, 'cursor')

Callers

nothing calls this directly

Calls 15

handle_account_indexMethod · 0.95
handle_api_key_indexMethod · 0.95
load_accountMethod · 0.95
ArgumentsRequiredClass · 0.90
safe_listMethod · 0.80
safe_stringMethod · 0.80
safe_dictMethod · 0.80
parse_transactionsMethod · 0.80

Tested by

no test coverage detected