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

Method parse_transaction

python/ccxt/hyperliquid.py:3906–3955  ·  view source on GitHub ↗
(self, transaction: dict, currency: Currency = None)

Source from the content-addressed store, hash-verified

3904 return self.parse_transaction(response)
3905
3906 def parse_transaction(self, transaction: dict, currency: Currency = None) -> Transaction:
3907 #
3908 # {status: 'ok', response: {type: 'default'}}
3909 #
3910 # fetchDeposits / fetchWithdrawals
3911 # {
3912 # "time":1724762307531,
3913 # "hash":"0x620a234a7e0eb7930575040f59482a01050058b0802163b4767bfd9033e77781",
3914 # "delta":{
3915 # "type":"accountClassTransfer",
3916 # "usdc":"50.0",
3917 # "toPerp":false
3918 # }
3919 # }
3920 #
3921 timestamp = self.safe_integer(transaction, 'time')
3922 delta = self.safe_dict(transaction, 'delta', {})
3923 fee = None
3924 feeCost = self.safe_integer(delta, 'fee')
3925 if feeCost is not None:
3926 fee = {
3927 'currency': 'USDC',
3928 'cost': feeCost,
3929 }
3930 internal = None
3931 type = self.safe_string(delta, 'type')
3932 if type is not None:
3933 internal = (type == 'internalTransfer')
3934 return {
3935 'info': transaction,
3936 'id': None,
3937 'txid': self.safe_string(transaction, 'hash'),
3938 'timestamp': timestamp,
3939 'datetime': self.iso8601(timestamp),
3940 'network': None,
3941 'address': None,
3942 'addressTo': self.safe_string(delta, 'destination'),
3943 'addressFrom': self.safe_string(delta, 'user'),
3944 'tag': None,
3945 'tagTo': None,
3946 'tagFrom': None,
3947 'type': None,
3948 'amount': self.safe_number(delta, 'usdc'),
3949 'currency': None,
3950 'status': self.safe_string(transaction, 'status'),
3951 'updated': None,
3952 'comment': None,
3953 'internal': internal,
3954 'fee': fee,
3955 }
3956
3957 def fetch_trading_fee(self, symbol: str, params={}) -> TradingFeeInterface:
3958 """

Callers 1

withdrawMethod · 0.95

Calls 5

safe_integerMethod · 0.80
safe_dictMethod · 0.80
safe_stringMethod · 0.80
safe_numberMethod · 0.80
iso8601Method · 0.45

Tested by

no test coverage detected