Getting Started

Getting Started

crossbell.js is a VanillaJS library containing everything you need to start working with Crossbell.


Install crossbell.js.

npm i crossbell.js

Import Contract

Import crossbell.js:

import { Contract } from 'crossbell.js'
const contract = new Contract(window.ethereum)

Use Contract

Now we can use the contract to interact with the Crossbell protocol.

// Example Read API: Get a character by ID
const { data } = await contract.getCharacter(10);
// Example Write 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"

Want to learn more? Continue on reading the documentation.

You can start by reading the Guides, and learn the details of every API in the API Reference.