// Adds the checksum (via upper-casing specific letters) getAddress("0x8ba1f109551bd432803012645ac136ddd64dba72") // '0x8ba1f109551bD432803012645Ac136ddd64DBA72' // Converts ICAP address and adds checksum getAddress("XE65GB6LDNXYOFTX0NSV3FUWKOWIXAMJK36"); // '0x8ba1f109551bD432803012645Ac136ddd64DBA72' // Throws an error if an address contains mixed case, // but the checksum fails getAddress("0x8Ba1f109551bD432803012645Ac136ddd64DBA72") // Error("bad address checksum", { // code: "INVALID_ARGUMENT" // argument: "address" // value: "0x8Ba1f109551bD432803012645Ac136ddd64DBA72" // })
// The address of the contract from = "0x8ba1f109551bD432803012645Ac136ddd64DBA72" // The salt salt = id("HelloWorld") // The hash of the initCode initCode = "0x6394198df16000526103ff60206004601c335afa6040516060f3"; initCodeHash = keccak256(initCode) getCreate2Address(from, salt, initCodeHash) // '0x533ae9d683B10C02EbDb05471642F85230071FC3'
from = "0x8ba1f109551bD432803012645Ac136ddd64DBA72"; nonce = 5; getCreateAddress({ from, nonce }); // '0x082B6aC9e47d7D83ea3FaBbD1eC7DAba9D687b36'
getIcapAddress("0x8ba1f109551bd432803012645ac136ddd64dba72"); // 'XE65GB6LDNXYOFTX0NSV3FUWKOWIXAMJK36' getIcapAddress("XE65GB6LDNXYOFTX0NSV3FUWKOWIXAMJK36"); // 'XE65GB6LDNXYOFTX0NSV3FUWKOWIXAMJK36' // Throws an error if the ICAP checksum is wrong getIcapAddress("XE65GB6LDNXYOFTX0NSV3FUWKOWIXAMJK37"); // Error("bad icap checksum", { // code: "INVALID_ARGUMENT" // argument: "address" // value: "XE65GB6LDNXYOFTX0NSV3FUWKOWIXAMJK37" // })
// Valid address isAddress("0x8ba1f109551bD432803012645Ac136ddd64DBA72") // true // Valid ICAP address isAddress("XE65GB6LDNXYOFTX0NSV3FUWKOWIXAMJK36") // true // Invalid checksum isAddress("0x8Ba1f109551bD432803012645Ac136ddd64DBa72") // false // Invalid ICAP checksum isAddress("0x8Ba1f109551bD432803012645Ac136ddd64DBA72") // false // Not an address (an ENS name requires a provided and an // asynchronous API to access) isAddress("ricmoo.eth") // false
// Wallets and AbstractSigner sub-classes isAddressable(Wallet.createRandom()) // true // Contracts contract = new Contract("dai.tokens.ethers.eth", [ ], provider) isAddressable(contract) // true
addr = "0x6B175474E89094C44Da98b954EedeAC495271d0F" // Addresses are return synchronously resolveAddress(addr, provider) // '0x6B175474E89094C44Da98b954EedeAC495271d0F' // Address promises are resolved asynchronously resolveAddress(Promise.resolve(addr)) // Promise<'0x6B175474E89094C44Da98b954EedeAC495271d0F'> // ENS names are resolved asynchronously resolveAddress("dai.tokens.ethers.eth", provider) // Promise<'0x6B175474E89094C44Da98b954EedeAC495271d0F'> // Addressable objects are resolved asynchronously contract = new Contract(addr, [ ]) resolveAddress(contract, provider) // Promise<'0x6B175474E89094C44Da98b954EedeAC495271d0F'> // Unconfigured ENS names reject resolveAddress("nothing-here.ricmoo.eth", provider) // Promise<Error("unconfigured name", { // code: "UNCONFIGURED_NAME" // value: "nothing-here.ricmoo.eth" // })> // ENS names require a NameResolver object passed in // (notice the provider was omitted) resolveAddress("nothing-here.ricmoo.eth") // Error("ENS resolution requires a provider", { // code: "UNSUPPORTED_OPERATION" // operation: "resolveName" // })
METHODS
METHODS