Last active
August 13, 2017 17:59
-
-
Save josephros/d2a8b1efd474a4b4284ec71746144ec3 to your computer and use it in GitHub Desktop.
Token Balance Explorer Form Template
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> | |
<html> | |
<head> | |
<title>Ethereum Token Balance Explorer</title> | |
<script src="https://cdn.jsdelivr.net/npm/web3@0.20.1/dist/web3.min.js"></script> | |
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js"></script> | |
</head> | |
<body> | |
<h1>Ethereum Token Balance Explorer</h1> | |
<form id="tokenForm"> | |
<div> | |
<label for="contractAddress"> | |
<b>Token Contract Address:</b> | |
</label> | |
<input id="contractAddress" type="text" value="0x2e071D2966Aa7D8dECB1005885bA1977D6038A65" size="60" /> | |
</div> | |
<br /> | |
<div> | |
<label for="accountAddress"> | |
<b>Token Holder Address:</b> | |
</label> | |
<input id="accountAddress" type="text" value="0x602de2c98f8e2fa65e939fa001e39be8b4b7682d" size="60" /> | |
</div> | |
<br /> | |
<input type="submit" value="Get Token Info" /> | |
</form> | |
<br /> | |
<div id="results"></div> | |
<script> | |
// create a web3 object connected to our NodETH node | |
var web3 = new Web3(new Web3.providers.HttpProvider("<node rpc url>")); | |
$('#tokenForm').submit(function (event) { | |
// preventDefault on the submit event to prevent form from carrying out its default action | |
event.preventDefault(); | |
// set our results div to show a loading status | |
$('#results').html('loading...'); | |
// query the blockchain and update #results | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment