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

Method parse_transaction

python/ccxt/lighter.py:2566–2616  ·  view source on GitHub ↗
(self, transaction: dict, currency: Currency = None)

Source from the content-addressed store, hash-verified

2564 return self.parse_transactions(data, currency, since, limit)
2565
2566 def parse_transaction(self, transaction: dict, currency: Currency = None) -> Transaction:
2567 #
2568 # fetchDeposits
2569 # {
2570 # "id": "2901843",
2571 # "asset_id": 5,
2572 # "amount": "100000.0",
2573 # "timestamp": 1766112729741,
2574 # "status": "completed",
2575 # "l1_tx_hash": "0xa24d83d58e1fd72b2a44a12d1ec766fb061fa0b806de2fed940b5d8ecd50744d",
2576 # }
2577 #
2578 # fetchWithdrawals
2579 # {
2580 # "id": "string",
2581 # "amount": "0.1",
2582 # "timestamp": "1640995200",
2583 # "status": "failed",
2584 # "type": "secure",
2585 # "l1_tx_hash": "0x70997970C51812dc3A010C7d01b50e0d17dc79C8"
2586 # }
2587 #
2588 type = self.safe_string(transaction, 'type')
2589 if type is None:
2590 type = 'deposit'
2591 else:
2592 type = 'withdrawal'
2593 timestamp = self.safe_integer(transaction, 'timestamp')
2594 status = self.safe_string(transaction, 'status')
2595 return {
2596 'info': transaction,
2597 'id': self.safe_string(transaction, 'id'),
2598 'txid': self.safe_string(transaction, 'l1_tx_hash'),
2599 'type': type,
2600 'currency': self.safe_currency_code(self.safe_string(transaction, 'asset_id'), currency),
2601 'network': None,
2602 'amount': self.safe_number(transaction, 'amount'),
2603 'status': self.parse_transaction_status(status),
2604 'timestamp': timestamp,
2605 'datetime': self.iso8601(timestamp),
2606 'address': None,
2607 'addressFrom': None,
2608 'addressTo': None,
2609 'tag': None,
2610 'tagFrom': None,
2611 'tagTo': None,
2612 'updated': None,
2613 'comment': None,
2614 'fee': None,
2615 'internal': None,
2616 }
2617
2618 def parse_transaction_status(self, status: Str):
2619 statuses = {

Callers 1

withdrawMethod · 0.95

Calls 6

safe_stringMethod · 0.80
safe_integerMethod · 0.80
safe_numberMethod · 0.80
safe_currency_codeMethod · 0.45
iso8601Method · 0.45

Tested by

no test coverage detected