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

Method parseLedgerEntry

ts/src/woo.ts:2635–2683  ·  view source on GitHub ↗
(item: Dict, currency: Currency = undefined)

Source from the content-addressed store, hash-verified

2633 }
2634
2635 parseLedgerEntry (item: Dict, currency: Currency = undefined): LedgerEntry {
2636 //
2637 // {
2638 // "createdTime": "1734964440.523",
2639 // "updatedTime": "1734964614.081",
2640 // "id": "24122314340000585",
2641 // "externalId": "241223143600621",
2642 // "applicationId": "251bf5c4-f3c8-4544-bb8b-80001007c3c0",
2643 // "token": "ARB_USDCNATIVE",
2644 // "targetAddress": "0x4d6802d2736daa85e6242ef0dc0f00aa0e68f635",
2645 // "sourceAddress": "0x63DFE4e34A3bFC00eB0220786238a7C6cEF8Ffc4",
2646 // "extra": "",
2647 // "type": "BALANCE",
2648 // "tokenSide": "WITHDRAW",
2649 // "amount": "10.00000000",
2650 // "txId": "0x891ade0a47fd55466bb9d06702bea4edcb75ed9367d9afbc47b93a84f496d2e6",
2651 // "feeToken": "USDC",
2652 // "feeAmount": "2",
2653 // "status": "COMPLETED",
2654 // "confirmingThreshold": null,
2655 // "confirmedNumber": null
2656 // }
2657 //
2658 const networkizedCode = this.safeString (item, 'token');
2659 const code = this.safeCurrencyCode (networkizedCode, currency);
2660 currency = this.safeCurrency (code, currency);
2661 const amount = this.safeNumber (item, 'amount');
2662 const side = this.safeString (item, 'tokenSide');
2663 const direction = (side === 'DEPOSIT') ? 'in' : 'out';
2664 const timestamp = this.safeTimestamp (item, 'createdTime');
2665 const fee = this.parseTokenAndFeeTemp (item, [ 'feeToken' ], [ 'feeAmount' ]);
2666 return this.safeLedgerEntry ({
2667 'info': item,
2668 'id': this.safeString (item, 'id'),
2669 'currency': code,
2670 'account': this.safeString (item, 'account'),
2671 'referenceAccount': undefined,
2672 'referenceId': this.safeString (item, 'txId'),
2673 'status': this.parseTransactionStatus (this.safeString (item, 'status')),
2674 'amount': amount,
2675 'before': undefined,
2676 'after': undefined,
2677 'direction': direction,
2678 'timestamp': timestamp,
2679 'datetime': this.iso8601 (timestamp),
2680 'type': this.parseLedgerEntryType (this.safeString (item, 'type')),
2681 'fee': fee,
2682 }, currency) as LedgerEntry;
2683 }
2684
2685 parseLedgerEntryType (type) {
2686 const types: Dict = {

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