@trustless-work/escrow
Version:
<p align="center"> <img src="https://github.com/user-attachments/assets/5b182044-dceb-41f5-acf0-da22dea7c98a" alt="CLR-S (2)"> </p>
108 lines (93 loc) • 5.25 kB
TypeScript
import { InitializeSingleReleaseEscrowPayload, InitializeMultiReleaseEscrowPayload, EscrowType, EscrowRequestResponse, SendTransactionResponse, InitializeSingleReleaseEscrowResponse, InitializeMultiReleaseEscrowResponse, GetEscrowFromIndexerByContractIdsParams, GetEscrowsFromIndexerResponse, UpdateSingleReleaseEscrowPayload, UpdateMultiReleaseEscrowPayload, SingleReleaseStartDisputePayload, MultiReleaseStartDisputePayload, SingleReleaseResolveDisputePayload, MultiReleaseResolveDisputePayload, GetBalanceParams, GetEscrowBalancesResponse, SingleReleaseReleaseFundsPayload, MultiReleaseReleaseFundsPayload, FundEscrowPayload, ChangeMilestoneStatusPayload, ApproveMilestonePayload, GetEscrowsFromIndexerBySignerParams, GetEscrowsFromIndexerByRoleParams } from '../types/index.js';
/**
* Use the useInitializeEscrow hook to initialize an escrow.
* @returns A function to initialize an escrow.
*/
declare function useInitializeEscrow(): {
deployEscrow: (payload: InitializeSingleReleaseEscrowPayload | InitializeMultiReleaseEscrowPayload, type: EscrowType) => Promise<EscrowRequestResponse>;
};
/**
* Use the useSendTransaction hook to send a transaction by signing it with the user's private key.
* @returns A function to send a transaction.
*/
declare function useSendTransaction(): {
sendTransaction: (signedXdr: string) => Promise<SendTransactionResponse | InitializeSingleReleaseEscrowResponse | InitializeMultiReleaseEscrowResponse>;
};
/**
* Use the useGetEscrowFromIndexerByContractId hook to get an escrow from the database by contractId.
* @returns A function to get an escrow from the database by contractId.
*/
declare function useGetEscrowFromIndexerByContractIds(): {
getEscrowByContractIds: (params: GetEscrowFromIndexerByContractIdsParams) => Promise<GetEscrowsFromIndexerResponse>;
};
/**
* Use the useUpdateEscrow hook to update an escrow.
* @returns A function to update an escrow.
*/
declare function useUpdateEscrow(): {
updateEscrow: (payload: UpdateSingleReleaseEscrowPayload | UpdateMultiReleaseEscrowPayload, type: EscrowType) => Promise<EscrowRequestResponse>;
};
/**
* Use the useStartDispute hook to start a dispute.
* @returns A function to start a dispute.
*/
declare function useStartDispute(): {
startDispute: (payload: SingleReleaseStartDisputePayload | MultiReleaseStartDisputePayload, type: EscrowType) => Promise<EscrowRequestResponse>;
};
/**
* Use the useResolveDispute hook to resolve a dispute.
* @returns A function to resolve a dispute.
*/
declare function useResolveDispute(): {
resolveDispute: (payload: SingleReleaseResolveDisputePayload | MultiReleaseResolveDisputePayload, type: EscrowType) => Promise<EscrowRequestResponse>;
};
/**
* Use the useGetMultipleEscrowBalances hook to get multiple escrow balances.
* @returns A function to get multiple escrow balances.
*/
declare function useGetMultipleEscrowBalances(): {
getMultipleBalances: (payload: GetBalanceParams, type: EscrowType) => Promise<GetEscrowBalancesResponse[]>;
};
/**
* Use the useReleaseFunds hook to release funds from an escrow.
* @returns A function to release funds from an escrow.
*/
declare function useReleaseFunds(): {
releaseFunds: (payload: SingleReleaseReleaseFundsPayload | MultiReleaseReleaseFundsPayload, type: EscrowType) => Promise<EscrowRequestResponse>;
};
/**
* Use the useFundEscrow hook to fund an escrow.
* @returns A function to fund an escrow.
*/
declare function useFundEscrow(): {
fundEscrow: (payload: FundEscrowPayload, type: EscrowType) => Promise<EscrowRequestResponse>;
};
/**
* Use the useChangeMilestoneStatus hook to change the status of a milestone.
* @returns A function to change the status of a milestone.
*/
declare function useChangeMilestoneStatus(): {
changeMilestoneStatus: (payload: ChangeMilestoneStatusPayload, type: EscrowType) => Promise<EscrowRequestResponse>;
};
/**
* Use the useApproveMilestone hook to change the approved flag of a milestone.
* @returns A function to change the approved flag of a milestone.
*/
declare function useApproveMilestone(): {
approveMilestone: (payload: ApproveMilestonePayload, type: EscrowType) => Promise<EscrowRequestResponse>;
};
/**
* Use the useGetEscrowsFromIndexerBySigner hook to get multiple escrows from the database by signer.
* @returns A function to get multiple escrows from the database by signer.
*/
declare function useGetEscrowsFromIndexerBySigner(): {
getEscrowsBySigner: (params: GetEscrowsFromIndexerBySignerParams) => Promise<GetEscrowsFromIndexerResponse[]>;
};
/**
* Use the useGetEscrowsFromIndexerByRole hook to get multiple escrows from the database by role.
* @returns A function to get multiple escrows from the database by role.
*/
declare function useGetEscrowsFromIndexerByRole(): {
getEscrowsByRole: (params: GetEscrowsFromIndexerByRoleParams) => Promise<GetEscrowsFromIndexerResponse[]>;
};
export { useApproveMilestone, useChangeMilestoneStatus, useFundEscrow, useGetEscrowFromIndexerByContractIds, useGetEscrowsFromIndexerByRole, useGetEscrowsFromIndexerBySigner, useGetMultipleEscrowBalances, useInitializeEscrow, useReleaseFunds, useResolveDispute, useSendTransaction, useStartDispute, useUpdateEscrow };