diff --git a/server/controllers/BlockchainBlock.ts b/server/controllers/BlockchainBlock.ts index abc5e94..1b7f4ec 100644 --- a/server/controllers/BlockchainBlock.ts +++ b/server/controllers/BlockchainBlock.ts @@ -711,24 +711,66 @@ export class BlockchainBlockController { next: NextFunction, ) => { try { - var BlockchainBlockFetchQuery = await getConnection(Global.network).getRepository( - BlockchainBlock, + var BlockchainOutputFetchQuery = await getConnection(Global.network).getRepository( + BlockchainOutput, ).findOne({ select: [ - 'Hash', - 'Height', - 'Timestamp', - 'TotalDifficultyCuckaroo', - 'TotalDifficultyCuckatoo', - 'TotalDifficultyProgpow', - 'TotalDifficultyRandomx', - 'PreviousId', - 'EdgeBits', - 'SecondaryScaling', - 'Proof', + 'BlockId' ], - where: { Hash: request.params.hash }, + where: { Commit : request.params.hash }, }); + + if(BlockchainOutputFetchQuery){ + var BlockchainBlockFetchQuery = await getConnection(Global.network).getRepository( + BlockchainBlock, + ).findOne({ + select: [ + 'Hash', + 'Height', + 'Timestamp', + 'TotalDifficultyCuckaroo', + 'TotalDifficultyCuckatoo', + 'TotalDifficultyProgpow', + 'TotalDifficultyRandomx', + 'PreviousId', + 'EdgeBits', + 'SecondaryScaling', + 'Proof', + ], + where: { Hash: BlockchainOutputFetchQuery.BlockId }, + }); + }else{ + var BlockchainBlockFetchQuery = await getConnection(Global.network).getRepository( + BlockchainBlock, + ).findOne({ + select: [ + 'Hash', + 'Height', + 'Timestamp', + 'TotalDifficultyCuckaroo', + 'TotalDifficultyCuckatoo', + 'TotalDifficultyProgpow', + 'TotalDifficultyRandomx', + 'PreviousId', + 'EdgeBits', + 'SecondaryScaling', + 'Proof', + ], + where: { Hash: request.params.hash }, + }); + } + + + + + + + + + + + + let paramVal = request.params.hash; if ( !BlockchainBlockFetchQuery && @@ -768,7 +810,7 @@ export class BlockchainBlockController { const BlockchainBlockOutputFetchQuery = await getConnection(Global.network).getRepository( BlockchainOutput, ).find({ - select: ['OutputType', 'Commit', 'Spent'], + select: ['OutputType', 'Commit', 'Spent', 'MerkleProof', 'MmrIndex', 'ProofHash', 'Proof'], where: { BlockId: BlockchainBlockFetchQuery.Hash }, }); @@ -892,6 +934,8 @@ export class BlockchainBlockController { let arr = balance.match(/.{1,6}/g); BlockchainBlockFetchQuery['hasharray'] = arr.map(i => '#' + i); + var viewType = BlockchainOutputFetchQuery ? 'Commit' : 'HashHeight'; + BlockchainBlockFetchQuery ? response.status(200).json({ status: 200, @@ -902,6 +946,7 @@ export class BlockchainBlockController { BlockchainBlockInputFetchQuery: BlockchainBlockInputFetchQuery, BlockchainBlockOutputFetchQuery: BlockchainBlockOutputFetchQuery, BlockchainBlockKernalFetchQuery: BlockchainBlockKernalFetchQuery, + viewType: viewType }, }) : next(new NoDataFoundException()); diff --git a/server/i18n/de.json b/server/i18n/de.json index 688d95f..581a87f 100644 --- a/server/i18n/de.json +++ b/server/i18n/de.json @@ -61,7 +61,7 @@ "DAYS" : "Tage", "MONTHS" : "Monate", "WEEK" : "Woche", - "SEARCH_TEXT" : "Suche nach Hash oder Blockhöhe", + "SEARCH_TEXT" : "Suche nach Hash oder Blockhöhe oder Ausgabe-Commit-ID", "BLOCK_REWARD" : "Block Belohnung", "NOT_FOUND" : "Seite nicht gefunden", "NOT_FOUND1" : "Die von Ihnen gesuchte Seite wurde nicht gefunden", diff --git a/server/i18n/en.json b/server/i18n/en.json index d3f06d4..c5c53b6 100644 --- a/server/i18n/en.json +++ b/server/i18n/en.json @@ -61,7 +61,7 @@ "DAYS" : "days", "MONTHS" : "months", "WEEK" : "week", - "SEARCH_TEXT" : "Search by hash, or block height", + "SEARCH_TEXT" : "Search by hash, or block height or output commit id", "BLOCK_REWARD" : "Block Reward", "NOT_FOUND" : "Page Not Found", "NOT_FOUND1" : "Page you are looking for is not found", diff --git a/src/app/view/api-view/api-view.component.html b/src/app/view/api-view/api-view.component.html index 5cae3de..634a719 100644 --- a/src/app/view/api-view/api-view.component.html +++ b/src/app/view/api-view/api-view.component.html @@ -8,7 +8,7 @@
height
parameter and returns unixtime of the block.