From 65f080d5268b7365a0a0f428ddc340fca6a19d8d Mon Sep 17 00:00:00 2001 From: natsoni Date: Tue, 8 Oct 2024 11:24:17 +0900 Subject: [PATCH] FIx error handling logic in ord-data --- .../ord-data/ord-data.component.html | 104 ++++++++---------- .../components/ord-data/ord-data.component.ts | 2 - .../transactions-list.component.html | 4 +- 3 files changed, 50 insertions(+), 60 deletions(-) diff --git a/frontend/src/app/components/ord-data/ord-data.component.html b/frontend/src/app/components/ord-data/ord-data.component.html index 696e7ea17..97dbc0d9d 100644 --- a/frontend/src/app/components/ord-data/ord-data.component.html +++ b/frontend/src/app/components/ord-data/ord-data.component.html @@ -1,64 +1,56 @@ -@if (error) { -
- Error fetching data (code {{ error.status }}) -
-} @else { - @if (minted) { - - Mint - {{ minted >= 100000 ? (minted | amountShortener:undefined:undefined:true) : minted }} - +@if (minted) { + + Mint + {{ minted >= 100000 ? (minted | amountShortener:undefined:undefined:true) : minted }} + + +} +@if (runestone?.etching?.supply) { + @if (runestone?.etching.premine > 0) { + + Premine + {{ runestone.etching.premine >= 100000 ? (toNumber(runestone.etching.premine) | amountShortener:undefined:undefined:true) : runestone.etching.premine }} + {{ runestone.etching.symbol }} + {{ runestone.etching.spacedName }} + ({{ toNumber(runestone.etching.premine) / toNumber(runestone.etching.supply) * 100 | amountShortener:0}}% of total supply) + + } @else { + + Etching of + {{ runestone.etching.symbol }} + {{ runestone.etching.spacedName }} } - @if (runestone?.etching?.supply) { - @if (runestone?.etching.premine > 0) { - - Premine - {{ runestone.etching.premine >= 100000 ? (toNumber(runestone.etching.premine) | amountShortener:undefined:undefined:true) : runestone.etching.premine }} - {{ runestone.etching.symbol }} - {{ runestone.etching.spacedName }} - ({{ toNumber(runestone.etching.premine) / toNumber(runestone.etching.supply) * 100 | amountShortener:0}}% of total supply) - - } @else { - - Etching of - {{ runestone.etching.symbol }} - {{ runestone.etching.spacedName }} - - } - } - @if (transferredRunes?.length && type === 'vout') { -
- - Transfer - - -
- } +} +@if (transferredRunes?.length && type === 'vout') { +
+ + Transfer + + +
+} - @if (inscriptions?.length && type === 'vin') { -
-
- {{ contentType.value.count > 1 ? contentType.value.count + " " : "" }}{{ contentType.value?.tag || contentType.key }} - {{ contentType.value.totalSize | bytes:2:'B':undefined:true }} - - Source inscription - -
-
{{ contentType.value.json | json }}
-
{{ contentType.value.text }}
-
- } - - @if (!runestone && type === 'vout') { -
- } - - @if (!inscriptions?.length && type === 'vin') { +@if (inscriptions?.length && type === 'vin') { +
- Error decoding inscription data + {{ contentType.value.count > 1 ? contentType.value.count + " " : "" }}{{ contentType.value?.tag || contentType.key }} + {{ contentType.value.totalSize | bytes:2:'B':undefined:true }} + + Source inscription +
- } +
{{ contentType.value.json | json }}
+
{{ contentType.value.text }}
+
+} + +@if (!runestone && type === 'vout') { +
+} + +@if ((runestone && !minted && !runestone.etching?.supply && !transferredRunes?.length && type === 'vout') || (!inscriptions?.length && type === 'vin')) { + Error decoding data } diff --git a/frontend/src/app/components/ord-data/ord-data.component.ts b/frontend/src/app/components/ord-data/ord-data.component.ts index 233b8d243..ccc77bce6 100644 --- a/frontend/src/app/components/ord-data/ord-data.component.ts +++ b/frontend/src/app/components/ord-data/ord-data.component.ts @@ -1,5 +1,4 @@ import { ChangeDetectionStrategy, Component, Input, OnChanges, SimpleChanges } from '@angular/core'; -import { HttpErrorResponse } from '@angular/common/http'; import { Runestone, Etching } from '../../shared/ord/rune.utils'; export interface Inscription { @@ -20,7 +19,6 @@ export class OrdDataComponent implements OnChanges { @Input() inscriptions: Inscription[]; @Input() runestone: Runestone; @Input() runeInfo: { [id: string]: { etching: Etching; txid: string } }; - @Input() error: HttpErrorResponse; @Input() type: 'vin' | 'vout'; toNumber = (value: bigint): number => Number(value); diff --git a/frontend/src/app/components/transactions-list/transactions-list.component.html b/frontend/src/app/components/transactions-list/transactions-list.component.html index 26187ecde..217eab7d7 100644 --- a/frontend/src/app/components/transactions-list/transactions-list.component.html +++ b/frontend/src/app/components/transactions-list/transactions-list.component.html @@ -103,7 +103,7 @@ }"> - + @@ -297,7 +297,7 @@ 'highlight': this.address !== '' && (vout.scriptpubkey_address === this.address || (vout.scriptpubkey_type === 'p2pk' && vout.scriptpubkey.slice(2, -2) === this.address)) }"> - +