on master help sign in
Fix wrong sponsor being displayed for ships who are on L1 but escaped via L2 (#1118)
9136cc9Pyry Kovanen
src/lib/useRoller.ts+17−14
@@ -148,13 +148,13 @@ export default function useRoller() {
148 const rawDetails = await api.getPoint(pointNum);
148 const rawDetails = await api.getPoint(pointNum);
149 const isL2 = isL2Spawn(rawDetails?.dominion);
149 const isL2 = isL2Spawn(rawDetails?.dominion);
150
150
151+ const details = toL1Details(rawDetails);
152+
151 try {
153 try {
152 if (isL2) {
154 if (isL2) {
153 const l2Quota = isL2 ? await api.getRemainingQuota(pointNum) : 0;
155 const l2Quota = isL2 ? await api.getRemainingQuota(pointNum) : 0;
154 const l2Allowance = isL2 ? await api.getAllowance(pointNum) : 0;
156 const l2Allowance = isL2 ? await api.getAllowance(pointNum) : 0;
155
157
156− const details = toL1Details(rawDetails);
157−
158 return new Point({
158 return new Point({
159 value: pointNum,
159 value: pointNum,
160 details,
160 details,
@@ -165,24 +165,27 @@ export default function useRoller() {
165 }
165 }
166
166
167 const _contracts = need.contracts(contracts);
167 const _contracts = need.contracts(contracts);
168− const details = await azimuth.azimuth.getPoint(_contracts, point);
168+ const l1Details = await azimuth.azimuth.getPoint(_contracts, point);
169+
170+ l1Details.sponsor = details.sponsor;
171+ l1Details.escapeRequested = details.escapeRequested;
172+ l1Details.escapeRequestedTo = details.escapeRequestedTo;
173+
169 return new Point({
174 return new Point({
170 value: pointNum,
175 value: pointNum,
171− details,
176+ details: l1Details,
172 address: _wallet.address,
177 address: _wallet.address,
173 });
178 });
174−
175 } catch (e) {
179 } catch (e) {
176 console.warn(e);
180 console.warn(e);
177− // Just return a placeholder Point
181+ // Just return a placeholder Point
178− const details: L1Point = toL1Details();
182+ const details: L1Point = toL1Details();
179− return new Point({
183+ return new Point({
180− value: pointNum,
184+ value: pointNum,
181− details,
185+ details,
182− address: _wallet.address,
186+ address: _wallet.address,
183− isPlaceholder: true,
187+ isPlaceholder: true,
184− });
188+ });
185−
186 }
189 }
187 },
190 },
188 [api, wallet, contracts]
191 [api, wallet, contracts]