
Research
/Security News
77 Firefox Extensions Linked to Crypto Wallet and Credential Theft
Socket uncovered 77 linked Firefox extensions, including 40 that steal wallet secrets or credentials and 37 deceptive sports-score shells.
@trustless-work/escrow
Advanced tools
A powerful React library for integrating Trustless Work's escrow and dispute resolution system into your applications. This library provides a set of React hooks and utilities to interact with the Trustless Work API.
npm install @trustless-work/escrow
# or
yarn add @trustless-work/escrow
"use client"; // make sure this is a client component
import React from "react";
import {
// development environment = "https://dev.api.trustlesswork.com"
development,
// mainnet environment = "https://api.trustlesswork.com"
mainNet,
TrustlessWorkConfig,
} from "@trustless-work/escrow";
interface TrustlessWorkProviderProps {
children: React.ReactNode;
}
export function TrustlessWorkProvider({
children,
}: TrustlessWorkProviderProps) {
/**
* Get the API key from the environment variables
*/
const apiKey = process.env.NEXT_PUBLIC_API_KEY || "";
return (
<TrustlessWorkConfig baseURL={development} apiKey={apiKey}>
{children}
</TrustlessWorkConfig>
);
}
import { TrustlessWorkProvider} from "@/trustless-work-provider.tsx";
export function App() {
return (
<TrustlessWorkProvider>
<YourApp />
</TrustlessWorkProvider>
);
}
import { useInitializeEscrow } from '@trustless-work/escrow/hooks';
function YourComponent() {
const { deployEscrow } = useInitializeEscrow();
// Use the hooks...
}
This library is designed to be flexible and work with any state management solution. The hooks expose functions that you can integrate with your preferred state management library.
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { TrustlessWorkConfig } from '@trustless-work/escrow';
const queryClient = new QueryClient({
defaultOptions: {
queries: {
staleTime: 5 * 60 * 1000, // 5 minutes
gcTime: 10 * 60 * 1000, // 10 minutes
},
},
});
function App() {
return (
<QueryClientProvider client={queryClient}>
<TrustlessWorkConfig baseURL={development} apiKey={apiKey}>
<YourApp />
</TrustlessWorkConfig>
</QueryClientProvider>
);
}
// Usage in components
import { useQuery } from '@tanstack/react-query';
import { useGetEscrowsFromIndexerByRole } from '@trustless-work/escrow/hooks';
export const useEscrowsByRoleQuery = (params) => {
const { getEscrowsByRole } = useGetEscrowsFromIndexerByRole();
return useQuery({
queryKey: ["escrows", params.roleAddress, params.role],
queryFn: () => getEscrowsByRole(params),
enabled: !!params.roleAddress && !!params.role,
staleTime: 5 * 60 * 1000,
});
};
import { create } from 'zustand';
import { useGetEscrowsFromIndexerByRole } from '@trustless-work/escrow/hooks';
const useEscrowStore = create((set, get) => ({
escrows: [],
isLoading: false,
error: null,
fetchEscrows: async (params) => {
const { getEscrowsByRole } = useGetEscrowsFromIndexerByRole();
set({ isLoading: true, error: null });
try {
const escrows = await getEscrowsByRole(params);
set({ escrows, isLoading: false });
} catch (error) {
set({ error, isLoading: false });
}
},
}));
useInitializeEscrow: Create a new escrowuseGetEscrow: Fetch escrow detailsuseGetMultipleEscrowBalances: Get balances for multiple escrowsuseUpdateEscrow: Update escrow informationuseFundEscrow: Fund an escrowuseReleaseFunds: Release funds from escrowuseStartDispute: Initiate a disputeuseResolveDispute: Resolve an existing disputeuseChangeMilestoneStatus: Update milestone statususeApproveMilestone: Approve or reject milestonesuseSendTransaction: Send a transactionuseGetEscrowsFromIndexerByRole: Get escrows by roleuseGetEscrowsFromIndexerBySigner: Get escrows by signerThe library includes comprehensive TypeScript types for all operations. Key type definitions can be found in:
types.entity.ts: Core entity definitionstypes.payload.ts: Request payload typestypes.response.ts: API response typesThe library supports two environments:
https://api.trustlesswork.comhttps://dev.api.trustlesswork.comMake sure to:
baseURL for your environmentimport {
useInitializeEscrow,
useSendTransaction,
} from "@trustless-work/escrow/hooks";
import {
InitializeEscrowPayload
} from "@trustless-work/escrow/types";
export const useInitializeEscrowForm = () => {
/*
* useInitializeEscrow
*/
const { deployEscrow } = useInitializeEscrow();
/*
* useSendTransaction
*/
const { sendTransaction } = useSendTransaction();
/*
* onSubmit function, this could be called by form button
*/
const onSubmit = async (payload: InitializeEscrowPayload) => {
try {
/**
* API call by using the trustless work hooks
* @Note:
* - We need to pass the payload to the deployEscrow function
* - The result will be an unsigned transaction
*/
const { unsignedTransaction } = await deployEscrow(
payload,
"single-release" // or "multi-release"
);
if (!unsignedTransaction) {
throw new Error(
"Unsigned transaction is missing from deployEscrow response."
);
}
/**
* @Note:
* - We need to sign the transaction using your [private key] such as wallet
* - The result will be a signed transaction
*/
const signedXdr = await signTransaction({ /* This method should be provided by the wallet */
unsignedTransaction,
address: walletAddress || "",
});
if (!signedXdr) {
throw new Error("Signed transaction is missing.");
}
/**
* @Note:
* - We need to send the signed transaction to the API
* - The data will be an SendTransactionResponse
*/
const data = await sendTransaction(signedXdr);
/**
* @Responses:
* data.status === "SUCCESS"
* - Escrow updated successfully
* - Show a success toast
*
* data.status == "ERROR"
* - Show an error toast
*/
if (data.status === "SUCCESS") {
toast.success("Escrow Created");
}
} catch (error: unknown) {
// catch error logic
}
};
}
We welcome contributions! Please read our contributing guidelines before submitting pull requests.
MIT License - see LICENSE file for details
|
Tech Rebel | Product Manager techrebelgit Telegram |
Joel Vargas | Frontend Developer JoelVR17 Telegram |
Armando Murillo | Full Stack Developer armandocodecr Telegram |
Caleb Loría | Smart Contract Developer zkCaleb-dev Telegram |
FAQs
Unknown package
The npm package @trustless-work/escrow receives a total of 195 weekly downloads. As such, @trustless-work/escrow popularity was classified as not popular.
We found that @trustless-work/escrow demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
/Security News
Socket uncovered 77 linked Firefox extensions, including 40 that steal wallet secrets or credentials and 37 deceptive sports-score shells.

Security News
NIST disclosed an unreleased AI tool called V-etalon and opened a broad inquiry into NVD modernization after years of automation plans produced no public enrichment system.

Security News
In his AI Council 2026 talk, Feross Aboukhadijeh covers recent package compromises, vulnerability discovery, and a more automated security model.