diff --git a/backend/src/api/bitcoin/bitcoin-api-abstract-factory.ts b/backend/src/api/bitcoin/bitcoin-api-abstract-factory.ts index 9cdf052f2..906cc0f95 100644 --- a/backend/src/api/bitcoin/bitcoin-api-abstract-factory.ts +++ b/backend/src/api/bitcoin/bitcoin-api-abstract-factory.ts @@ -7,10 +7,8 @@ export interface AbstractBitcoinApi { $getTxIdsForBlock(hash: string): Promise; $getBlockHash(height: number): Promise; $getBlockHeader(hash: string): Promise; - $getRawBlock(hash: string): Promise; $getBlock(hash: string): Promise; $getAddress(address: string): Promise; $getAddressTransactions(address: string, lastSeenTxId: string): Promise; $getAddressPrefix(prefix: string): string[]; - } diff --git a/backend/src/api/bitcoin/esplora-api.interface.ts b/backend/src/api/bitcoin/esplora-api.interface.ts index 9ca3cfb75..7ac4e1675 100644 --- a/backend/src/api/bitcoin/esplora-api.interface.ts +++ b/backend/src/api/bitcoin/esplora-api.interface.ts @@ -9,6 +9,7 @@ export namespace IEsploraApi { vin: Vin[]; vout: Vout[]; status: Status; + hex?: string; } export interface Recent { diff --git a/backend/src/api/bitcoin/esplora-api.ts b/backend/src/api/bitcoin/esplora-api.ts index aa1d46e04..86d4179ad 100644 --- a/backend/src/api/bitcoin/esplora-api.ts +++ b/backend/src/api/bitcoin/esplora-api.ts @@ -40,12 +40,6 @@ class ElectrsApi implements AbstractBitcoinApi { .then((response) => response.data); } - $getRawBlock(hash: string): Promise { - return axios.get(config.ESPLORA.REST_API_URL + '/block/' + hash + '/raw', this.axiosConfig) - .then((response) => response.data); - } - - $getBlock(hash: string): Promise { return axios.get(config.ESPLORA.REST_API_URL + '/block/' + hash, this.axiosConfig) .then((response) => response.data); diff --git a/backend/src/api/transaction-utils.ts b/backend/src/api/transaction-utils.ts index cb84396ba..2a5d3a9ad 100644 --- a/backend/src/api/transaction-utils.ts +++ b/backend/src/api/transaction-utils.ts @@ -25,11 +25,6 @@ class TransactionUtils { return this.extendTransaction(transaction); } - public async $getRawTransactionExtended(txId: string, addPrevouts = false): Promise { - const transaction: IEsploraApi.Transaction = await bitcoinApi.$getRawTransaction(txId, true, addPrevouts); - return this.extendTransaction(transaction); - } - private extendTransaction(transaction: IEsploraApi.Transaction): TransactionExtended { // @ts-ignore if (transaction.vsize) { diff --git a/backend/src/index.ts b/backend/src/index.ts index 3b1e4e1d8..f3a06d7d5 100644 --- a/backend/src/index.ts +++ b/backend/src/index.ts @@ -235,12 +235,11 @@ class Server { .get(config.MEMPOOL.API_URL_PREFIX + 'mempool/txids', routes.getMempoolTxIds) .get(config.MEMPOOL.API_URL_PREFIX + 'mempool/recent', routes.getRecentMempoolTransactions) .get(config.MEMPOOL.API_URL_PREFIX + 'tx/:txId', routes.getTransaction) - .get(config.MEMPOOL.API_URL_PREFIX + 'tx/:txId/raw', routes.getRawTransaction) + .get(config.MEMPOOL.API_URL_PREFIX + 'tx/:txId/hex', routes.getRawTransaction) .get(config.MEMPOOL.API_URL_PREFIX + 'tx/:txId/status', routes.getTransactionStatus) .get(config.MEMPOOL.API_URL_PREFIX + 'tx/:txId/outspends', routes.getTransactionOutspends) .get(config.MEMPOOL.API_URL_PREFIX + 'block/:hash', routes.getBlock) .get(config.MEMPOOL.API_URL_PREFIX + 'block/:hash/header', routes.getBlockHeader) - .get(config.MEMPOOL.API_URL_PREFIX + 'block/:hash/raw', routes.getRawBlock) .get(config.MEMPOOL.API_URL_PREFIX + 'blocks', routes.getBlocks) .get(config.MEMPOOL.API_URL_PREFIX + 'blocks/:height', routes.getBlocks) .get(config.MEMPOOL.API_URL_PREFIX + 'blocks/tip/height', routes.getBlockTipHeight) diff --git a/backend/src/mempool.interfaces.ts b/backend/src/mempool.interfaces.ts index bac267a05..fae78ef9b 100644 --- a/backend/src/mempool.interfaces.ts +++ b/backend/src/mempool.interfaces.ts @@ -31,7 +31,6 @@ export interface TransactionExtended extends IEsploraApi.Transaction { bestDescendant?: BestDescendant | null; cpfpChecked?: boolean; deleteAfter?: number; - hex?:string } interface Ancestor { diff --git a/backend/src/routes.ts b/backend/src/routes.ts index 2bfc9b4fd..cf4caeec8 100644 --- a/backend/src/routes.ts +++ b/backend/src/routes.ts @@ -486,7 +486,7 @@ class Routes { public async getRawTransaction(req: Request, res: Response) { try { - const transaction = await transactionUtils.$getRawTransactionExtended(req.params.txId, true); + const transaction: IEsploraApi.Transaction = await bitcoinApi.$getRawTransaction(req.params.txId, true); res.setHeader('content-type', 'text/plain'); res.send(transaction.hex); } catch (e) { @@ -530,16 +530,6 @@ class Routes { } } - public async getRawBlock(req: Request, res: Response) { - try { - const blockHeader = await bitcoinApi.$getRawBlock(req.params.hash); - res.setHeader('content-type', 'text/plain'); - res.send(blockHeader); - } catch (e) { - res.status(500).send(e.message || e); - } - } - public async getBlocks(req: Request, res: Response) { try { loadingIndicators.setProgress('blocks', 0); diff --git a/frontend/src/app/components/block/block.component.html b/frontend/src/app/components/block/block.component.html index 5e98d712d..51740e636 100644 --- a/frontend/src/app/components/block/block.component.html +++ b/frontend/src/app/components/block/block.component.html @@ -118,10 +118,6 @@ Block Header Hex - - Raw Block - - diff --git a/frontend/src/app/components/transaction/transaction.component.html b/frontend/src/app/components/transaction/transaction.component.html index 80ad6d5f8..fb184b99b 100644 --- a/frontend/src/app/components/transaction/transaction.component.html +++ b/frontend/src/app/components/transaction/transaction.component.html @@ -217,8 +217,8 @@ - Raw Tx - + Transaction Hex +