Skip to content

Commit

Permalink
Merge pull request #1 from maxschoenberger/master
Browse files Browse the repository at this point in the history
Thank you for the PR
  • Loading branch information
zafai authored Oct 4, 2019
2 parents 7308436 + f0212a9 commit f9a39d9
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions Litecoin.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 Litecoins as cryptoportfolio in MoneyMoney by providing Litecoin addresses as usernme (comma seperated) and a random Password",
services= { "Litecoin" }
}
Expand Down Expand Up @@ -93,18 +93,21 @@ end
function requestLitecoinQuantityForLitecoinAddress(litecoinAddress)
response = connection:request("GET", litecoinRequestUrl(litecoinAddress), {})
json = JSON(response)

return json:dictionary()['data']['confirmed_balance']
balance = json:dictionary()['balance']

return convertSatoshiToLitecoin(balance)
end


-- Helper Functions
function convertSatoshiToLitecoin(satoshi)
return satoshi / 100000000
end

function cryptocompareRequestUrl()
return "https://min-api.cryptocompare.com/data/price?fsym=LTC&tsyms=EUR"
end
end

function litecoinRequestUrl(litecoinAddress)
return "https://chain.so/api/v2/get_address_balance/LTC/" .. litecoinAddress .. ""
return "https://api.blockcypher.com/v1/ltc/main/addrs/" .. litecoinAddress .. "/balance"
end

0 comments on commit f9a39d9

Please sign in to comment.