SDK
crossbell.js
Contract API
Character
Read Methods

Read Methods

The following methods are used to read character data from the blockchain.

Though the contract offers these read methods, they are not ideal for use in a production environment for performance concerns. We recommend using the indexer instead.

getCharacter

Returns the character data for the given character ID.

getCharacter(characterId: BigNumberish, overrides?: CallOverrides): Promise<{ data: Character; }>

Usage

contract.getCharacter(42)

Parameters

characterId

  • Type: BigNumberish

The ID of the character to retrieve.

Returns

interface Returns {
  data: {
    /** The id of this character. */
    characterId: number
    /** The handle of this character. */
    handle: string
    /** The metadata URI of this character. */
    uri: string
    /** The metadata of this character. */
    metadata?: CharacterMetadata
    /** The social token of this character. */
    socialToken: string
    /** The count of notes this character posted. */
    noteCount: number
  }
}

getCharacterByHandle

Returns the character data for the given character handle.

getCharacterByHandle(handle: string, overrides?: CallOverrides): Promise<{ data: Character; }>

Usage

contract.getCharacterByHandle('0x1234')

Parameters

handle

  • Type: string

The handle of the character to retrieve.

Returns

interface Returns {
  data: {
    /** The id of this character. */
    characterId: number
    /** The handle of this character. */
    handle: string
    /** The metadata URI of this character. */
    uri: string
    /** The metadata of this character. */
    metadata?: CharacterMetadata
    /** The social token of this character. */
    socialToken: string
    /** The count of notes this character posted. */
    noteCount: number
  }
}

getCharacterUri

Returns the URI of the character metadata for the given character ID.

getCharacterUri(characterId: BigNumberish, overrides?: CallOverrides): Promise<{ data: string; }>

Usage

contract.getCharacterUri(42)

Parameters

characterId

  • Type: BigNumberish

The ID of the character to retrieve.

Returns

interface Returns {
  data: string
}

getHandle

Returns the handle of the character with the given ID.

getHandle(characterId: BigNumberish, overrides?: CallOverrides): Promise<{ data: string; }>

Usage

contract.getHandle(42)

Parameters

characterId

  • Type: BigNumberish

The ID of the character to retrieve.

Returns

interface Returns {
  data: string
}

getPrimaryCharacterId

Returns the ID of the primary character for the given address.

getPrimaryCharacterId(address: string, overrides?: CallOverrides): Promise<{ data: number; }>

Usage

contract.getPrimaryCharacterId('0x1234567890123456789012345678901234567890')

Parameters

address

  • Type: string

The Ethereum address to retrieve the primary character ID for.

Returns

interface Returns {
  data: number
}

isPrimaryCharacterId

Returns whether the given character ID is the primary character for the given address.

isPrimaryCharacterId(address: string, characterId: BigNumberish, overrides?: CallOverrides): Promise<{ data: boolean; }>

Usage

contract.isPrimaryCharacterId('0x1234567890123456789012345678901234567890', 42)

Parameters

address

  • Type: string

The Ethereum address to check.

characterId

  • Type: BigNumberish

The character ID to check.

Returns

interface Returns {
  data: boolean
}

existsCharacterForAddress

Returns whether the given address has a character.

existsCharacterForAddress(address: string, overrides?: CallOverrides): Promise<{ data: boolean; }>

Usage

contract.existsCharacterForAddress('0x1234567890123456789012345678901234567890')

Parameters

address

  • Type: string

The Ethereum address to check.

Returns

interface Returns {
  data: boolean
}

existsCharacterForHandle

Returns whether the given handle is taken.

existsCharacterForHandle(handle: string, overrides?: CallOverrides): Promise<{ data: boolean; }>

Usage

contract.existsCharacterForHandle('Jason')

Parameters

handle

  • Type: string

The handle to check.

Returns

interface Returns {
  data: boolean
}