From ec625c844477b9a04d48d360aac1fb7f31942939 Mon Sep 17 00:00:00 2001 From: librelois <elois@ifee.fr> Date: Thu, 30 Apr 2020 23:52:09 +0200 Subject: [PATCH] [ref] bma: add types --- app/modules/bma/lib/dtos.ts | 3 ++- app/modules/bma/lib/tojson.ts | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/modules/bma/lib/dtos.ts b/app/modules/bma/lib/dtos.ts index 6a17335d5..1ba54fe4a 100644 --- a/app/modules/bma/lib/dtos.ts +++ b/app/modules/bma/lib/dtos.ts @@ -14,6 +14,7 @@ import { BlockDTO } from "../../../lib/dto/BlockDTO"; import { WS2PHead } from "../../ws2p/lib/WS2PCluster"; import { JSONDBPeer } from "../../../lib/db/DBPeer"; +import { TransactionDTO } from "../../../lib/dto/TransactionDTO"; export const Summary = { duniter: { @@ -292,7 +293,7 @@ export function block2HttpBlock(blockDTO: BlockDTO): HttpBlock { revoked: blockDTO.revoked, excluded: blockDTO.excluded, transactions: blockDTO.transactions.map( - (tx): HttpTransactionOfBlock => { + (tx: TransactionDTO): HttpTransactionOfBlock => { return { version: tx.version, currency: tx.currency, diff --git a/app/modules/bma/lib/tojson.ts b/app/modules/bma/lib/tojson.ts index 8330c2cf3..2fc834f5d 100644 --- a/app/modules/bma/lib/tojson.ts +++ b/app/modules/bma/lib/tojson.ts @@ -13,12 +13,13 @@ import { BlockDTO } from "../../../lib/dto/BlockDTO"; import { Underscore } from "../../../lib/common-libs/underscore"; +import { HttpBlock } from "./dtos"; export const stat = (stat: number[]) => { return { blocks: stat }; }; -export const block = (block: any) => { +export const block = (block: any): HttpBlock => { const json: any = {}; json.version = parseInt(block.version); json.nonce = parseInt(block.nonce); -- GitLab