From f466c6aa4db08d953df9916fad8ba5d03020e0a0 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Fri, 11 Dec 2015 11:28:18 -0800 Subject: Proxy blockcypher API requests --- public/js/wallet.js | 47 +++++++++++++++++++++++------------------------ 1 file changed, 23 insertions(+), 24 deletions(-) (limited to 'public/js/wallet.js') diff --git a/public/js/wallet.js b/public/js/wallet.js index d83b764d..cadd6db3 100644 --- a/public/js/wallet.js +++ b/public/js/wallet.js @@ -1,16 +1,19 @@ ;(function(e,t,n){function i(n,s){if(!t[n]){if(!e[n]){var o=typeof require=="function"&&require;if(!s&&o)return o(n,!0);if(r)return r(n,!0);throw new Error("Cannot find module '"+n+"'")}var u=t[n]={exports:{}};e[n][0](function(t){var r=e[n][1][t];return i(r?r:t)},u,u.exports)}return t[n].exports}var r=typeof require=="function"&&require;for(var s=0;s= 0) { return getBalance(); @@ -191,7 +190,7 @@ extended_public_key: g.user.pubkey, subchain_indexes: [0, 1] }; - return $.post("" + g.api + "/wallets/hd?token=" + g.token, JSON.stringify(data)).always(getBalance); + return $.post("" + g.api + "/wallets/hd", JSON.stringify(data)).always(getBalance); } else { $('#balance').html(99); return $('#amount').val(99); @@ -201,7 +200,7 @@ }; getBalance = function() { - return $.get("" + g.api + "/addrs/" + g.user.username + "/balance?token=" + g.token + "&omitWalletAddresses=true", function(data) { + return $.get("" + g.api + "/addrs/" + g.user.username + "/balance?omitWalletAddresses=true", function(data) { var balance, fiat; balance = data.final_balance; g.balance = balance.toBTC(); @@ -257,7 +256,7 @@ ], preference: $('#priority').val() }; - return $.post("" + g.api + "/txs/new?token=" + g.token, JSON.stringify(params)).done(function(data) { + return $.post("" + g.api + "/txs/new", JSON.stringify(params)).done(function(data) { var amount, value; if ($('#currency_toggle').html() === g.user.unit) { amount = $('#amount').val(); @@ -270,7 +269,7 @@ if (value > parseFloat(g.balance).toSatoshis() - params.fees) { params.outputs[0].value -= params.fees; } - return $.post("" + g.api + "/txs/new?token=" + g.token, JSON.stringify(params)).done(function(data) { + return $.post("" + g.api + "/txs/new", JSON.stringify(params)).done(function(data) { var fee, total; data.pubkeys = []; data.signatures = data.tosign.map(function(tosign, i) { @@ -293,7 +292,7 @@ $('.dialog .address').html(data.tx.outputs[0].addresses[0]); dialog.getModalBody().html($('.dialog').html()); return dialog.getModal().find('.btn-primary').click(function() { - return $.post("" + g.api + "/txs/send?token=" + g.token, JSON.stringify(g.data)).then(function(finaltx) { + return $.post("" + g.api + "/txs/send", JSON.stringify(g.data)).then(function(finaltx) { var balance, fiat; $('#transaction_sent').fadeIn(); balance = g.balance.toSatoshis() - finaltx.tx.outputs[0].value - finaltx.tx.fees; @@ -302,7 +301,7 @@ $('#balance').html(g.balance); $('#fiat').html("" + fiat + " " + g.user.currency); $('#blockchain').off('click').on('click', function() { - return window.open('https://live.blockcypher.com/btc/main/' + finaltx.tx.hash, '_blank'); + return window.open('https://live.blockcypher.com/btc/main/tx/' + finaltx.tx.hash, '_blank'); }); return dialog.close(); }); -- cgit v1.2.3