Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CalculateDeprecatedTransactionHashCommon ¶ added in v0.8.0
func CalculateDeprecatedTransactionHashCommon( 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
CalculateDeprecatedTransactionHashCommon 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/8276ac35830148a397e1143389f23253c8b80e93/src/starkware/starknet/core/os/transaction_hash/deprecated_transaction_hash.py#L29
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
func ClassHash ¶
func ClassHash(contract rpc.ContractClass) *felt.Felt
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.
Types ¶
This section is empty.