@trustless-work/blocks 0.0.3 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/bin/index.js +1 -1
- package/package.json +1 -1
- package/templates/escrows/details/EscrowDetailDialog.tsx +1 -1
- package/templates/escrows/escrows-by-role/cards/EscrowsCards.tsx +4 -2
- package/templates/escrows/escrows-by-role/table/EscrowsTable.tsx +1 -1
- package/templates/escrows/escrows-by-role/useEscrowsByRole.shared.ts +1 -1
- package/templates/escrows/escrows-by-signer/cards/EscrowsCards.tsx +4 -2
- package/templates/escrows/escrows-by-signer/table/EscrowsTable.tsx +1 -1
- package/templates/escrows/escrows-by-signer/useEscrowsBySigner.shared.ts +1 -1
- package/templates/escrows/single-release/approve-milestone/button/ApproveMilestone.tsx +1 -1
- package/templates/escrows/single-release/approve-milestone/shared/useApproveMilestone.ts +1 -1
- package/templates/escrows/single-release/change-milestone-status/button/ChangeMilestoneStatus.tsx +1 -1
- package/templates/escrows/single-release/change-milestone-status/shared/useChangeMilestoneStatus.ts +1 -1
- package/templates/escrows/single-release/dispute-escrow/button/DisputeEscrow.tsx +1 -1
- package/templates/escrows/single-release/fund-escrow/button/FundEscrow.tsx +3 -8
- package/templates/escrows/single-release/fund-escrow/form/FundEscrow.tsx +1 -1
- package/templates/escrows/single-release/fund-escrow/shared/useFundEscrow.ts +1 -1
- package/templates/escrows/single-release/initialize-escrow/dialog/InitializeEscrow.tsx +1 -1
- package/templates/escrows/single-release/initialize-escrow/shared/useInitializeEscrow.ts +1 -1
- package/templates/escrows/single-release/release-escrow/button/ReleaseEscrow.tsx +1 -1
- package/templates/escrows/single-release/resolve-dispute/button/ResolveDispute.tsx +1 -1
- package/templates/escrows/single-release/resolve-dispute/form/ResolveDispute.tsx +1 -1
- package/templates/escrows/single-release/resolve-dispute/shared/useResolveDispute.ts +1 -1
- package/templates/escrows/single-release/update-escrow/shared/useUpdateEscrow.ts +1 -1
- /package/templates/{tanstak → tanstack}/useEscrowsByRoleQuery.ts +0 -0
- /package/templates/{tanstak → tanstack}/useEscrowsBySignerQuery.ts +0 -0
- /package/templates/{tanstak → tanstack}/useEscrowsMutations.ts +0 -0
package/README.md
CHANGED
|
@@ -115,7 +115,7 @@ This library works with any state solution. It exposes React Context providers a
|
|
|
115
115
|
|
|
116
116
|
```tsx
|
|
117
117
|
// Fetch escrows by role
|
|
118
|
-
import { useEscrowsByRoleQuery } from "@/components/tw-blocks/
|
|
118
|
+
import { useEscrowsByRoleQuery } from "@/components/tw-blocks/tanstack/useEscrowsByRoleQuery";
|
|
119
119
|
|
|
120
120
|
export function MyEscrows({ roleAddress }: { roleAddress: string }) {
|
|
121
121
|
const { data, isLoading, isError, refetch } = useEscrowsByRoleQuery({
|
|
@@ -134,7 +134,7 @@ export function MyEscrows({ roleAddress }: { roleAddress: string }) {
|
|
|
134
134
|
}
|
|
135
135
|
|
|
136
136
|
// Mutations (deploy/fund/update/approve/change-status/release/dispute/resolve)
|
|
137
|
-
import { useEscrowsMutations } from "@/components/tw-blocks/
|
|
137
|
+
import { useEscrowsMutations } from "@/components/tw-blocks/tanstack/useEscrowsMutations";
|
|
138
138
|
|
|
139
139
|
export function DeployButton({ address }: { address: string }) {
|
|
140
140
|
const { deployEscrow } = useEscrowsMutations();
|
|
@@ -167,7 +167,7 @@ npx trustless-work add providers
|
|
|
167
167
|
npx trustless-work add wallet-kit
|
|
168
168
|
npx trustless-work add handle-errors
|
|
169
169
|
npx trustless-work add helpers
|
|
170
|
-
npx trustless-work add
|
|
170
|
+
npx trustless-work add tanstack
|
|
171
171
|
npx trustless-work add escrows
|
|
172
172
|
|
|
173
173
|
# Escrow context providers
|
package/bin/index.js
CHANGED
package/package.json
CHANGED
|
@@ -59,7 +59,7 @@ const EscrowDetailDialog = ({
|
|
|
59
59
|
return (
|
|
60
60
|
<>
|
|
61
61
|
<Dialog open={isDialogOpen} onOpenChange={handleClose}>
|
|
62
|
-
<DialogContent className="w-11/12 sm:w-3/4 h-[95vh] overflow-
|
|
62
|
+
<DialogContent className="w-11/12 sm:w-3/4 h-[95vh] overflow-y-auto flex flex-col !max-w-none">
|
|
63
63
|
<DialogHeader className="flex-shrink-0">
|
|
64
64
|
<div className="w-full">
|
|
65
65
|
<div className="flex flex-col gap-2">
|
|
@@ -155,9 +155,11 @@ export function EscrowsByRoleCards() {
|
|
|
155
155
|
setOrderDirection={(v) => setOrderDirection(v)}
|
|
156
156
|
/>
|
|
157
157
|
|
|
158
|
-
<div className="w-full
|
|
158
|
+
<div className="w-full py-2 sm:py-4">
|
|
159
159
|
<div className="mb-2 sm:mb-3 flex items-center justify-end gap-2">
|
|
160
|
-
<span className="text-xs text-muted-foreground">
|
|
160
|
+
<span className="hidden sm:block text-xs text-muted-foreground">
|
|
161
|
+
Sort
|
|
162
|
+
</span>
|
|
161
163
|
<Button
|
|
162
164
|
className="cursor-pointer"
|
|
163
165
|
variant={sortField === "createdAt" ? "default" : "outline"}
|
|
@@ -239,7 +239,7 @@ export function EscrowsByRoleTable() {
|
|
|
239
239
|
setOrderDirection={(v) => setOrderDirection(v)}
|
|
240
240
|
/>
|
|
241
241
|
|
|
242
|
-
<Card className="w-full
|
|
242
|
+
<Card className="w-full py-2 sm:py-4">
|
|
243
243
|
<div className="mt-2 sm:mt-4 overflow-x-auto">
|
|
244
244
|
<Table>
|
|
245
245
|
<TableHeader>
|
|
@@ -6,7 +6,7 @@ import type { DateRange as DayPickerDateRange } from "react-day-picker";
|
|
|
6
6
|
import { usePathname, useRouter, useSearchParams } from "next/navigation";
|
|
7
7
|
import type { SortingState } from "@tanstack/react-table";
|
|
8
8
|
import { useWalletContext } from "../../wallet-kit/WalletProvider";
|
|
9
|
-
import { useEscrowsByRoleQuery } from "../../
|
|
9
|
+
import { useEscrowsByRoleQuery } from "../../tanstack/useEscrowsByRoleQuery";
|
|
10
10
|
import type { GetEscrowsFromIndexerByRoleParams } from "@trustless-work/escrow";
|
|
11
11
|
import { GetEscrowsFromIndexerResponse as Escrow } from "@trustless-work/escrow/types";
|
|
12
12
|
|
|
@@ -151,9 +151,11 @@ export function EscrowsBySignerCards() {
|
|
|
151
151
|
setOrderDirection={(v) => setOrderDirection(v)}
|
|
152
152
|
/>
|
|
153
153
|
|
|
154
|
-
<div className="w-full
|
|
154
|
+
<div className="w-full py-2 sm:py-4">
|
|
155
155
|
<div className="mb-2 sm:mb-3 flex items-center justify-end gap-2">
|
|
156
|
-
<span className="text-xs text-muted-foreground">
|
|
156
|
+
<span className="hidden sm:block text-xs text-muted-foreground">
|
|
157
|
+
Sort
|
|
158
|
+
</span>
|
|
157
159
|
<Button
|
|
158
160
|
className="cursor-pointer"
|
|
159
161
|
variant={sortField === "createdAt" ? "default" : "outline"}
|
|
@@ -234,7 +234,7 @@ export function EscrowsBySignerTable() {
|
|
|
234
234
|
setOrderDirection={(v) => setOrderDirection(v)}
|
|
235
235
|
/>
|
|
236
236
|
|
|
237
|
-
<Card className="w-full
|
|
237
|
+
<Card className="w-full py-2 sm:py-4">
|
|
238
238
|
<div className="mt-2 sm:mt-4 overflow-x-auto">
|
|
239
239
|
<Table>
|
|
240
240
|
<TableHeader>
|
|
@@ -6,7 +6,7 @@ import type { DateRange as DayPickerDateRange } from "react-day-picker";
|
|
|
6
6
|
import { usePathname, useRouter, useSearchParams } from "next/navigation";
|
|
7
7
|
import type { SortingState } from "@tanstack/react-table";
|
|
8
8
|
import { useWalletContext } from "../../wallet-kit/WalletProvider";
|
|
9
|
-
import { useEscrowsBySignerQuery } from "../../
|
|
9
|
+
import { useEscrowsBySignerQuery } from "../../tanstack/useEscrowsBySignerQuery";
|
|
10
10
|
import { GetEscrowsFromIndexerResponse as Escrow } from "@trustless-work/escrow/types";
|
|
11
11
|
|
|
12
12
|
export type EscrowOrderBy = "createdAt" | "updatedAt" | "amount";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { Button } from "__UI_BASE__/button";
|
|
3
|
-
import { useEscrowsMutations } from "@/components/tw-blocks/
|
|
3
|
+
import { useEscrowsMutations } from "@/components/tw-blocks/tanstack/useEscrowsMutations";
|
|
4
4
|
import { useWalletContext } from "@/components/tw-blocks/wallet-kit/WalletProvider";
|
|
5
5
|
import { ApproveMilestonePayload } from "@trustless-work/escrow/types";
|
|
6
6
|
import { toast } from "sonner";
|
|
@@ -5,7 +5,7 @@ import { approveMilestoneSchema, type ApproveMilestoneValues } from "./schema";
|
|
|
5
5
|
import { toast } from "sonner";
|
|
6
6
|
import { ApproveMilestonePayload } from "@trustless-work/escrow";
|
|
7
7
|
import { useEscrowContext } from "../../../escrow-context/EscrowProvider";
|
|
8
|
-
import { useEscrowsMutations } from "@/components/tw-blocks/
|
|
8
|
+
import { useEscrowsMutations } from "@/components/tw-blocks/tanstack/useEscrowsMutations";
|
|
9
9
|
import {
|
|
10
10
|
ErrorResponse,
|
|
11
11
|
handleError,
|
package/templates/escrows/single-release/change-milestone-status/button/ChangeMilestoneStatus.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { Button } from "__UI_BASE__/button";
|
|
3
|
-
import { useEscrowsMutations } from "@/components/tw-blocks/
|
|
3
|
+
import { useEscrowsMutations } from "@/components/tw-blocks/tanstack/useEscrowsMutations";
|
|
4
4
|
import { useWalletContext } from "@/components/tw-blocks/wallet-kit/WalletProvider";
|
|
5
5
|
import { ChangeMilestoneStatusPayload } from "@trustless-work/escrow/types";
|
|
6
6
|
import { toast } from "sonner";
|
package/templates/escrows/single-release/change-milestone-status/shared/useChangeMilestoneStatus.ts
CHANGED
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
import { toast } from "sonner";
|
|
9
9
|
import { ChangeMilestoneStatusPayload } from "@trustless-work/escrow";
|
|
10
10
|
import { useEscrowContext } from "../../../escrow-context/EscrowProvider";
|
|
11
|
-
import { useEscrowsMutations } from "@/components/tw-blocks/
|
|
11
|
+
import { useEscrowsMutations } from "@/components/tw-blocks/tanstack/useEscrowsMutations";
|
|
12
12
|
import {
|
|
13
13
|
ErrorResponse,
|
|
14
14
|
handleError,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { Button } from "__UI_BASE__/button";
|
|
3
|
-
import { useEscrowsMutations } from "@/components/tw-blocks/
|
|
3
|
+
import { useEscrowsMutations } from "@/components/tw-blocks/tanstack/useEscrowsMutations";
|
|
4
4
|
import { useWalletContext } from "@/components/tw-blocks/wallet-kit/WalletProvider";
|
|
5
5
|
import { SingleReleaseStartDisputePayload } from "@trustless-work/escrow/types";
|
|
6
6
|
import { toast } from "sonner";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { Button } from "__UI_BASE__/button";
|
|
3
|
-
import { useEscrowsMutations } from "@/components/tw-blocks/
|
|
3
|
+
import { useEscrowsMutations } from "@/components/tw-blocks/tanstack/useEscrowsMutations";
|
|
4
4
|
import { useWalletContext } from "@/components/tw-blocks/wallet-kit/WalletProvider";
|
|
5
5
|
import { FundEscrowPayload } from "@trustless-work/escrow/types";
|
|
6
6
|
import { toast } from "sonner";
|
|
@@ -9,18 +9,13 @@ import {
|
|
|
9
9
|
handleError,
|
|
10
10
|
} from "@/components/tw-blocks/handle-errors/handle";
|
|
11
11
|
import { useEscrowContext } from "../../../escrow-context/EscrowProvider";
|
|
12
|
-
import { cn } from "@/lib/utils";
|
|
13
12
|
import { Loader2 } from "lucide-react";
|
|
14
13
|
|
|
15
14
|
type FundEscrowButtonProps = {
|
|
16
15
|
amount: number;
|
|
17
|
-
className?: string;
|
|
18
16
|
};
|
|
19
17
|
|
|
20
|
-
export default function FundEscrowButton({
|
|
21
|
-
amount,
|
|
22
|
-
className,
|
|
23
|
-
}: FundEscrowButtonProps) {
|
|
18
|
+
export default function FundEscrowButton({ amount }: FundEscrowButtonProps) {
|
|
24
19
|
const { fundEscrow } = useEscrowsMutations();
|
|
25
20
|
const { selectedEscrow, updateEscrow } = useEscrowContext();
|
|
26
21
|
const { walletAddress } = useWalletContext();
|
|
@@ -69,7 +64,7 @@ export default function FundEscrowButton({
|
|
|
69
64
|
type="button"
|
|
70
65
|
disabled={isSubmitting}
|
|
71
66
|
onClick={handleClick}
|
|
72
|
-
className=
|
|
67
|
+
className="cursor-pointer w-full"
|
|
73
68
|
>
|
|
74
69
|
{isSubmitting ? (
|
|
75
70
|
<div className="flex items-center">
|
|
@@ -5,7 +5,7 @@ import { fundEscrowSchema, type FundEscrowValues } from "./schema";
|
|
|
5
5
|
import { toast } from "sonner";
|
|
6
6
|
import { FundEscrowPayload } from "@trustless-work/escrow";
|
|
7
7
|
import { useEscrowContext } from "../../../escrow-context/EscrowProvider";
|
|
8
|
-
import { useEscrowsMutations } from "@/components/tw-blocks/
|
|
8
|
+
import { useEscrowsMutations } from "@/components/tw-blocks/tanstack/useEscrowsMutations";
|
|
9
9
|
import {
|
|
10
10
|
ErrorResponse,
|
|
11
11
|
handleError,
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
} from "@trustless-work/escrow/types";
|
|
10
10
|
import { toast } from "sonner";
|
|
11
11
|
import { useWalletContext } from "@/components/tw-blocks/wallet-kit/WalletProvider";
|
|
12
|
-
import { useEscrowsMutations } from "@/components/tw-blocks/
|
|
12
|
+
import { useEscrowsMutations } from "@/components/tw-blocks/tanstack/useEscrowsMutations";
|
|
13
13
|
import {
|
|
14
14
|
ErrorResponse,
|
|
15
15
|
handleError,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { Button } from "__UI_BASE__/button";
|
|
3
|
-
import { useEscrowsMutations } from "@/components/tw-blocks/
|
|
3
|
+
import { useEscrowsMutations } from "@/components/tw-blocks/tanstack/useEscrowsMutations";
|
|
4
4
|
import { useWalletContext } from "@/components/tw-blocks/wallet-kit/WalletProvider";
|
|
5
5
|
import { SingleReleaseReleaseFundsPayload } from "@trustless-work/escrow/types";
|
|
6
6
|
import { toast } from "sonner";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { Button } from "__UI_BASE__/button";
|
|
3
|
-
import { useEscrowsMutations } from "@/components/tw-blocks/
|
|
3
|
+
import { useEscrowsMutations } from "@/components/tw-blocks/tanstack/useEscrowsMutations";
|
|
4
4
|
import { useWalletContext } from "@/components/tw-blocks/wallet-kit/WalletProvider";
|
|
5
5
|
import { SingleReleaseResolveDisputePayload } from "@trustless-work/escrow/types";
|
|
6
6
|
import { toast } from "sonner";
|
|
@@ -17,7 +17,7 @@ export default function ResolveDisputeForm() {
|
|
|
17
17
|
|
|
18
18
|
return (
|
|
19
19
|
<Form {...form}>
|
|
20
|
-
<form onSubmit={handleSubmit}>
|
|
20
|
+
<form onSubmit={handleSubmit} className="flex flex-col space-y-6 w-full">
|
|
21
21
|
<div className="grid grid-cols-1 lg:grid-cols-2 gap-4">
|
|
22
22
|
<FormField
|
|
23
23
|
control={form.control}
|
|
@@ -5,7 +5,7 @@ import { resolveDisputeSchema, type ResolveDisputeValues } from "./schema";
|
|
|
5
5
|
import { toast } from "sonner";
|
|
6
6
|
import { SingleReleaseResolveDisputePayload } from "@trustless-work/escrow";
|
|
7
7
|
import { useEscrowContext } from "../../../escrow-context/EscrowProvider";
|
|
8
|
-
import { useEscrowsMutations } from "@/components/tw-blocks/
|
|
8
|
+
import { useEscrowsMutations } from "@/components/tw-blocks/tanstack/useEscrowsMutations";
|
|
9
9
|
import {
|
|
10
10
|
ErrorResponse,
|
|
11
11
|
handleError,
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
import { toast } from "sonner";
|
|
11
11
|
import { useEscrowContext } from "../../../escrow-context/EscrowProvider";
|
|
12
12
|
import { useWalletContext } from "@/components/tw-blocks/wallet-kit/WalletProvider";
|
|
13
|
-
import { useEscrowsMutations } from "@/components/tw-blocks/
|
|
13
|
+
import { useEscrowsMutations } from "@/components/tw-blocks/tanstack/useEscrowsMutations";
|
|
14
14
|
import {
|
|
15
15
|
ErrorResponse,
|
|
16
16
|
handleError,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|