Transactions

class ape_starknet.transactions.ContractDeclaration(*, contract_address: Optional[ChecksumAddress] = None, block_number: int, actual_fee: int, logs: List[dict] = [], status: TransactionStatus, hash: str, transaction: TransactionAPI, block_hash: Optional[str] = None, class_hash: int)

The result of declaring a contract type in Starknet.

class ape_starknet.transactions.InvokeFunctionTransaction(*, chainId: int = 0, receiver: ChecksumAddress, sender: Optional[ChecksumAddress] = None, gas: Optional[int] = None, nonce: Optional[int] = None, value: int = 0, calldata: List[Any] = [], type: TransactionType = TransactionType.INVOKE_FUNCTION, max_fee: int = 0, max_priority_fee: Optional[int] = None, required_confirmations: Optional[int] = None, signature: Optional[TransactionSignature] = None, version: int = 1, is_prepared: bool = False, method_abi: MethodABI, contract_address: Optional[ChecksumAddress] = None, original_transaction: Optional[InvokeFunctionTransaction] = None)
as_execute() InvokeFunctionTransaction

Convert this transaction to an account __execute__ transaction.

as_starknet_object() InvokeFunction

Convert TransactionAPI to its Starknet transaction equivalent so it can be accepted by the core Starknet OS framework.

contract_address: Optional[ChecksumAddress]

Gets set when calling deployContract on a UDC contract.

original_transaction: Optional[InvokeFunctionTransaction]

The original transaction before transforming to an account __execute__() invoke transaction. Gets set in the :meth:`~ape_starknet.transactions.InvokeFunctionTransaction.as_execute method.

property txn_hash: HexBytes

The calculated hash of the transaction.

class ape_starknet.transactions.StarknetReceipt(*, contract_address: Optional[ChecksumAddress] = None, block_number: int, actual_fee: int, logs: List[dict] = [], status: TransactionStatus, hash: str, transaction: TransactionAPI, block_hash: Optional[str] = None)

An object represented a confirmed transaction in Starknet.

block_hash: Optional[str]

Aliased

decode_logs(**kwargs)

Decode the logs on the receipt.

Parameters:

abi (EventABI) – The ABI of the event to decode into logs.

Returns:

List[ContractLog]

property ran_out_of_gas: bool

Check if a transaction ran out of gas and failed.

Returns:

True when the transaction failed and used the same amount of gas as the given gas_limit.

Return type:

bool

property return_value: Any

Obtain the final return value of the call. Requires tracing to function, since this is not available from the receipt object.

property total_fees_paid: int

The total amount of fees paid for the transaction.

class ape_starknet.transactions.StarknetTransaction(*, chainId: int = 0, to: Optional[ChecksumAddress] = None, sender: Optional[ChecksumAddress] = None, gas: Optional[int] = None, nonce: Optional[int] = None, value: int = 0, data: bytes = b'', type: int, max_fee: Optional[int] = None, max_priority_fee: Optional[int] = None, required_confirmations: Optional[int] = None, signature: Optional[TransactionSignature] = None, version: int = 1)

A base transaction class for all Starknet transactions.

abstract as_starknet_object() Transaction

Convert TransactionAPI to its Starknet transaction equivalent so it can be accepted by the core Starknet OS framework.

serialize_transaction() dict

Serialize the transaction

property total_transfer_value: int

The total amount of WEI that a transaction could use. Useful for determining if an account balance can afford to submit the transaction.