Merge pull request #224 from ArtemKolodko/fix_export_csv_rounding

Fix rounding for export to csv
pull/225/head
Artem 2 years ago committed by GitHub
commit b5b2dd8207
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      src/pages/ExportData/export-utils.ts

@ -1,5 +1,6 @@
import { RelatedTransaction } from "../../types";
import dayjs from "dayjs";
import Big from "big.js";
import { calculateFee, calculateFeePriceUSD } from "../../utils/fee";
import {TRelatedTransaction} from "../../api/client.interface";
import {Erc20} from "../../hooks/ERC20_Pool";
@ -18,9 +19,7 @@ const downloadBlob = (content: any, filename: string) => {
}
const convertValue = (value: string | number, precision = 18) => {
const n = 4
const bigIntValue = BigInt(parseInt(value.toString())) / BigInt(10 ** (precision - n))
return parseInt(bigIntValue.toString()) / (10 ** n);
return Big(value).div(Math.pow(10, precision)).round(precision).toString()
}
const mapRelatedTxToExport = (ownerAddress: string, tx: RelatedTransaction, onePrice: number) => {

Loading…
Cancel
Save