Allow undefined properties in transaction object and fix stray this (#860).
This commit is contained in:
parent
1a89c591c2
commit
98bb58964b
@ -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",
|
||||
@ -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);
|
||||
}
|
||||
|
||||
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user