useUpdateEscrow
This endpoint allows you to change the properties of an escrow as long as a series of requirements are met, which will be mentioned in this section.
Usage
This custom hook exposes a function to update an escrow.
import { useUpdateEscrow} from "@trustless-work/escrow/hooks";
import { UpdateSingleReleaseEscrowPayload, UpdateMultiReleaseEscrowPayload } from "@trustless-work/escrow/types";
/*
* useUpdateEscrow
*/
const { updateEscrow } = useUpdateEscrow();
/*
* It returns an unsigned transaction
* payload should be of type `UpdateSingleReleaseEscrowPayload` or `UpdateMultiReleaseEscrowPayload`
*/
const { unsignedTransaction } = await updateEscrow(payload);
Function
updateEscrow
Responsible for 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.
UpdateSingleReleaseEscrowPayload: An object with fields necessary to update a single-release escrow.
UpdateMultiReleaseEscrowPayload: An object with fields necessary to update a multi-release escrow.
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: An object containing the required fields to update an escrow.
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?