on master help sign in
Added planet check
commitc250bda5f4fc09303b4b8f1556945fb291c9ed94 authorWill Galebach <willbach@gmail.com> dateFri 3 Sep 2021, 17:40 (5 years ago) parent4002714
2 files changed+23−10
src/lib/useRoller.ts+7−3 src/views/Invite/Cohort.js+16−7
src/lib/useRoller.ts+7−3
@@ -274,8 +274,6 @@ export default function useRoller() {
274274 Just({ point: point, has: hasTransferProxy(details) })
275275 )
276276 );
277− // if we have details for every point,
278− // return the array of pending transfers.
279277 if (points.every((p: any) => Just.hasInstance(p))) {
280278 const outgoing = points
281279 .filter((p: any) => p.value.has)
@@ -288,7 +286,13 @@ export default function useRoller() {
288286 })
289287 );
290288
291− possibleMissingInvites = maybeOutgoingPoints.getOrElse([]);
289+ possibleMissingInvites = maybeOutgoingPoints
290+ .getOrElse([])
291+ .filter(
292+ (p: number) =>
293+ azimuth.azimuth.getPointSize(p) ===
294+ azimuth.azimuth.PointSize.Planet
295+ );
292296 }
293297
294298 // Iterate over all spawned and controlled planets
src/views/Invite/Cohort.js+16−7
@@ -75,19 +75,28 @@ export default function InviteCohort() {
7575
7676 const setUpInvite = async () => {
7777 setLoading(true);
78− const [invitePoint] = await azimuth.azimuth.getUnspawnedChildren(
78+ const possiblePoints = await azimuth.azimuth.getUnspawnedChildren(
7979 _contracts,
8080 point
8181 );
8282
83− // TODO: figure out how to store the ticket and invite info
84− const { ticket, owner } = await wg.generateTemporaryDeterministicWallet(
85− point,
86− _authToken
83+ const invitePoint = possiblePoints.find(
84+ p =>
85+ azimuth.azimuth.getPointSize(p) === azimuth.azimuth.PointSize.Planet
8786 );
8887
89− construct(invitePoint, owner.keys.address);
90− setL1Invite({ ticket, planet: invitePoint });
88+ if (invitePoint) {
89+ const { ticket, owner } = await wg.generateTemporaryDeterministicWallet(
90+ point,
91+ _authToken
92+ );
93+
94+ construct(invitePoint, owner.keys.address);
95+ setL1Invite({ ticket, planet: invitePoint });
96+ } else {
97+ setError('No available planets');
98+ }
99+
91100 setLoading(false);
92101 };
93102