useApproveMilestone
Responsible for modifying the "flag" property of a specific milestone in the escrow to approve that milestone.
Usage
This custom hook exposes a mutation function along with status flags to manage the approval of a milestone.
Description of Return Values
isPending
A boolean status flag indicating whether the mutation is currently in progress. Useful for showing loaders or disabling UI elements during the process.isError
A boolean status flag that becomestrue
if the mutation fails.isSuccess
A boolean status flag that becomestrue
once the mutation completes successfully.
Mutation Function
approveMilestone
This is the main mutation function. Internally, it wraps mutate
or mutateAsync
and handles building and returning an unsigned transaction based on the provided payload.
EscrowType: Specifies the type of escrow. It accepts the following values:
multi-release: Allows for multiple releases of funds.
single-release: Funds are released in a single transaction.
ApproveMilestonePayload: An object with fields necessary to approve a milestone. It is applicable for both single-release and multi-release escrow types.
Parameters:
Ensure they match: if you choose a "multi-release" type, you must also use a "multi-release" payload.
type: Describes the escrow type to be used. Options are "multi-release" or "single-release".
payload: Contains the data required for milestone approval.
Return Value:
unsignedTransaction
: An object representing the constructed transaction, ready to be signed by your wallet and broadcast.
Usage Example
Last updated
Was this helpful?