diff --git a/p2p-safe-swap/lib/trustless-work.ts b/p2p-safe-swap/lib/trustless-work.ts index 9820d12..9c0e08f 100644 --- a/p2p-safe-swap/lib/trustless-work.ts +++ b/p2p-safe-swap/lib/trustless-work.ts @@ -6,7 +6,7 @@ function getHeaders() { return { "Content-Type": "application/json", - Authorization: `Bearer ${apiKey}`, + "x-api-key": apiKey, }; } @@ -28,38 +28,66 @@ async function request( } export const trustlessWork = { - escrow: { - initialize: (body: Record) => - request("/escrow/initialize-escrow", { - method: "POST", - body: JSON.stringify(body), - }), - - getByContractId: (contractId: string) => - request(`/escrow/get-escrow-by-contract-id?contractId=${contractId}`), - - fundEscrow: (body: Record) => - request("/escrow/fund-escrow", { - method: "POST", - body: JSON.stringify(body), - }), - - completeEscrow: (body: Record) => - request("/escrow/complete-escrow", { - method: "POST", - body: JSON.stringify(body), - }), - - disputeEscrow: (body: Record) => - request("/escrow/dispute-escrow", { - method: "POST", - body: JSON.stringify(body), - }), - - resolveDispute: (body: Record) => - request("/escrow/resolve-dispute", { - method: "POST", - body: JSON.stringify(body), - }), - }, + deploy: (body: Record) => + request("/deploy", { + method: "POST", + body: JSON.stringify(body), + }), + + fund: (body: Record) => + request("/fund", { + method: "POST", + body: JSON.stringify(body), + }), + + changeMilestoneStatus: (body: Record) => + request("/change-milestone-status", { + method: "POST", + body: JSON.stringify(body), + }), + + approveMilestones: (body: Record) => + request("/approve-milestones", { + method: "POST", + body: JSON.stringify(body), + }), + + releaseFunds: (body: Record) => + request("/release-funds", { + method: "POST", + body: JSON.stringify(body), + }), + + update: (body: Record) => + request("/update", { + method: "POST", + body: JSON.stringify(body), + }), + + dispute: (body: Record) => + request("/dispute", { + method: "POST", + body: JSON.stringify(body), + }), + + resolveDispute: (body: Record) => + request("/resolve-dispute", { + method: "POST", + body: JSON.stringify(body), + }), + + sendTransaction: (body: Record) => + request("/send-transaction", { + method: "POST", + body: JSON.stringify(body), + }), + + getEscrowsBySigner: (signer: string) => + request(`/get-escrows-by-signer?signer=${signer}`), + + getMultipleEscrowBalance: (body: Record) => + request("/get-multiple-escrow-balance", { + method: "POST", + body: JSON.stringify(body), + }), };