Skip to content

@gala-chain/chaincodeAPI


API > verifyAndUseAllowances

Function: verifyAndUseAllowances()

verifyAndUseAllowances(ctx, grantedBy, tokenInstanceKey, quantity, tokenInstance, authorizedOnBehalf, actionType): Promise\<boolean>

Parameters

ctx: GalaChainContext

grantedBy: string

tokenInstanceKey: TokenInstanceKey

quantity: BigNumber

tokenInstance: TokenInstance

authorizedOnBehalf: string

actionType: AllowanceType

Returns

Promise

Description

Query allowances from World State using a partial composite key query constructed from the provided parameters, 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:96