Documentation ¶
Index ¶
- func CalculateTransactionHashCommon(txHashPrefix *felt.Felt, version *felt.Felt, contractAddress *felt.Felt, ...) (*felt.Felt, error)
- func ClassHash(contract rpc.ContractClass) (*felt.Felt, error)
- func CompiledClassHash(casmClass contracts.CasmClass) *felt.Felt
- func ComputeHashOnElementsFelt(feltArr []*felt.Felt) (*felt.Felt, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CalculateTransactionHashCommon ¶
func CalculateTransactionHashCommon( txHashPrefix *felt.Felt, version *felt.Felt, contractAddress *felt.Felt, entryPointSelector *felt.Felt, calldata *felt.Felt, maxFee *felt.Felt, chainId *felt.Felt, additionalData []*felt.Felt) (*felt.Felt, error)
CalculateTransactionHashCommon calculates the transaction hash common to be used in the StarkNet network - a unique identifier of the transaction. [specification]: https://github.com/starkware-libs/cairo-lang/blob/master/src/starkware/starknet/core/os/transaction_hash/transaction_hash.py#L27C5-L27C38
Parameters: - txHashPrefix: The prefix of the transaction hash - version: The version of the transaction - contractAddress: The address of the contract - entryPointSelector: The selector of the entry point - calldata: The data of the transaction - maxFee: The maximum fee for the transaction - chainId: The ID of the blockchain - additionalData: Additional data to be included in the hash Returns: - *felt.Felt: the calculated transaction hash - error: an error if any
func ClassHash ¶
func ClassHash(contract rpc.ContractClass) (*felt.Felt, error)
ClassHash calculates the hash of a contract class.
It takes a contract class as input and calculates the hash by combining various elements of the class. The hash is calculated using the PoseidonArray function from the Curve package. The elements used in the hash calculation include the contract class version, constructor entry point, external entry point, L1 handler entry point, ABI, and Sierra program. The ABI is converted to bytes and then hashed using the StarknetKeccak function from the Curve package. Finally, the ContractClassVersionHash, ExternalHash, L1HandleHash, ConstructorHash, ABIHash, and SierraProgamHash are combined using the PoseidonArray function from the Curve package.
Parameters: - contract: A contract class object of type rpc.ContractClass. Returns: - *felt.Felt: a pointer to a felt.Felt object that represents the calculated hash. - error: an error object if there was an error during the hash calculation.
func CompiledClassHash ¶
CompiledClassHash calculates the hash of a compiled class in the Casm format.
Parameters: - casmClass: A `contracts.CasmClass` object Returns: - *felt.Felt: a pointer to a felt.Felt object that represents the calculated hash.
func ComputeHashOnElementsFelt ¶
ComputeHashOnElementsFelt computes the hash on elements of a Felt array.
Parameters: - feltArr: A pointer to an array of Felt objects. Returns: - *felt.Felt: a pointer to a Felt object - error: an error if any
Types ¶
This section is empty.