@trustless-work/blocks 1.2.0 → 1.2.2
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/bin/index.js +326 -105
- package/package.json +1 -1
- package/templates/dashboard/dashboard-01/useDashboard.ts +1 -1
- package/templates/dashboard/deps.json +8 -0
- package/templates/deps.json +12 -26
- package/templates/escrows/deps.json +30 -0
- package/templates/escrows/details/Actions.tsx +46 -45
- package/templates/escrows/details/GeneralInformation.tsx +10 -7
- package/templates/escrows/details/MilestoneCard.tsx +31 -16
- package/templates/escrows/details/MilestoneDetailDialog.tsx +2 -2
- package/templates/escrows/details/SuccessReleaseDialog.tsx +1 -1
- package/templates/escrows/details/useDetailsEscrow.ts +1 -1
- package/templates/escrows/escrows-by-role/cards/EscrowsCards.tsx +4 -4
- package/templates/escrows/escrows-by-role/table/EscrowsTable.tsx +2 -2
- package/templates/escrows/escrows-by-role/useEscrowsByRole.shared.ts +1 -1
- package/templates/escrows/escrows-by-signer/cards/EscrowsCards.tsx +4 -4
- package/templates/escrows/escrows-by-signer/table/EscrowsTable.tsx +2 -2
- package/templates/escrows/escrows-by-signer/useEscrowsBySigner.shared.ts +1 -1
- package/templates/escrows/multi-release/dispute-milestone/button/DisputeMilestone.tsx +1 -1
- package/templates/escrows/multi-release/dispute-milestone/shared/useDisputeMilestone.ts +1 -1
- package/templates/escrows/multi-release/initialize-escrow/shared/useInitializeEscrow.ts +1 -1
- package/templates/escrows/multi-release/release-milestone/button/ReleaseMilestone.tsx +1 -1
- package/templates/escrows/multi-release/release-milestone/shared/useReleaseMilestone.ts +1 -1
- package/templates/escrows/multi-release/resolve-dispute/button/ResolveDispute.tsx +1 -1
- package/templates/escrows/multi-release/resolve-dispute/dialog/ResolveDispute.tsx +1 -1
- package/templates/escrows/multi-release/resolve-dispute/form/ResolveDispute.tsx +1 -1
- package/templates/escrows/multi-release/resolve-dispute/shared/useResolveDispute.ts +23 -5
- package/templates/escrows/multi-release/update-escrow/shared/schema.ts +3 -0
- package/templates/escrows/multi-release/update-escrow/shared/useUpdateEscrow.ts +4 -8
- package/templates/escrows/multi-release/withdraw-remaining-funds/button/WithdrawRemainingFunds.tsx +1 -1
- package/templates/escrows/multi-release/withdraw-remaining-funds/dialog/WithdrawRemainingFunds.tsx +1 -1
- package/templates/escrows/multi-release/withdraw-remaining-funds/form/WithdrawRemainingFunds.tsx +1 -1
- package/templates/escrows/multi-release/withdraw-remaining-funds/shared/useWithdrawRemainingFunds.ts +1 -1
- package/templates/escrows/single-multi-release/approve-milestone/button/ApproveMilestone.tsx +1 -1
- package/templates/escrows/single-multi-release/approve-milestone/shared/useApproveMilestone.ts +1 -1
- package/templates/escrows/single-multi-release/change-milestone-status/button/ChangeMilestoneStatus.tsx +1 -1
- package/templates/escrows/single-multi-release/change-milestone-status/shared/useChangeMilestoneStatus.ts +1 -1
- package/templates/escrows/single-multi-release/fund-escrow/button/FundEscrow.tsx +1 -1
- package/templates/escrows/single-multi-release/fund-escrow/shared/useFundEscrow.ts +1 -1
- package/templates/escrows/single-release/dispute-escrow/button/DisputeEscrow.tsx +1 -1
- package/templates/escrows/single-release/initialize-escrow/dialog/InitializeEscrow.tsx +1 -0
- package/templates/escrows/single-release/initialize-escrow/form/InitializeEscrow.tsx +1 -0
- 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/dialog/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 +3 -7
- package/templates/handle-errors/deps.json +7 -0
- package/templates/helpers/deps.json +5 -0
- package/templates/providers/deps.json +8 -0
- package/templates/tanstack/deps.json +8 -0
- package/templates/wallet-kit/WalletButtons.tsx +1 -1
- package/templates/wallet-kit/deps.json +7 -0
- package/templates/wallet-kit/trustlines.ts +5 -5
- package/templates/wallet-kit/useWallet.ts +1 -1
- /package/templates/{wallet-kit → providers}/WalletProvider.tsx +0 -0
package/templates/escrows/multi-release/withdraw-remaining-funds/form/WithdrawRemainingFunds.tsx
CHANGED
|
@@ -125,7 +125,7 @@ export const WithdrawRemainingFundsForm = () => {
|
|
|
125
125
|
<span className="font-bold">Total Balance: </span>
|
|
126
126
|
{formatCurrency(
|
|
127
127
|
selectedEscrow?.balance || 0,
|
|
128
|
-
selectedEscrow?.trustline.
|
|
128
|
+
selectedEscrow?.trustline.symbol || ""
|
|
129
129
|
)}
|
|
130
130
|
</p>
|
|
131
131
|
</div>
|
package/templates/escrows/multi-release/withdraw-remaining-funds/shared/useWithdrawRemainingFunds.ts
CHANGED
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
ErrorResponse,
|
|
14
14
|
handleError,
|
|
15
15
|
} from "@/components/tw-blocks/handle-errors/handle";
|
|
16
|
-
import { useWalletContext } from "@/components/tw-blocks/
|
|
16
|
+
import { useWalletContext } from "@/components/tw-blocks/providers/WalletProvider";
|
|
17
17
|
|
|
18
18
|
type DistributionInput = { address: string; amount: string | number };
|
|
19
19
|
|
package/templates/escrows/single-multi-release/approve-milestone/button/ApproveMilestone.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { Button } from "__UI_BASE__/button";
|
|
3
3
|
import { useEscrowsMutations } from "@/components/tw-blocks/tanstack/useEscrowsMutations";
|
|
4
|
-
import { useWalletContext } from "@/components/tw-blocks/
|
|
4
|
+
import { useWalletContext } from "@/components/tw-blocks/providers/WalletProvider";
|
|
5
5
|
import {
|
|
6
6
|
ApproveMilestonePayload,
|
|
7
7
|
MultiReleaseMilestone,
|
package/templates/escrows/single-multi-release/approve-milestone/shared/useApproveMilestone.ts
CHANGED
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
ErrorResponse,
|
|
14
14
|
handleError,
|
|
15
15
|
} from "@/components/tw-blocks/handle-errors/handle";
|
|
16
|
-
import { useWalletContext } from "@/components/tw-blocks/
|
|
16
|
+
import { useWalletContext } from "@/components/tw-blocks/providers/WalletProvider";
|
|
17
17
|
|
|
18
18
|
export function useApproveMilestone({
|
|
19
19
|
onSuccess,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { Button } from "__UI_BASE__/button";
|
|
3
3
|
import { useEscrowsMutations } from "@/components/tw-blocks/tanstack/useEscrowsMutations";
|
|
4
|
-
import { useWalletContext } from "@/components/tw-blocks/
|
|
4
|
+
import { useWalletContext } from "@/components/tw-blocks/providers/WalletProvider";
|
|
5
5
|
import { ChangeMilestoneStatusPayload } from "@trustless-work/escrow/types";
|
|
6
6
|
import { toast } from "sonner";
|
|
7
7
|
import {
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
ErrorResponse,
|
|
14
14
|
handleError,
|
|
15
15
|
} from "@/components/tw-blocks/handle-errors/handle";
|
|
16
|
-
import { useWalletContext } from "@/components/tw-blocks/
|
|
16
|
+
import { useWalletContext } from "@/components/tw-blocks/providers/WalletProvider";
|
|
17
17
|
|
|
18
18
|
export function useChangeMilestoneStatus({
|
|
19
19
|
onSuccess,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { Button } from "__UI_BASE__/button";
|
|
3
3
|
import { useEscrowsMutations } from "@/components/tw-blocks/tanstack/useEscrowsMutations";
|
|
4
|
-
import { useWalletContext } from "@/components/tw-blocks/
|
|
4
|
+
import { useWalletContext } from "@/components/tw-blocks/providers/WalletProvider";
|
|
5
5
|
import { FundEscrowPayload } from "@trustless-work/escrow/types";
|
|
6
6
|
import { toast } from "sonner";
|
|
7
7
|
import {
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
ErrorResponse,
|
|
11
11
|
handleError,
|
|
12
12
|
} from "@/components/tw-blocks/handle-errors/handle";
|
|
13
|
-
import { useWalletContext } from "@/components/tw-blocks/
|
|
13
|
+
import { useWalletContext } from "@/components/tw-blocks/providers/WalletProvider";
|
|
14
14
|
|
|
15
15
|
export function useFundEscrow({ onSuccess }: { onSuccess?: () => void } = {}) {
|
|
16
16
|
const { fundEscrow } = useEscrowsMutations();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { Button } from "__UI_BASE__/button";
|
|
3
3
|
import { useEscrowsMutations } from "@/components/tw-blocks/tanstack/useEscrowsMutations";
|
|
4
|
-
import { useWalletContext } from "@/components/tw-blocks/
|
|
4
|
+
import { useWalletContext } from "@/components/tw-blocks/providers/WalletProvider";
|
|
5
5
|
import { SingleReleaseStartDisputePayload } from "@trustless-work/escrow/types";
|
|
6
6
|
import { toast } from "sonner";
|
|
7
7
|
import {
|
|
@@ -466,6 +466,7 @@ export const InitializeEscrowDialog = () => {
|
|
|
466
466
|
onClick={() => handleRemoveMilestone(index)}
|
|
467
467
|
className="p-2 bg-transparent text-destructive rounded-md border-none shadow-none hover:bg-transparent hover:shadow-none hover:text-destructive focus:ring-0 active:ring-0 self-start sm:self-center cursor-pointer"
|
|
468
468
|
disabled={milestones.length === 1}
|
|
469
|
+
type="button"
|
|
469
470
|
>
|
|
470
471
|
<Trash2 className="h-5 w-5" />
|
|
471
472
|
</Button>
|
|
@@ -445,6 +445,7 @@ export const InitializeEscrowForm = () => {
|
|
|
445
445
|
onClick={() => handleRemoveMilestone(index)}
|
|
446
446
|
className="p-2 bg-transparent text-destructive rounded-md border-none shadow-none hover:bg-transparent hover:shadow-none hover:text-destructive focus:ring-0 active:ring-0 self-start sm:self-center cursor-pointer"
|
|
447
447
|
disabled={milestones.length === 1}
|
|
448
|
+
type="button"
|
|
448
449
|
>
|
|
449
450
|
<Trash2 className="h-5 w-5" />
|
|
450
451
|
</Button>
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
InitializeSingleReleaseEscrowResponse,
|
|
9
9
|
} from "@trustless-work/escrow/types";
|
|
10
10
|
import { toast } from "sonner";
|
|
11
|
-
import { useWalletContext } from "@/components/tw-blocks/
|
|
11
|
+
import { useWalletContext } from "@/components/tw-blocks/providers/WalletProvider";
|
|
12
12
|
import { useEscrowsMutations } from "@/components/tw-blocks/tanstack/useEscrowsMutations";
|
|
13
13
|
import {
|
|
14
14
|
ErrorResponse,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { Button } from "__UI_BASE__/button";
|
|
3
3
|
import { useEscrowsMutations } from "@/components/tw-blocks/tanstack/useEscrowsMutations";
|
|
4
|
-
import { useWalletContext } from "@/components/tw-blocks/
|
|
4
|
+
import { useWalletContext } from "@/components/tw-blocks/providers/WalletProvider";
|
|
5
5
|
import { SingleReleaseReleaseFundsPayload } from "@trustless-work/escrow/types";
|
|
6
6
|
import { toast } from "sonner";
|
|
7
7
|
import {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { Button } from "__UI_BASE__/button";
|
|
3
3
|
import { useEscrowsMutations } from "@/components/tw-blocks/tanstack/useEscrowsMutations";
|
|
4
|
-
import { useWalletContext } from "@/components/tw-blocks/
|
|
4
|
+
import { useWalletContext } from "@/components/tw-blocks/providers/WalletProvider";
|
|
5
5
|
import { SingleReleaseResolveDisputePayload } from "@trustless-work/escrow/types";
|
|
6
6
|
import { toast } from "sonner";
|
|
7
7
|
import {
|
|
@@ -145,7 +145,7 @@ export const ResolveDisputeDialog = () => {
|
|
|
145
145
|
<span className="font-bold">Total Balance: </span>
|
|
146
146
|
{formatCurrency(
|
|
147
147
|
selectedEscrow?.balance || 0,
|
|
148
|
-
selectedEscrow?.trustline.
|
|
148
|
+
selectedEscrow?.trustline.symbol || ""
|
|
149
149
|
)}
|
|
150
150
|
</p>
|
|
151
151
|
</div>
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
ErrorResponse,
|
|
11
11
|
handleError,
|
|
12
12
|
} from "@/components/tw-blocks/handle-errors/handle";
|
|
13
|
-
import { useWalletContext } from "@/components/tw-blocks/
|
|
13
|
+
import { useWalletContext } from "@/components/tw-blocks/providers/WalletProvider";
|
|
14
14
|
|
|
15
15
|
type DistributionInput = { address: string; amount: string | number };
|
|
16
16
|
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
} from "@trustless-work/escrow/types";
|
|
14
14
|
import { toast } from "sonner";
|
|
15
15
|
import { useEscrowContext } from "@/components/tw-blocks/providers/EscrowProvider";
|
|
16
|
-
import { useWalletContext } from "@/components/tw-blocks/
|
|
16
|
+
import { useWalletContext } from "@/components/tw-blocks/providers/WalletProvider";
|
|
17
17
|
import { useEscrowsMutations } from "@/components/tw-blocks/tanstack/useEscrowsMutations";
|
|
18
18
|
import {
|
|
19
19
|
ErrorResponse,
|
|
@@ -50,7 +50,6 @@ export function useUpdateEscrow({
|
|
|
50
50
|
amount: selectedEscrow?.amount as unknown as number | string | undefined,
|
|
51
51
|
trustline: {
|
|
52
52
|
address: selectedEscrow?.trustline?.address || "",
|
|
53
|
-
symbol: selectedEscrow?.trustline?.name || "",
|
|
54
53
|
},
|
|
55
54
|
roles: {
|
|
56
55
|
approver: selectedEscrow?.roles?.approver || "",
|
|
@@ -87,7 +86,6 @@ export function useUpdateEscrow({
|
|
|
87
86
|
"",
|
|
88
87
|
trustline: {
|
|
89
88
|
address: selectedEscrow?.trustline?.address || "",
|
|
90
|
-
symbol: selectedEscrow?.trustline?.name || "",
|
|
91
89
|
},
|
|
92
90
|
roles: {
|
|
93
91
|
approver: selectedEscrow?.roles?.approver || "",
|
|
@@ -181,6 +179,7 @@ export function useUpdateEscrow({
|
|
|
181
179
|
: payload.amount,
|
|
182
180
|
trustline: {
|
|
183
181
|
address: payload.trustline.address,
|
|
182
|
+
symbol: selectedEscrow?.trustline?.symbol || "",
|
|
184
183
|
},
|
|
185
184
|
roles: payload.roles,
|
|
186
185
|
milestones: payload.milestones.map((milestone, index) => ({
|
|
@@ -210,10 +209,7 @@ export function useUpdateEscrow({
|
|
|
210
209
|
...selectedEscrow,
|
|
211
210
|
...finalPayload.escrow,
|
|
212
211
|
trustline: {
|
|
213
|
-
|
|
214
|
-
selectedEscrow.trustline?.name ||
|
|
215
|
-
(selectedEscrow.trustline?.address as string) ||
|
|
216
|
-
"",
|
|
212
|
+
symbol: selectedEscrow.trustline?.address,
|
|
217
213
|
address: finalPayload.escrow.trustline.address,
|
|
218
214
|
},
|
|
219
215
|
};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import { useWallet } from "./useWallet";
|
|
5
|
-
import { useWalletContext } from "
|
|
5
|
+
import { useWalletContext } from "@/components/tw-blocks/providers/WalletProvider";
|
|
6
6
|
import { Button } from "__UI_BASE__/button";
|
|
7
7
|
import { Popover, PopoverContent, PopoverTrigger } from "__UI_BASE__/popover";
|
|
8
8
|
import { Check, Copy, LogOut, ChevronDown, Wallet } from "lucide-react";
|
|
@@ -8,23 +8,23 @@
|
|
|
8
8
|
export const trustlines = [
|
|
9
9
|
// TESTNET
|
|
10
10
|
{
|
|
11
|
-
|
|
11
|
+
symbol: "USDC",
|
|
12
12
|
address: "GBBD47IF6LWK7P7MDEVSCWR7DPUWV3NY3DTQEVFL4NAT4AQH3ZLLFLA5",
|
|
13
13
|
network: "testnet",
|
|
14
14
|
},
|
|
15
15
|
{
|
|
16
|
-
|
|
16
|
+
symbol: "EURC",
|
|
17
17
|
address: "GA5ZSEJYB37JRC5AVCIA5MOP4RHTM335X2KGX3IHOJAPP5RE34K4KZVN",
|
|
18
18
|
network: "testnet",
|
|
19
19
|
},
|
|
20
20
|
// MAINNET
|
|
21
21
|
{
|
|
22
|
-
|
|
22
|
+
symbol: "USDC",
|
|
23
23
|
address: "GA5ZSEJYB37JRC5AVCIA5MOP4RHTM335X2KGX3IHOJAPP5RE34K4KZVN",
|
|
24
24
|
network: "mainnet",
|
|
25
25
|
},
|
|
26
26
|
{
|
|
27
|
-
|
|
27
|
+
symbol: "EURC",
|
|
28
28
|
address: "GDHU6WRG4IEQXM5NZ4BMPKOXHW76MZM4Y2IEMFDVXBSDP6SJY4ITNPP2",
|
|
29
29
|
network: "mainnet",
|
|
30
30
|
},
|
|
@@ -37,7 +37,7 @@ export const trustlineOptions = Array.from(
|
|
|
37
37
|
.filter((trustline) => trustline.network === "testnet")
|
|
38
38
|
.map((trustline) => [
|
|
39
39
|
trustline.address,
|
|
40
|
-
{ value: trustline.address, label: trustline.
|
|
40
|
+
{ value: trustline.address, label: trustline.symbol },
|
|
41
41
|
])
|
|
42
42
|
).values()
|
|
43
43
|
);
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
disconnectWalletKit,
|
|
4
4
|
getSelectedWallet,
|
|
5
5
|
} from "./wallet-kit";
|
|
6
|
-
import { useWalletContext } from "
|
|
6
|
+
import { useWalletContext } from "@/components/tw-blocks/providers/WalletProvider";
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Custom hook that provides wallet connection and disconnection functionality
|
|
File without changes
|