SDK
crossbell.js
Contract API
Link
Read Methods

Read Methods

The following methods are used to read link 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.

getLinkingCharacterIds

Returns the character IDs of all characters that have linked to the specified character.

getLinkingCharacterIds(fromCharacterId: BigNumberish, linkType: string, overrides?: CallOverrides): Promise<{ data: number[]; }>

Usage

Get the IDs of all characters that have linked to character 42 with the follow link type. That is to say, get the IDs of all characters that character 42 is following.

contract.getLinkingCharacterIds(42, 'follow')

Parameters

fromCharacterId

The ID of the character to get linking character IDs for.

linkType

The link type to get linking character IDs for.

Returns

interface Returns {
  data: number[]
}

getLinkedCharacters

Returns the characters that have linked to the specified character.

getLinkingCharacters(fromCharacterId: BigNumberish, linkType: string, overrides?: CallOverrides): Promise<{ data: Character[]; }>

Usage

Get the characters that have linked to character 42 with the follow link type. That is to say, get the characters that character 42 is following.

contract.getLinkedCharacters(42, 'follow')

Parameters

fromCharacterId

The ID of the character to get linking characters for.

linkType

The link type to get linking characters for.

Returns

interface Returns {
  data: Character[]
}
 
interface Character {
  /** 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
}