@@ -57,6 +57,7 @@ import {
5757 CustomTagFieldOptions ,
5858 SmartContractLogs ,
5959 PermissionsDocument ,
60+ EternalReportV1 ,
6061} from '../../interfaces/DragonchainClientInterfaces' ;
6162import { CredentialService , HmacAlgorithm } from '../credential-service/CredentialService' ;
6263import { getDragonchainId , getDragonchainEndpoint } from '../config-service' ;
@@ -1437,6 +1438,32 @@ export class DragonchainClient {
14371438 return ( await this . post ( '/v1/public-blockchain-transaction' , body ) ) as Response < PublicBlockchainTransactionResponse > ;
14381439 } ;
14391440
1441+ /**
1442+ * Get/Generate an Eternal-type report given a transaction ID
1443+ */
1444+ public getEternalReport = async ( options : {
1445+ /**
1446+ * the transaction ID of the transaction to generate report for
1447+ */
1448+ transactionId : string ;
1449+ } ) => {
1450+ if ( ! options . transactionId ) throw new FailureByDesign ( 'PARAM_ERROR' , 'Parameter `transactionId` is required' ) ;
1451+ const transaction = await this . getTransaction ( { transactionId : options . transactionId } ) ;
1452+ if ( transaction && ! transaction . ok ) throw new FailureByDesign ( 'NOT_FOUND' , 'transaction not found' ) ;
1453+ const blockId = transaction . response . header . block_id ;
1454+ const block = await this . getBlock ( { blockId } ) ;
1455+ if ( block && ! block . ok ) throw new FailureByDesign ( 'NOT_FOUND' , 'block not found' ) ;
1456+ const verifications = await this . getVerifications ( { blockId } ) ;
1457+ return {
1458+ l1Transaction : transaction . response ,
1459+ l1Block : block . response ,
1460+ l2Verifications : verifications . response && verifications . response [ '2' ] ,
1461+ l3Verifications : verifications . response && verifications . response [ '3' ] ,
1462+ l4Verifications : verifications . response && verifications . response [ '4' ] ,
1463+ l5Verifications : verifications . response && verifications . response [ '5' ] ,
1464+ } as EternalReportV1 ;
1465+ } ;
1466+
14401467 /**
14411468 * @hidden
14421469 */
0 commit comments