Skip to content

Commit 2f29faf

Browse files
committed
Apply review suggestions
1 parent fdcf6da commit 2f29faf

3 files changed

Lines changed: 18 additions & 7 deletions

File tree

starknet_py/net/client_models.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -640,6 +640,10 @@ class StarknetBlockWithTxHashes(BlockHeader):
640640

641641

642642
class TransactionResponseFlag(str, Enum):
643+
"""
644+
Flags that control what additional fields are included in the transaction response.
645+
"""
646+
643647
INCLUDE_PROOF_FACTS = "INCLUDE_PROOF_FACTS"
644648

645649

starknet_py/net/full_node_client.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,8 @@ async def get_block_with_txs(
153153
)
154154

155155
params = {**block_identifier}
156-
if response_flags is not None:
156+
157+
if response_flags:
157158
params["response_flags"] = response_flags
158159

159160
res = await self._client.call(
@@ -202,7 +203,8 @@ async def get_block_with_receipts(
202203
)
203204

204205
params = {**block_identifier}
205-
if response_flags is not None:
206+
207+
if response_flags:
206208
params["response_flags"] = response_flags
207209

208210
res = await self._client.call(
@@ -379,14 +381,18 @@ async def get_storage_at(
379381
"key": _to_storage_key(key),
380382
**block_identifier,
381383
}
382-
if response_flags is not None:
384+
385+
if response_flags:
383386
params["response_flags"] = response_flags
384387

385388
res = await self._client.call(
386389
method_name="getStorageAt",
387390
params=params,
388391
)
389-
if isinstance(res, dict):
392+
if (
393+
response_flags
394+
and StorageResponseFlag.INCLUDE_LAST_UPDATE_BLOCK in response_flags
395+
):
390396
return cast(StorageResult, StorageResultSchema().load(res))
391397
res = cast(str, res)
392398
return int(res, 16)
@@ -453,7 +459,7 @@ async def get_transaction(
453459
try:
454460
params: dict = {"transaction_hash": _to_rpc_felt(tx_hash)}
455461

456-
if response_flags is not None:
462+
if response_flags:
457463
params["response_flags"] = response_flags
458464

459465
res = await self._client.call(
@@ -735,7 +741,8 @@ async def get_transaction_by_block_id(
735741
**block_identifier,
736742
"index": index,
737743
}
738-
if response_flags is not None:
744+
745+
if response_flags:
739746
params["response_flags"] = response_flags
740747

741748
res = await self._client.call(

starknet_py/net/schemas/rpc/transactions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ def make_transaction(self, data, **kwargs) -> InvokeTransactionV3:
190190

191191

192192
class BroadcastedInvokeTransactionV3Schema(InvokeTransactionV3Schema):
193-
proof = fields.String(data_key="proof", load_default=None)
193+
proof = fields.String(data_key="proof", required=False)
194194

195195
@post_dump
196196
def remove_none_proof_fields(self, data, **kwargs):

0 commit comments

Comments
 (0)