mirror of
https://github.com/haveno-dex/haveno-ts.git
synced 2025-08-06 13:34:21 -04:00
update atomic unit conversion utils
This commit is contained in:
parent
f6268c4d9f
commit
3709f52b2e
1 changed files with 2 additions and 2 deletions
|
@ -108,7 +108,7 @@ export default class HavenoUtils {
|
|||
* @return {bigint} amount in atomic units
|
||||
*/
|
||||
static xmrToAtomicUnits(amountXmr: number | string): bigint {
|
||||
return BigInt(new Decimal(amountXmr).mul(HavenoUtils.AU_PER_XMR.toString()).toFixed(0));
|
||||
return BigInt(new Decimal(amountXmr).mul(HavenoUtils.AU_PER_XMR.toString()).toDecimalPlaces(0, Decimal.ROUND_HALF_UP).toFixed(0));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -118,7 +118,7 @@ export default class HavenoUtils {
|
|||
* @return {number} amount in XMR
|
||||
*/
|
||||
static atomicUnitsToXmr(amountAtomicUnits: bigint | string): number {
|
||||
return new Decimal(amountAtomicUnits.toString()).div(HavenoUtils.AU_PER_XMR.toString()).toNumber();
|
||||
return new Decimal(amountAtomicUnits.toString()).div(HavenoUtils.AU_PER_XMR.toString()).toDecimalPlaces(12, Decimal.ROUND_HALF_UP).toNumber();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue