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

Method parseTransaction

js/src/woo.js:2740–2796  ·  view source on GitHub ↗
(transaction, currency = undefined)

Source from the content-addressed store, hash-verified

2738 return this.parseTransactions(rows, currency, since, limit, params);
2739 }
2740 parseTransaction(transaction, currency = undefined) {
2741 //
2742 // {
2743 // "createdTime": "1734964440.523",
2744 // "updatedTime": "1734964614.081",
2745 // "id": "24122314340000585",
2746 // "externalId": "241223143600621",
2747 // "applicationId": "251bf5c4-f3c8-4544-bb8b-80001007c3c0",
2748 // "token": "ARB_USDCNATIVE",
2749 // "targetAddress": "0x4d6802d2736daa85e6242ef0dc0f00aa0e68f635",
2750 // "sourceAddress": "0x63DFE4e34A3bFC00eB0220786238a7C6cEF8Ffc4",
2751 // "extra": "",
2752 // "type": "BALANCE",
2753 // "tokenSide": "WITHDRAW",
2754 // "amount": "10.00000000",
2755 // "txId": "0x891ade0a47fd55466bb9d06702bea4edcb75ed9367d9afbc47b93a84f496d2e6",
2756 // "feeToken": "USDC",
2757 // "feeAmount": "2",
2758 // "status": "COMPLETED",
2759 // "confirmingThreshold": null,
2760 // "confirmedNumber": null
2761 // }
2762 //
2763 const networkizedCode = this.safeString(transaction, 'token');
2764 const currencyDefined = this.getCurrencyFromChaincode(networkizedCode, currency);
2765 const code = currencyDefined['code'];
2766 let movementDirection = this.safeStringLowerN(transaction, ['token_side', 'tokenSide', 'type']);
2767 if (movementDirection === 'withdraw') {
2768 movementDirection = 'withdrawal';
2769 }
2770 const fee = this.parseTokenAndFeeTemp(transaction, ['fee_token', 'feeToken'], ['fee_amount', 'feeAmount']);
2771 const addressTo = this.safeStringN(transaction, ['target_address', 'targetAddress', 'addressTo']);
2772 const addressFrom = this.safeString2(transaction, 'source_address', 'sourceAddress');
2773 const timestamp = this.safeTimestampN(transaction, ['created_time', 'createdTime'], this.safeInteger(transaction, 'timestamp'));
2774 return {
2775 'info': transaction,
2776 'id': this.safeStringN(transaction, ['id', 'withdraw_id', 'withdrawId']),
2777 'txid': this.safeString2(transaction, 'tx_id', 'txId'),
2778 'timestamp': timestamp,
2779 'datetime': this.iso8601(timestamp),
2780 'address': undefined,
2781 'addressFrom': addressFrom,
2782 'addressTo': addressTo,
2783 'tag': this.safeString2(transaction, 'extra', 'tag'),
2784 'tagFrom': undefined,
2785 'tagTo': undefined,
2786 'type': movementDirection,
2787 'amount': this.safeNumber(transaction, 'amount'),
2788 'currency': code,
2789 'status': this.parseTransactionStatus(this.safeString(transaction, 'status')),
2790 'updated': this.safeTimestamp2(transaction, 'updated_time', 'updatedTime'),
2791 'comment': undefined,
2792 'internal': undefined,
2793 'fee': fee,
2794 'network': this.networkIdToCode(this.safeString(transaction, 'network'), code),
2795 };
2796 }
2797 parseTransactionStatus(status) {

Callers 1

withdrawMethod · 0.95

Calls 13

parseTokenAndFeeTempMethod · 0.95
safeStringMethod · 0.45
safeStringLowerNMethod · 0.45
safeStringNMethod · 0.45
safeString2Method · 0.45
safeTimestampNMethod · 0.45
safeIntegerMethod · 0.45
iso8601Method · 0.45
safeNumberMethod · 0.45
safeTimestamp2Method · 0.45

Tested by

no test coverage detected