Created
September 24, 2018 23:30
-
-
Save Siimone/54a3a7be5848cce19b0d363aefcf96d1 to your computer and use it in GitHub Desktop.
Get transactions of IOTA address with Iota.lib.js
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('search-transactions-js').addEventListener('click', function () { | |
let container = document.getElementById('transactions-js'); | |
container.innerHTML = ""; | |
let address = document.getElementById('iota-address-transactions-js').value | |
if (iota.valid.isAddress(address)) | |
iota.api.findTransactionObjects( | |
{ | |
addresses: [address] | |
}, function (err, res) { | |
if (err) | |
container.innerText = JSON.stringify(err); | |
if (res.length > 0) { | |
console.log(res) | |
document.getElementById('transactions-js').classList.remove('invisible'); | |
document.getElementById('transactions-js').classList.add('visibile'); | |
let ul = document.createElement("ul"); | |
ul.classList.add('list-group'); | |
for (let i = 0; i < res.length; i++) { | |
let child = document.createElement("li"); | |
child.classList.add('list-group-item'); | |
child.innerText = "Hash: " + res[i].hash + "\n"; | |
child.innerText += "Nonce: " + res[i].nonce + "\n"; | |
child.innerText += "Obsolete Tag: " + res[i].obsoleteTag + "\n"; | |
child.innerText += "Tag: " + res[i].tag + "\n"; | |
ul.appendChild(child) | |
} | |
container.appendChild(ul) | |
} | |
}) | |
else | |
$('#wrong-address-modal').modal('show'); | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment