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

Method parseLedgerEntry

js/src/woo.js:2614–2662  ·  view source on GitHub ↗
(item, currency = undefined)

Source from the content-addressed store, hash-verified

2612 return this.parseLedger(rows, currency, since, limit, params);
2613 }
2614 parseLedgerEntry(item, currency = undefined) {
2615 //
2616 // {
2617 // "createdTime": "1734964440.523",
2618 // "updatedTime": "1734964614.081",
2619 // "id": "24122314340000585",
2620 // "externalId": "241223143600621",
2621 // "applicationId": "251bf5c4-f3c8-4544-bb8b-80001007c3c0",
2622 // "token": "ARB_USDCNATIVE",
2623 // "targetAddress": "0x4d6802d2736daa85e6242ef0dc0f00aa0e68f635",
2624 // "sourceAddress": "0x63DFE4e34A3bFC00eB0220786238a7C6cEF8Ffc4",
2625 // "extra": "",
2626 // "type": "BALANCE",
2627 // "tokenSide": "WITHDRAW",
2628 // "amount": "10.00000000",
2629 // "txId": "0x891ade0a47fd55466bb9d06702bea4edcb75ed9367d9afbc47b93a84f496d2e6",
2630 // "feeToken": "USDC",
2631 // "feeAmount": "2",
2632 // "status": "COMPLETED",
2633 // "confirmingThreshold": null,
2634 // "confirmedNumber": null
2635 // }
2636 //
2637 const networkizedCode = this.safeString(item, 'token');
2638 const code = this.safeCurrencyCode(networkizedCode, currency);
2639 currency = this.safeCurrency(code, currency);
2640 const amount = this.safeNumber(item, 'amount');
2641 const side = this.safeString(item, 'tokenSide');
2642 const direction = (side === 'DEPOSIT') ? 'in' : 'out';
2643 const timestamp = this.safeTimestamp(item, 'createdTime');
2644 const fee = this.parseTokenAndFeeTemp(item, ['feeToken'], ['feeAmount']);
2645 return this.safeLedgerEntry({
2646 'info': item,
2647 'id': this.safeString(item, 'id'),
2648 'currency': code,
2649 'account': this.safeString(item, 'account'),
2650 'referenceAccount': undefined,
2651 'referenceId': this.safeString(item, 'txId'),
2652 'status': this.parseTransactionStatus(this.safeString(item, 'status')),
2653 'amount': amount,
2654 'before': undefined,
2655 'after': undefined,
2656 'direction': direction,
2657 'timestamp': timestamp,
2658 'datetime': this.iso8601(timestamp),
2659 'type': this.parseLedgerEntryType(this.safeString(item, 'type')),
2660 'fee': fee,
2661 }, currency);
2662 }
2663 parseLedgerEntryType(type) {
2664 const types = {
2665 'BALANCE': 'transaction', // Funds moved in/out wallet

Callers

nothing calls this directly

Calls 10

parseTokenAndFeeTempMethod · 0.95
parseLedgerEntryTypeMethod · 0.95
safeStringMethod · 0.45
safeCurrencyCodeMethod · 0.45
safeCurrencyMethod · 0.45
safeNumberMethod · 0.45
safeTimestampMethod · 0.45
safeLedgerEntryMethod · 0.45
iso8601Method · 0.45

Tested by

no test coverage detected