crossbell.js - v0.19.4


A JavaScript SDK to interact with the Crossbell. It works for both browser and Node.js.

npm version npm downloads


npm install crossbell.js



Connect with Metamask

import { Contract } from 'crossbell.js'

// Create a new contract instance with metamask provider
const provider = window.ethereum
const contract = new Contract(provider)

// Example API: Create a new character for an address
try {
const result = await contract.createCharacter(
console.log( // '42' (characterId)
console.log(result.transactionHash) // '0xabcdef...'
} catch (e) {
console.error(e.message) // e.g. "execution reverted: Web3Entry: HandleExists"

Connect with Private Key

You can also connect with a private key directly.

import { Contract } from 'crossbell.js'

const privateKey =
const contract = new Contract(privateKey)

Connect with Read-Only

You can also connect with a read-only provider. Note that in this case, you can't do write operations like createCharacter.

import { Contract } from 'crossbell.js'

const contract = new Contract() // just pass nothing to use a read-only provider

For more contract api, see docs.


You can fetch data from the crossbell indexer.

import { Indexer } from 'crossbell.js'

const indexer = new Indexer()

// get a list of characters owned by a specific address
const res = await indexer.getCharacters(

For more indexer api, see docs.

Trouble Shooting

In Vue.js: TypeError: get on proxy: property provider is a read-only and non-configurable data property on the proxy target but the proxy did not return its actual value.

To fix this in Vue.js, you need to call makeRaw for the Web3Provider instance.

let web3provider = new Web3Provider(wallet.provider, 'any')
web3provider = markRaw(web3provider)

Generated using TypeDoc