Prevent unhandled rejections when passing nullish into Contract constructor (#1234).
This commit is contained in:
parent
8279120e0a
commit
d937668dc1
@ -658,6 +658,10 @@ export class Contract {
|
||||
defineReadOnly(this, "_runningEvents", { });
|
||||
defineReadOnly(this, "_wrappedEmits", { });
|
||||
|
||||
if (addressOrName == null) {
|
||||
logger.throwArgumentError("invalid contract address or ENS name", "addressOrName", addressOrName);
|
||||
}
|
||||
|
||||
defineReadOnly(this, "address", addressOrName);
|
||||
if (this.provider) {
|
||||
defineReadOnly(this, "resolvedAddress", resolveName(this.provider, addressOrName));
|
||||
|
Loading…
Reference in New Issue
Block a user