useChangeMilestoneStatus

Responsible for modifying the "status" property of a specific milestone in the escrow.

Usage

This custom hook exposes a function to change a custom status the milestone.

import { useChangeMilestoneStatus } from "@trustless-work/escrow/hooks";
import { ChangeMilestoneStatusPayload } from "@trustless-work/escrow/types";

/*
 *  useChangeMilestoneStatus 
*/
const { changeMilestoneStatus } = useChangeMilestoneStatus();

/* 
 * It returns an unsigned transaction
 * payload should be of type `ChangeMilestoneStatusPayload`
*/
const { unsignedTransaction } = await changeMilestoneStatus(payload);

Mutation Function

changeMilestoneStatus

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.

ChangeMilestoneStatusPayload: An object with fields necessary to change the milestone status. 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 change milestone status.

Change Milestone Status

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?