From 8e22a91f71335dff34c7db5e336e643ac8aa6291 Mon Sep 17 00:00:00 2001 From: juddydev Date: Wed, 23 Apr 2025 03:21:28 +0900 Subject: [PATCH 1/2] add export csv blockpit --- pages/admin/pro/history.js | 44 +++++++++++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/pages/admin/pro/history.js b/pages/admin/pro/history.js index 79bcf10eb..47f34c256 100644 --- a/pages/admin/pro/history.js +++ b/pages/admin/pro/history.js @@ -77,6 +77,22 @@ const dateFormatters = { const ss = pad(date.getUTCSeconds()) return `${mm}/${dd}/${yyyy} ${hh}:${min}:${ss}` + }, + BlockPit: (timestamp) => { + // Format: DD.MM.YYYY HH:MM:SS in UTC + const date = new Date(timestamp * 1000) + + const pad = (n) => n.toString().padStart(2, '0') + + const dd = pad(date.getUTCDate()) + const mm = pad(date.getUTCMonth() + 1) + const yyyy = date.getUTCFullYear() + + const hh = pad(date.getUTCHours()) + const min = pad(date.getUTCMinutes()) + const ss = pad(date.getUTCSeconds()) + + return `${dd}.${mm}.${yyyy} ${hh}:${min}:${ss}` } } @@ -145,6 +161,22 @@ export default function History({ queryAddress, selectedCurrency, setSelectedCur { label: 'Description (Optional)', key: 'memo' }, { label: 'TxHash (Optional)', key: 'hash' } ] + }, + { + platform: 'BlockPit', + headers: [ + { label: 'Date (UTC)', key: 'timestampExport' }, + { label: 'Integration Name', key: 'platform' }, + { label: 'Label', key: 'blockPitTxType' }, + { label: 'Outgoing Asset', key: 'sentCurrency' }, + { label: 'Outgoing Amount', key: 'sentAmount' }, + { label: 'Incoming Asset', key: 'receivedCurrency' }, + { label: 'Incoming Amount', key: 'receivedAmount' }, + { label: 'Fee Asset (optional)', key: 'txFeeCurrencyCode' }, + { label: 'Fee Amount (optional)', key: 'txFeeNumber' }, + { label: 'Comment (optional)', key: 'memo' }, + { label: 'Trx. ID (optional)', key: 'hash' } + ] } ], [selectedCurrency] @@ -336,6 +368,14 @@ export default function History({ queryAddress, selectedCurrency, setSelectedCur // For CoinLedger platform res.activities[i].coinLedgerTxType = res.activities[i].amountNumber > 0 ? 'Deposit' : 'Withdrawal' + + // For BlockPit platform + res.activities[i].blockPitTxType = + res.activities[i].amountNumber > 0 + ? 'Deposit' + : Math.abs(res.activities[i].amountNumber) <= res.activities[i].txFeeNumber + ? 'Fee' + : 'Withdrawal' } setData(res) // last request data if (options?.marker) { @@ -524,7 +564,8 @@ export default function History({ queryAddress, selectedCurrency, setSelectedCur setValue={setPlatformCSVExport} optionsList={[ { value: 'Koinly', label: 'Koinly' }, - { value: 'CoinLedger', label: 'CoinLedger' } + { value: 'CoinLedger', label: 'CoinLedger' }, + { value: 'BlockPit', label: 'BlockPit' } ]} />