UNPKG

@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>

206 lines (186 loc) 6.5 kB
"use strict"; var __create = Object.create; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __getProtoOf = Object.getPrototypeOf; var __hasOwnProp = Object.prototype.hasOwnProperty; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( // If the importer is in node compatibility mode or this is not an ESM // file that has been converted to a CommonJS file using a Babel- // compatible transform (i.e. "__esModule" has not been set), then set // "default" to the CommonJS "module.exports" for node compatibility. isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod )); var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); // src/hooks/index.ts var hooks_exports = {}; __export(hooks_exports, { useApproveMilestone: () => useApproveMilestone, useChangeMilestoneStatus: () => useChangeMilestoneStatus, useFundEscrow: () => useFundEscrow, useGetEscrowFromIndexerByContractIds: () => useGetEscrowFromIndexerByContractIds, useGetEscrowsFromIndexerByRole: () => useGetEscrowsFromIndexerByRole, useGetEscrowsFromIndexerBySigner: () => useGetEscrowsFromIndexerBySigner, useGetMultipleEscrowBalances: () => useGetMultipleEscrowBalances, useInitializeEscrow: () => useInitializeEscrow, useReleaseFunds: () => useReleaseFunds, useResolveDispute: () => useResolveDispute, useSendTransaction: () => useSendTransaction, useStartDispute: () => useStartDispute, useUpdateEscrow: () => useUpdateEscrow, useUpdateFromTxHash: () => useUpdateFromTxHash, useWithdrawRemainingFunds: () => useWithdrawRemainingFunds }); module.exports = __toCommonJS(hooks_exports); // src/provider.tsx var import_react = __toESM(require("react")); // src/client.ts var import_axios = __toESM(require("axios")); // src/provider.tsx var TrustlessWorkContext = import_react.default.createContext({ client: null }); function useTrustlessWorkClient() { const ctx = (0, import_react.useContext)(TrustlessWorkContext); if (!ctx.client) { throw new Error( "useTrustlessWorkClient must be inside TrustlessWorkConfig" ); } return ctx.client; } // src/hooks/useInitializeEscrow.ts function useInitializeEscrow() { const client = useTrustlessWorkClient(); return { deployEscrow: (payload, type) => client.initializeEscrow(payload, type) }; } // src/hooks/useSendTransaction.ts function useSendTransaction() { const client = useTrustlessWorkClient(); return { sendTransaction: (signedXdr) => client.sendTransaction(signedXdr) }; } // src/hooks/useGetEscrowFromIndexerByContractIds.ts function useGetEscrowFromIndexerByContractIds() { const client = useTrustlessWorkClient(); return { getEscrowByContractIds: (params) => client.getEscrowFromIndexerByContractIds(params) }; } // src/hooks/useUpdateEscrow.ts function useUpdateEscrow() { const client = useTrustlessWorkClient(); return { updateEscrow: (payload, type) => client.updateEscrow(payload, type) }; } // src/hooks/useStartDispute.ts function useStartDispute() { const client = useTrustlessWorkClient(); return { startDispute: (payload, type) => client.startDispute(payload, type) }; } // src/hooks/useResolveDispute.ts function useResolveDispute() { const client = useTrustlessWorkClient(); return { resolveDispute: (payload, type) => client.resolveDispute(payload, type) }; } // src/hooks/useWithdrawRemainingFunds.ts function useWithdrawRemainingFunds() { const client = useTrustlessWorkClient(); return { withdrawRemainingFunds: (payload) => client.withdrawRemainingFunds(payload) }; } // src/hooks/useGetMultipleEscrowBalances.ts function useGetMultipleEscrowBalances() { const client = useTrustlessWorkClient(); return { getMultipleBalances: (payload) => client.getMultipleEscrowBalances(payload) }; } // src/hooks/useReleaseFunds.ts function useReleaseFunds() { const client = useTrustlessWorkClient(); return { releaseFunds: (payload, type) => client.releaseFunds(payload, type) }; } // src/hooks/useFundEscrow.ts function useFundEscrow() { const client = useTrustlessWorkClient(); return { fundEscrow: (payload, type) => client.fundEscrow(payload, type) }; } // src/hooks/useChangeMilestoneStatus.ts function useChangeMilestoneStatus() { const client = useTrustlessWorkClient(); return { changeMilestoneStatus: (payload, type) => client.changeMilestoneStatus(payload, type) }; } // src/hooks/useApproveMilestone.ts function useApproveMilestone() { const client = useTrustlessWorkClient(); return { approveMilestone: (payload, type) => client.approveMilestone(payload, type) }; } // src/hooks/useGetEscrowsFromIndexerBySigner.ts function useGetEscrowsFromIndexerBySigner() { const client = useTrustlessWorkClient(); return { getEscrowsBySigner: (params) => client.getEscrowsFromIndexerBySigner(params) }; } // src/hooks/useGetEscrowsFromIndexerByRole.ts function useGetEscrowsFromIndexerByRole() { const client = useTrustlessWorkClient(); return { getEscrowsByRole: (params) => client.getEscrowsFromIndexerByRole(params) }; } // src/hooks/useUpdateFromTxHash.ts function useUpdateFromTxHash() { const client = useTrustlessWorkClient(); return { updateFromTxHash: (payload) => client.updateFromTxHash(payload) }; } // Annotate the CommonJS export names for ESM import in node: 0 && (module.exports = { useApproveMilestone, useChangeMilestoneStatus, useFundEscrow, useGetEscrowFromIndexerByContractIds, useGetEscrowsFromIndexerByRole, useGetEscrowsFromIndexerBySigner, useGetMultipleEscrowBalances, useInitializeEscrow, useReleaseFunds, useResolveDispute, useSendTransaction, useStartDispute, useUpdateEscrow, useUpdateFromTxHash, useWithdrawRemainingFunds });