Skip to content

Commit

Permalink
Allow undefined properties in transaction object and fix stray this (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
ricmoo committed Jun 3, 2020
1 parent 1a89c59 commit 98bb589
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/contracts/src.ts/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ async function populateTransaction(contract: Contract, fragment: FunctionFragmen

// Make sure there are no stray overrides, which may indicate a
// typo or using an unsupported key.
const leftovers = Object.keys(overrides);
const leftovers = Object.keys(overrides).filter((key) => ((<any>overrides)[key] != null));
if (leftovers.length) {
logger.throwError(`cannot override ${ leftovers.map((l) => JSON.stringify(l)).join(",") }`, Logger.errors.UNSUPPORTED_OPERATION, {
operation: "overrides",
Expand Down Expand Up @@ -271,10 +271,10 @@ function buildCall(contract: Contract, fragment: FunctionFragment, collapseSimpl
let blockTag = undefined;
if (args.length === fragment.inputs.length + 1 && typeof(args[args.length - 1]) === "object") {
const overrides = shallowCopy(args.pop());
if (overrides.blockTag) {
if (overrides.blockTag != null) {
blockTag = await overrides.blockTag;
delete overrides.blockTag;
}
delete overrides.blockTag;
args.push(overrides);
}

Expand Down Expand Up @@ -337,7 +337,7 @@ function buildSend(contract: Contract, fragment: FunctionFragment): ContractFunc
if (parsed) {
event.args = parsed.args;
event.decode = (data: BytesLike, topics?: Array<any>) => {
return this.interface.decodeEventLog(parsed.eventFragment, data, topics);
return contract.interface.decodeEventLog(parsed.eventFragment, data, topics);
};
event.event = parsed.name;
event.eventSignature = parsed.signature;
Expand Down

0 comments on commit 98bb589

Please sign in to comment.