Read Methods
The following methods are used to read note 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.
getNote
Returns the note data for the given note ID.
getNote<T extends LinkItem>(
characterId: BigNumberish,
noteId: BigNumberish,
linkItemType?: Note['linkItemTypeString'],
overrides: CallOverrides = {},
): Promise<Result<Note<T>>> | never
Usage
contract.getCharacter(42, 5)
Parameters
characterId
- Type: BigNumberish
The ID of the character who posted the note.
noteId
- Type: BigNumberish
The ID of the note to retrieve.
linkItemType
(optional)
- Type: 'Character' | 'Address' | 'Note' | 'ERC721' | 'Linklist' | 'AnyUri' | undefined
The type of link item to retrieve.
For example, if it's AnyUri
, it means the note was posted with postNoteWithAnyUri
.
Returns
export interface Note<T extends LinkItem | undefined = undefined> {
/** The character id of the address who owns the note. */
characterId: number
/** The id of this note. Each id is unique under one character. */
noteId: number
/** The content URI of this note. */
contentUri: string
/** The metadata content of this note. */
metadata?: NoteMetadata
/** The bytes32 representation of the link if there is one. */
linkItemType: string
/** The type of the link if there is one. */
linkItemTypeString?: LinkItemType
linkItem: T
/**
* The primary key (id) of the linking target. It's keccak256 encoded.
* You may need to use `contract.getLinkingXXX(linkKey)` to get the target.
**/
linkKey: string
/** The link module address of the note. */
linkModule: string
/** NFT contract address if this is a minted NFT note. */
contractAddress: string
/** The mint module address of the note */
mintModule: string
/** Whether or not this note has been deleted. */
deleted: boolean
/** Whether or not this note has been locked. I.e., not able to be edited. */
locked: boolean
}
interface Returns {
data: Note
}