@trustless-work/blocks 1.1.6 → 1.1.8

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trustless-work/blocks",
3
- "version": "1.1.6",
3
+ "version": "1.1.8",
4
4
  "author": "Trustless Work",
5
5
  "keywords": [
6
6
  "react",
@@ -36,7 +36,9 @@ export const LoadEscrowButton = ({ contractId }: LoadEscrowButtonProps) => {
36
36
 
37
37
  setSelectedEscrow(escrowData);
38
38
 
39
- toast.success("Escrow data fetched successfully");
39
+ toast.success(
40
+ "Escrow data fetched successfully. Now you can use the selectedEscrow state"
41
+ );
40
42
  } catch (error) {
41
43
  toast.error(handleError(error as ErrorResponse).message);
42
44
  } finally {
@@ -17,7 +17,9 @@ import {
17
17
  import { useEscrowContext } from "@/components/tw-blocks/providers/EscrowProvider";
18
18
  import { trustlineOptions } from "@/components/tw-blocks/wallet-kit/trustlines";
19
19
 
20
- export function useInitializeEscrow({ onSuccess }: { onSuccess?: () => void } = {}) {
20
+ export function useInitializeEscrow({
21
+ onSuccess,
22
+ }: { onSuccess?: () => void } = {}) {
21
23
  const [isSubmitting, setIsSubmitting] = React.useState(false);
22
24
 
23
25
  const { getMultiReleaseFormSchema } = useInitializeEscrowSchema();
@@ -122,6 +124,15 @@ export function useInitializeEscrow({ onSuccess }: { onSuccess?: () => void } =
122
124
  try {
123
125
  setIsSubmitting(true);
124
126
 
127
+ const trustline = trustlineOptions.find(
128
+ (t) => t.value === payload.trustline.address
129
+ );
130
+
131
+ if (!trustline) {
132
+ toast.error("Invalid trustline address");
133
+ return;
134
+ }
135
+
125
136
  /**
126
137
  * Create the final payload for the initialize escrow mutation
127
138
  *
@@ -142,6 +153,10 @@ export function useInitializeEscrow({ onSuccess }: { onSuccess?: () => void } =
142
153
  ? Number(milestone.amount)
143
154
  : milestone.amount,
144
155
  })),
156
+ trustline: {
157
+ address: trustline.value,
158
+ symbol: trustline.label,
159
+ },
145
160
  };
146
161
 
147
162
  /**
@@ -17,7 +17,9 @@ import {
17
17
  import { useEscrowContext } from "@/components/tw-blocks/providers/EscrowProvider";
18
18
  import { trustlineOptions } from "@/components/tw-blocks/wallet-kit/trustlines";
19
19
 
20
- export function useInitializeEscrow({ onSuccess }: { onSuccess?: () => void } = {}) {
20
+ export function useInitializeEscrow({
21
+ onSuccess,
22
+ }: { onSuccess?: () => void } = {}) {
21
23
  const [isSubmitting, setIsSubmitting] = React.useState(false);
22
24
 
23
25
  const { getSingleReleaseFormSchema } = useInitializeEscrowSchema();
@@ -108,6 +110,15 @@ export function useInitializeEscrow({ onSuccess }: { onSuccess?: () => void } =
108
110
  try {
109
111
  setIsSubmitting(true);
110
112
 
113
+ const trustline = trustlineOptions.find(
114
+ (t) => t.value === payload.trustline.address
115
+ );
116
+
117
+ if (!trustline) {
118
+ toast.error("Invalid trustline address");
119
+ return;
120
+ }
121
+
111
122
  /**
112
123
  * Create the final payload for the initialize escrow mutation
113
124
  *
@@ -126,6 +137,10 @@ export function useInitializeEscrow({ onSuccess }: { onSuccess?: () => void } =
126
137
  : payload.platformFee,
127
138
  signer: walletAddress || "",
128
139
  milestones: payload.milestones,
140
+ trustline: {
141
+ address: trustline.value,
142
+ symbol: trustline.label,
143
+ },
129
144
  };
130
145
 
131
146
  /**