A celo-web-signer allows unlimited use of celo web dapps in desktop web browsers and mobile dapp browsers.
npm install @dexfair/celo-web-signer
or if you use yarn
yarn add @dexfair/celo-web-signer
- MetaMask Chrome Extension
- MetaMask Mobile Wallet (iPHONE is not tested)
- DSRV's Chrome Desktop Wallet
- Ledger: Hardware Wallet USB
- Developing
- dexfair dapp browser (with Valora, Ledger USB, Ledger BLE)
"@celo/contractkit": "^1.0.0-beta3"
import { Celo, NETWORKS, ERC20ABI } from "@dexfair/celo-web-signer"
const celo = new Celo(NETWORKS.Mainnet)
const onChainChanged = (network) => {
// do something
}
const onAccountsChanged = (account) => {
// do something
}
await celo.connectCelo(onChainChanged, onAccountsChanged) // for celo extension wallet
// or
await celo.connectMetaMask(onAccountsChanged) // for metamask extension wallet
// or
await celo.connectLedgerUSB(onAccountsChanged) // for ledger wallet for web browsers
// or
await celo.connectLedgerBLE(onAccountsChanged) // for ledger wallet for web browsers
await celo.changeNetwork(NETWORKS.Alfajores)
const accounts = await celo.getAccounts()
const tx = {
from: myAddress,
to: someAddress,
value: oneGold,
data: someData
}
const txReceipt = await celo.sendTransaction(tx)