Last active
September 28, 2017 07:43
-
-
Save williamcotton/6e15676e7084cfb92da9 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
document.getElementById("get-unspents").addEventListener("click", function(event) { | |
getUnspentOutputs = function(callback) { | |
xhr("https://www.blockai.com/chain/testnet/addresses/" + address + "/unspents", function(err, res, body) { | |
var unspentOutputs = JSON.parse(body); | |
unspentOutputs.forEach(function(utxo) { | |
utxo.txHash = utxo.hash; | |
utxo.index = utxo.outputIndex; | |
}); | |
callback(err, unspentOutputs); | |
}); | |
}; | |
getUnspentOutputs(function(err, unspentOutputs) { | |
wallet.setUnspentOutputs(unspentOutputs); | |
unspentOutputsJSON = JSON.stringify(unspentOutputs, null, 4); | |
document.getElementById("unspent-outputs-json").innerHTML = unspentOutputsJSON; | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment