Skip to content

Commit c20a4cb

Browse files
committed
Merge branch 'development'
2 parents ee0cfc9 + 1a8814c commit c20a4cb

File tree

94 files changed

+3894
-16072
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+3894
-16072
lines changed

.github/workflows/checks.yml

Lines changed: 55 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Checks
22

33
env:
44
CAIRO_LANG_VERSION: "0.13.1"
5-
DEVNET_VERSION: "0.0.5"
5+
DEVNET_VERSION: "0.1.2"
66

77
on:
88
push:
@@ -134,6 +134,7 @@ jobs:
134134
if: steps.cache-contracts.outputs.cache-hit != 'true'
135135
run: |
136136
pip install --upgrade setuptools
137+
pip install sympy==1.11.1
137138
pip install cairo-lang==${{ env.CAIRO_LANG_VERSION }}
138139
139140
- name: Compile contracts v0
@@ -159,6 +160,10 @@ jobs:
159160
fail-fast: false
160161
matrix:
161162
python-version: [ "3.8", "3.9", "3.10", "3.11", "3.12" ]
163+
env:
164+
LEDGER_PROXY_ADDRESS: 127.0.0.1
165+
LEDGER_PROXY_PORT: 9999
166+
SEPOLIA_RPC_URL: ${{ secrets.SEPOLIA_RPC_URL }}
162167
steps:
163168
- uses: actions/checkout@v4
164169

@@ -196,6 +201,48 @@ jobs:
196201
- name: Install devnet
197202
run: ./starknet_py/tests/install_devnet.sh
198203

204+
# ====================== SETUP LEDGER SPECULOS ====================== #
205+
206+
- name: Pull speculos image
207+
run: docker pull ghcr.io/ledgerhq/ledger-app-builder/ledger-app-dev-tools
208+
209+
210+
- name: Clone LedgerHQ Starknet app repository
211+
run: git clone https://github.com/LedgerHQ/app-starknet.git
212+
213+
- name: Build the app inside Docker container
214+
uses: addnab/docker-run-action@v3
215+
with:
216+
image: ghcr.io/ledgerhq/ledger-app-builder/ledger-app-dev-tools
217+
options: --rm -v ${{ github.workspace }}:/apps
218+
run: |
219+
cd /apps/app-starknet
220+
cargo clean
221+
cargo ledger build nanox
222+
223+
- name: Start Speculos emulator container
224+
uses: addnab/docker-run-action@v3
225+
with:
226+
image: ghcr.io/ledgerhq/ledger-app-builder/ledger-app-dev-tools
227+
options: --rm -d --name speculos-emulator -v ${{ github.workspace }}:/apps --publish 5000:5000 --publish 9999:9999
228+
run: |
229+
speculos \
230+
-m nanox \
231+
--apdu-port 9999 \
232+
--api-port 5000 \
233+
--display headless \
234+
/apps/app-starknet/target/nanox/release/starknet
235+
236+
- name: Wait for Speculos to start
237+
run: sleep 5
238+
239+
- name: Update automation rules
240+
working-directory: starknet_py/tests/unit/signer
241+
run: |
242+
curl -X POST http://127.0.0.1:5000/automation \
243+
-H "Content-Type: application/json" \
244+
-d @speculos_automation.json
245+
199246
# ====================== RUN TESTS ====================== #
200247

201248
- name: Check circular imports
@@ -219,18 +266,15 @@ jobs:
219266
# ---------------------------------------------------------- #
220267

221268
run-tests-on-networks:
222-
name: Tests on networks (testnet and integration)
269+
name: Tests on networks (testnet)
223270
needs: setup-tests
224271
runs-on: ubuntu-latest
225272
strategy:
226273
fail-fast: false
227274
env:
228-
SEPOLIA_INTEGRATION_RPC_URL: ${{ secrets.SEPOLIA_INTEGRATION_RPC_URL }}
229275
SEPOLIA_RPC_URL: ${{ secrets.SEPOLIA_RPC_URL }}
230276
SEPOLIA_ACCOUNT_ADDRESS: ${{ secrets.SEPOLIA_ACCOUNT_ADDRESS }}
231277
SEPOLIA_ACCOUNT_PRIVATE_KEY: ${{ secrets.SEPOLIA_ACCOUNT_PRIVATE_KEY }}
232-
SEPOLIA_INTEGRATION_ACCOUNT_PRIVATE_KEY: ${{ secrets.SEPOLIA_INTEGRATION_ACCOUNT_PRIVATE_KEY }}
233-
SEPOLIA_INTEGRATION_ACCOUNT_ADDRESS: ${{ secrets.SEPOLIA_INTEGRATION_ACCOUNT_ADDRESS }}
234278
steps:
235279
- uses: actions/checkout@v4
236280

@@ -293,11 +337,13 @@ jobs:
293337
fail-fast: false
294338
matrix:
295339
python-version: [ "3.8", "3.9", "3.10", "3.11", "3.12" ]
340+
env:
341+
SEPOLIA_RPC_URL: ${{ secrets.SEPOLIA_RPC_URL }}
296342
steps:
297343
- uses: actions/checkout@v4
298344
- uses: dtolnay/rust-toolchain@dc6353516c68da0f06325f42ad880f76a5e77ec9
299345
with:
300-
toolchain: stable
346+
toolchain: 1.79.0 # Doesn't work with "stable"
301347

302348
- name: Download contracts
303349
uses: actions/download-artifact@v3
@@ -315,7 +361,7 @@ jobs:
315361
- name: Install devnet
316362
run: |
317363
$DEVNET_INSTALL_DIR = "$(git rev-parse --show-toplevel)/starknet_py/tests/e2e/devnet"
318-
cargo install starknet-devnet --version ${{ env.DEVNET_VERSION }} --root $DEVNET_INSTALL_DIR
364+
cargo install --git https://github.com/0xSpaceShard/starknet-devnet-rs.git --locked --rev 3ad81456092a2da939be1f590855cea2c18ce40c --root $DEVNET_INSTALL_DIR
319365
320366
# ====================== SETUP PYTHON ====================== #
321367

@@ -433,7 +479,7 @@ jobs:
433479
- uses: actions/checkout@v4
434480
- uses: dtolnay/rust-toolchain@dc6353516c68da0f06325f42ad880f76a5e77ec9
435481
with:
436-
toolchain: stable
482+
toolchain: 1.79.0 # Doesn't work with "stable"
437483

438484
- name: Download contracts
439485
uses: actions/download-artifact@v3
@@ -469,7 +515,7 @@ jobs:
469515
- name: Install devnet
470516
run: |
471517
$DEVNET_INSTALL_DIR = "$(git rev-parse --show-toplevel)/starknet_py/tests/e2e/devnet"
472-
cargo install starknet-devnet --version ${{ env.DEVNET_VERSION }} --root $DEVNET_INSTALL_DIR
518+
cargo install --git https://github.com/0xSpaceShard/starknet-devnet-rs.git --locked --rev 3ad81456092a2da939be1f590855cea2c18ce40c --root $DEVNET_INSTALL_DIR
473519
474520
# ====================== RUN TESTS ====================== #
475521

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/api/signer.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,12 @@ KeyPair
3232
:undoc-members:
3333
:member-order: groupwise
3434

35+
------------
36+
LedgerSigner
37+
------------
38+
39+
.. py:module:: starknet_py.net.signer.ledger_signer
40+
41+
.. autoclass:: LedgerSigner
42+
:members:
43+
:member-order: groupwise

docs/development.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +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 and integration networks (``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

28-
- ``SEPOLIA_INTEGRATION_RPC_URL``
2928
- ``SEPOLIA_RPC_URL``
30-
- ``SEPOLIA_INTEGRATION_ACCOUNT_PRIVATE_KEY``
31-
- ``SEPOLIA_INTEGRATION_ACCOUNT_ADDRESS``
29+
30+
To run tests on testnet network (``starknet_py/tests/e2e/tests_on_networks/``) additionally you must set:
31+
3232
- ``SEPOLIA_ACCOUNT_PRIVATE_KEY``
3333
- ``SEPOLIA_ACCOUNT_ADDRESS``
3434

docs/guide/signing.rst

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,21 @@ signing algorithm, it is possible to create ``Account`` with custom
1212
:language: python
1313
:dedent: 4
1414

15+
Signing with Ledger
16+
-------------------
17+
:ref:`LedgerSigner` allows you to sign transactions using a Ledger device. The device must be unlocked and Starknet app needs to be open.
18+
19+
.. codesnippet:: ../../starknet_py/tests/unit/signer/test_ledger_signer.py
20+
:language: python
21+
:dedent: 4
22+
23+
Deploying account and transferring STRK
24+
---------------------------------------
25+
.. codesnippet:: ../../starknet_py/tests/unit/signer/test_ledger_signer.py
26+
:language: python
27+
:dedent: 4
28+
:start-after: docs-deploy-account-and-transfer: start
29+
:end-before: docs-deploy-account-and-transfer: end
1530

1631
Signing off-chain messages
1732
-------------------------------

docs/migration_guide.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ Version 0.23.0 of **starknet.py** comes with support for `SNIP-12 <https://githu
3131
2. :meth:`Account.verify_message` now accepts parameter ``typed_data`` as both :class:`~starknet_py.utils.typed_data.TypedData` and :class:`~starknet_py.net.models.typed_data.TypedDataDict`
3232
3. :meth:`~starknet_py.net.signer.stark_curve_signer.KeyPair.from_keystore` has been added
3333

34+
3. :class:`CompiledContract`, :class:`ContractClass` and :class:`ContractClassSchema` have been renamed to :class:`DeprecatedCompiledContract`, :class:`DeprecatedContractClass` and :class:`DeprecatedContractClassSchema`
35+
3436
******************************
3537
0.22.0 Migration guide
3638
******************************

0 commit comments

Comments
 (0)