Skip to content

Commit 49fbb85

Browse files
authored
Add DevnetClient implementation (#1393)
* unknown=EXCLUDE ramoved * devnet version bump to 0.1.2 and test fix * fix tests with pending block * delete print * devnet client setup * default values added * time rpc calls * time advancing tests * add 'generate_block' for set_time * mint tests * add test_predeployd_accounts * class description update * block create and drop * dump, load, restart * add account impersonate * abort blocks tests * account impersonation test * more account impersonation tests * postman hooks * constant rename * account impersonation test fix * Rename fixtures in client_devnet tests * Change loading of MyString contract * Skip test if contract_dir v1 marked * Simplify __init__ * Update description for get_account_balance * Rename dataclass Mint and IncreasedTimeResponse * Rename advancing_time_test.py file * Rename 'devnet_forking_mode_client' fixture * Refactor 'get_start_devnet_command' function * Rename 'account_impersonated' fixture * Remove testnet address * Remove unnecessary accunt fixture * Add PriceUnit enum type for unit paremeter * Add env variable in workflows * Fix time advancing test * Refactor RpcHttpClient * Migrate allow_none -> load_default=None in specific MarshmallowSchema * Migrate default -> dump_default in specific MarshmallowSchema * Update unit types * Fix 'Hash' type handling * Fix names in 'time_test.py' * Add comment to address in 'account_to_impersonate' fixture * Rename directory devnet -> devnet_utils * Add docs for DevnetClient * Correct the description * Improve readability 'test_impersonated_account_should_fail' * Rename MintSchema -> MintResponseSchema * Change dataclass types from Hash to int * Remove unnecessary 'Optional' type wrapper * Change default value in 'get_account_balance()' block_tag * Add function that converts int to eth address '_to_eth_address' * Fix payload datatype serialization in 'send_message_to_l2' * Update docs after devnet client tests * Add docstrings for postman methods
1 parent 92ca763 commit 49fbb85

File tree

24 files changed

+982
-11
lines changed

24 files changed

+982
-11
lines changed

.github/workflows/checks.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,8 @@ jobs:
160160
fail-fast: false
161161
matrix:
162162
python-version: [ "3.8", "3.9", "3.10", "3.11", "3.12" ]
163+
env:
164+
SEPOLIA_RPC_URL: ${{ secrets.SEPOLIA_RPC_URL }}
163165
steps:
164166
- uses: actions/checkout@v4
165167

@@ -291,6 +293,8 @@ jobs:
291293
fail-fast: false
292294
matrix:
293295
python-version: [ "3.8", "3.9", "3.10", "3.11", "3.12" ]
296+
env:
297+
SEPOLIA_RPC_URL: ${{ secrets.SEPOLIA_RPC_URL }}
294298
steps:
295299
- uses: actions/checkout@v4
296300
- uses: dtolnay/rust-toolchain@dc6353516c68da0f06325f42ad880f76a5e77ec9

docs/api.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ API
44

55
api/client
66
api/full_node_client
7+
api/devnet_client
78
api/account
89
api/client_models
910
api/client_errors

docs/api/devnet_client.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
DevnetClient
2+
============
3+
4+
.. py:module:: starknet_py.devnet_utils.devnet_client
5+
6+
.. autoclass-with-examples:: DevnetClient
7+
:members:
8+
:member-order: groupwise

docs/development.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,12 @@ To install `starknet-devnet-rs <https://github.com/0xSpaceShard/starknet-devnet-
2323
Environment variables
2424
^^^^^^^^^^^^^^^^^^^^^
2525

26-
In order to be able to run tests on testnet network (``starknet_py/tests/e2e/tests_on_networks/``), you must set some environmental variables:
26+
In order to be able to run devnet client tests (``starknet_py/tests/e2e/client_devnet``) you must set environmental variable:
2727

2828
- ``SEPOLIA_RPC_URL``
29+
30+
To run tests on testnet network (``starknet_py/tests/e2e/tests_on_networks/``) additionally you must set:
31+
2932
- ``SEPOLIA_ACCOUNT_PRIVATE_KEY``
3033
- ``SEPOLIA_ACCOUNT_ADDRESS``
3134

starknet_py/abi/v1/schemas.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class FunctionBaseSchema(Schema):
2525
outputs = fields.List(
2626
fields.Nested(TypeSchema()), data_key="outputs", required=True
2727
)
28-
state_mutability = fields.String(data_key="state_mutability", default=None)
28+
state_mutability = fields.String(data_key="state_mutability", dump_default=None)
2929

3030

3131
class FunctionAbiEntrySchema(FunctionBaseSchema):

starknet_py/abi/v2/schemas.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class FunctionBaseSchema(Schema):
3131
outputs = fields.List(
3232
fields.Nested(TypeSchema()), data_key="outputs", required=True
3333
)
34-
state_mutability = fields.String(data_key="state_mutability", default=None)
34+
state_mutability = fields.String(data_key="state_mutability", dump_default=None)
3535

3636

3737
class FunctionAbiEntrySchema(FunctionBaseSchema):

starknet_py/conftest.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,7 @@
1212
"starknet_py.tests.e2e.client.fixtures.transactions",
1313
"starknet_py.tests.e2e.client.fixtures.prepare_network",
1414
"starknet_py.tests.e2e.tests_on_networks.fixtures",
15+
"starknet_py.tests.e2e.client_devnet.fixtures.accounts",
16+
"starknet_py.tests.e2e.client_devnet.fixtures.clients",
17+
"starknet_py.tests.e2e.client_devnet.fixtures.contracts",
1518
]

starknet_py/devnet_utils/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)