@trustless-work/blocks 0.0.9 → 1.0.0
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 +30 -23
- package/package.json +1 -1
- package/templates/escrows/details/Actions.tsx +3 -0
- package/templates/escrows/details/MilestoneCard.tsx +2 -2
- package/templates/escrows/escrows-by-role/cards/EscrowsCards.tsx +0 -2
- package/templates/escrows/multi-release/dispute-milestone/button/{DisputeEscrow.tsx → DisputeMilestone.tsx} +4 -4
- package/templates/escrows/multi-release/release-milestone/button/{ReleaseEscrow.tsx → ReleaseMilestone.tsx} +4 -4
package/bin/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
1
|
+
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
/*
|
|
4
4
|
AUTHOR: @trustless-work / Joel Vargas
|
|
@@ -1757,9 +1757,6 @@ if (args[0] === "init") {
|
|
|
1757
1757
|
trustless-work add escrows/escrows-by-signer/table
|
|
1758
1758
|
trustless-work add escrows/escrows-by-signer/cards
|
|
1759
1759
|
|
|
1760
|
-
--- Escrow details (optional standalone) ---
|
|
1761
|
-
trustless-work add escrows/details
|
|
1762
|
-
|
|
1763
1760
|
----------------------
|
|
1764
1761
|
--- SINGLE-RELEASE ---
|
|
1765
1762
|
trustless-work add escrows/single-release
|
|
@@ -1769,24 +1766,6 @@ if (args[0] === "init") {
|
|
|
1769
1766
|
- trustless-work add escrows/single-release/initialize-escrow/form
|
|
1770
1767
|
- trustless-work add escrows/single-release/initialize-escrow/dialog
|
|
1771
1768
|
|
|
1772
|
-
--- Approve milestone ---
|
|
1773
|
-
- trustless-work add escrows/single-release/approve-milestone
|
|
1774
|
-
- trustless-work add escrows/single-release/approve-milestone/form
|
|
1775
|
-
- trustless-work add escrows/single-release/approve-milestone/button
|
|
1776
|
-
- trustless-work add escrows/single-release/approve-milestone/dialog
|
|
1777
|
-
|
|
1778
|
-
--- Change milestone status ---
|
|
1779
|
-
- trustless-work add escrows/single-release/change-milestone-status
|
|
1780
|
-
- trustless-work add escrows/single-release/change-milestone-status/form
|
|
1781
|
-
- trustless-work add escrows/single-release/change-milestone-status/button
|
|
1782
|
-
- trustless-work add escrows/single-release/change-milestone-status/dialog
|
|
1783
|
-
|
|
1784
|
-
--- Fund escrow ---
|
|
1785
|
-
- trustless-work add escrows/single-release/fund-escrow
|
|
1786
|
-
- trustless-work add escrows/single-release/fund-escrow/form
|
|
1787
|
-
- trustless-work add escrows/single-release/fund-escrow/button
|
|
1788
|
-
- trustless-work add escrows/single-release/fund-escrow/dialog
|
|
1789
|
-
|
|
1790
1769
|
--- Resolve dispute ---
|
|
1791
1770
|
- trustless-work add escrows/single-release/resolve-dispute
|
|
1792
1771
|
- trustless-work add escrows/single-release/resolve-dispute/form
|
|
@@ -1805,9 +1784,37 @@ if (args[0] === "init") {
|
|
|
1805
1784
|
--- Dispute escrow ---
|
|
1806
1785
|
- trustless-work add escrows/single-release/dispute-escrow
|
|
1807
1786
|
- trustless-work add escrows/single-release/dispute-escrow/button
|
|
1787
|
+
|
|
1788
|
+
----------------------
|
|
1789
|
+
--- MULTI-RELEASE ---
|
|
1790
|
+
trustless-work add escrows/multi-release
|
|
1791
|
+
|
|
1792
|
+
--- Initialize escrow ---
|
|
1793
|
+
- trustless-work add escrows/multi-release/initialize-escrow
|
|
1794
|
+
- trustless-work add escrows/multi-release/initialize-escrow/form
|
|
1795
|
+
- trustless-work add escrows/multi-release/initialize-escrow/dialog
|
|
1796
|
+
|
|
1797
|
+
--- Resolve dispute ---
|
|
1798
|
+
- trustless-work add escrows/multi-release/resolve-dispute
|
|
1799
|
+
- trustless-work add escrows/multi-release/resolve-dispute/form
|
|
1800
|
+
- trustless-work add escrows/multi-release/resolve-dispute/button
|
|
1801
|
+
- trustless-work add escrows/multi-release/resolve-dispute/dialog
|
|
1802
|
+
|
|
1803
|
+
--- Update escrow ---
|
|
1804
|
+
- trustless-work add escrows/multi-release/update-escrow
|
|
1805
|
+
- trustless-work add escrows/multi-release/update-escrow/form
|
|
1806
|
+
- trustless-work add escrows/multi-release/update-escrow/dialog
|
|
1807
|
+
|
|
1808
|
+
--- Release escrow ---
|
|
1809
|
+
- trustless-work add escrows/multi-release/release-milestone
|
|
1810
|
+
- trustless-work add escrows/multi-release/release-milestone/button
|
|
1811
|
+
|
|
1812
|
+
--- Dispute escrow ---
|
|
1813
|
+
- trustless-work add escrows/multi-release/dispute-milestone
|
|
1814
|
+
- trustless-work add escrows/multi-release/dispute-milestone/button
|
|
1808
1815
|
|
|
1809
1816
|
----------------------
|
|
1810
|
-
--- SINGLE-MULTI-RELEASE ---
|
|
1817
|
+
--- SINGLE-MULTI-RELEASE -> Works with both types of escrows ---
|
|
1811
1818
|
trustless-work add escrows/single-multi-release
|
|
1812
1819
|
|
|
1813
1820
|
--- Approve milestone ---
|
package/package.json
CHANGED
|
@@ -128,12 +128,15 @@ export const Actions = ({
|
|
|
128
128
|
{/* {shouldShowEditButton && <UpdateEscrowDialog />} */}
|
|
129
129
|
|
|
130
130
|
{/* Works only with single-release escrows */}
|
|
131
|
+
{/* Only appears if the escrow has balance */}
|
|
131
132
|
{/* {shouldShowDisputeButton && <DisputeEscrowButton />} */}
|
|
132
133
|
|
|
133
134
|
{/* Works only with single-release escrows */}
|
|
135
|
+
{/* Only appears if the escrow is disputed */}
|
|
134
136
|
{/* {shouldShowResolveButton && <ResolveDisputeDialog />} */}
|
|
135
137
|
|
|
136
138
|
{/* Works only with single-release escrows */}
|
|
139
|
+
{/* Only appears if all the milestones are approved */}
|
|
137
140
|
{/* {shouldShowReleaseFundsButton && <ReleaseEscrowButton />} */}
|
|
138
141
|
</div>
|
|
139
142
|
)}
|
|
@@ -141,7 +141,7 @@ const MilestoneCardComponent = ({
|
|
|
141
141
|
buttons
|
|
142
142
|
.push
|
|
143
143
|
// You can add the button here, using the button from the blocks. This button is conditional based on the milestone status and the user roles. Works only with multi-release escrows.
|
|
144
|
-
// <
|
|
144
|
+
// <ReleaseMilestoneButton
|
|
145
145
|
// key={`release-${milestoneIndex}`}
|
|
146
146
|
// milestoneIndex={milestoneIndex}
|
|
147
147
|
// />
|
|
@@ -159,7 +159,7 @@ const MilestoneCardComponent = ({
|
|
|
159
159
|
buttons
|
|
160
160
|
.push
|
|
161
161
|
// You can add the button here, using the button from the blocks. This button is conditional based on the milestone status and the user roles. Works only with multi-release escrows.
|
|
162
|
-
// <
|
|
162
|
+
// <DisputeMilestoneButton
|
|
163
163
|
// key={`dispute-${milestoneIndex}`}
|
|
164
164
|
// milestoneIndex={milestoneIndex}
|
|
165
165
|
// />
|
|
@@ -14,13 +14,13 @@ import {
|
|
|
14
14
|
import { useEscrowContext } from "@/components/tw-blocks/providers/EscrowProvider";
|
|
15
15
|
import { Loader2 } from "lucide-react";
|
|
16
16
|
|
|
17
|
-
type
|
|
17
|
+
type DisputeMilestoneButtonProps = {
|
|
18
18
|
milestoneIndex: number | string;
|
|
19
19
|
};
|
|
20
20
|
|
|
21
|
-
export const
|
|
21
|
+
export const DisputeMilestoneButton = ({
|
|
22
22
|
milestoneIndex,
|
|
23
|
-
}:
|
|
23
|
+
}: DisputeMilestoneButtonProps) => {
|
|
24
24
|
const { startDispute } = useEscrowsMutations();
|
|
25
25
|
const { selectedEscrow, updateEscrow } = useEscrowContext();
|
|
26
26
|
const { walletAddress } = useWalletContext();
|
|
@@ -54,7 +54,7 @@ export const DisputeEscrowButton = ({
|
|
|
54
54
|
address: walletAddress || "",
|
|
55
55
|
});
|
|
56
56
|
|
|
57
|
-
toast.success("
|
|
57
|
+
toast.success("Milestone disputed successfully");
|
|
58
58
|
|
|
59
59
|
updateEscrow({
|
|
60
60
|
...selectedEscrow,
|
|
@@ -16,13 +16,13 @@ import { useEscrowDialogs } from "@/components/tw-blocks/providers/EscrowDialogs
|
|
|
16
16
|
import { useEscrowAmountContext } from "@/components/tw-blocks/providers/EscrowAmountProvider";
|
|
17
17
|
import { Loader2 } from "lucide-react";
|
|
18
18
|
|
|
19
|
-
type
|
|
19
|
+
type ReleaseMilestoneButtonProps = {
|
|
20
20
|
milestoneIndex: number | string;
|
|
21
21
|
};
|
|
22
22
|
|
|
23
|
-
export const
|
|
23
|
+
export const ReleaseMilestoneButton = ({
|
|
24
24
|
milestoneIndex,
|
|
25
|
-
}:
|
|
25
|
+
}: ReleaseMilestoneButtonProps) => {
|
|
26
26
|
const { releaseFunds } = useEscrowsMutations();
|
|
27
27
|
const { selectedEscrow, updateEscrow } = useEscrowContext();
|
|
28
28
|
const dialogStates = useEscrowDialogs();
|
|
@@ -58,7 +58,7 @@ export const ReleaseEscrowButton = ({
|
|
|
58
58
|
address: walletAddress || "",
|
|
59
59
|
});
|
|
60
60
|
|
|
61
|
-
toast.success("
|
|
61
|
+
toast.success("Milestone released successfully");
|
|
62
62
|
|
|
63
63
|
// Ensure amounts are up to date for the success dialog
|
|
64
64
|
if (selectedEscrow) {
|