Skip to content

@gala-chain/chaincodeAPI


API > verifyAndUseTransferAllowancesByKeys

Function: verifyAndUseTransferAllowancesByKeys()

verifyAndUseTransferAllowancesByKeys(ctx, grantedBy, tokenInstanceKey, quantity, tokenInstance, authorizedOnBehalf, useAllowancesArr): Promise\<boolean>

Parameters

ctx: GalaChainContext

grantedBy: string

tokenInstanceKey: TokenInstanceKey

quantity: BigNumber

tokenInstance: TokenInstance

authorizedOnBehalf: string

useAllowancesArr: string[]

Array of allowance composite keys to use

Returns

Promise

Description

Query allowances from World State using specific allowance keys (composite keys), ensuring that the provided grantedBy and authorizedOnBehalf parameters match the TokenAllowance grantedBy and grantedTo properties.

Apply the remaining quantity of each applicable allowance to the total quantity.

Return true after accounting for the full spend. Write a TokenClaim entry for each allowance used.

Throws an exception if the full quantity cannot be met by the provided allowances.

Source

chaincode/src/allowances/verifyAndUseAllowances.ts:154