From da412f660723d1c411484e74970ce4eb166374c2 Mon Sep 17 00:00:00 2001 From: Richard Moore Date: Fri, 3 Apr 2020 20:45:23 -0400 Subject: [PATCH] Force Log properties to be non-optional (#415). --- packages/abstract-provider/src.ts/index.ts | 12 +++++------- packages/providers/src.ts/formatter.ts | 11 ++--------- 2 files changed, 7 insertions(+), 16 deletions(-) diff --git a/packages/abstract-provider/src.ts/index.ts b/packages/abstract-provider/src.ts/index.ts index 9271df662..4c63eb7e4 100644 --- a/packages/abstract-provider/src.ts/index.ts +++ b/packages/abstract-provider/src.ts/index.ts @@ -76,21 +76,19 @@ export interface BlockWithTransactions extends _Block { export interface Log { - blockNumber?: number; - blockHash?: string; - transactionIndex?: number; + blockNumber: number; + blockHash: string; + transactionIndex: number; removed: boolean; - transactionLogIndex?: number, - address: string; data: string; topics: Array; - transactionHash?: string; - logIndex?: number; + transactionHash: string; + logIndex: number; } export interface TransactionReceipt { diff --git a/packages/providers/src.ts/formatter.ts b/packages/providers/src.ts/formatter.ts index ec4e37a44..c89d7fa18 100644 --- a/packages/providers/src.ts/formatter.ts +++ b/packages/providers/src.ts/formatter.ts @@ -86,7 +86,6 @@ export class Formatter { }; formats.receiptLog = { - transactionLogIndex: Formatter.allowNull(number), transactionIndex: number, blockNumber: number, transactionHash: hash, @@ -381,18 +380,12 @@ export class Formatter { } receipt(value: any): TransactionReceipt { - //let status = transactionReceipt.status; - //let root = transactionReceipt.root; - const result: TransactionReceipt = Formatter.check(this.formats.receipt, value); - result.logs.forEach((entry, index) => { - if (entry.transactionLogIndex == null) { - entry.transactionLogIndex = index; - } - }); + if (value.status != null) { result.byzantium = true; } + return result; }