index.ts 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /**
  2. * Addresses are a fundamental part of interacting with Ethereum. They
  3. * represent the gloabal identity of Externally Owned Accounts (accounts
  4. * backed by a private key) and contracts.
  5. *
  6. * The Ethereum Naming Service (ENS) provides an interconnected ecosystem
  7. * of contracts, standards and libraries which enable looking up an
  8. * address for an ENS name.
  9. *
  10. * These functions help convert between various formats, validate
  11. * addresses and safely resolve ENS names.
  12. *
  13. * @_section: api/address:Addresses [about-addresses]
  14. */
  15. null;
  16. /**
  17. * An interface for objects which have an address, and can
  18. * resolve it asyncronously.
  19. *
  20. * This allows objects such as [[Signer]] or [[Contract]] to
  21. * be used most places an address can be, for example getting
  22. * the [balance](Provider-getBalance).
  23. */
  24. export interface Addressable {
  25. /**
  26. * Get the object address.
  27. */
  28. getAddress(): Promise<string>;
  29. }
  30. /**
  31. * Anything that can be used to return or resolve an address.
  32. */
  33. export type AddressLike = string | Promise<string> | Addressable;
  34. /**
  35. * An interface for any object which can resolve an ENS name.
  36. */
  37. export interface NameResolver {
  38. /**
  39. * Resolve to the address for the ENS %%name%%.
  40. *
  41. * Resolves to ``null`` if the name is unconfigued. Use
  42. * [[resolveAddress]] (passing this object as %%resolver%%) to
  43. * throw for names that are unconfigured.
  44. */
  45. resolveName(name: string): Promise<null | string>;
  46. }
  47. export { getAddress, getIcapAddress } from "./address.js";
  48. export { getCreateAddress, getCreate2Address } from "./contract-address.js";
  49. export { isAddressable, isAddress, resolveAddress } from "./checks.js";