From 6db011a3f621b023f15d8a65e7e57a2b7ccb4602 Mon Sep 17 00:00:00 2001 From: Jim Date: Mon, 9 Sep 2019 17:04:56 +0200 Subject: [PATCH] Replace Chain.so API by Blockexplorer.com --- Bitcoin.lua | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Bitcoin.lua b/Bitcoin.lua index de49801..3d9b5cd 100644 --- a/Bitcoin.lua +++ b/Bitcoin.lua @@ -92,22 +92,22 @@ end function requestBitcoinQuantityForBitcoinAddress(bitcoinAddress) response = connection:request("GET", bitcoinRequestUrl(bitcoinAddress), {}) - json = JSON(response) - balance = json:dictionary()['data']['confirmed_balance'] - return balance +-- json = JSON(response) + + return convertSatoshiToBitcoin(response) end -- Helper Functions --- function convertSatoshiToBitcoin(satoshi) --- return satoshi / 100000000 --- end +function convertSatoshiToBitcoin(satoshi) + return satoshi / 100000000 +end function cryptocompareRequestUrl() return "https://api.coinmarketcap.com/v1/ticker/bitcoin/?convert=EUR" end function bitcoinRequestUrl(bitcoinAddress) - return "https://chain.so/api/v2/get_address_balance/BTC/" .. bitcoinAddress .. "/" +-- return "https://blockexplorer.com/api/addr/" .. bitcoinAddress .. "/balance" + return "https://blockchain.info/q/addressbalance/" .. bitcoinAddress .. "?confirmations=6" end -