Skip to content

Commit

Permalink
Merge pull request #110 from yxxyun/dev
Browse files Browse the repository at this point in the history
fix #109
  • Loading branch information
ult-zhiwei authored Oct 23, 2019
2 parents b45fbdc + 582da86 commit 2760cf5
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/wallet/coins/Ripple.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ import tradingPlatformConfig from '../config/trading-platform';
import rippleKeypairs from 'ripple-keypairs';
import Big from 'big.js';

const round = function(dight, howMany) {
if(howMany) {
dight = Math.round(dight * Math.pow(10, howMany)) / Math.pow(10, howMany);
} else {
dight = Math.round(dight);
}
return dight;
};
class RippleWallet{
constructor(url, option = {}) {
if (url) {
Expand Down Expand Up @@ -463,15 +471,15 @@ class RippleWallet{
};
if (selling.issuer) {
order.totalPrice.counterparty = selling.issuer;
order.totalPrice.value = totalPrice.toFixed(8).toString();
order.totalPrice.value = round(totalPrice,8).toString();
}else{
order.totalPrice.value = totalPrice.toFixed(6).toString();
order.totalPrice.value = round(totalPrice,6).toString();
}
if (buying.issuer) {
order.quantity.counterparty = buying.issuer;
order.quantity.value = amount.toString();
}else{
order.quantity.value = amount.toFixed(6).toString();
order.quantity.value = round(amount,6).toString();
}
order.memos = [{data: 'utoken.cash', type: 'client', format: 'plain/text'}];
let prepared = await this.server.prepareOrder(address, order);
Expand Down

0 comments on commit 2760cf5

Please sign in to comment.