2.2 KiB
Addresses
Address Formats
Address
ICAP Address
Converting and Verifying
ethers . utils . getAddress( address ) => string< Address >
Returns address as a Checksum Address.
If address is an invalid 40-nibble HexString or if it contains mixed case and the checksum is invalid, an InvalidArgument Error is thrown.
The value of address may be any supported address format.
ethers . utils . getIcapAddress( address ) => string< IcapAddress >
Returns address as an ICAP address. Supports the same restrictions as utils.getAddress.
ethers . utils . isAddress( address ) => boolean
Returns true if address is valid (in any supported format).
Derivation
ethers . utils . computeAddress( publicOrPrivateKey ) => string< Address >
Returns the address for publicOrPrivateKey. A public key may be compressed or uncompressed, and a private key will be converted automatically to a public key for the derivation.
ethers . utils . recoverAddress( digest , signature ) => string< Address >
Use ECDSA Public Key Recovery to determine the address that signed digest to which generated signature.
Contracts Addresses
ethers . utils . getContractAddress( transaction ) => string< Address >
Returns the contract address that would result if transaction was used to deploy a contract.
ethers . utils . getCreate2Address( from , salt , initCodeHash ) => string< Address >
Returns the contract address that would result from the given CREATE2 call.