Skip to content

Commit

Permalink
fix some idiosincracies with custom or unofficial tokens
Browse files Browse the repository at this point in the history
  • Loading branch information
kajoseph committed Oct 4, 2024
1 parent 8e3d630 commit a37691c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions packages/bitcore-client/bin/wallet-tx-list
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ const main = async () => {
txs = JSON.parse(txs.trim().replaceAll('\n', ',') + ']');
for (const tx of txs) {
if (tx.category === 'fee') continue;
console.log(`[${new Date(tx.blockTime).toLocaleString()}] ${tx.txid} ${catSymbol(tx)} ${displayAmt(tx, currencyObj)}`);
tx.chain = wallet.chain; // tx.chain is not always populated
console.log(`[${new Date(tx.blockTime).toLocaleString()}] ${tx.txid} ${catSymbol(tx)} ${displayAmt(tx, tokenObj || currencyObj)}`);
}
done();
}
Expand All @@ -68,9 +69,9 @@ function catSymbol(tx) {

function displayAmt(tx, currObj) {
const baseToCommon = sats => Math.abs(sats) / Math.pow(10, currObj.decimals);
const dc = currObj.displayCode;
const dc = currObj.displayCode || currObj.symbol;
const gwei = tx.gasPrice / 1e9; // NaN if not EVM
const drops = currObj.chain === 'XRP' ? tx.fee : NaN;
const drops = tx.chain === 'XRP' ? tx.fee : NaN;
const feeRate = tx.fee / (tx.vsize ?? tx.size);
const feeRateStr = !isNaN(gwei) ? ` - ${gwei.toFixed(1)} gwei` :
!isNaN(drops) ? '' :
Expand Down

0 comments on commit a37691c

Please sign in to comment.