From 4b8e198bf209fcf0aea55018d8940355ea4345de Mon Sep 17 00:00:00 2001 From: Richard Moore Date: Tue, 25 Feb 2020 13:51:33 -0500 Subject: [PATCH] Fix log parsing when no matching topic is found (#733). --- packages/abi/src.ts/index.ts | 7 +++++-- packages/contracts/src.ts/index.ts | 6 +++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/packages/abi/src.ts/index.ts b/packages/abi/src.ts/index.ts index f954a4009b..f0f4cfc0a2 100644 --- a/packages/abi/src.ts/index.ts +++ b/packages/abi/src.ts/index.ts @@ -2,7 +2,7 @@ import { ConstructorFragment, EventFragment, FormatTypes, Fragment, FunctionFragment, JsonFragment, JsonFragmentType, ParamType } from "./fragments"; import { AbiCoder, CoerceFunc, defaultAbiCoder } from "./abi-coder"; -import { Indexed, Interface, Result } from "./interface"; +import { Indexed, Interface, LogDescription, Result, TransactionDescription } from "./interface"; export { ConstructorFragment, @@ -25,5 +25,8 @@ export { JsonFragment, JsonFragmentType, - Result + Result, + + LogDescription, + TransactionDescription }; diff --git a/packages/contracts/src.ts/index.ts b/packages/contracts/src.ts/index.ts index c94e92b7dc..81f0be9ffb 100644 --- a/packages/contracts/src.ts/index.ts +++ b/packages/contracts/src.ts/index.ts @@ -1,6 +1,6 @@ "use strict"; -import { EventFragment, Fragment, Indexed, Interface, JsonFragment, ParamType, Result } from "@ethersproject/abi"; +import { EventFragment, Fragment, Indexed, Interface, JsonFragment, LogDescription, ParamType, Result } from "@ethersproject/abi"; import { Block, BlockTag, Filter, FilterByBlockHash, Listener, Log, Provider, TransactionReceipt, TransactionRequest, TransactionResponse } from "@ethersproject/abstract-provider"; import { Signer, VoidSigner } from "@ethersproject/abstract-signer"; import { getContractAddress } from "@ethersproject/address"; @@ -12,7 +12,7 @@ import { UnsignedTransaction } from "@ethersproject/transactions"; import { Logger } from "@ethersproject/logger"; import { version } from "./_version"; -import { LogDescription } from "@ethersproject/abi/lib/interface"; + const logger = new Logger(version); export interface Overrides { @@ -241,7 +241,7 @@ function runMethod(contract: Contract, functionName: string, options: RunOptions receipt.events = receipt.logs.map((log) => { let event: Event = (deepCopy(log)); - let parsed: LogDescription; + let parsed: LogDescription = null; try { parsed = contract.interface.parseLog(log); } catch (e){}