Fix log parsing when no matching topic is found (#733).

This commit is contained in:
Richard Moore 2020-02-25 13:51:33 -05:00
parent 89ac9f4f29
commit 4b8e198bf2
No known key found for this signature in database
GPG Key ID: 665176BE8E9DC651
2 changed files with 8 additions and 5 deletions

@ -2,7 +2,7 @@
import { ConstructorFragment, EventFragment, FormatTypes, Fragment, FunctionFragment, JsonFragment, JsonFragmentType, ParamType } from "./fragments"; import { ConstructorFragment, EventFragment, FormatTypes, Fragment, FunctionFragment, JsonFragment, JsonFragmentType, ParamType } from "./fragments";
import { AbiCoder, CoerceFunc, defaultAbiCoder } from "./abi-coder"; import { AbiCoder, CoerceFunc, defaultAbiCoder } from "./abi-coder";
import { Indexed, Interface, Result } from "./interface"; import { Indexed, Interface, LogDescription, Result, TransactionDescription } from "./interface";
export { export {
ConstructorFragment, ConstructorFragment,
@ -25,5 +25,8 @@ export {
JsonFragment, JsonFragment,
JsonFragmentType, JsonFragmentType,
Result Result,
LogDescription,
TransactionDescription
}; };

@ -1,6 +1,6 @@
"use strict"; "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 { Block, BlockTag, Filter, FilterByBlockHash, Listener, Log, Provider, TransactionReceipt, TransactionRequest, TransactionResponse } from "@ethersproject/abstract-provider";
import { Signer, VoidSigner } from "@ethersproject/abstract-signer"; import { Signer, VoidSigner } from "@ethersproject/abstract-signer";
import { getContractAddress } from "@ethersproject/address"; import { getContractAddress } from "@ethersproject/address";
@ -12,7 +12,7 @@ import { UnsignedTransaction } from "@ethersproject/transactions";
import { Logger } from "@ethersproject/logger"; import { Logger } from "@ethersproject/logger";
import { version } from "./_version"; import { version } from "./_version";
import { LogDescription } from "@ethersproject/abi/lib/interface";
const logger = new Logger(version); const logger = new Logger(version);
export interface Overrides { export interface Overrides {
@ -241,7 +241,7 @@ function runMethod(contract: Contract, functionName: string, options: RunOptions
receipt.events = receipt.logs.map((log) => { receipt.events = receipt.logs.map((log) => {
let event: Event = (<Event>deepCopy(log)); let event: Event = (<Event>deepCopy(log));
let parsed: LogDescription; let parsed: LogDescription = null;
try { try {
parsed = contract.interface.parseLog(log); parsed = contract.interface.parseLog(log);
} catch (e){} } catch (e){}