aboutsummaryrefslogtreecommitdiffstats
path: root/public/js/wallet.coffee
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.coffee
parenta0af153bafed1503475937031fe3e346869bb21b (diff)
downloadcoinos-server-13eca3d113fc3558f82bc4951598cca79f270cd0.tar.gz
coinos-server-13eca3d113fc3558f82bc4951598cca79f270cd0.zip
Fix wallet bugs
Diffstat (limited to 'public/js/wallet.coffee')
-rw-r--r--public/js/wallet.coffee7
1 files changed, 4 insertions, 3 deletions
diff --git a/public/js/wallet.coffee b/public/js/wallet.coffee
index 53734be6..3158c99d 100644
--- a/public/js/wallet.coffee
+++ b/public/js/wallet.coffee
@@ -274,7 +274,7 @@ createWallet = ->
getBalance = ->
$.get("#{g.api}/addrs/#{g.user.username}/balance?omitWalletAddresses=true", (data) ->
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}")
@@ -352,7 +352,7 @@ sendTransaction = ->
else
data.signatures = data.tosign.map((tosign, i) ->
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'))
key.keyPair.sign(new buffer.Buffer(tosign, "hex")).toDER().toString("hex")
)
@@ -404,6 +404,7 @@ displayErrors = (data, dialog) ->
convertedAmount = ->
+ g.amount = amount unless g.amount and isNumeric(g.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()))
@@ -442,7 +443,7 @@ Number.prototype.toBTC = ->
parseFloat((this / 100000000 * multiplier())).toFixed(precision())
Number.prototype.toFiat = ->
- (this * g.exchange / 100000000).toFixed(2)
+ parseFloat((this * g.exchange / 100000000)).toFixed(2)
Number.prototype.toSatoshis = ->
parseInt(this * 100000000 / multiplier())