diff --git a/backend/src/interfaces.ts b/backend/src/interfaces.ts index 9ca54dbb0..4317dc9db 100644 --- a/backend/src/interfaces.ts +++ b/backend/src/interfaces.ts @@ -16,12 +16,10 @@ export interface MempoolBlock { feeRange: number[]; } - export interface MempoolBlockWithTransactions extends MempoolBlock { transactionIds: string[]; } - export interface Transaction { txid: string; version: number; @@ -53,26 +51,18 @@ export interface TransactionExtended extends Transaction { firstSeen: number; } -export interface Prevout { - scriptpubkey: string; - scriptpubkey_asm: string; - scriptpubkey_type: string; - scriptpubkey_address: string; - value: number; - asset?: string; -} - export interface Vin { txid: string; vout: number; - prevout?: Prevout; + is_coinbase: boolean; scriptsig: string; scriptsig_asm: string; inner_redeemscript_asm?: string; - is_coinbase: boolean; + inner_witnessscript_asm?: string; sequence: any; witness?: string[]; - inner_witnessscript_asm?: string; + prevout: Vout; + // Elements is_pegin?: boolean; issuance?: Issuance; } @@ -93,11 +83,19 @@ export interface Vout { scriptpubkey: string; scriptpubkey_asm: string; scriptpubkey_type: string; - scriptpubkey_address?: string; + scriptpubkey_address: string; value: number; - - pegout?: any; + // Elements + valuecommitment?: number; asset?: string; + pegout?: Pegout; +} + +interface Pegout { + genesis_hash: string; + scriptpubkey: string; + scriptpubkey_asm: string; + scriptpubkey_address: string; } export interface Status { @@ -112,19 +110,22 @@ export interface Block { height: number; version: number; timestamp: number; + bits: number; + nounce: number; + difficulty: number; + merkle_root: string; tx_count: number; size: number; weight: number; - merkle_root: string; previousblockhash: string; - nonce: any; - bits: number; + // Custom properties medianFee?: number; feeRange?: number[]; reward?: number; - coinbaseTx?: TransactionMinerInfo; - matchRate?: number; + coinbaseTx?: Transaction; + matchRate: number; + stage: number; } export interface Address { diff --git a/frontend/src/app/components/block/block.component.ts b/frontend/src/app/components/block/block.component.ts index 60624e250..e0a020018 100644 --- a/frontend/src/app/components/block/block.component.ts +++ b/frontend/src/app/components/block/block.component.ts @@ -108,7 +108,7 @@ export class BlockComponent implements OnInit, OnDestroy { ), ) .subscribe((transactions: Transaction[]) => { - if (this.fees === undefined && transactions[0]) { + if (this.fees === undefined && transactions[0] && this.network !== 'liquid') { this.fees = transactions[0].vout.reduce((acc: number, curr: Vout) => acc + curr.value, 0) / 100000000 - this.blockSubsidy; } this.transactions = transactions; diff --git a/frontend/src/app/interfaces/electrs.interface.ts b/frontend/src/app/interfaces/electrs.interface.ts index 7d6fac34c..2ad52ec8f 100644 --- a/frontend/src/app/interfaces/electrs.interface.ts +++ b/frontend/src/app/interfaces/electrs.interface.ts @@ -2,12 +2,14 @@ export interface Transaction { txid: string; version: number; locktime: number; - fee: number; size: number; weight: number; + fee: number; vin: Vin[]; vout: Vout[]; status: Status; + + // Custom properties firstSeen?: number; } @@ -18,26 +20,18 @@ export interface Recent { value: number; } -export interface Prevout { - scriptpubkey: string; - scriptpubkey_asm: string; - scriptpubkey_type: string; - scriptpubkey_address: string; - value: number; - asset?: string; -} - export interface Vin { txid: string; vout: number; - prevout: Prevout; + is_coinbase: boolean; scriptsig: string; scriptsig_asm: string; inner_redeemscript_asm?: string; - is_coinbase: boolean; + inner_witnessscript_asm?: string; sequence: any; witness?: string[]; - inner_witnessscript_asm?: string; + prevout: Vout; + // Elements is_pegin?: boolean; issuance?: Issuance; } @@ -60,6 +54,7 @@ export interface Vout { scriptpubkey_type: string; scriptpubkey_address: string; value: number; + // Elements valuecommitment?: number; asset?: string; pegout?: Pegout; @@ -84,10 +79,13 @@ export interface Block { height: number; version: number; timestamp: number; + bits: number; + nounce: number; + difficulty: number; + merkle_root: string; tx_count: number; size: number; weight: number; - merkle_root: string; previousblockhash: string; // Custom properties @@ -135,8 +133,8 @@ export interface Asset { reissuance_token: string; contract_hash: string; status: Status; - chain_stats: AssetChainStats; - mempool_stats: AssetMempoolStats; + chain_stats: AssetStats; + mempool_stats: AssetStats; } interface IssuanceTxin { @@ -149,7 +147,7 @@ interface IssuancePrevout { vout: number; } -interface AssetChainStats { +interface AssetStats { tx_count: number; issuance_count: number; issued_amount: number; @@ -157,30 +155,9 @@ interface AssetChainStats { has_blinded_issuances: boolean; reissuance_tokens: number; burned_reissuance_tokens: number; - peg_in_count: number; peg_in_amount: number; peg_out_count: number; peg_out_amount: number; burn_count: number; } - -interface AssetMempoolStats { - tx_count: number; - issuance_count: number; - issued_amount: number; - burned_amount: number; - has_blinded_issuances: boolean; - reissuance_tokens: any; - burned_reissuance_tokens: number; - - peg_in_count: number; - peg_in_amount: number; - peg_out_count: number; - peg_out_amount: number; - burn_count: number; -} - -interface Entity { - domain: string; -}