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?: string

params.type?: string

Overrides

ChainObject.constructor

Source

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

Properties

additionalKey

readonly additionalKey: string

Source

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


category

readonly category: string

Source

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


collection

readonly collection: string

Source

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


inUseHolds

private inUseHolds?: TokenHold[]

Source

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


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:153


lockedHolds

private lockedHolds?: TokenHold[]

Source

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


owner

readonly owner: string

Source

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


quantity

private quantity: BigNumber

Source

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


type

readonly type: string

Source

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


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:103


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

cleanupExpiredHolds()

cleanupExpiredHolds(currentTime): TokenBalance

Parameters

currentTime: number

Source

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


clearHolds()

clearHolds(instanceId, currentTime): void

Parameters

instanceId: BigNumber

currentTime: number

Source

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


containsAnyNftInstanceId()

containsAnyNftInstanceId(): boolean

Source

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


containsInstance()

private containsInstance(instanceId): boolean

Parameters

instanceId: BigNumber

Source

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


ensureCanAddInstance()

ensureCanAddInstance(instanceId): object

Parameters

instanceId: BigNumber

Returns

add()

Source

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


ensureCanAddQuantity()

ensureCanAddQuantity(quantity): object

Parameters

quantity: BigNumber

Returns

add()

Source

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


ensureCanLockInstance()

ensureCanLockInstance(hold, currentTime): object

Parameters

hold: TokenHold

currentTime: number

Returns

lock()

Source

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


ensureCanLockQuantity()

ensureCanLockQuantity(hold): object

Parameters

hold: TokenHold

Returns

lock()

Source

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


ensureCanReleaseInstance()

ensureCanReleaseInstance(instanceId, name, currentTime): object

Parameters

instanceId: BigNumber

name: undefined | string

currentTime: number

Returns

release()

Source

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


ensureCanRemoveInstance()

ensureCanRemoveInstance(instanceId, currentTime): object

Parameters

instanceId: BigNumber

currentTime: number

Returns

remove()

Source

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


ensureCanSubtractQuantity()

ensureCanSubtractQuantity(quantity, currentTime): object

Parameters

quantity: BigNumber

currentTime: number

Returns

subtract()

Source

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


ensureCanUnlockInstance()

ensureCanUnlockInstance(instanceId, name, currentTime): object

Parameters

instanceId: BigNumber

name: undefined | string

currentTime: number

Returns

unlock()

Source

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


ensureCanUnlockQuantity()

ensureCanUnlockQuantity(quantity, currentTime, name?, lockAuthority?): object

Parameters

quantity: BigNumber

currentTime: number

name?: string

lockAuthority?: string

Returns

unlock()

Source

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


ensureCanUseInstance()

ensureCanUseInstance(hold, currentTime): object

Parameters

hold: TokenHold

currentTime: number

Returns

use()

Source

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


ensureContainsNoNftInstances()

private ensureContainsNoNftInstances(): void

Source

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


ensureInstanceIsInBalance()

private ensureInstanceIsInBalance(instanceId): void

Parameters

instanceId: BigNumber

Source

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


ensureInstanceIsNft()

private ensureInstanceIsNft(instanceId): void

Parameters

instanceId: BigNumber

Source

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


ensureInstanceIsNotLocked()

private ensureInstanceIsNotLocked(instanceId, currentTime): void

Parameters

instanceId: BigNumber

currentTime: number

Source

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


ensureInstanceIsNotLockedWithTheSameName()

private ensureInstanceIsNotLockedWithTheSameName(instanceId, name, currentTime): void

Parameters

instanceId: BigNumber

name: undefined | string

currentTime: number

Source

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


ensureInstanceIsNotUsed()

private ensureInstanceIsNotUsed(instanceId, currentTime): void

Parameters

instanceId: BigNumber

currentTime: number

Source

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


ensureIsValidQuantityForFungible()

private ensureIsValidQuantityForFungible(quantity): void

Parameters

quantity: BigNumber

Source

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


ensureQuantityIsSpendable()

private ensureQuantityIsSpendable(quantity, currentTime): void

Parameters

quantity: BigNumber

currentTime: number

Source

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


ensureTokenQuantityHoldIsFungible()

private ensureTokenQuantityHoldIsFungible(hold): void

Parameters

hold: TokenHold

Source

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


findInUseHold()

findInUseHold(instanceId, currentTime): undefined | TokenHold

Parameters

instanceId: BigNumber

currentTime: number

Source

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


findLockedHold()

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

Parameters

instanceId: BigNumber

name: undefined | string

currentTime: number

Source

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


getCompositeKey()

getCompositeKey(): string

Inherited from

ChainObject.getCompositeKey

Source

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


getCurrentLockedQuantity()

private getCurrentLockedQuantity(currentTime): BigNumber

Parameters

currentTime: number

Source

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


getLockedQuantityTotal()

getLockedQuantityTotal(currentTime): BigNumber

Parameters

currentTime: number

Source

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


getNftInstanceCount()

getNftInstanceCount(): number

Source

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


getNftInstanceIds()

getNftInstanceIds(): BigNumber[]

Source

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


getQuantityTotal()

getQuantityTotal(): BigNumber

Source

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


getSpendableQuantityTotal()

getSpendableQuantityTotal(currentTime): BigNumber

Parameters

currentTime: number

Source

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


getUnexpiredInUseHolds()

getUnexpiredInUseHolds(currentTime): TokenHold[]

Parameters

currentTime: number

Source

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


getUnexpiredLockedHolds()

getUnexpiredLockedHolds(currentTime): TokenHold[]

Parameters

currentTime: number

Source

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


getUnexpiredLockedHoldsSortedByAscendingExpiration()

getUnexpiredLockedHoldsSortedByAscendingExpiration(currentTime): TokenHold[]

Parameters

currentTime: number

Source

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


isInstanceInUse()

private isInstanceInUse(instanceId, currentTime): boolean

Parameters

instanceId: BigNumber

currentTime: number

Source

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


isInstanceLocked()

private isInstanceLocked(instanceId, currentTime): boolean

Parameters

instanceId: BigNumber

currentTime: number

Source

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


isInstanceSpendable()

isInstanceSpendable(instanceId, currentTime): boolean

Parameters

instanceId: BigNumber

currentTime: number

Source

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


isMatchingHold()

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

Parameters

hold: TokenHold

name?: string

lockAuthority?: string

Source

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


serialize()

serialize(): string

Inherited from

ChainObject.serialize

Source

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


toPlainObject()

toPlainObject(): Record\<string, unknown>

Inherited from

ChainObject.toPlainObject

Source

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


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:72


getCompositeKeyFromParts()

static getCompositeKeyFromParts(indexKey, parts): string

Parameters

indexKey: string

parts: unknown[]

Inherited from

ChainObject.getCompositeKeyFromParts

Source

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


getStringKeyFromParts()

static getStringKeyFromParts(parts): string

Parameters

parts: string[]

Inherited from

ChainObject.getStringKeyFromParts

Source

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