Ethereum Library
Etherglade is currently in Beta!
We would love it if you gave us any feedback - if the docs are unclear, you run into a bug, or something isn't working like you expect it to please e-mail [email protected] and we'll do our best to fix it ASAP :)
We automatically setup the web3 API for you when you include the Etherglade script on your site. Simply add a callback when you create an Etherglade instance that accepts the web3 instance. The web3 instance will allow you to call the web3 API with a provider already setup:
var ponzicoin = new etherglade(
"PONZICOIN_APP_ID",
"main_ponzicoin_api_key",
(web3_instance, null) => {
// Get the current ether balance of any Ethereum address
web3_instance.eth.getBalance('0x506A24fBCb8eDa2EC7d757c943723cFB32a0682E');
}
);
If your app is a smart contract, we also automatically set up a contract instance so that you can easily call read-only methods on your contract. The contract instance is a web3 contract object, so all web3 documentation applies. Add a second parameter to the callback that accepts the contract instance:
var ponzicoin = new etherglade(
"PONZICOIN_APP_ID",
"main_ponzicoin_api_key",
(web3_instance, ponzicoin_contract) => {
// Call the balanceOf function on the PonziCoin contract to find
// how many PonziCoin tokens I hold
ponzicoin_contract.balanceOf('0x506A24fBCb8eDa2EC7d757c943723cFB32a0682E');
// Get the current ether balance of any Ethereum address
web3_instance.eth.getBalance('0x506A24fBCb8eDa2EC7d757c943723cFB32a0682E');
}
);
Updated almost 7 years ago