TypedData#
- class starknet_py.utils.typed_data.TypedData#
Dataclass representing a TypedData object
- primary_type: str#
- message: dict#
- static from_dict(data: TypedDataDict) TypedData #
Create TypedData dataclass from dictionary.
- Parameters:
data – TypedData dictionary.
- Returns:
TypedData dataclass instance.
- to_dict() dict #
Create TypedData dictionary from dataclass.
- Returns:
TypedData dictionary.
- 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#
StandardParameter#
EnumParameter#
MerkleTreeParameter#
Domain#
- class starknet_py.utils.typed_data.Domain#
Dataclass representing a domain object (StarkNetDomain, StarknetDomain)
- name: str#
- version: str#
- chain_id: str | int#
- revision: Revision | None = None#
- static from_dict(data: DomainDict) Domain #
Create Domain dataclass from dictionary.
- Parameters:
data – Domain dictionary.
- Returns:
Domain dataclass instance.
- to_dict() dict #
Create Domain dictionary from dataclass.
- Returns:
Domain dictionary.
BasicType#
- class starknet_py.utils.typed_data.BasicType#
An enumeration.
- FELT = 'felt'#
- SELECTOR = 'selector'#
- MERKLE_TREE = 'merkletree'#
- ENUM = 'enum'#
- SHORT_STRING = 'shortstring'#
- STRING = 'string'#
- CONTRACT_ADDRESS = 'ContractAddress'#
- CLASS_HASH = 'ClassHash'#
- BOOL = 'bool'#
- U128 = 'u128'#
- I128 = 'i128'#
- TIMESTAMP = 'timestamp'#