You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you choose to install `starknet-devnet-rs <https://github.com/0xSpaceShard/starknet-devnet-rs>`_ using a different method, please make sure to add the executable ``starknet-devnet`` to your ``PATH`` environment variable.
35
35
36
36
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:
37
37
38
-
- ``INTEGRATION_RPC_URL``
39
-
- ``TESTNET_RPC_URL``
40
-
- ``INTEGRATION_ACCOUNT_PRIVATE_KEY``
41
-
- ``INTEGRATION_ACCOUNT_ADDRESS``
42
-
- ``TESTNET_ACCOUNT_PRIVATE_KEY``
43
-
- ``TESTNET_ACCOUNT_ADDRESS``
38
+
- ``GOERLI_INTEGRATION_RPC_URL``
39
+
- ``GOERLI_TESTNET_RPC_URL``
40
+
- ``SEPOLIA_INTEGRATION_RPC_URL``
41
+
- ``SEPOLIA_TESTNET_RPC_URL``
42
+
- ``GOERLI_INTEGRATION_ACCOUNT_PRIVATE_KEY``
43
+
- ``GOERLI_INTEGRATION_ACCOUNT_ADDRESS``
44
+
- ``GOERLI_TESTNET_ACCOUNT_PRIVATE_KEY``
45
+
- ``GOERLI_TESTNET_ACCOUNT_ADDRESS``
44
46
45
-
The best way to do that is to create ``test-variables.env`` file in ``starknet_py/tests/e2e/`` directory, so they can be loaded by the ``python-dotenv`` library.
47
+
The existing tests don't execute any invoke transactions on the Sepolia networks. If you plan to incorporate such tests, please also set the following environment variables:
48
+
49
+
- ``SEPOLIA_INTEGRATION_ACCOUNT_PRIVATE_KEY``
50
+
- ``SEPOLIA_INTEGRATION_ACCOUNT_ADDRESS``
51
+
- ``SEPOLIA_TESTNET_ACCOUNT_PRIVATE_KEY``
52
+
- ``SEPOLIA_TESTNET_ACCOUNT_ADDRESS``
53
+
54
+
The best way to set environment variables is to create ``test-variables.env`` file in ``starknet_py/tests/e2e/`` directory, so they can be loaded by the ``python-dotenv`` library.
46
55
You can find an example file ``test-variables.env.template`` in the same directory with the format of how it should look like.
Copy file name to clipboardExpand all lines: docs/guide/account_and_client.rst
+28-5Lines changed: 28 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,16 +4,41 @@ Account and Client
4
4
Executing transactions
5
5
----------------------
6
6
7
-
To execute transactions on Starknet, use :meth:`~starknet_py.net.account.account.Account.execute` method from :ref:`Account` interface.
7
+
To execute transactions on Starknet, use :meth:`~starknet_py.net.account.account.Account.execute_v1` or :meth:`~starknet_py.net.account.account.Account.execute_v3` methods from :ref:`Account` interface.
8
+
These methods will send :class:`~starknet_py.net.models.InvokeV1` and :class:`~starknet_py.net.models.InvokeV3` transactions respectively. To read about differences between transaction versions please visit `transaction types <https://docs.starknet.io/documentation/architecture_and_concepts/Network_Architecture/transactions>`_ from the Starknet docs.
All methods within the :ref:`Account` that involve on-chain modifications require either specifying a maximum transaction fee or using auto estimation.
18
+
In the case of V1 and V2 transactions, the transaction fee, denoted in Wei, is configured by the ``max_fee`` parameter.
19
+
For V3 transactions, however, the fee is expressed in Fri and is determined by the ``l1_resource_bounds`` parameter.
20
+
To enable auto estimation, set the ``auto_estimate`` parameter to ``True``.
There is a possibility to execute an Invoke transaction containing multiple calls.
27
-
Simply pass a list of calls to :meth:`~starknet_py.net.account.account.Account.execute` method.
52
+
Simply pass a list of calls to :meth:`~starknet_py.net.account.account.Account.execute_v1` or :meth:`~starknet_py.net.account.account.Account.execute_v3` methods.
Copy file name to clipboardExpand all lines: docs/guide/deploying_contracts.rst
+5-14Lines changed: 5 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,27 +4,21 @@ Deploying contracts
4
4
Declaring contracts
5
5
-------------------
6
6
7
-
Since Cairo 0.10.0 Declare transactions can be signed and in the future, declaring without signing the transaction
8
-
(and without paying the fee) will be impossible. That is why :ref:`Account` has
9
-
:meth:`sign_declare_transaction()` method.
7
+
A declare transaction can be issued in version 1, 2 or 3. Contracts written in Cairo 0 should be declared using version 1, while those written in Cairo 1 or higher should be declared with versions 2 or 3.
8
+
To sign a declare transaction, you should utilize the :meth:`~starknet_py.net.account.account.Account.sign_declare_v1`, :meth:`~starknet_py.net.account.account.Account.sign_declare_v2` or :meth:`~starknet_py.net.account.account.Account.sign_declare_v3` method, respectively.
@@ -34,7 +28,7 @@ through Universal Deployment Contract (UDC) to deploy a contract.
34
28
Simple deploy
35
29
-------------
36
30
37
-
If you already know the class hash of an already declared contract you want to deploy just use the :meth:`Contract.deploy_contract`.
31
+
If you know the class hash of an already declared contract you want to deploy just use the :meth:`~starknet_py.contract.Contract.deploy_contract_v1` or :meth:`~starknet_py.contract.Contract.deploy_contract_v3`.
38
32
It will deploy the contract using funds from your account. Deployment is handled by UDC.
|Starknet 0.11 introduced the ability to declare contracts written in Cairo1!
79
-
80
-
To declare a new contract, Declare v2 or Declare v3 transaction has to be sent.
71
+
To declare a contract in Cairo version 1 or higher, Declare V2 or Declare V3 transaction has to be sent.
81
72
You can see the structure of these transactions `here <https://docs.starknet.io/documentation/architecture_and_concepts/Network_Architecture/transactions/#declare-transaction>`_.
82
73
83
74
The main differences in the structure of the transaction from its previous version are:
When max_fee is specified when preparing a call, you can invoke it without
49
-
``max_fee``.
50
+
The ``max_fee`` argument can be also defined in :meth:`~ContractFunction.prepare_invoke_v1`. Subsequently, the :meth:`~PreparedFunctionInvokeV1.invoke` method on a prepared call can be used either with ``max_fee`` omitted or with its value overridden.
51
+
The same behavior applies to :meth:`~ContractFunction.prepare_invoke_v3` and ``l1_resource_bounds``.
If ``max_fee`` is not specified at any step it will default to ``None``,
59
-
and will raise an exception when invoking a transaction.
62
+
For V1 transactions if ``max_fee`` is not specified at any step it will default to ``None``,
63
+
and will raise an exception when invoking a transaction, unless `auto_estimate` is specified and is set to `True`. The same applies to ``l1_resource_bounds`` and V3 transactions.
60
64
61
-
Please note you will need to have enough Wei in your Starknet account otherwise
65
+
Please note you will need to have enough Wei (for V1 transaction) or Fri (for V3 transaction) in your Starknet account otherwise
62
66
transaction will be rejected.
63
67
64
68
Fee estimation
65
69
--------------
66
70
67
71
You can estimate required amount of fee that will need to be paid for transaction
68
-
using :meth:`PreparedFunctionCall.estimate_fee() <starknet_py.contract.PreparedFunctionCall.estimate_fee>`
72
+
using :meth:`PreparedFunctionInvoke.estimate_fee() <starknet_py.contract.PreparedFunctionInvoke.estimate_fee>`
For testing purposes it is possible to enable automatic fee estimation when making
79
-
a transaction. starknet.py will then use ``estimate_fee()`` internally and use value
80
-
returned by it multiplied by ``1.5`` as a ``max_fee``.
81
-
82
-
.. warning::
83
-
84
-
Do not use automatic fee estimation in production code! It may lead to
85
-
very high fees paid as the amount returned by ``estimate_fee()`` may be arbitrarily large.
83
+
For testing purposes it is possible to enable automatic fee estimation when making a transaction. Starknet.py will then call :meth:`~starknet_py.net.full_node_client.FullNodeClient.estimate_fee`
84
+
internally and use the returned value, multiplied by ``1.5`` to mitigate fluctuations in price, as a ``max_fee`` for V1 transactions. For V3 transactions,
85
+
``max_amount`` will be multiplied by ``1.1``, and ``max_price_per_unit`` by ``1.5``.
It is strongly discouraged to use automatic fee estimation in production code as it may lead to unexpectedly high fee.
91
94
92
95
.. note::
93
-
It is possible to configure the value by which the estimated fee is multiplied,
94
-
by changing ``ESTIMATED_FEE_MULTIPLIER`` in :class:`~starknet_py.net.account.account.Account`.
96
+
For V1 transactions it is possible to configure the value by which the estimated fee is multiplied,
97
+
by changing ``ESTIMATED_FEE_MULTIPLIER`` in :class:`~starknet_py.net.account.account.Account`. The same applies to
98
+
``ESTIMATED_AMOUNT_MULTIPLIER`` and ``ESTIMATED_UNIT_PRICE_MULTIPLIER`` for V3 transactions.
95
99
96
100
Account and Client interoperability
97
101
-----------------------------------
98
102
99
103
.. currentmodule:: starknet_py.contract
100
104
101
-
:ref:`Contract` methods have been designed to be
102
-
compatible with :ref:`Account` and :ref:`Client`.
105
+
:ref:`Contract` methods have been designed to be compatible with :ref:`Account` and :ref:`Client`.
103
106
104
-
:ref:`PreparedFunctionCall` returned by :meth:`ContractFunction.prepare` can be used in Account methods to create Invoke transactions.
107
+
:ref:`PreparedFunctionInvokeV1` and :ref:`PreparedFunctionInvokeV3` returned by :meth:`ContractFunction.prepare_invoke_v1` and :meth:`ContractFunction.prepare_invoke_v3` respectively can be used in Account methods to create Invoke transactions.
It can also be used in :meth:`Client.call_contract() <starknet_py.net.client.Client.call_contract>`
113
+
114
+
Similarly, :ref:`PreparedFunctionCall` returned by :meth:`ContractFunction.prepare_call` can be used in :meth:`Client.call_contract() <starknet_py.net.client.Client.call_contract>`
Copy file name to clipboardExpand all lines: docs/installation.rst
+4-3Lines changed: 4 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -50,15 +50,16 @@ You can install starknet.py on Windows in two ways:
50
50
51
51
1. Install it just like you would on Linux.
52
52
53
-
You might encounter problems related to ``libcrypto_c_exports``.
54
-
55
53
In such case make sure that you have `MinGW <https://www.mingw-w64.org/>`_ installed and up-to-date.
56
54
57
55
.. hint::
58
-
An easy way to install MinGW is through `chocolatey <https://community.chocolatey.org/packages/mingw>`_.
56
+
The recommended way to install is through `chocolatey <https://community.chocolatey.org/packages/mingw>`_.
59
57
60
58
You also should have MinGW in your PATH environment variable (e.g. ``C:\ProgramData\chocolatey\lib\mingw\tools\install\mingw64\bin``).
61
59
60
+
.. warning::
61
+
Please be aware that you may encounter issues related to ``libcrypto_c_exports`` (e.g LoadLibraryEx).
62
+
Installing MinGW via chocolatey and correctly adding it to the PATH should solve these issues.
62
63
63
64
If you encounter any further problems related to installation, you can create an `issue at our GitHub <https://github.com/software-mansion/starknet.py/issues/new?assignees=&labels=bug&projects=&template=bug_report.yaml&title=%5BBUG%5D+%3Ctitle%3E>`_
64
65
or ask for help in ``#🐍 | starknet-py`` channel on `Starknet Discord server <https://starknet.io/discord>`_.
0 commit comments