Skip to content

Commit 3115830

Browse files
authored
Merge pull request #5 from zealot128/master
Replace Blockexplore API by Chain.co
2 parents a726a3a + c6dab6c commit 3115830

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

Bitcoin.lua

+8-8
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030

3131

3232
WebBanking{
33-
version = 0.1,
33+
version = 0.2,
3434
description = "Include your Bitcoins as cryptoportfolio in MoneyMoney by providing Bitcoin addresses as usernme (comma seperated) and a random Password",
3535
services= { "Bitcoin" }
3636
}
@@ -93,21 +93,21 @@ end
9393
function requestBitcoinQuantityForBitcoinAddress(bitcoinAddress)
9494
response = connection:request("GET", bitcoinRequestUrl(bitcoinAddress), {})
9595
json = JSON(response)
96-
97-
return convertSatoshiToBitcoin(response)
96+
balance = json:dictionary()['data']['confirmed_balance']
97+
return balance
9898
end
9999

100100

101101
-- Helper Functions
102-
function convertSatoshiToBitcoin(satoshi)
103-
return satoshi / 100000000
104-
end
102+
-- function convertSatoshiToBitcoin(satoshi)
103+
-- return satoshi / 100000000
104+
-- end
105105

106106
function cryptocompareRequestUrl()
107107
return "https://api.coinmarketcap.com/v1/ticker/bitcoin/?convert=EUR"
108-
end
108+
end
109109

110110
function bitcoinRequestUrl(bitcoinAddress)
111-
return "https://blockexplorer.com/api/addr/" .. bitcoinAddress .. "/balance"
111+
return "https://chain.so/api/v2/get_address_balance/BTC/" .. bitcoinAddress .. "/"
112112
end
113113

0 commit comments

Comments
 (0)