@gala-chain/chaincode ∙ API
API > fetchOrCreateBalance
Function: fetchOrCreateBalance()
fetchOrCreateBalance(
ctx,owner,tokenClassKey):Promise\<TokenBalance>
Parameters
▪ ctx: GalaChainContext
▪ owner: string
▪ tokenClassKey: NonFunctionProperties\<TokenClassKey>
Returns
Promise
Description
Query a single TokenBalance from on-chain World State
belonging to the provided owner for the specified
tokenClassKey argument.
If the TokenBalance does not yet exist on-chain, a
new TokenBalance class instance will be instantiated
and returned.