@gala-chain/api ∙ API
API > TokenBalance
Class: TokenBalance
Contents
- Extends
- Constructors
- new TokenBalance(params)
- Properties
- additionalKey
- category
- collection
- inUseHolds
- instanceIds
- lockedHolds
- owner
- quantity
- type
- COMPOSITEKEY_NS
- ID_SPLIT_CHAR
- ID_SUB_SPLIT_CHAR
- INDEX_KEY
- MIN_UNICODE_RUNE_VALUE
- Methods
- cleanupExpiredHolds()
- clearHolds()
- containsAnyNftInstanceId()
- containsInstance()
- ensureCanAddInstance()
- ensureCanAddQuantity()
- ensureCanLockInstance()
- ensureCanLockQuantity()
- ensureCanReleaseInstance()
- ensureCanRemoveInstance()
- ensureCanSubtractQuantity()
- ensureCanUnlockInstance()
- ensureCanUnlockQuantity()
- ensureCanUseInstance()
- ensureContainsNoNftInstances()
- ensureInstanceIsInBalance()
- ensureInstanceIsNft()
- ensureInstanceIsNotLocked()
- ensureInstanceIsNotLockedWithTheSameName()
- ensureInstanceIsNotUsed()
- ensureIsValidQuantityForFungible()
- ensureQuantityIsSpendable()
- ensureTokenQuantityHoldIsFungible()
- findInUseHold()
- findLockedHold()
- getCompositeKey()
- getCurrentLockedQuantity()
- getLockedQuantityTotal()
- getNftInstanceCount()
- getNftInstanceIds()
- getQuantityTotal()
- getSpendableQuantityTotal()
- getUnexpiredInUseHolds()
- getUnexpiredLockedHolds()
- getUnexpiredLockedHoldsSortedByAscendingExpiration()
- isInstanceInUse()
- isInstanceLocked()
- isInstanceSpendable()
- isMatchingHold()
- serialize()
- toPlainObject()
- validate()
- validateOrReject()
- deserialize()
- getCompositeKeyFromParts()
- getStringKeyFromParts()
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
Source
chain-api/src/types/TokenBalance.ts:123
Properties
additionalKey
readonly
additionalKey:string
Source
chain-api/src/types/TokenBalance.ts:121
category
readonly
category:string
Source
chain-api/src/types/TokenBalance.ts:113
collection
readonly
collection:string
Source
chain-api/src/types/TokenBalance.ts:109
inUseHolds
private
inUseHolds?:TokenHold
[]
Source
chain-api/src/types/TokenBalance.ts:161
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:151
lockedHolds
private
lockedHolds?:TokenHold
[]
Source
chain-api/src/types/TokenBalance.ts:156
owner
readonly
owner:string
Source
chain-api/src/types/TokenBalance.ts:105
quantity
private
quantity:BigNumber
Source
chain-api/src/types/TokenBalance.ts:165
type
readonly
type:string
Source
chain-api/src/types/TokenBalance.ts:117
COMPOSITEKEY_NS
static
COMPOSITEKEY_NS:string
="\x00"
Inherited from
Source
chain-api/src/types/ChainObject.ts:45
ID_SPLIT_CHAR
static
ID_SPLIT_CHAR:string
="$"
Inherited from
Source
chain-api/src/types/ChainObject.ts:48
ID_SUB_SPLIT_CHAR
static
ID_SUB_SPLIT_CHAR:string
="|"
Inherited from
Source
chain-api/src/types/ChainObject.ts:50
INDEX_KEY
static
readonly
INDEX_KEY:"GCTB"
="GCTB"
Source
chain-api/src/types/TokenBalance.ts:101
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:337
clearHolds()
clearHolds(
instanceId
,currentTime
):void
Parameters
▪ instanceId: BigNumber
▪ currentTime: number
Source
chain-api/src/types/TokenBalance.ts:296
containsAnyNftInstanceId()
containsAnyNftInstanceId():
boolean
Source
chain-api/src/types/TokenBalance.ts:321
containsInstance()
private
containsInstance(instanceId
):boolean
Parameters
▪ instanceId: BigNumber
Source
chain-api/src/types/TokenBalance.ts:343
ensureCanAddInstance()
ensureCanAddInstance(
instanceId
):object
Parameters
▪ instanceId: BigNumber
Returns
add()
Source
chain-api/src/types/TokenBalance.ts:189
ensureCanAddQuantity()
ensureCanAddQuantity(
quantity
):object
Parameters
▪ quantity: BigNumber
Returns
add()
Source
chain-api/src/types/TokenBalance.ts:412
ensureCanLockInstance()
ensureCanLockInstance(
hold
,currentTime
):object
Parameters
▪ hold: TokenHold
▪ currentTime: number
Returns
lock()
Source
chain-api/src/types/TokenBalance.ts:232
ensureCanLockQuantity()
ensureCanLockQuantity(
hold
):object
Parameters
▪ hold: TokenHold
Returns
lock()
Source
chain-api/src/types/TokenBalance.ts:459
ensureCanReleaseInstance()
ensureCanReleaseInstance(
instanceId
,name
,currentTime
):object
Parameters
▪ instanceId: BigNumber
▪ name: undefined
| string
▪ currentTime: number
Returns
release()
Source
chain-api/src/types/TokenBalance.ts:277
ensureCanRemoveInstance()
ensureCanRemoveInstance(
instanceId
,currentTime
):object
Parameters
▪ instanceId: BigNumber
▪ currentTime: number
Returns
remove()
Source
chain-api/src/types/TokenBalance.ts:215
ensureCanSubtractQuantity()
ensureCanSubtractQuantity(
quantity
,currentTime
):object
Parameters
▪ quantity: BigNumber
▪ currentTime: number
Returns
subtract()
Source
chain-api/src/types/TokenBalance.ts:423
ensureCanUnlockInstance()
ensureCanUnlockInstance(
instanceId
,name
,currentTime
):object
Parameters
▪ instanceId: BigNumber
▪ name: undefined
| string
▪ currentTime: number
Returns
unlock()
Source
chain-api/src/types/TokenBalance.ts:245
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:478
ensureCanUseInstance()
ensureCanUseInstance(
hold
,currentTime
):object
Parameters
▪ hold: TokenHold
▪ currentTime: number
Returns
use()
Source
chain-api/src/types/TokenBalance.ts:264
ensureContainsNoNftInstances()
private
ensureContainsNoNftInstances():void
Source
chain-api/src/types/TokenBalance.ts:536
ensureInstanceIsInBalance()
private
ensureInstanceIsInBalance(instanceId
):void
Parameters
▪ instanceId: BigNumber
Source
chain-api/src/types/TokenBalance.ts:362
ensureInstanceIsNft()
private
ensureInstanceIsNft(instanceId
):void
Parameters
▪ instanceId: BigNumber
Source
chain-api/src/types/TokenBalance.ts:355
ensureInstanceIsNotLocked()
private
ensureInstanceIsNotLocked(instanceId
,currentTime
):void
Parameters
▪ instanceId: BigNumber
▪ currentTime: number
Source
chain-api/src/types/TokenBalance.ts:379
ensureInstanceIsNotLockedWithTheSameName()
private
ensureInstanceIsNotLockedWithTheSameName(instanceId
,name
,currentTime
):void
Parameters
▪ instanceId: BigNumber
▪ name: undefined
| string
▪ currentTime: number
Source
chain-api/src/types/TokenBalance.ts:368
ensureInstanceIsNotUsed()
private
ensureInstanceIsNotUsed(instanceId
,currentTime
):void
Parameters
▪ instanceId: BigNumber
▪ currentTime: number
Source
chain-api/src/types/TokenBalance.ts:386
ensureIsValidQuantityForFungible()
private
ensureIsValidQuantityForFungible(quantity
):void
Parameters
▪ quantity: BigNumber
Source
chain-api/src/types/TokenBalance.ts:546
ensureQuantityIsSpendable()
private
ensureQuantityIsSpendable(quantity
,currentTime
):void
Parameters
▪ quantity: BigNumber
▪ currentTime: number
Source
chain-api/src/types/TokenBalance.ts:435
ensureTokenQuantityHoldIsFungible()
private
ensureTokenQuantityHoldIsFungible(hold
):void
Parameters
▪ hold: TokenHold
Source
chain-api/src/types/TokenBalance.ts:449
findInUseHold()
findInUseHold(
instanceId
,currentTime
):undefined
|TokenHold
Parameters
▪ instanceId: BigNumber
▪ currentTime: number
Source
chain-api/src/types/TokenBalance.ts:316
findLockedHold()
findLockedHold(
instanceId
,name
,currentTime
):undefined
|TokenHold
Parameters
▪ instanceId: BigNumber
▪ name: undefined
| string
▪ currentTime: number
Source
chain-api/src/types/TokenBalance.ts:307
getCompositeKey()
getCompositeKey():
string
Inherited from
Source
chain-api/src/types/ChainObject.ts:79
getCurrentLockedQuantity()
private
getCurrentLockedQuantity(currentTime
):BigNumber
Parameters
▪ currentTime: number
Source
chain-api/src/types/TokenBalance.ts:529
getLockedQuantityTotal()
getLockedQuantityTotal(
currentTime
):BigNumber
Parameters
▪ currentTime: number
Source
chain-api/src/types/TokenBalance.ts:406
getNftInstanceCount()
getNftInstanceCount():
number
Source
chain-api/src/types/TokenBalance.ts:171
getNftInstanceIds()
getNftInstanceIds():
BigNumber
[]
Source
chain-api/src/types/TokenBalance.ts:333
getQuantityTotal()
getQuantityTotal():
BigNumber
Source
chain-api/src/types/TokenBalance.ts:395
getSpendableQuantityTotal()
getSpendableQuantityTotal(
currentTime
):BigNumber
Parameters
▪ currentTime: number
Source
chain-api/src/types/TokenBalance.ts:400
getUnexpiredInUseHolds()
getUnexpiredInUseHolds(
currentTime
):TokenHold
[]
Parameters
▪ currentTime: number
Source
chain-api/src/types/TokenBalance.ts:185
getUnexpiredLockedHolds()
getUnexpiredLockedHolds(
currentTime
):TokenHold
[]
Parameters
▪ currentTime: number
Source
chain-api/src/types/TokenBalance.ts:175
getUnexpiredLockedHoldsSortedByAscendingExpiration()
getUnexpiredLockedHoldsSortedByAscendingExpiration(
currentTime
):TokenHold
[]
Parameters
▪ currentTime: number
Source
chain-api/src/types/TokenBalance.ts:179
isInstanceInUse()
private
isInstanceInUse(instanceId
,currentTime
):boolean
Parameters
▪ instanceId: BigNumber
▪ currentTime: number
Source
chain-api/src/types/TokenBalance.ts:351
isInstanceLocked()
private
isInstanceLocked(instanceId
,currentTime
):boolean
Parameters
▪ instanceId: BigNumber
▪ currentTime: number
Source
chain-api/src/types/TokenBalance.ts:347
isInstanceSpendable()
isInstanceSpendable(
instanceId
,currentTime
):boolean
Parameters
▪ instanceId: BigNumber
▪ currentTime: number
Source
chain-api/src/types/TokenBalance.ts:325
isMatchingHold()
private
isMatchingHold(hold
,name
?,lockAuthority
?):boolean
Parameters
▪ hold: TokenHold
▪ name?: string
▪ lockAuthority?: string
Source
chain-api/src/types/TokenBalance.ts:470
serialize()
serialize():
string
Inherited from
Source
chain-api/src/types/ChainObject.ts:52
toPlainObject()
toPlainObject():
Record
\<string
,unknown
>
Inherited from
Source
chain-api/src/types/ChainObject.ts:68
validate()
validate():
Promise
\<ValidationError
[]>
Inherited from
Source
chain-api/src/types/ChainObject.ts:56
validateOrReject()
validateOrReject():
Promise
\<void
>
Inherited from
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
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