diff --git a/packages/abstract-provider/src.ts/index.ts b/packages/abstract-provider/src.ts/index.ts index c38323cb9..d2fdc7764 100644 --- a/packages/abstract-provider/src.ts/index.ts +++ b/packages/abstract-provider/src.ts/index.ts @@ -56,7 +56,7 @@ export interface TransactionResponse extends Transaction { export type BlockTag = string | number; -interface _Block { +export interface _Block { hash: string; parentHash: string; number: number; @@ -64,6 +64,7 @@ interface _Block { timestamp: number; nonce: string; difficulty: number; + _difficulty: BigNumber; gasLimit: BigNumber; gasUsed: BigNumber; diff --git a/packages/providers/src.ts/formatter.ts b/packages/providers/src.ts/formatter.ts index d83c7b457..d90ca3397 100644 --- a/packages/providers/src.ts/formatter.ts +++ b/packages/providers/src.ts/formatter.ts @@ -295,7 +295,11 @@ export class Formatter { if (value.author != null && value.miner == null) { value.miner = value.author; } - return Formatter.check(format, value); + // The difficulty may need to come from _difficulty in recursed blocks + const difficulty = (value._difficulty != null) ? value._difficulty: value.difficulty; + const result = Formatter.check(format, value); + result._difficulty = ((difficulty == null) ? null: BigNumber.from(difficulty)); + return result; } block(value: any): Block {