Better error message when passing invalid overrides object into a contract deployment (#4182).
This commit is contained in:
parent
bcc4d8c870
commit
aa2ea3d529
@ -133,8 +133,12 @@ function getProvider(value: null | ContractRunner): null | Provider {
|
||||
*/
|
||||
export async function copyOverrides<O extends string = "data" | "to">(arg: any, allowed?: Array<string>): Promise<Omit<ContractTransaction, O>> {
|
||||
|
||||
// Make sure the overrides passed in are a valid overrides object
|
||||
const _overrides = Typed.dereference(arg, "overrides");
|
||||
assertArgument(typeof(_overrides) === "object", "invalid overrides parameter", "overrides", arg);
|
||||
|
||||
// Create a shallow copy (we'll deep-ify anything needed during normalizing)
|
||||
const overrides = copyRequest(Typed.dereference(arg, "overrides"));
|
||||
const overrides = copyRequest(_overrides);
|
||||
|
||||
assertArgument(overrides.to == null || (allowed || [ ]).indexOf("to") >= 0,
|
||||
"cannot override to", "overrides.to", overrides.to);
|
||||
|
Loading…
Reference in New Issue
Block a user