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

Method parse_transaction

python/ccxt/okx.py:5490–5589  ·  view source on GitHub ↗
(self, transaction: dict, currency: Currency = None)

Source from the content-addressed store, hash-verified

5488 return self.safe_string(statuses, status, status)
5489
5490 def parse_transaction(self, transaction: dict, currency: Currency = None) -> Transaction:
5491 #
5492 # withdraw
5493 #
5494 # {
5495 # "amt": "0.1",
5496 # "wdId": "67485",
5497 # "ccy": "BTC"
5498 # }
5499 #
5500 # fetchWithdrawals
5501 #
5502 # {
5503 # "amt": "0.094",
5504 # "wdId": "4703879",
5505 # "fee": "0.01000000eth",
5506 # "txId": "0x62477bac6509a04512819bb1455e923a60dea5966c7caeaa0b24eb8fb0432b85",
5507 # "ccy": "ETH",
5508 # "from": "13426335357",
5509 # "to": "0xA41446125D0B5b6785f6898c9D67874D763A1519",
5510 # "tag",
5511 # "pmtId",
5512 # "memo",
5513 # "ts": "1597026383085",
5514 # "state": "2"
5515 # }
5516 #
5517 # fetchDeposits
5518 #
5519 # {
5520 # "amt": "0.01044408",
5521 # "txId": "1915737_3_0_0_asset",
5522 # "ccy": "BTC",
5523 # "from": "13801825426",
5524 # "to": "",
5525 # "ts": "1597026383085",
5526 # "state": "2",
5527 # "depId": "4703879"
5528 # }
5529 #
5530 type = None
5531 id = None
5532 withdrawalId = self.safe_string(transaction, 'wdId')
5533 addressFrom = self.safe_string(transaction, 'from')
5534 addressTo = self.safe_string(transaction, 'to')
5535 address = addressTo
5536 tagTo = self.safe_string_2(transaction, 'tag', 'memo')
5537 tagTo = self.safe_string_2(transaction, 'pmtId', tagTo)
5538 if withdrawalId is not None:
5539 type = 'withdrawal'
5540 id = withdrawalId
5541 else:
5542 # the payment_id will appear on new deposits but appears to be removed from the response after 2 months
5543 id = self.safe_string(transaction, 'depId')
5544 type = 'deposit'
5545 currencyId = self.safe_string(transaction, 'ccy')
5546 code = self.safe_currency_code(currencyId)
5547 network = None

Callers 3

withdrawMethod · 0.95
fetch_depositMethod · 0.95
fetch_withdrawalMethod · 0.95

Calls 10

safe_stringMethod · 0.80
safe_string_2Method · 0.80
splitMethod · 0.80
array_sliceMethod · 0.80
safe_numberMethod · 0.80
safe_integerMethod · 0.80
safe_currency_codeMethod · 0.45
network_id_to_codeMethod · 0.45
iso8601Method · 0.45

Tested by

no test coverage detected