From 57a05c80a25cd7d3510b169d7495652ecaaac495 Mon Sep 17 00:00:00 2001 From: natsoni Date: Tue, 8 Oct 2024 12:53:18 +0900 Subject: [PATCH] Move inscription type to utils --- .../src/app/components/ord-data/ord-data.component.ts | 10 +--------- .../transactions-list/transactions-list.component.ts | 2 +- frontend/src/app/services/ord-api.service.ts | 2 +- frontend/src/app/shared/ord/inscription.utils.ts | 11 +++++++++-- 4 files changed, 12 insertions(+), 13 deletions(-) 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 0e18750f1..40e189f7b 100644 --- a/frontend/src/app/components/ord-data/ord-data.component.ts +++ b/frontend/src/app/components/ord-data/ord-data.component.ts @@ -1,14 +1,6 @@ import { ChangeDetectionStrategy, Component, Input, OnChanges, SimpleChanges } from '@angular/core'; import { Runestone, Etching } from '../../shared/ord/rune.utils'; - -export interface Inscription { - body?: Uint8Array; - is_cropped?: boolean; - body_length?: number; - content_type?: Uint8Array; - content_type_str?: string; - delegate_txid?: string; -} +import { Inscription } from '../../shared/ord/inscription.utils'; @Component({ selector: 'app-ord-data', diff --git a/frontend/src/app/components/transactions-list/transactions-list.component.ts b/frontend/src/app/components/transactions-list/transactions-list.component.ts index 706ee9684..7bb1604c6 100644 --- a/frontend/src/app/components/transactions-list/transactions-list.component.ts +++ b/frontend/src/app/components/transactions-list/transactions-list.component.ts @@ -12,7 +12,7 @@ import { ApiService } from '../../services/api.service'; import { PriceService } from '../../services/price.service'; import { StorageService } from '../../services/storage.service'; import { OrdApiService } from '../../services/ord-api.service'; -import { Inscription } from '../ord-data/ord-data.component'; +import { Inscription } from '../../shared/ord/inscription.utils'; import { Etching, Runestone } from '../../shared/ord/rune.utils'; @Component({ diff --git a/frontend/src/app/services/ord-api.service.ts b/frontend/src/app/services/ord-api.service.ts index 6a38e5b17..5fcd75298 100644 --- a/frontend/src/app/services/ord-api.service.ts +++ b/frontend/src/app/services/ord-api.service.ts @@ -1,6 +1,6 @@ import { Injectable } from '@angular/core'; import { catchError, forkJoin, map, Observable, of, switchMap, tap } from 'rxjs'; -import { Inscription } from '../components/ord-data/ord-data.component'; +import { Inscription } from '../shared/ord/inscription.utils'; import { Transaction } from '../interfaces/electrs.interface'; import { getNextInscriptionMark, hexToBytes, extractInscriptionData } from '../shared/ord/inscription.utils'; import { decipherRunestone, Runestone, Etching, UNCOMMON_GOODS } from '../shared/ord/rune.utils'; diff --git a/frontend/src/app/shared/ord/inscription.utils.ts b/frontend/src/app/shared/ord/inscription.utils.ts index e62f892d7..f4d92b206 100644 --- a/frontend/src/app/shared/ord/inscription.utils.ts +++ b/frontend/src/app/shared/ord/inscription.utils.ts @@ -1,8 +1,6 @@ // Adapted from https://github.com/ordpool-space/ordpool-parser/tree/ce04d7a5b6bb1cf37b9fdadd77ba430f5bd6e7d6/src // Utils functions to decode ord inscriptions -import { Inscription } from "../../components/ord-data/ord-data.component"; - export const OP_FALSE = 0x00; export const OP_IF = 0x63; export const OP_0 = 0x00; @@ -304,6 +302,15 @@ export function concatUint8Arrays(arrays: Uint8Array[]): Uint8Array { ////////////////////////////// Inscription /////////////////////////// +export interface Inscription { + body?: Uint8Array; + is_cropped?: boolean; + body_length?: number; + content_type?: Uint8Array; + content_type_str?: string; + delegate_txid?: string; +} + /** * Extracts fields from the raw data until OP_0 is encountered. *