Created
March 5, 2014 18:34
-
-
Save uyjulian/9373605 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--Bitcoin checker wip | |
local httpService = game:GetService("HttpService"); | |
local currentBitcoin = 0; | |
local encodedJSONString; | |
local decodedJSONTable; | |
local bitcoinAddress = "14fXxRQLPSNamBfR4F49vHFSVApV9a6asL"; | |
local apiAddress = "https://blockchain.info/address/" .. bitcoinAddress .. "?format=json&limit=0"; | |
local BitcoinValue = { | |
RECIEVED = 0, | |
UNCHANGED = 1, | |
SENT = 2 | |
}; | |
local status = BitcoinValue.UNCHANGED; | |
while true do | |
wait(60); | |
encodedJSONString = httpService:GetAsync(apiAddress, true); | |
decodedJSONTable = httpService:JSONDecode(encodedJSONString); | |
local tempBitcoin = tonumber(decodedJSONTable["final_balance"]); | |
if tempBitcoin >= currentBitcoin then | |
status = BitcoinValue.RECIEVED; | |
elseif tempBitcoin <= currentBitcoin then | |
status = BitcoinValue.SENT; | |
elseif tempBitcoin == currentBitcoin then | |
status = BitcoinValue.UNCHANGED; | |
end | |
currentBitcoin = tempBitcoin; | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment