When using Ethers.js on Celo, we suggest using the Celo Ethers.js Wrapper to make Ethers.JS compatible with the Celo network. This means being able to handle fee abstraction when opened in MiniPay/ Valora.Fee Abstraction on Celo enables the use of stablecoins like cUSD, USDT and USDC as gas tokens.
Celo Ethers.JS Wrapper
A minimal wrapper to make Ethers.JS compatible with the Celo network.This is still experimental. View on GitHub
Install
npm i @celo-tools/celo-ethers-wrapper
or
yarn add @celo-tools/celo-ethers-wrapper
Note this wrapper has Ethers v5 as a peer dependency. Your project must include a dependency on that as well.
Basic Usage
Connect to the network by creating aCeloProvider
, which is based on JsonRpc-Provider:
StaticCeloProvider
instead.
Next, Create a CeloWallet, which is based on Wallet :
Contract Interaction
CeloWallet
can be used to send transactions.
Hereās an example of sending cUSD with the Mento StableToken contract. For interacting with contracts you need the ABI and address. Addresses for Celo core contracts can be found with the CLIās network:contracts
command. The ABIs can be built from the solidity code or extracted in ContractKitās generated
folder.