@@ -40,6 +40,34 @@ export const maybeGetResult = (obj, key, defaultValue) =>
4040export const hasTransferProxy = details =>
4141 !isZeroAddress(details.transferProxy);
4242
43+export const getOutgoingPoints = (controlledPoints, getDetails) => {
44+ return controlledPoints.chain((points) =>
45+ points.matchWith({
46+ Error: () => Nothing(),
47+ Ok: (c) => {
48+ const points = c.value.ownedPoints.map((point) =>
49+ getDetails(point).chain((details) => {
50+ // need those that are inactive
51+ if (!details.active) {
52+ console.log(point, details)
53+ }
54+ return Just({ point: point, has: hasTransferProxy(details) })
55+ }
56+ )
57+ );
58+ if (points.every((p) => Just.hasInstance(p))) {
59+ const outgoing = points
60+ .filter((p) => p.value.has)
61+ .map((p) => p.value.point);
62+ return Just(outgoing);
63+ } else {
64+ return Nothing();
65+ }
66+ },
67+ })
68+ ).getOrElse([]);
69+}
70+
4371export const isLocked = details =>
4472 details.owner === '0x86cd9cd0992f04231751e3761de45cecea5d1801' ||
4573 details.owner === '0x8c241098c3d3498fe1261421633fd57986d74aea';
@@ -112,30 +140,8 @@ export default function Points() {
112140 ] = useRejectedIncomingPointTransfers();
113141 const { syncStarReleaseDetails, starReleaseDetails } = useStarReleaseCache();
114142
115− const maybeOutgoingPoints = useMemo(
116− () =>
117− controlledPoints.chain(points =>
118− points.matchWith({
119− Error: () => Nothing(),
120− Ok: c => {
121− const points = c.value.ownedPoints.map(point =>
122− getDetails(point).chain(details =>
123− Just({ point: point, has: hasTransferProxy(details) })
124− )
125− );
126− // if we have details for every point,
127− // return the array of pending transfers.
128− if (points.every(p => Just.hasInstance(p))) {
129− const outgoing = points
130− .filter(p => p.value.has)
131− .map(p => p.value.point);
132− return Just(outgoing);
133− } else {
134− return Nothing();
135− }
136− },
137− })
138− ),
143+ const outgoingPoints = useMemo(
144+ () => getOutgoingPoints(controlledPoints, getDetails),
139145 [getDetails, controlledPoints]
140146 );
141147
@@ -172,10 +178,7 @@ export default function Points() {
172178 // if there are any pending transfers, incoming or outgoing, stay on this
173179 // page, because those can only be completed/cancelled here.
174180 useEffect(() => {
175− if (
176− Nothing.hasInstance(maybeOutgoingPoints) ||
177− Nothing.hasInstance(starReleaseDetails)
178− ) {
181+ if (outgoingPoints.length < 1 || Nothing.hasInstance(starReleaseDetails)) {
179182 return;
180183 }
181184 controlledPoints.matchWith({
@@ -196,7 +199,7 @@ export default function Points() {
196199 if (
197200 all.length === 1 &&
198201 incoming.length === 0 &&
199− maybeOutgoingPoints.value.length === 0 &&
202+ outgoingPoints.length === 0 &&
200203 (starReleaseDetails.value === null ||
201204 starReleaseDetails.value.total === 0)
202205 ) {
@@ -210,7 +213,7 @@ export default function Points() {
210213 }, [
211214 controlledPoints,
212215 rejectedPoints,
213− maybeOutgoingPoints,
216+ outgoingPoints,
214217 setPointCursor,
215218 popAndPush,
216219 names,
@@ -230,7 +233,6 @@ export default function Points() {
230233 const managingPoints = maybeGetResult(controlledPoints, 'managingPoints', []);
231234 const votingPoints = maybeGetResult(controlledPoints, 'votingPoints', []);
232235 const spawningPoints = maybeGetResult(controlledPoints, 'spawningPoints', []);
233− const outgoingPoints = maybeOutgoingPoints.getOrElse([]);
234236 const lockedPoints = maybeLockedPoints.getOrElse([]);
235237
236238 const allPoints = [