mirror of
https://github.com/haveno-dex/haveno-ts.git
synced 2025-08-14 17:26:09 -04:00
test random trade amounts, fix conversion utils using decimal.js
This commit is contained in:
parent
b4a5749378
commit
b304139779
18 changed files with 1790 additions and 1143 deletions
18
dist/utils/HavenoUtils.js
vendored
18
dist/utils/HavenoUtils.js
vendored
|
@ -1,10 +1,26 @@
|
|||
"use strict";
|
||||
/*
|
||||
* Copyright Haveno
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const assert_1 = __importDefault(require("assert"));
|
||||
const console_1 = __importDefault(require("console"));
|
||||
const decimal_js_1 = __importDefault(require("decimal.js"));
|
||||
const pb_pb_1 = require("../protobuf/pb_pb");
|
||||
/**
|
||||
* Collection of utilities for working with Haveno.
|
||||
|
@ -132,7 +148,7 @@ class HavenoUtils {
|
|||
amountAtomicUnits = BigInt(amountAtomicUnits);
|
||||
const quotient = amountAtomicUnits / HavenoUtils.AU_PER_XMR;
|
||||
const remainder = amountAtomicUnits % HavenoUtils.AU_PER_XMR;
|
||||
return Number(quotient) + Number(remainder) / Number(HavenoUtils.AU_PER_XMR);
|
||||
return new decimal_js_1.default(quotient.toString()).plus(new decimal_js_1.default(remainder.toString()).div(HavenoUtils.AU_PER_XMR.toString())).toNumber();
|
||||
}
|
||||
// ------------------------- PAYMENT ACCOUNT FORMS --------------------------
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue