Created
September 25, 2022 16:59
-
-
Save pavelTU/e48c71d09ff5dcfb5343699d485760d9 to your computer and use it in GitHub Desktop.
Course on Indexers: Tezos Balance Check
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
<!DOCTYPE html> | |
<head> | |
<title>Check Your Balance</title> | |
<script src="https://code.jquery.com/jquery-3.6.1.min.js"></script> | |
</head> | |
<body> | |
<script> | |
function check(address){ | |
$(document).ready(function(){ | |
$.ajax({ | |
"url" : "https://api.tzkt.io/v1/accounts/" + address + "/balance", | |
"type" : "GET", | |
"success" : function(data) { | |
var balance = data/1000000; | |
document.getElementById("balance").innerHTML = balance | |
} | |
}); | |
}); | |
document.getElementById("balanceDiv").style.display = "block"; | |
} | |
</script> | |
<input type="text" id="addressField" size = 38> | |
<button onclick="check(document.getElementById('addressField').value)">Check balance</button> | |
<div id="balanceDiv" style="display:none"> | |
<h2> | |
Your balance is <span id="balance"></span> tez | |
</h2> | |
</div> | |
</body> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment