Improve address API and more robust resolveName.

This commit is contained in:
Richard Moore 2023-01-15 07:51:05 -05:00
parent 4de185b5c7
commit 741bd05830

@ -48,7 +48,7 @@ export function isAddressable(value: any): value is Addressable {
* isAddress("ricmoo.eth")
* //_result:
*/
export function isAddress(value: any): boolean {
export function isAddress(value: any): value is string {
try {
getAddress(value);
return true;
@ -115,7 +115,7 @@ export function resolveAddress(target: AddressLike, resolver?: null | NameResolv
} else if (isAddressable(target)) {
return checkAddress(target, target.getAddress());
} else if (typeof(target.then) === "function") {
} else if (target && typeof(target.then) === "function") {
return checkAddress(target, target);
}