aboutsummaryrefslogtreecommitdiffstats
path: root/public/js/calculator.coffee
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2016-11-22 17:04:29 -0800
committerAdam Soltys <[email protected]>2016-12-26 14:22:39 -0800
commit69fe9bc5e29415e66e5463adb37d9524d7ac185a (patch)
tree562562000e31e2f4861c53681bca4bdc98b8f969 /public/js/calculator.coffee
parent6101cbf5db17faa2c32d81fc28a3971fb3b98c12 (diff)
downloadcoinos-server-69fe9bc5e29415e66e5463adb37d9524d7ac185a.tar.gz
coinos-server-69fe9bc5e29415e66e5463adb37d9524d7ac185a.zip
Listen for testnet payments
Diffstat (limited to 'public/js/calculator.coffee')
-rw-r--r--public/js/calculator.coffee6
1 files changed, 5 insertions, 1 deletions
diff --git a/public/js/calculator.coffee b/public/js/calculator.coffee
index 7d185f24..7dfb6186 100644
--- a/public/js/calculator.coffee
+++ b/public/js/calculator.coffee
@@ -1,6 +1,8 @@
EXCHANGE_FAIL = "Problem fetching exchange rate"
SOCKET_FAIL = "Problem connecting to payment server, notifications may not appear"
ADDRESS_FAIL = "Invalid address"
+API_URL = "wss://socket.blockcypher.com/v1/btc/main"
+TEST_URL = "wss://socket.blockcypher.com/v1/btc/test3"
g = exports ? this
g.errors = []
@@ -90,6 +92,8 @@ setup = ->
$('#logo').attr('src', src).show()
getAddress()
+ if g.user.address[0] is 'm'
+ API_URL = TEST_URL
$('.symbol').html(g.user.currency)
$('.currency').html(g.user.currency)
@@ -169,7 +173,7 @@ listen = ->
setTimeout(listen, 12000)
else
fail(SOCKET_FAIL) if g.attempts > 3
- g.blockchain = new WebSocket("wss://socket.blockcypher.com/v1/btc/main")
+ g.blockchain = new WebSocket(API_URL)
g.blockchain.onopen = ->
if g.blockchain.readyState is 1