FUNCTIONS
<src>dnsEncode(name: string, maxLength?: number)⇒ string Returns the DNS encoded name.
This is used for various parts of ENS name resolution, such as the wildcard resolution.
<src>ensNormalize(name: string)⇒ string Returns the ENS name normalized.
<src>hashMessage(message: Uint8Array | string)⇒ string Computes the EIP-191 personal-sign message digest to sign.
This prefixes the message with MessagePrefix and the decimal length of message and computes the keccak256 digest.
If message is a string, it is converted to its UTF-8 bytes first. To compute the digest of a DataHexString, it must be converted to bytes.
hashMessage("Hello World")
// '0xa1de988600a42c4b4ab089b619297c17d53cffae5d5120d82d8a92d0bb3b78f2'
hashMessage("0x4243")
// '0x6d91b221f765224b256762dcba32d62209cf78e9bebb0a1b758ca26c76db3af4'
hashMessage(getBytes("0x4243"))
// '0x0d3abc18ec299cf9b42ba439ac6f7e3e6ec9f5c048943704e30fc2d9c7981438'
hashMessage(new Uint8Array([ 0x42, 0x43 ]))
// '0x0d3abc18ec299cf9b42ba439ac6f7e3e6ec9f5c048943704e30fc2d9c7981438'
<src>id(value: string)⇒ string A simple hashing function which operates on UTF-8 strings to compute an 32-byte identifier.
This simply computes the UTF-8 bytes and computes the keccak256.
id("hello world")
// '0x47173285a8d7341e5e972fc677286384f802f8ef42a5ec5f03bbfa254cb01fad'
<src>isValidName(name: string)⇒ boolean Returns true if name is a valid ENS name.
<src>namehash(name: string)⇒ string <src>solidityPacked(types: ReadonlyArray< string >, values: ReadonlyArray< any >)⇒ string addr = "0x8ba1f109551bd432803012645ac136ddd64dba72"
solidityPacked([ "address", "uint" ], [ addr, 45 ]);
// '0x8ba1f109551bd432803012645ac136ddd64dba72000000000000000000000000000000000000000000000000000000000000002d'
<src>solidityPackedKeccak256(types: ReadonlyArray< string >, values: ReadonlyArray< any >)⇒ string addr = "0x8ba1f109551bd432803012645ac136ddd64dba72"
solidityPackedKeccak256([ "address", "uint" ], [ addr, 45 ]);
// '0x9465ddbc845149cfc7046bee85c30fd1b52b4f87d9c03ca8a0bd046868763030'
<src>solidityPackedSha256(types: ReadonlyArray< string >, values: ReadonlyArray< any >)⇒ string addr = "0x8ba1f109551bd432803012645ac136ddd64dba72"
solidityPackedSha256([ "address", "uint" ], [ addr, 45 ]);
// '0xb9d5d16842f6832018ea7bd1aa6aef22049eb966a5fb915470e22dfc3e2f828f'
Return the address of the private key that produced the signature sig during signing for message.
Compute the address used to sign the typed data for the signature.
interface TypedDataDomain
PROPERTIES
The chain ID of the signing domain.
<src>typedDataDomain.name⇒ null | string The human-readable name of the signing domain.
A salt used for purposes decided by the specific domain.
<src>typedDataDomain.verifyingContract⇒ null | string The the address of the contract that will verify the signature.
<src>typedDataDomain.version⇒ null | string The major version of the signing domain.
A TypedDataEncode prepares and encodes EIP-712 payloads for signed typed data.
This is useful for those that wish to compute various components of a typed data hash, primary types, or sub-components, but generally the higher level signer.signTypedData is more useful.
PROPERTIES
<src>typedDataEncoder.primaryType⇒ stringread-only The primary type for the structured types.
This is derived automatically from the types, since no recursion is possible, once the DAG for the types is consturcted internally, the primary type must be the only remaining type with no parent nodes.
CREATING INSTANCES
Create a new TypedDataEncoder for types.
This performs all necessary checking that types are valid and do not violate the EIP-712 structural constraints as well as computes the primaryType.
Create a new TypedDataEncoder for types.
METHODS
<src>typedDataEncoder.encode(value: Record< string, any >)⇒ string Return the fulled encoded value for the types.
<src>typedDataEncoder.encodeData(type: string, value: any)⇒ string Return the encoded value for the type.
<src>typedDataEncoder.encodeType(name: string)⇒ string Return the full type for name.
<src>typedDataEncoder.getEncoder(type: string)⇒ (value: any) => string Returnthe encoder for the specific type.
<src>typedDataEncoder.hash(value: Record< string, any >)⇒ string Return the hash of the fully encoded value for the types.
<src>typedDataEncoder.hashStruct(name: string, value: Record< string, any >)⇒ string Returns the hash of value for the type of name.
<src>typedDataEncoder.visit(value: Record< string, any >, callback: (type: string, data: any) => any)⇒ any Call calback for each value in value, passing the type and component within value.
This is useful for replacing addresses or other transformation that may be desired on each component, based on its type.
STATIC METHODS
Return the fully encoded EIP-712 value for types with domain.
Returns the JSON-encoded payload expected by nodes which implement the JSON-RPC EIP-712 method.
Return the primary type for types.
Return the hash of the fully encoded EIP-712 value for types with domain.
Return the domain hash for domain.
<src>TypedDataEncoder.hashStruct(name: string, types: Record< string, Array< TypedDataField > >, value: Record< string, any >)⇒ string Return the hashed struct for value using types and name.
Resolves to the value from resolving all addresses in value for types and the domain.
A specific field of a structured EIP-712 type.
PROPERTIES
<src>typedDataField.name⇒ string <src>typedDataField.type⇒ string