Contract Kit API

Contract Kit Example Using Ankr Endpoint

Setup

Please follow the official guides in order install the Contract Kit SDK:https://docs.celo.org/developer-guide/overview/introduction/contractkit

Example

Once the Contract Kit was install, you can start by creating a new .js file:

$ touch celo.js

We can edit with our favorite IDE, and insert the following content:

const celoEverything = require('@celo/contractkit')
const kit = celoEverything.newKit('http://<your-app-id>.ankr.com')
async function checkBalance(address) {
const balance = await kit.web3.eth.getBalance(address)
console.log(balance)
}
checkBalance('0xD2Bf1847e3385dbee3032646662690E29cdb52c9')

Make sure to change <your-app-id> with your actual Ankr App Id.

After saving the content, we can run it:

$ node celo.js

And we can see the following Output:

999623887000000000
Contents
Setup
Example