starknet.py
starknet.py copied to clipboard
Allow ignoring unknown keys in RPC responses by set env
Closes #1305
- Remove hardcoded unknown=EXCLUDE from deserializing in FullNodeClient
- Allow ignoring unknown keys in RPC responses by set env
I had to leave some unknown=EXCLUDE
because devnet sometimes returns more fields than starknet-spec claim should be sent
Introduced changes
- [ ] This PR contains breaking changes
Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 97.81%. Comparing base (
a2686e2
) to head (9bfbde1
).
Additional details and impacted files
@@ Coverage Diff @@
## development #1312 +/- ##
============================================
Coverage 97.80% 97.81%
============================================
Files 94 95 +1
Lines 4743 4752 +9
============================================
+ Hits 4639 4648 +9
Misses 104 104
Files | Coverage Δ | |
---|---|---|
starknet_py/net/client_models.py | 99.57% <100.00%> (+<0.01%) |
:arrow_up: |
starknet_py/net/full_node_client.py | 99.51% <100.00%> (ø) |
|
starknet_py/net/schemas/rpc.py | 99.21% <100.00%> (+<0.01%) |
:arrow_up: |
starknet_py/utils/schema.py | 100.00% <100.00%> (ø) |
INCLUDE strategy can't be added because mapping Schema to dataclass doesn't work with it. Example:
def make_dataclass(self, data, **kwargs) -> ExecutionResources:
> return ExecutionResources(**data)
E TypeError: ExecutionResources.__init__() got an unexpected keyword argument 'segment_arena_builtin'
Could we add some unit tests by setting a temporary environment variable?
It's problematic because we need to keep broken schema in our code to test it
This PR should be updated with apropriate docs section that will explain this feature and give some examples.
Any idea about an example, IMO the description how to set it seems to be clear
This PR should be updated with apropriate docs section that will explain this feature and give some examples.
Any idea about an example, IMO the description how to set it seems to be clear
The description you've provided should be enough