Skip to content

@gala-chain/chaincodeAPI


API > useAllowances

Function: useAllowances()

useAllowances(ctx, quantity, applicableAllowances, allowanceType): Promise\<boolean>

Parameters

ctx: GalaChainContext

quantity: BigNumber

applicableAllowances: TokenAllowance[]

allowanceType: AllowanceType

Returns

Promise

Description

Given one or more TokenAllowance entries allocated to a single action, 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.

This function expects applicableAllowances to be pre-filtered by grantedTo / grantedBy. See also verifyAndUseAllowances for a function that includes these identity checks.

Source

chaincode/src/allowances/useAllowances.ts:44