Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion starknet_py/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class OutsideExecutionInterfaceID(IntEnum):
V2 = 0x1D1144BB2138366FF28D8E9AB57456B1D332AC42196230C3A602003C89872


EXPECTED_RPC_VERSION = "0.10.0"
EXPECTED_RPC_VERSION = "0.10.1-rc.2"

ARGENT_V040_CLASS_HASH = (
0x036078334509B514626504EDC9FB252328D1A240E4E948BEF8D0C08DFF45927F
Expand Down
11 changes: 11 additions & 0 deletions starknet_py/net/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,11 @@
StarknetBlockWithTxHashes,
StorageProofResponse,
Tag,
TraceFlag,
Transaction,
TransactionExecutionStatus,
TransactionReceiptWithBlockInfo,
TransactionResponseFlag,
TransactionStatus,
TransactionStatusResponse,
)
Expand Down Expand Up @@ -72,12 +74,14 @@ async def get_block_with_txs(
self,
block_hash: Optional[Union[Hash, Tag]] = None,
block_number: Optional[Union[int, Tag]] = None,
response_flags: Optional[List[TransactionResponseFlag]] = None,
) -> Union[StarknetBlock, PreConfirmedStarknetBlock]:
"""
Retrieve the block's data by its number or hash.

:param block_hash: Block's hash or literals `"l1_accepted"`, `"pre_confirmed"` or `"latest"`
:param block_number: Block's number or literals `"l1_accepted"`, `"pre_confirmed"` or `"latest"`
:param response_flags: Flags that control what additional fields are included in transaction responses
:return: StarknetBlock object representing retrieved block with transactions.
"""

Expand All @@ -86,12 +90,14 @@ async def get_block_with_tx_hashes(
self,
block_hash: Optional[Union[Hash, Tag]] = None,
block_number: Optional[Union[int, Tag]] = None,
response_flags: Optional[List[TransactionResponseFlag]] = None,
) -> Union[StarknetBlockWithTxHashes, PreConfirmedStarknetBlockWithTxHashes]:
"""
Retrieve the block's data with a list of contained transaction hashes.

:param block_hash: Block's hash or literals `"l1_accepted"`, `"pre_confirmed"` or `"latest"`
:param block_number: Block's number or literals `"l1_accepted"`, `"pre_confirmed"` or `"latest"`
:param response_flags: Flags that control what additional fields are included in transaction responses
:return: StarknetBlockWithTxHashes object representing retrieved block with transactions.
"""

Expand All @@ -100,12 +106,14 @@ async def get_block_with_receipts(
self,
block_hash: Optional[Union[Hash, Tag]] = None,
block_number: Optional[Union[int, Tag]] = None,
response_flags: Optional[List[TransactionResponseFlag]] = None,
) -> Union[StarknetBlockWithReceipts, PreConfirmedStarknetBlockWithReceipts]:
"""
Retrieve the block's data with a list of receipts for contained transactions.

:param block_hash: Block's hash or literals `"l1_accepted"`, `"pre_confirmed"` or `"latest"`
:param block_number: Block's number or literals `"l1_accepted"`, `"pre_confirmed"` or `"latest"`
:param response_flags: Flags that control what additional fields are included in transaction responses
:return: StarknetBlockWithReceipts object representing retrieved block with transactions.
"""

Expand All @@ -114,12 +122,14 @@ async def trace_block_transactions(
self,
block_hash: Optional[Union[Hash, LatestTag]] = None,
block_number: Optional[Union[int, LatestTag]] = None,
trace_flags: Optional[List[TraceFlag]] = None,
) -> List[BlockTransactionTrace]:
"""
Receive the traces of all the transactions within specified block

:param block_hash: Block's hash
:param block_number: Block's number or "pre_confirmed" for pre_confirmed block
:param trace_flags: Flags that indicate when additional information should be included in the trace
:return: BlockTransactionTraces object representing received traces
"""

Expand Down Expand Up @@ -178,6 +188,7 @@ async def get_storage_proof(
async def get_transaction(
self,
tx_hash: Hash,
response_flags: Optional[List[TransactionResponseFlag]] = None,
) -> Transaction:
"""
Get the details and status of a submitted transaction
Expand Down
76 changes: 76 additions & 0 deletions starknet_py/net/client_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,8 @@ class InvokeTransactionV3(TransactionV3):
sender_address: int
nonce: int
account_deployment_data: List[int]
proof: Optional[List[int]] = None
proof_facts: Optional[List[int]] = None


@dataclass
Expand Down Expand Up @@ -638,6 +640,10 @@ class StarknetBlockWithTxHashes(BlockHeader):
transactions: List[int]


class TransactionResponseFlag(str, Enum):
INCLUDE_PROOF_FACTS = "INCLUDE_PROOF_FACTS"


@dataclass
class StarknetBlockWithReceipts(BlockHeader):
"""
Expand Down Expand Up @@ -1052,6 +1058,53 @@ class SimulationFlag(str, Enum):

SKIP_VALIDATE = "SKIP_VALIDATE"
SKIP_FEE_CHARGE = "SKIP_FEE_CHARGE"
RETURN_INITIAL_READS = "RETURN_INITIAL_READS"


class TraceFlag(str, Enum):
"""
Enum class representing flags that indicate what additional information should be included in the trace.
"""

RETURN_INITIAL_READS = "RETURN_INITIAL_READS"


@dataclass
class StorageInitialRead:
contract_address: int
key: str
value: int


@dataclass
class NonceInitialRead:
contract_address: int
nonce: int


@dataclass
class ClassHashInitialRead:
contract_address: int
class_hash: int


@dataclass
class DeclaredContractInitialRead:
class_hash: int
is_declared: bool


@dataclass
class InitialReads:
"""
Dataclass representing the set of state values fetched from
the underlying state reader during execution.
"""

storage: Optional[List[StorageInitialRead]] = None
nonces: Optional[List[NonceInitialRead]] = None
class_hashes: Optional[List[ClassHashInitialRead]] = None
declared_contracts: Optional[List[DeclaredContractInitialRead]] = None


class EntryPointType(Enum):
Expand Down Expand Up @@ -1172,6 +1225,18 @@ class SimulatedTransaction:
fee_estimation: EstimatedFee


@dataclass
class SimulatedTransactionsWithInitialReads:
"""
Dataclass representing the execution trace and consumed resources
of the required transactions, along with initial reads when
RETURN_INITIAL_READS is present in simulation_flags.
"""

simulated_transactions: List[SimulatedTransaction]
initial_reads: InitialReads


@dataclass
class BlockTransactionTrace:
"""
Expand All @@ -1182,6 +1247,17 @@ class BlockTransactionTrace:
trace_root: TransactionTrace


@dataclass
class BlockTransactionTracesWithInitialReads:
"""
Dataclass representing the traces of all transactions in the block, along with the initial reads
when RETURN_INITIAL_READS is present in trace_flags.
"""

transaction_traces: List[BlockTransactionTrace]
initial_reads: InitialReads


@dataclass
class BinaryNode:
"""
Expand Down
Loading
Loading