Merge pull request #1637 from RafaelTaranto/feat/display-fee-on-admin

feat: display fee on admin
This commit is contained in:
Rafael Taranto 2024-01-07 21:51:39 +00:00 committed by GitHub
commit 09c8594355
6 changed files with 25 additions and 3 deletions

View file

@ -172,7 +172,7 @@ function advancedBatch (data) {
}
function simplifiedBatch (data) {
const fields = ['txClass', 'id', 'created', 'machineName',
const fields = ['txClass', 'id', 'created', 'machineName', 'fee',
'cryptoCode', 'cryptoAtoms', 'fiat', 'fiatCode', 'phone', 'toAddress',
'txHash', 'dispense', 'error', 'status', 'fiatProfit', 'cryptoAmount']

View file

@ -89,6 +89,17 @@ const CANCEL_CASH_IN_TRANSACTION = gql`
const getCryptoAmount = tx =>
coinUtils.toUnit(new BigNumber(tx.cryptoAtoms), tx.cryptoCode).toNumber()
const getCryptoFeeAmount = tx => {
const feeAmount = coinUtils
.toUnit(new BigNumber(tx.cryptoAtoms), tx.cryptoCode)
.toNumber()
return new BigNumber(feeAmount)
.times(tx.rawTickerPrice)
.toNumber()
.toFixed(2, 1)
}
const formatAddress = (cryptoCode = '', address = '') =>
coinUtils.formatCryptoAddress(cryptoCode, address).replace(/(.{5})/g, '$1 ')
@ -129,6 +140,7 @@ const DetailsRow = ({ it: tx, timezone }) => {
.minus(cashInFee)
.toFixed(2, 1) // ROUND_DOWN
const crypto = getCryptoAmount(tx)
const cryptoFee = getCryptoFeeAmount(tx)
const exchangeRate = BigNumber(fiat)
.div(crypto)
.toFixed(2, 1) // ROUND_DOWN
@ -369,6 +381,12 @@ const DetailsRow = ({ it: tx, timezone }) => {
)}
</div>
</div>
{tx.txClass === 'cashIn' && (
<div className={classes.blockFee}>
<Label>Network Fee</Label>
{cryptoFee} {tx.fiatCode}
</div>
)}
<div className={classes.sessionId}>
<Label>Session ID</Label>
<CopyToClipboard>{tx.id}</CopyToClipboard>

View file

@ -90,6 +90,9 @@ export default {
transactionId: {
width: 280
},
blockFee: {
width: 140
},
sessionId: {
width: 215
},

View file

@ -104,6 +104,7 @@ const GET_TRANSACTIONS = gql`
errorCode
deviceId
fiat
fee
cashInFee
fiatCode
cryptoAtoms

2
package-lock.json generated
View file

@ -1,6 +1,6 @@
{
"name": "lamassu-server",
"version": "8.1.9",
"version": "8.1.10",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View file

@ -2,7 +2,7 @@
"name": "lamassu-server",
"description": "bitcoin atm client server protocol module",
"keywords": [],
"version": "8.1.9",
"version": "8.1.10",
"license": "./LICENSE",
"author": "Lamassu (https://lamassu.is)",
"dependencies": {