Skip to content

@gala-chain/apiAPI


API > TokenBalance

Class: TokenBalance

Contents

Extends

Constructors

new TokenBalance(params)

new TokenBalance(params?): TokenBalance

Parameters

params?: object

params.additionalKey?: string

params.category?: string

params.collection?: string

params.owner?: UserAlias

params.type?: string

Overrides

ChainObject.constructor

Source

chain-api/src/types/TokenBalance.ts:124

Properties

additionalKey

readonly additionalKey: string

Source

chain-api/src/types/TokenBalance.ts:122


category

readonly category: string

Source

chain-api/src/types/TokenBalance.ts:114


collection

readonly collection: string

Source

chain-api/src/types/TokenBalance.ts:110


inUseHolds

private inUseHolds?: TokenHold[]

Source

chain-api/src/types/TokenBalance.ts:162


instanceIds

private instanceIds?: BigNumber[]

Token instance IDs for NFTs. It is also used to determine if the balance is for fungible or non-fungible tokens. If the array is undefined, then the balance is for fungible tokens.

Source

chain-api/src/types/TokenBalance.ts:152


lockedHolds

private lockedHolds?: TokenHold[]

Source

chain-api/src/types/TokenBalance.ts:157


owner

readonly owner: UserAlias

Source

chain-api/src/types/TokenBalance.ts:106


quantity

private quantity: BigNumber

Source

chain-api/src/types/TokenBalance.ts:166


type

readonly type: string

Source

chain-api/src/types/TokenBalance.ts:118


COMPOSITEKEY_NS

static COMPOSITEKEY_NS: string = "\x00"

Inherited from

ChainObject.COMPOSITEKEY_NS

Source

chain-api/src/types/ChainObject.ts:45


ID_SPLIT_CHAR

static ID_SPLIT_CHAR: string = "$"

Inherited from

ChainObject.ID_SPLIT_CHAR

Source

chain-api/src/types/ChainObject.ts:48


ID_SUB_SPLIT_CHAR

static ID_SUB_SPLIT_CHAR: string = "|"

Inherited from

ChainObject.ID_SUB_SPLIT_CHAR

Source

chain-api/src/types/ChainObject.ts:50


INDEX_KEY

static readonly INDEX_KEY: "GCTB" = "GCTB"

Source

chain-api/src/types/TokenBalance.ts:102


MIN_UNICODE_RUNE_VALUE

static MIN_UNICODE_RUNE_VALUE: string = "\u0000"

Inherited from

ChainObject.MIN_UNICODE_RUNE_VALUE

Source

chain-api/src/types/ChainObject.ts:43

Methods

addInstance()

addInstance(instanceId): void

Parameters

instanceId: BigNumber

Source

chain-api/src/types/TokenBalance.ts:190


addQuantity()

addQuantity(quantity): void

Parameters

quantity: BigNumber

Source

chain-api/src/types/TokenBalance.ts:382


cleanupExpiredHolds()

cleanupExpiredHolds(currentTime): TokenBalance

Parameters

currentTime: number

Source

chain-api/src/types/TokenBalance.ts:306


clearHolds()

clearHolds(instanceId, currentTime): void

Parameters

instanceId: BigNumber

currentTime: number

Source

chain-api/src/types/TokenBalance.ts:265


containsAnyNftInstanceId()

containsAnyNftInstanceId(): boolean

Source

chain-api/src/types/TokenBalance.ts:290


containsInstance()

private containsInstance(instanceId): boolean

Parameters

instanceId: BigNumber

Source

chain-api/src/types/TokenBalance.ts:312


copy()

copy(): TokenBalance

Inherited from

ChainObject.copy

Source

chain-api/src/types/ChainObject.ts:72


ensureContainsNoNftInstances()

private ensureContainsNoNftInstances(): void

Source

chain-api/src/types/TokenBalance.ts:490


ensureInstanceIsInBalance()

private ensureInstanceIsInBalance(instanceId): void

Parameters

instanceId: BigNumber

Source

chain-api/src/types/TokenBalance.ts:331


ensureInstanceIsNft()

private ensureInstanceIsNft(instanceId): void

Parameters

instanceId: BigNumber

Source

chain-api/src/types/TokenBalance.ts:324


ensureInstanceIsNotLocked()

private ensureInstanceIsNotLocked(instanceId, currentTime): void

Parameters

instanceId: BigNumber

currentTime: number

Source

chain-api/src/types/TokenBalance.ts:348


ensureInstanceIsNotLockedWithTheSameName()

private ensureInstanceIsNotLockedWithTheSameName(instanceId, name, currentTime): void

Parameters

instanceId: BigNumber

name: undefined | string

currentTime: number

Source

chain-api/src/types/TokenBalance.ts:337


ensureInstanceIsNotUsed()

private ensureInstanceIsNotUsed(instanceId, currentTime): void

Parameters

instanceId: BigNumber

currentTime: number

Source

chain-api/src/types/TokenBalance.ts:355


ensureIsValidQuantityForFungible()

private ensureIsValidQuantityForFungible(quantity): void

Parameters

quantity: BigNumber

Source

chain-api/src/types/TokenBalance.ts:500


ensureQuantityIsSpendable()

private ensureQuantityIsSpendable(quantity, currentTime): void

Parameters

quantity: BigNumber

currentTime: number

Source

chain-api/src/types/TokenBalance.ts:397


ensureTokenQuantityHoldIsFungible()

private ensureTokenQuantityHoldIsFungible(hold): void

Parameters

hold: TokenHold

Source

chain-api/src/types/TokenBalance.ts:411


findInUseHold()

findInUseHold(instanceId, currentTime): undefined | TokenHold

Parameters

instanceId: BigNumber

currentTime: number

Source

chain-api/src/types/TokenBalance.ts:285


findLockedHold()

findLockedHold(instanceId, name, currentTime): undefined | TokenHold

Parameters

instanceId: BigNumber

name: undefined | string

currentTime: number

Source

chain-api/src/types/TokenBalance.ts:276


getCompositeKey()

getCompositeKey(): string

Inherited from

ChainObject.getCompositeKey

Source

chain-api/src/types/ChainObject.ts:84


getCurrentLockedQuantity()

private getCurrentLockedQuantity(currentTime): BigNumber

Parameters

currentTime: number

Source

chain-api/src/types/TokenBalance.ts:483


getLockedQuantityTotal()

getLockedQuantityTotal(currentTime): BigNumber

Parameters

currentTime: number

Source

chain-api/src/types/TokenBalance.ts:376


getNftInstanceCount()

getNftInstanceCount(): number

Source

chain-api/src/types/TokenBalance.ts:172


getNftInstanceIds()

getNftInstanceIds(): BigNumber[]

Source

chain-api/src/types/TokenBalance.ts:302


getQuantityTotal()

getQuantityTotal(): BigNumber

Source

chain-api/src/types/TokenBalance.ts:365


getSpendableQuantityTotal()

getSpendableQuantityTotal(currentTime): BigNumber

Parameters

currentTime: number

Source

chain-api/src/types/TokenBalance.ts:370


getUnexpiredInUseHolds()

getUnexpiredInUseHolds(currentTime): TokenHold[]

Parameters

currentTime: number

Source

chain-api/src/types/TokenBalance.ts:186


getUnexpiredLockedHolds()

getUnexpiredLockedHolds(currentTime): TokenHold[]

Parameters

currentTime: number

Source

chain-api/src/types/TokenBalance.ts:176


getUnexpiredLockedHoldsSortedByAscendingExpiration()

getUnexpiredLockedHoldsSortedByAscendingExpiration(currentTime): TokenHold[]

Parameters

currentTime: number

Source

chain-api/src/types/TokenBalance.ts:180


isInstanceInUse()

private isInstanceInUse(instanceId, currentTime): boolean

Parameters

instanceId: BigNumber

currentTime: number

Source

chain-api/src/types/TokenBalance.ts:320


isInstanceLocked()

private isInstanceLocked(instanceId, currentTime): boolean

Parameters

instanceId: BigNumber

currentTime: number

Source

chain-api/src/types/TokenBalance.ts:316


isInstanceSpendable()

isInstanceSpendable(instanceId, currentTime): boolean

Parameters

instanceId: BigNumber

currentTime: number

Source

chain-api/src/types/TokenBalance.ts:294


isMatchingHold()

private isMatchingHold(hold, name?, lockAuthority?): boolean

Parameters

hold: TokenHold

name?: string

lockAuthority?: string

Source

chain-api/src/types/TokenBalance.ts:428


lockInstance()

lockInstance(hold, currentTime): void

Parameters

hold: TokenHold

currentTime: number

Source

chain-api/src/types/TokenBalance.ts:225


lockQuantity()

lockQuantity(hold): void

Parameters

hold: TokenHold

Source

chain-api/src/types/TokenBalance.ts:421


releaseInstance()

releaseInstance(instanceId, name, currentTime): void

Parameters

instanceId: BigNumber

name: undefined | string

currentTime: number

Source

chain-api/src/types/TokenBalance.ts:254


removeInstance()

removeInstance(instanceId, currentTime): void

Parameters

instanceId: BigNumber

currentTime: number

Source

chain-api/src/types/TokenBalance.ts:212


serialize()

serialize(): string

Inherited from

ChainObject.serialize

Source

chain-api/src/types/ChainObject.ts:52


subtractQuantity()

subtractQuantity(quantity, currentTime): void

Parameters

quantity: BigNumber

currentTime: number

Source

chain-api/src/types/TokenBalance.ts:389


toPlainObject()

toPlainObject(): Record\<string, unknown>

Inherited from

ChainObject.toPlainObject

Source

chain-api/src/types/ChainObject.ts:68


unlockInstance()

unlockInstance(instanceId, name, currentTime): void

Parameters

instanceId: BigNumber

name: undefined | string

currentTime: number

Source

chain-api/src/types/TokenBalance.ts:234


unlockQuantity()

unlockQuantity(quantity, currentTime, name?, lockAuthority?): void

Parameters

quantity: BigNumber

currentTime: number

name?: string

lockAuthority?: string

Source

chain-api/src/types/TokenBalance.ts:436


useInstance()

useInstance(hold, currentTime): void

Parameters

hold: TokenHold

currentTime: number

Source

chain-api/src/types/TokenBalance.ts:245


validate()

validate(): Promise\<ValidationError[]>

Inherited from

ChainObject.validate

Source

chain-api/src/types/ChainObject.ts:56


validateOrReject()

validateOrReject(): Promise\<void>

Inherited from

ChainObject.validateOrReject

Source

chain-api/src/types/ChainObject.ts:60


deserialize()

static deserialize\<T>(constructor, object): T

Type parameters

T

Parameters

constructor: ClassConstructor\<Inferred\<T, ChainObject>>

object: string | Record\<string, unknown> | Record\<string, unknown>[]

Inherited from

ChainObject.deserialize

Source

chain-api/src/types/ChainObject.ts:77


getCompositeKeyFromParts()

static getCompositeKeyFromParts(indexKey, parts): string

Parameters

indexKey: string

parts: unknown[]

Inherited from

ChainObject.getCompositeKeyFromParts

Source

chain-api/src/types/ChainObject.ts:109


getStringKeyFromParts()

static getStringKeyFromParts(parts): string

Parameters

parts: string[]

Inherited from

ChainObject.getStringKeyFromParts

Source

chain-api/src/types/ChainObject.ts:129