@@ -13,7 +13,11 @@ import { useNetwork } from 'store/network';
13import { usePointCursor } from 'store/pointCursor';
13import { usePointCursor } from 'store/pointCursor';
14import { EMPTY_POINT, useRollerStore } from 'store/rollerStore';
14import { EMPTY_POINT, useRollerStore } from 'store/rollerStore';
15import { useWallet } from 'store/wallet';
15import { useWallet } from 'store/wallet';
16−import { getStoredInvites, setStoredInvites } from 'store/storage/roller';
20+} from 'store/storage/roller';
17import { usePointCache } from 'store/pointCache';
21import { usePointCache } from 'store/pointCache';
18import { getOutgoingPoints } from 'views/Points';
22import { getOutgoingPoints } from 'views/Points';
@@ -86,13 +90,14 @@ export default function useRoller() {
86 nextBatchTime,
90 nextBatchTime,
88 invitePoints,
92 invitePoints,
89− invites,
93+ removeInvite,
90 setNextBatchTime,
94 setNextBatchTime,
91 setPendingTransactions,
95 setPendingTransactions,
92 setInvites,
96 setInvites,
93 setInvitePoints,
97 setInvitePoints,
94 setInviteGeneratingNum,
98 setInviteGeneratingNum,
95 setPoints,
99 setPoints,
96 } = useRollerStore();
101 } = useRollerStore();
97 const [config, setConfig] = useState<Config | null>(null);
102 const [config, setConfig] = useState<Config | null>(null);
@@ -120,6 +125,15 @@ export default function useRoller() {
120 return new RollerRPCAPI(options);
125 return new RollerRPCAPI(options);
121 }, [options]);
126 }, [options]);
131+ isCompression: false,
132+ encryptionSecret: authToken.getOrElse('default'),
123 const fetchConfig = useCallback(async () => {
137 const fetchConfig = useCallback(async () => {
125 .getRollerConfig()
139 .getRollerConfig()
@@ -136,15 +150,6 @@ export default function useRoller() {
137 }, [api]); // eslint-disable-line react-hooks/exhaustive-deps
151 }, [api]); // eslint-disable-line react-hooks/exhaustive-deps
142− isCompression: false,
143− encryptionSecret: authToken.getOrElse('default'),
148 const generateInviteCodes = useCallback(
153 const generateInviteCodes = useCallback(
149 async (numInvites: number) => {
154 async (numInvites: number) => {
150 const _point = need.point(pointCursor);
155 const _point = need.point(pointCursor);
@@ -346,21 +351,20 @@ export default function useRoller() {
346 for (let i = 0; i < invitePlanets.length; i++) {
351 for (let i = 0; i < invitePlanets.length; i++) {
347 setInviteGeneratingNum(i + 1);
352 setInviteGeneratingNum(i + 1);
348 const planet = invitePlanets[i];
353 const planet = invitePlanets[i];
349− const invite = storedInvites[planet];
355+ storedInvites[planet] ||
356+ (await generateInviteInfo(planet, _authToken));
351− if (invite?.ticket) {
358+ // TODO: check if the invite point's owner still matches the deterministic wallet address
359+ const planetInfo = await api.getPoint(planet);
360+ if (invite.owner === planetInfo.ownership?.transferProxy?.address) {
352 newInvites.push(invite);
361 newInvites.push(invite);
353− } else if (getAll) {
362+ updateInvite(invite);
354− if (isDevelopment) {
363+ setStoredInvite(ls, invite);
355− console.log('MISSING INVITE INFO', planet);
357− const newInvite = await generateInviteInfo(planet, _authToken);
358− newInvites.push(newInvite);
360− newInvites.push(inviteTemplate(planet));
365+ removeInvite(planet);
364 setStoredInvites(ls, newInvites);
368 setStoredInvites(ls, newInvites);
365 setInvites(newInvites);
369 setInvites(newInvites);
@@ -379,27 +383,13 @@ export default function useRoller() {
379 pointCursor,
383 pointCursor,
380 invitePoints,
384 invitePoints,
382 setInvites,
387 setInvites,
383 setInviteGeneratingNum,
388 setInviteGeneratingNum,
387− const showInvite = useCallback(
388− async (planet: number) => {
389− const _authToken = authToken.getOrElse(null);
392− const newInvite = await generateInviteInfo(planet, _authToken);
393− const newInvites = invites.map(invite =>
394− invite.planet === planet ? newInvite : invite
396− setInvites(newInvites);
397− setStoredInvites(ls, newInvites);
400− [authToken, invites, ls, setInvites]
403 const getNumInvites = useCallback(
393 const getNumInvites = useCallback(
404 async (isL2: boolean) => {
394 async (isL2: boolean) => {
@@ -887,6 +877,5 @@ export default function useRoller() {
888 performL2Reticket,
878 performL2Reticket,
889 setProxyAddress,
879 setProxyAddress,