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
const Web3 = require('web3') | |
const ContractKit = require('@celo/contractkit') | |
require('dotenv').config({path: '.env'}) | |
const web3 = new Web3(`https://celo-alfajores--rpc.datahub.figment.io/apikey/${process.env.FIGMENT_API_KEY}/`) | |
const kit = ContractKit.newKitFromWeb3(web3) | |
async function getCusdRate(){ | |
let oracles = await kit.contracts.getSortedOracles() |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
const Web3 = require("web3") | |
const ContractKit = require('@celo/contractkit') | |
const web3 = new Web3('https://forno.celo.org') | |
const kit = ContractKit.newKitFromWeb3(web3) | |
let anAddress = '0xD86518b29BB52a5DAC5991eACf09481CE4B0710d' | |
async function signTx(){ | |
let goldtoken = await kit.contracts.getGoldToken() |
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
// API call: | |
// https://explorer.celo.org/api?module=transaction&action=gettxinfo&txhash=0xc495463ca93ec63fa654cc12690db488a9b127221a21af4c6359ceb357f3d757 | |
{ | |
"status": "1", | |
"result": { | |
"value": "0", | |
"to": "0x6d67b41236129cb4f6ffaf6e37223485b20d1d06", | |
"timeStamp": "1610353070", | |
"success": true, | |
"next_page_params": null, |
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
[{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"string","name":""}],"name":"name","inputs":[],"constant":true},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[{"type":"bool","name":""}],"name":"approve","inputs":[{"type":"address","name":"spender"},{"type":"uint256","name":"value"}],"constant":false},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"address","name":""}],"name":"validatorSignerAddressFromCurrentSet","inputs":[{"type":"uint256","name":"index"}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":""}],"name":"valueToUnits","inputs":[{"type":"uint256","name":"value"}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"bool","name":""}],"name":"initialized","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":""}],"name":"totalSupp |
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
// In this example, we will go over how to look up a Celo address that is registered with a phone number with ODIS | |
// 1. Import the appropriate packages | |
const ContractKit = require('@celo/contractkit') | |
const OdisUtils = require('@celo/identity').OdisUtils | |
// 2. Import these packages to help with private key management for the example | |
const privateKeyToAddress = require('@celo/utils/lib/address').privateKeyToAddress | |
const normalizeAddressWith0x = require('@celo/utils/lib/address').normalizeAddressWith0x |
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
// Import ContractKit | |
const ContractKit = require('@celo/contractkit') | |
// Create a new instance of ContractKit, connecting to a local Celo node | |
//const contractKit = ContractKit.newKit('http://localhost:8545') | |
const contractKit = ContractKit.newKit('https://alfajores-forno.celo-testnet.org') | |
// Specify an arbitrary recipient of the transaction | |
const recipient = '0xB9727f7f1e1f4a5229a49E260fBBBD410d10f2Ff' | |
const privateKey = '3a26ebc37944c305670a21ea6a5d16c1084db2f18bc6635ba95f487e5c59868f' |
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
#!/usr/bin/env node | |
/* | |
This script is a demo of how to use the ContractKit to send a transaction on the Celo network (https://celo.org) | |
With npm installed, run this script with the command: | |
npx https://gist.github.com/critesjosh/7dd9cdb3076d9d5874c061612af8057e | |
*/ | |
// Import ContractKit | |
const ContractKit = require('@celo/contractkit') |