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

Method parseTransaction

js/src/cex.js:1516–1548  ·  view source on GitHub ↗
(transaction, currency = undefined)

Source from the content-addressed store, hash-verified

1514 return this.parseTransactions(data, currency, since, limit);
1515 }
1516 parseTransaction(transaction, currency = undefined) {
1517 const currencyId = this.safeString(transaction, 'currency');
1518 const direction = this.safeString(transaction, 'direction');
1519 const type = (direction === 'withdraw') ? 'withdrawal' : 'deposit';
1520 const code = this.safeCurrencyCode(currencyId, currency);
1521 const updatedAt = this.safeString(transaction, 'updatedAt');
1522 const timestamp = this.parse8601(updatedAt);
1523 return {
1524 'info': transaction,
1525 'id': this.safeString(transaction, 'txId'),
1526 'txid': undefined,
1527 'type': type,
1528 'currency': code,
1529 'network': undefined,
1530 'amount': this.safeNumber(transaction, 'amount'),
1531 'status': this.parseTransactionStatus(this.safeString(transaction, 'status')),
1532 'timestamp': timestamp,
1533 'datetime': this.iso8601(timestamp),
1534 'address': undefined,
1535 'addressFrom': undefined,
1536 'addressTo': undefined,
1537 'tag': undefined,
1538 'tagFrom': undefined,
1539 'tagTo': undefined,
1540 'updated': undefined,
1541 'comment': undefined,
1542 'fee': {
1543 'currency': code,
1544 'cost': this.safeNumber(transaction, 'commissionAmount'),
1545 },
1546 'internal': undefined,
1547 };
1548 }
1549 parseTransactionStatus(status) {
1550 const statuses = {
1551 'rejected': 'rejected',

Callers

nothing calls this directly

Calls 6

safeStringMethod · 0.45
safeCurrencyCodeMethod · 0.45
parse8601Method · 0.45
safeNumberMethod · 0.45
iso8601Method · 0.45

Tested by

no test coverage detected