@@ -29,7 +29,7 @@ import {
2929 setStoredInvites,
3030} from 'store/storage/roller';
3131import { usePointCache } from 'store/pointCache';
32−import { getOutgoingPoints, hasTransferProxy, maybeGetResult } from 'views/Points';
32+import { getOutgoingPoints, maybeGetResult } from 'views/Points';
3333
3434const hasPoint = (point: number) => (invite: Invite) => invite.planet === point;
3535
@@ -227,7 +227,6 @@ export default function useRoller() {
227227 const curPoint: string = need.point(pointCursor);
228228 const invites = getStoredInvites(curPoint);
229229 const availableInvites = invites.available;
230− console.log('WHAT', curPoint, invites, availableInvites)
231230
232231 const pendingTransactions = await api.getPendingByShip(curPoint);
233232 console.log('PENDING', pendingTransactions);
@@ -252,43 +251,51 @@ export default function useRoller() {
252251 });
253252 setInvites(availableInvites);
254253
255− let possibleMissingInvites: number[] = [];
256−
257− if (isL2) {
258− const allSpawned = await api.getSpawned(Number(curPoint));
259− const ownedPoints = maybeGetResult(controlledPoints, 'ownedPoints', []);
260− possibleMissingInvites = allSpawned.filter(
261− (p: number) =>
262− ownedPoints.includes(p) &&
263− azimuth.azimuth.getPointSize(p) ===
264− azimuth.azimuth.PointSize.Planet
265− );
266− } else {
267− // How to get outgoing points by star?
268− const outgoingPoints = getOutgoingPoints(
269− controlledPoints,
270− getDetails
271− );
272−
273− possibleMissingInvites = outgoingPoints.filter(
274− (p: number) =>
275− azimuth.azimuth.getPointSize(p) ===
276− azimuth.azimuth.PointSize.Planet
277− );
278− }
279−
280− // Iterate over all spawned and controlled planets
281− // If the planet is not in available invites, generate the ticket and add it
282254 const _authToken = authToken.getOrElse(null);
283255 const _contracts = contracts.getOrElse(null);
284256
285− console.log('POSSIBLE MISSING', possibleMissingInvites)
257+ if (_authToken && _contracts) {
258+ let possibleMissingInvites: number[] = [];
259+ if (isL2) {
260+ const allSpawned = await api.getSpawned(Number(curPoint));
261+ const ownedPoints = maybeGetResult(
262+ controlledPoints,
263+ 'ownedPoints',
264+ []
265+ );
266+ possibleMissingInvites = allSpawned.filter(
267+ (p: number) =>
268+ ownedPoints.includes(p) &&
269+ azimuth.azimuth.getPointSize(p) ===
270+ azimuth.azimuth.PointSize.Planet
271+ );
272+ } else {
273+ const outgoingPoints = getOutgoingPoints(
274+ controlledPoints,
275+ getDetails
276+ );
277+
278+ const availablePoints = await azimuth.azimuth.getUnspawnedChildren(
279+ _contracts,
280+ curPoint
281+ );
282+
283+ possibleMissingInvites = outgoingPoints.filter(
284+ (p: number) =>
285+ azimuth.azimuth.getPointSize(p) ===
286+ azimuth.azimuth.PointSize.Planet &&
287+ availablePoints.includes(p)
288+ );
289+ }
286290
287− const newClaimed = availableInvites.filter(
288− ({ planet }) => !possibleMissingInvites.includes(planet)
289− );
291+ // Iterate over all spawned and controlled planets
292+ // If the planet is not in available invites, generate the ticket and add it
293+ console.log('POSSIBLE MISSING', possibleMissingInvites);
294+
295+ const newClaimed = availableInvites.filter(
296+ ({ planet }) => !possibleMissingInvites.includes(planet)
297+ );
290298
291− if (_authToken && _contracts) {
292299 for (let i = 0; i < possibleMissingInvites.length; i++) {
293300 const planet = possibleMissingInvites[i];
294301
@@ -359,12 +366,12 @@ export default function useRoller() {
359366 setNextBatchTime(response.nextBatch);
360367 });
361368
362− getInvites();
369+ getInvites(currentL2);
363370 }
364371 }, 1000);
365372
366373 return () => clearInterval(interval);
367− }, [nextBatchTime, getPendingTransactions]); // eslint-disable-line react-hooks/exhaustive-deps
374+ }, [nextBatchTime, getPendingTransactions, currentL2]); // eslint-disable-line react-hooks/exhaustive-deps
368375
369376 return {
370377 api,