JSPM

  • Created
  • Published
  • Downloads 17396
  • Score
    100M100P100Q141752F
  • License Apache-2.0

Light Toolkit for connecting with the Celo network

Package Exports

  • @celo/connect
  • @celo/connect/lib/index.js
  • @celo/connect/lib/utils/formatter
  • @celo/connect/lib/utils/formatter.js
  • @celo/connect/lib/utils/provider-utils
  • @celo/connect/lib/utils/provider-utils.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@celo/connect) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

@celo/connect

Connect to the Celo Blockchain. Connection provides the core of what you need to interact with Celo blockchain. The Core Difference between it and ContractKit is that it provides zero Contract Wrappers, and therefore leaves out convenience methods for example for setting FeeCurrency, or getting configs.

Examples

Basic

import { Connection, CeloProvider } from '@celo/connect'

const web3 = new Web3("YOUR_RPC_URL")
const connection = new Connection(web3)

connection.setProvider()

const connectedChainID =  await connection.chainId()

For a raw transaction:

const oneCelo = connection.web3.utils.toWei('1', 'ether')

const tx = connection.sendTransaction({
  from: myAddress,
  to: someAddress,
  value: oneCelo,
})
const hash = await tx.getHash()
const receipt = await tx.waitReceipt()