Skip to content

Commit 0fd0d6b

Browse files
committed
Fix error accessing OASIS SettlementInfo details
Fixes #WALLET-2D9
1 parent e9a765c commit 0fd0d6b

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

src/components/modals/BuyCryptoModal.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,7 @@ export default defineComponent({
519519
console.log('Swap ID:', swapSuggestion.id); // eslint-disable-line no-console
520520
521521
console.debug('Swap:', swapSuggestion); // eslint-disable-line no-console
522-
} catch (error) {
522+
} catch (error: any) {
523523
console.error(error); // eslint-disable-line no-console
524524
estimateError.value = error.message;
525525
if (swapSuggestion!) cancelSwap(swapSuggestion);
@@ -616,7 +616,7 @@ export default defineComponent({
616616
try {
617617
signedTransactions = await setupSwap(hubRequest);
618618
if (typeof signedTransactions === 'undefined') return; // Using Hub redirects
619-
} catch (error) {
619+
} catch (error: any) {
620620
if (Config.reportToSentry) captureException(error);
621621
else console.error(error); // eslint-disable-line no-console
622622
swapError.value = error.message;

src/components/modals/SellCryptoModal.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,7 @@ export default defineComponent({
523523
524524
console.debug('Swap:', swapSuggestion); // eslint-disable-line no-console
525525
swapError.value = null;
526-
} catch (error) {
526+
} catch (error: any) {
527527
console.error(error); // eslint-disable-line no-console
528528
swapError.value = error.message;
529529
reject(error);
@@ -654,7 +654,7 @@ export default defineComponent({
654654
try {
655655
signedTransactions = await setupSwap(hubRequest);
656656
if (typeof signedTransactions === 'undefined') return; // Using Hub redirects
657-
} catch (error) {
657+
} catch (error: any) {
658658
if (Config.reportToSentry) captureException(error);
659659
else console.error(error); // eslint-disable-line no-console
660660
swapError.value = error.message;

src/components/swap/SwapNotification.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ export default defineComponent({
410410
stateEnteredAt: Date.now(),
411411
fundingTx,
412412
});
413-
} catch (error) {
413+
} catch (error: any) {
414414
if (error.message === SwapError.EXPIRED) return;
415415
if (error.message === SwapError.DELETED) return;
416416
@@ -539,10 +539,10 @@ export default defineComponent({
539539
status: htlc.settlement.status,
540540
...(htlc.settlement.status === SettlementStatus.ACCEPTED
541541
? {
542-
...((htlc.settlement as SettlementInfo<SettlementStatus.ACCEPTED>).detail.eta
542+
...((htlc.settlement as SettlementInfo<SettlementStatus.ACCEPTED>).detail?.eta
543543
? { eta: new Date(
544544
(htlc.settlement as SettlementInfo<SettlementStatus.ACCEPTED>)
545-
.detail.eta!).getTime() }
545+
.detail!.eta!).getTime() }
546546
: {}
547547
),
548548
lastUpdated: Date.now(),
@@ -568,7 +568,7 @@ export default defineComponent({
568568
stateEnteredAt: Date.now(),
569569
settlementTx,
570570
});
571-
} catch (error) {
571+
} catch (error: any) {
572572
if (error.message === SwapError.EXPIRED) return;
573573
if (error.message === SwapError.DELETED) return;
574574

src/composables/useOasisPayoutStatusUpdater.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export function useOasisPayoutStatusUpdater(swapData: Ref<SwapData | null>) {
3636
settlement.status = htlc.settlement.status;
3737
if (htlc.settlement.status === SettlementStatus.ACCEPTED) {
3838
const details = (htlc.settlement as SettlementInfo<SettlementStatus.ACCEPTED>).detail;
39-
if (details.eta) {
39+
if (details && details.eta) {
4040
settlement.eta = new Date(details.eta).getTime();
4141
}
4242
settlement.lastUpdated = Date.now();

src/hub.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ export async function syncFromHub() {
231231
// throwing a "Must call init() first" error (which then fails both requests).
232232
listedAccounts = await hubApi.list();
233233
listedCashlinks = await hubApi.cashlinks();
234-
} catch (error) {
234+
} catch (error: any) {
235235
if (error.message === 'MIGRATION_REQUIRED') {
236236
const behavior = new HubApi.RedirectRequestBehavior() as RequestBehavior<BehaviorType.REDIRECT>;
237237
hubApi.migrate(behavior);

0 commit comments

Comments
 (0)