ethers.js/src.ts/address/index.ts

58 lines
1.7 KiB
TypeScript
Raw Normal View History

2022-11-28 05:55:52 +03:00
/**
2022-12-03 05:23:13 +03:00
* Addresses are a fundamental part of interacting with Ethereum. They
* represent the gloabal identity of Externally Owned Accounts (accounts
* backed by a private key) and contracts.
*
* The Ethereum Naming Service (ENS) provides an interconnected ecosystem
* of contracts, standards and libraries which enable looking up an
* address for an ENS name.
*
* These functions help convert between various formats, validate
* addresses and safely resolve ENS names.
2022-11-28 05:55:52 +03:00
*
* @_section: api/address:Addresses [addresses]
*/
2022-12-03 05:23:13 +03:00
null;
/**
* An interface for objects which have an address, and can
* resolve it asyncronously.
*
* This allows objects such as [[Signer]] or [[Contract]] to
* be used most places an address can be, for example getting
* the [balance](Provider-getBalance).
*/
2022-09-05 23:14:43 +03:00
export interface Addressable {
2022-12-03 05:23:13 +03:00
/**
* Get the object address.
*/
2022-09-05 23:14:43 +03:00
getAddress(): Promise<string>;
}
2022-12-03 05:23:13 +03:00
/**
* Anything that can be used to return or resolve an address.
*/
2022-09-05 23:14:43 +03:00
export type AddressLike = string | Promise<string> | Addressable;
2022-12-03 05:23:13 +03:00
/**
* An interface for any object which can resolve an ENS name.
*/
2022-09-05 23:14:43 +03:00
export interface NameResolver {
2022-12-03 05:23:13 +03:00
/**
* Resolve to the address for the ENS %%name%%.
*
* Resolves to ``null`` if the name is unconfigued. Use
* [[resolveAddress]] (passing this object as %%resolver%%) to
* throw for names that are unconfigured.
*/
2022-09-05 23:14:43 +03:00
resolveName(name: string): Promise<null | string>;
}
export { getAddress, getIcapAddress } from "./address.js";
export { getCreateAddress, getCreate2Address } from "./contract-address.js";
export { isAddressable, isAddress, resolveAddress } from "./checks.js";