EIP712

EIP712#

class rizemind.authentication.signatures.eip712.EIP712DomainRequiredFields(*args, **kwargs)[source]

Bases: Protocol

Protocol defining the required fields for an EIP-712 domain.

This protocol specifies the mandatory fields that must be present in any EIP-712 domain implementation to ensure compatibility with the EIP-712 standard for typed structured data hashing and signing.

name

A human-readable name for the domain. This is typically

Type:

str

the name of the DApp or protocol.
version

The current version of the domain.

Type:

str

chainId

The EIP-155 chain ID of the network where the contract is

Type:

int

deployed.
verifyingContract

The Ethereum address of the contract that will

Type:

eth_typing.evm.ChecksumAddress

verify the signature.
chainId: int
name: str
verifyingContract: ChecksumAddress
version: str
class rizemind.authentication.signatures.eip712.EIP712DomainStruct(name: str, version: str, chainId: int, verifyingContract: ChecksumAddress)[source]

Bases: object

Dataclass implementation of EIP-712 domain fields.

This class provides a concrete implementation of the EIP-712 domain separator structure, containing all required fields for creating typed structured data signatures according to the EIP-712 standard.

name

A human-readable name for the domain. This is typically

Type:

str

the name of the DApp or protocol.
version

The current version of the domain.

Type:

str

chainId

The EIP-155 chain ID of the network where the contract is

Type:

int

deployed.
verifyingContract

The Ethereum address of the contract that will

Type:

eth_typing.evm.ChecksumAddress

verify the signature.
chainId: int
name: str
verifyingContract: ChecksumAddress
version: str
rizemind.authentication.signatures.eip712.domain_to_dict(domain: EIP712DomainRequiredFields) dict[str, Any][source]

Changes the type of the domain to python dictionary

Parameters:

domain – The EIP712DomainRequiredFields representation of the EIP-712 domain.

Returns:

The dictionary representation of the EIP-712 domain.

rizemind.authentication.signatures.eip712.prepare_eip712_domain(chainid: int, version: str, contract: ChecksumAddress, name: str) EIP712DomainRequiredFields[source]

Prepares the EIP-712 domain object for signing typed structured data.

Parameters:
  • chainid – The ID of the blockchain network (e.g., 1 for Ethereum mainnet, 3 for Ropsten).

  • version – The current version of the domain.

  • contract – The address of the verifying contract in hexadecimal format (e.g., “0xCcCCc…”).

  • name – The human-readable name of the domain (e.g., “MyApp”).

Returns:

An object representing the EIP-712 domain.

rizemind.authentication.signatures.eip712.prepare_eip712_message(eip712_domain: EIP712DomainRequiredFields, primaryType: str, message: dict, types: dict = {}) SignableMessage[source]

Prepares the EIP-712 structured message for signing and encoding using the provided parameters.

Parameters:
  • eip712_domain – The EIP-712 domain object.

  • primaryType – The name of the primary message type.

  • message – The structured data to be signed.

  • types – A dictionary defining the custom data types used in the message,

  • definitions. (where keys are type names and values are their ABI)

Returns:

An SignableMessage object ready for signing.