TypedData#

class starknet_py.utils.typed_data.TypedData#

Dataclass representing a TypedData object

types: Dict[str, List[Parameter]]#
primary_type: str#
domain: StarkNetDomain#
message: dict#
static from_dict(data: TypedData) TypedData#

Create TypedData dataclass from dictionary.

Parameters:

data – TypedData dictionary.

Returns:

TypedData dataclass instance.

type_hash(type_name: str) int#

Calculate the hash of a type name.

Parameters:

type_name – Name of the type.

Returns:

Hash of the type name.

struct_hash(type_name: str, data: dict) int#

Calculate the hash of a struct.

Parameters:
  • type_name – Name of the type.

  • data – Data defining the struct.

Returns:

Hash of the struct.

message_hash(account_address: int) int#

Calculate the hash of the message.

Parameters:

account_address – Address of an account.

Returns:

Hash of the message.

Parameter#

class starknet_py.utils.typed_data.Parameter#

Dataclass representing a Parameter object

name: str#
type: str#

StarkNetDomain#

class starknet_py.net.models.typed_data.StarkNetDomain#

TypedDict representing a StarkNetDomain object

chainId: str | int#
name: str#
version: str#