FIx error handling logic in ord-data
This commit is contained in:
		
							parent
							
								
									3b9601a82e
								
							
						
					
					
						commit
						65f080d526
					
				| @ -1,16 +1,11 @@ | |||||||
| @if (error) { | @if (minted) { | ||||||
|   <div> |  | ||||||
|     <i>Error fetching data (code {{ error.status }})</i> |  | ||||||
|   </div> |  | ||||||
| } @else { |  | ||||||
|   @if (minted) { |  | ||||||
|   <ng-container i18n="ord.mint-n-runes"> |   <ng-container i18n="ord.mint-n-runes"> | ||||||
|     <span>Mint</span> |     <span>Mint</span> | ||||||
|     <span class="amount"> {{ minted >= 100000 ? (minted | amountShortener:undefined:undefined:true) : minted }} </span> |     <span class="amount"> {{ minted >= 100000 ? (minted | amountShortener:undefined:undefined:true) : minted }} </span> | ||||||
|     <ng-container *ngTemplateOutlet="runeName; context: { $implicit: runestone.mint.toString() }"></ng-container> |     <ng-container *ngTemplateOutlet="runeName; context: { $implicit: runestone.mint.toString() }"></ng-container> | ||||||
|   </ng-container> |   </ng-container> | ||||||
|   } | } | ||||||
|   @if (runestone?.etching?.supply) { | @if (runestone?.etching?.supply) { | ||||||
|   @if (runestone?.etching.premine > 0) { |   @if (runestone?.etching.premine > 0) { | ||||||
|     <ng-container i18n="ord.premine-n-runes"> |     <ng-container i18n="ord.premine-n-runes"> | ||||||
|       <span>Premine</span> |       <span>Premine</span> | ||||||
| @ -26,17 +21,17 @@ | |||||||
|       <span class="name">{{ runestone.etching.spacedName }}</span> |       <span class="name">{{ runestone.etching.spacedName }}</span> | ||||||
|     </ng-container> |     </ng-container> | ||||||
|   } |   } | ||||||
|   } | } | ||||||
|   @if (transferredRunes?.length && type === 'vout') { | @if (transferredRunes?.length && type === 'vout') { | ||||||
|   <div *ngFor="let rune of transferredRunes"> |   <div *ngFor="let rune of transferredRunes"> | ||||||
|     <ng-container i18n="ord.transfer-rune"> |     <ng-container i18n="ord.transfer-rune"> | ||||||
|       <span>Transfer</span> |       <span>Transfer</span> | ||||||
|       <ng-container *ngTemplateOutlet="runeName; context: { $implicit: rune.key }"></ng-container> |       <ng-container *ngTemplateOutlet="runeName; context: { $implicit: rune.key }"></ng-container> | ||||||
|     </ng-container> |     </ng-container> | ||||||
|   </div> |   </div> | ||||||
|   } | } | ||||||
| 
 | 
 | ||||||
|   @if (inscriptions?.length && type === 'vin') { | @if (inscriptions?.length && type === 'vin') { | ||||||
|   <div *ngFor="let contentType of inscriptionsData | keyvalue"> |   <div *ngFor="let contentType of inscriptionsData | keyvalue"> | ||||||
|     <div> |     <div> | ||||||
|       <span class="badge badge-ord mr-1">{{ contentType.value.count > 1 ? contentType.value.count + " " : "" }}{{ contentType.value?.tag || contentType.key }}</span> |       <span class="badge badge-ord mr-1">{{ contentType.value.count > 1 ? contentType.value.count + " " : "" }}{{ contentType.value?.tag || contentType.key }}</span> | ||||||
| @ -48,17 +43,14 @@ | |||||||
|     <pre *ngIf="contentType.value.json" class="name" style="white-space: pre-wrap; word-break: break-word;">{{ contentType.value.json | json }}</pre> |     <pre *ngIf="contentType.value.json" class="name" style="white-space: pre-wrap; word-break: break-word;">{{ contentType.value.json | json }}</pre> | ||||||
|     <pre *ngIf="contentType.value.text" class="name" style="white-space: pre-wrap; word-break: break-word;">{{ contentType.value.text }}</pre> |     <pre *ngIf="contentType.value.text" class="name" style="white-space: pre-wrap; word-break: break-word;">{{ contentType.value.text }}</pre> | ||||||
|     </div> |     </div> | ||||||
|   } | } | ||||||
| 
 | 
 | ||||||
|   @if (!runestone && type === 'vout') { | @if (!runestone && type === 'vout') { | ||||||
|   <div class="skeleton-loader" style="width: 50%;"></div> |   <div class="skeleton-loader" style="width: 50%;"></div> | ||||||
|   } | } | ||||||
| 
 | 
 | ||||||
|   @if (!inscriptions?.length && type === 'vin') { | @if ((runestone && !minted && !runestone.etching?.supply && !transferredRunes?.length && type === 'vout') || (!inscriptions?.length && type === 'vin')) { | ||||||
|     <div> |   <i i18n="error.decoding-data">Error decoding data</i> | ||||||
|       <i>Error decoding inscription data</i> |  | ||||||
|     </div> |  | ||||||
|   } |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| <ng-template #runeName let-id> | <ng-template #runeName let-id> | ||||||
|  | |||||||
| @ -1,5 +1,4 @@ | |||||||
| import { ChangeDetectionStrategy, Component, Input, OnChanges, SimpleChanges } from '@angular/core'; | import { ChangeDetectionStrategy, Component, Input, OnChanges, SimpleChanges } from '@angular/core'; | ||||||
| import { HttpErrorResponse } from '@angular/common/http'; |  | ||||||
| import { Runestone, Etching } from '../../shared/ord/rune.utils'; | import { Runestone, Etching } from '../../shared/ord/rune.utils'; | ||||||
| 
 | 
 | ||||||
| export interface Inscription { | export interface Inscription { | ||||||
| @ -20,7 +19,6 @@ export class OrdDataComponent implements OnChanges { | |||||||
|   @Input() inscriptions: Inscription[]; |   @Input() inscriptions: Inscription[]; | ||||||
|   @Input() runestone: Runestone; |   @Input() runestone: Runestone; | ||||||
|   @Input() runeInfo: { [id: string]: { etching: Etching; txid: string } }; |   @Input() runeInfo: { [id: string]: { etching: Etching; txid: string } }; | ||||||
|   @Input() error: HttpErrorResponse; |  | ||||||
|   @Input() type: 'vin' | 'vout'; |   @Input() type: 'vin' | 'vout'; | ||||||
| 
 | 
 | ||||||
|   toNumber = (value: bigint): number => Number(value); |   toNumber = (value: bigint): number => Number(value); | ||||||
|  | |||||||
| @ -103,7 +103,7 @@ | |||||||
|               }"> |               }"> | ||||||
|                 <td></td> |                 <td></td> | ||||||
|                 <td colspan="2"> |                 <td colspan="2"> | ||||||
|                   <app-ord-data [inscriptions]="showOrdData[tx.txid + '-vin-' + vindex]['inscriptions']" [type]="'vin'" [error]="showOrdData[tx.txid + '-vin-' + vindex]['error']"></app-ord-data> |                   <app-ord-data [inscriptions]="showOrdData[tx.txid + '-vin-' + vindex]['inscriptions']" [type]="'vin'"></app-ord-data> | ||||||
|                 </td> |                 </td> | ||||||
|               </tr> |               </tr> | ||||||
|               <tr *ngIf="(showDetails$ | async) === true"> |               <tr *ngIf="(showDetails$ | async) === true"> | ||||||
| @ -297,7 +297,7 @@ | |||||||
|                 'highlight': this.address !== '' && (vout.scriptpubkey_address === this.address || (vout.scriptpubkey_type === 'p2pk' && vout.scriptpubkey.slice(2, -2) === this.address)) |                 'highlight': this.address !== '' && (vout.scriptpubkey_address === this.address || (vout.scriptpubkey_type === 'p2pk' && vout.scriptpubkey.slice(2, -2) === this.address)) | ||||||
|               }"> |               }"> | ||||||
|                 <td colspan="3"> |                 <td colspan="3"> | ||||||
|                     <app-ord-data [runestone]="showOrdData[tx.txid + '-vout-' + vindex]['runestone']" [runeInfo]="showOrdData[tx.txid + '-vout-' + vindex]['runeInfo']" [type]="'vout'" [error]="showOrdData[tx.txid + '-vout-' + vindex]['error']"></app-ord-data> |                     <app-ord-data [runestone]="showOrdData[tx.txid + '-vout-' + vindex]['runestone']" [runeInfo]="showOrdData[tx.txid + '-vout-' + vindex]['runeInfo']" [type]="'vout'"></app-ord-data> | ||||||
|                 </td> |                 </td> | ||||||
|               </tr> |               </tr> | ||||||
|               <tr *ngIf="(showDetails$ | async) === true"> |               <tr *ngIf="(showDetails$ | async) === true"> | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user