aboutsummaryrefslogtreecommitdiffstats
path: root/public/js/wallet.js
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2016-10-13 07:07:22 -0700
committerAdam Soltys <[email protected]>2016-10-13 07:07:22 -0700
commit13eca3d113fc3558f82bc4951598cca79f270cd0 (patch)
tree8722dcceca333505050012d1680a707f10fb5afa /public/js/wallet.js
parenta0af153bafed1503475937031fe3e346869bb21b (diff)
downloadcoinos-server-13eca3d113fc3558f82bc4951598cca79f270cd0.tar.gz
coinos-server-13eca3d113fc3558f82bc4951598cca79f270cd0.zip
Fix wallet bugs
Diffstat (limited to 'public/js/wallet.js')
-rw-r--r--public/js/wallet.js9
1 files changed, 6 insertions, 3 deletions
diff --git a/public/js/wallet.js b/public/js/wallet.js
index c7cdd4c3..c9bb846f 100644
--- a/public/js/wallet.js
+++ b/public/js/wallet.js
@@ -324,7 +324,7 @@
return $.get("" + g.api + "/addrs/" + g.user.username + "/balance?omitWalletAddresses=true", function(data) {
var balance, fiat;
balance = data.final_balance;
- g.balance = balance.toBTC();
+ g.balance = parseFloat(balance.toBTC());
fiat = balance.toFiat();
$('#balance').html(g.balance);
$('#fiat').html("" + fiat + " " + g.user.currency);
@@ -424,7 +424,7 @@
data.signatures = data.tosign.map(function(tosign, i) {
var key, path;
path = data.tx.inputs[i].hd_path.split('/');
- key = g.key.derive(path[1]).derive(path[2]);
+ key = g.key.derive(parseInt(path[1])).derive(parseInt(path[2]));
data.pubkeys.push(key.keyPair.getPublicKeyBuffer().toString('hex'));
return key.keyPair.sign(new buffer.Buffer(tosign, "hex")).toDER().toString("hex");
});
@@ -491,6 +491,9 @@
convertedAmount = function() {
var amount, difference, tolerance;
+ if (!(g.amount && isNumeric(g.amount))) {
+ g.amount = amount;
+ }
amount = parseFloat($('#amount').val() * multiplier() / g.exchange).toFixed(precision());
difference = parseFloat(Math.abs(g.amount - amount).toFixed(precision()));
tolerance = parseFloat((.00000002 * g.exchange * multiplier()).toFixed(precision()));
@@ -543,7 +546,7 @@
};
Number.prototype.toFiat = function() {
- return (this * g.exchange / 100000000).toFixed(2);
+ return parseFloat(this * g.exchange / 100000000).toFixed(2);
};
Number.prototype.toSatoshis = function() {