useWithdrawRemainingFunds

In a multi-release escrow, when some funds are locked, you can use this hook to release the remaining funds

Usage

This custom hook exposes a function to do the withdraw remaining funds in an escrow.

import { useResolveDispute } from "@trustless-work/escrow/hooks";
import { WithdrawRemainingFundsPayload } from "@trustless-work/escrow/types";

/*
 *  useWithdrawRemainingFunds
*/
const { withdrawRemainingFunds} = useWithdrawRemainingFunds();

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

Mutation Function

withdrawRemainingFunds

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.

WithdrawRemainingFundsPayload: An object with fields necessary to release the locked funds

Parameters:

Only allows multi-release escrows..

  • payload: An object containing the required fields to resolve a dispute.

Withdraw Remaining Funds

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?