on master help sign in
Fix wrong sponsor being displayed for ships who are on L1 but escaped via L2 (#1118)

useRoller: fix incorrect sponsor --------- Co-authored-by: Shawn Tobin <shawn.david.tobin@gmail.com>

commit9136cc983d384fce395c0c6c190f3501b58e6a08 authorPyry Kovanen <pkova@users.noreply.github.com> dateWed 13 Sep 2023, 17:34 (3 years ago) parent9e00401
1 file changed+17−14
src/lib/useRoller.ts+17−14
src/lib/useRoller.ts+17−14
@@ -148,13 +148,13 @@ export default function useRoller() {
148148 const rawDetails = await api.getPoint(pointNum);
149149 const isL2 = isL2Spawn(rawDetails?.dominion);
150150
151+ const details = toL1Details(rawDetails);
152+
151153 try {
152154 if (isL2) {
153155 const l2Quota = isL2 ? await api.getRemainingQuota(pointNum) : 0;
154156 const l2Allowance = isL2 ? await api.getAllowance(pointNum) : 0;
155157
156− const details = toL1Details(rawDetails);
157−
158158 return new Point({
159159 value: pointNum,
160160 details,
@@ -165,24 +165,27 @@ export default function useRoller() {
165165 }
166166
167167 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+
169174 return new Point({
170175 value: pointNum,
171− details,
176+ details: l1Details,
172177 address: _wallet.address,
173178 });
174−
175179 } catch (e) {
176180 console.warn(e);
177− // Just return a placeholder Point
178− const details: L1Point = toL1Details();
179− return new Point({
180− value: pointNum,
181− details,
182− address: _wallet.address,
183− isPlaceholder: true,
184− });
185−
181+ // Just return a placeholder Point
182+ const details: L1Point = toL1Details();
183+ return new Point({
184+ value: pointNum,
185+ details,
186+ address: _wallet.address,
187+ isPlaceholder: true,
188+ });
186189 }
187190 },
188191 [api, wallet, contracts]