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

Method parse_transaction

python/ccxt/async_support/woo.py:2637–2691  ·  view source on GitHub ↗
(self, transaction: dict, currency: Currency = None)

Source from the content-addressed store, hash-verified

2635 return self.parse_transactions(rows, currency, since, limit, params)
2636
2637 def parse_transaction(self, transaction: dict, currency: Currency = None) -> Transaction:
2638 #
2639 # {
2640 # "createdTime": "1734964440.523",
2641 # "updatedTime": "1734964614.081",
2642 # "id": "24122314340000585",
2643 # "externalId": "241223143600621",
2644 # "applicationId": "251bf5c4-f3c8-4544-bb8b-80001007c3c0",
2645 # "token": "ARB_USDCNATIVE",
2646 # "targetAddress": "0x4d6802d2736daa85e6242ef0dc0f00aa0e68f635",
2647 # "sourceAddress": "0x63DFE4e34A3bFC00eB0220786238a7C6cEF8Ffc4",
2648 # "extra": "",
2649 # "type": "BALANCE",
2650 # "tokenSide": "WITHDRAW",
2651 # "amount": "10.00000000",
2652 # "txId": "0x891ade0a47fd55466bb9d06702bea4edcb75ed9367d9afbc47b93a84f496d2e6",
2653 # "feeToken": "USDC",
2654 # "feeAmount": "2",
2655 # "status": "COMPLETED",
2656 # "confirmingThreshold": null,
2657 # "confirmedNumber": null
2658 # }
2659 #
2660 networkizedCode = self.safe_string(transaction, 'token')
2661 currencyDefined = self.get_currency_from_chaincode(networkizedCode, currency)
2662 code = currencyDefined['code']
2663 movementDirection = self.safe_string_lower_n(transaction, ['token_side', 'tokenSide', 'type'])
2664 if movementDirection == 'withdraw':
2665 movementDirection = 'withdrawal'
2666 fee = self.parse_token_and_fee_temp(transaction, ['fee_token', 'feeToken'], ['fee_amount', 'feeAmount'])
2667 addressTo = self.safe_string_n(transaction, ['target_address', 'targetAddress', 'addressTo'])
2668 addressFrom = self.safe_string_2(transaction, 'source_address', 'sourceAddress')
2669 timestamp = self.safe_timestamp_n(transaction, ['created_time', 'createdTime'], self.safe_integer(transaction, 'timestamp'))
2670 return {
2671 'info': transaction,
2672 'id': self.safe_string_n(transaction, ['id', 'withdraw_id', 'withdrawId']),
2673 'txid': self.safe_string_2(transaction, 'tx_id', 'txId'),
2674 'timestamp': timestamp,
2675 'datetime': self.iso8601(timestamp),
2676 'address': None,
2677 'addressFrom': addressFrom,
2678 'addressTo': addressTo,
2679 'tag': self.safe_string_2(transaction, 'extra', 'tag'),
2680 'tagFrom': None,
2681 'tagTo': None,
2682 'type': movementDirection,
2683 'amount': self.safe_number(transaction, 'amount'),
2684 'currency': code,
2685 'status': self.parse_transaction_status(self.safe_string(transaction, 'status')),
2686 'updated': self.safe_timestamp_2(transaction, 'updated_time', 'updatedTime'),
2687 'comment': None,
2688 'internal': None,
2689 'fee': fee,
2690 'network': self.network_id_to_code(self.safe_string(transaction, 'network'), code),
2691 }
2692
2693 def parse_transaction_status(self, status: Str):
2694 statuses = {

Callers 1

withdrawMethod · 0.95

Calls 13

safe_stringMethod · 0.80
safe_string_lower_nMethod · 0.80
safe_string_nMethod · 0.80
safe_string_2Method · 0.80
safe_timestamp_nMethod · 0.80
safe_integerMethod · 0.80
safe_numberMethod · 0.80
safe_timestamp_2Method · 0.80
iso8601Method · 0.45

Tested by

no test coverage detected