Skip to content

Commit

Permalink
Merge pull request #5 from zealot128/master
Browse files Browse the repository at this point in the history
Replace Blockexplore API by Chain.co
  • Loading branch information
Jacubeit authored Jun 25, 2019
2 parents a726a3a + c6dab6c commit 3115830
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions Bitcoin.lua
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@


WebBanking{
version = 0.1,
version = 0.2,
description = "Include your Bitcoins as cryptoportfolio in MoneyMoney by providing Bitcoin addresses as usernme (comma seperated) and a random Password",
services= { "Bitcoin" }
}
Expand Down Expand Up @@ -93,21 +93,21 @@ end
function requestBitcoinQuantityForBitcoinAddress(bitcoinAddress)
response = connection:request("GET", bitcoinRequestUrl(bitcoinAddress), {})
json = JSON(response)

return convertSatoshiToBitcoin(response)
balance = json:dictionary()['data']['confirmed_balance']
return balance
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
end

function bitcoinRequestUrl(bitcoinAddress)
return "https://blockexplorer.com/api/addr/" .. bitcoinAddress .. "/balance"
return "https://chain.so/api/v2/get_address_balance/BTC/" .. bitcoinAddress .. "/"
end

0 comments on commit 3115830

Please sign in to comment.