diff --git a/docs/guide/account_and_client.rst b/docs/guide/account_and_client.rst index ce0c12a59..c23d135b4 100644 --- a/docs/guide/account_and_client.rst +++ b/docs/guide/account_and_client.rst @@ -43,14 +43,14 @@ Note that the nonce will be bumped only by 1. FullNodeClient usage -------------------- -Use a :ref:`FullNodeClient` to interact with services providing `Starknet rpc interface `_ -like `Pathfinder Full Node `_ or starknet-devnet. starknet.py provides uniform interface for -both gateway and full node client - usage is exactly the same as gateway client minus some optional -parameters. - +Use a :ref:`FullNodeClient` to interact with services providing `Starknet RPC interface `_ +like `Pathfinder `_, +`Papyrus `_, `Juno `_ +or `starknet-devnet `_. Using own full node allows for querying Starknet with better performance. -Since gateway will be deprecated at some point in the future, having ``FullNodeClient`` with interface uniform with that of ``GatewayClient`` -will allow for simple migration for starknet.py users. + +Since GatewayClient is deprecated and will be removed at some point in the future, having ``FullNodeClient`` +with interface uniform with that of ``GatewayClient`` will allow for simple migration for starknet.py users. .. codesnippet:: ../../starknet_py/tests/e2e/docs/guide/test_full_node_client.py :language: python diff --git a/starknet_py/tests/e2e/docs/account_creation/test_deploy_prefunded_account.py b/starknet_py/tests/e2e/docs/account_creation/test_deploy_prefunded_account.py index d5bd72cae..2f83c86c5 100644 --- a/starknet_py/tests/e2e/docs/account_creation/test_deploy_prefunded_account.py +++ b/starknet_py/tests/e2e/docs/account_creation/test_deploy_prefunded_account.py @@ -12,15 +12,14 @@ async def test_deploy_prefunded_account( account_with_validate_deploy_class_hash: int, network: str, fee_contract: Contract, - gateway_client: Client, + full_node_client: Client, ): # pylint: disable=import-outside-toplevel, too-many-locals # docs: start from starknet_py.hash.address import compute_address from starknet_py.net.account.account import Account - from starknet_py.net.gateway_client import GatewayClient + from starknet_py.net.full_node_client import FullNodeClient from starknet_py.net.models import StarknetChainId - from starknet_py.net.networks import TESTNET from starknet_py.net.signer.stark_curve_signer import KeyPair # First, make sure to generate private key and salt @@ -50,11 +49,11 @@ async def test_deploy_prefunded_account( # docs: start # Define the client to be used to interact with Starknet - client = GatewayClient(net=TESTNET) + client = FullNodeClient(node_url="your.node.url") chain = StarknetChainId.TESTNET # docs: end - client = gateway_client + client = full_node_client chain = chain_from_network(net=network, chain=StarknetChainId.TESTNET) # docs: start diff --git a/starknet_py/tests/e2e/docs/code_examples/test_account.py b/starknet_py/tests/e2e/docs/code_examples/test_account.py index c424af992..af89cd432 100644 --- a/starknet_py/tests/e2e/docs/code_examples/test_account.py +++ b/starknet_py/tests/e2e/docs/code_examples/test_account.py @@ -17,6 +17,13 @@ def test_init(): # docs-start: init + account = Account( + address=0x123, + client=FullNodeClient(node_url="your.node.url"), + key_pair=KeyPair(12, 34), + chain=StarknetChainId.TESTNET, + ) + # or (not recommended, soon GatewayClient will be removed) account = Account( address=0x123, client=GatewayClient(net=TESTNET), @@ -26,13 +33,6 @@ def test_init(): chain_id=StarknetChainId.TESTNET, ), ) - # or - account = Account( - address=0x123, - client=FullNodeClient(node_url="your.node.url"), - key_pair=KeyPair(12, 34), - chain=StarknetChainId.TESTNET, - ) # docs-end: init diff --git a/starknet_py/tests/e2e/docs/code_examples/test_contract.py b/starknet_py/tests/e2e/docs/code_examples/test_contract.py index 769cf6678..a1d8e5956 100644 --- a/starknet_py/tests/e2e/docs/code_examples/test_contract.py +++ b/starknet_py/tests/e2e/docs/code_examples/test_contract.py @@ -24,12 +24,12 @@ def test_init(): ], provider=Account( address=0x321, - client=GatewayClient(TESTNET), + client=FullNodeClient(node_url="your.node.url"), key_pair=KeyPair(12, 34), chain=StarknetChainId.TESTNET, ), ) - # or + # or (not recommended, soon GatewayClient will be removed) contract = Contract( address=0x123, abi=[ @@ -42,7 +42,7 @@ def test_init(): ], provider=Account( address=0x321, - client=FullNodeClient(TESTNET), + client=GatewayClient(TESTNET), key_pair=KeyPair(12, 34), chain=StarknetChainId.TESTNET, ), diff --git a/starknet_py/tests/e2e/docs/guide/test_cairo1_contract.py b/starknet_py/tests/e2e/docs/guide/test_cairo1_contract.py index 168e0ba22..49a87d609 100644 --- a/starknet_py/tests/e2e/docs/guide/test_cairo1_contract.py +++ b/starknet_py/tests/e2e/docs/guide/test_cairo1_contract.py @@ -3,7 +3,6 @@ import pytest from starknet_py.net.client_models import CasmClass -from starknet_py.net.gateway_client import GatewayClient from starknet_py.net.udc_deployer.deployer import _get_random_salt from starknet_py.tests.e2e.fixtures.constants import CONTRACTS_COMPILED_V1_DIR, MAX_FEE from starknet_py.tests.e2e.fixtures.misc import read_contract @@ -13,23 +12,17 @@ async def test_cairo1_contract( account, sierra_minimal_compiled_contract_and_class_hash, - another_sierra_minimal_compiled_contract_and_class_hash, gateway_client, ): - # pylint: disable=import-outside-toplevel, too-many-locals + # pylint: disable=too-many-locals + # pylint: disable=import-outside-toplevel ( compiled_contract, compiled_class_hash, - ) = ( - sierra_minimal_compiled_contract_and_class_hash - if isinstance(account.client, GatewayClient) - else another_sierra_minimal_compiled_contract_and_class_hash - ) + ) = sierra_minimal_compiled_contract_and_class_hash contract_compiled_casm = read_contract( - "minimal_contract_compiled.casm" - if isinstance(account.client, GatewayClient) - else "another_minimal_contract_compiled.casm", + "minimal_contract_compiled.casm", directory=CONTRACTS_COMPILED_V1_DIR, ) @@ -94,6 +87,6 @@ async def test_cairo1_contract( assert contract_deployment.address != 0 compiled_class = await gateway_client.get_compiled_class_by_class_hash( - sierra_class_hash + class_hash=sierra_class_hash ) assert isinstance(compiled_class, CasmClass) diff --git a/starknet_py/tests/e2e/docs/guide/test_custom_nonce.py b/starknet_py/tests/e2e/docs/guide/test_custom_nonce.py index 092cc77c8..dc13d51f3 100644 --- a/starknet_py/tests/e2e/docs/guide/test_custom_nonce.py +++ b/starknet_py/tests/e2e/docs/guide/test_custom_nonce.py @@ -6,10 +6,10 @@ @pytest.mark.asyncio -async def test_custom_nonce(gateway_client): +async def test_custom_nonce(full_node_client): # pylint: disable=import-outside-toplevel address = 0x1 - client = gateway_client + client = full_node_client private_key = 0x1 # docs: start diff --git a/starknet_py/tests/e2e/docs/guide/test_custom_signer.py b/starknet_py/tests/e2e/docs/guide/test_custom_signer.py index 455fba931..d13bd2509 100644 --- a/starknet_py/tests/e2e/docs/guide/test_custom_signer.py +++ b/starknet_py/tests/e2e/docs/guide/test_custom_signer.py @@ -9,7 +9,7 @@ async def test_custom_signer(): # docs: start from starknet_py.net.account.account import Account - from starknet_py.net.gateway_client import GatewayClient + from starknet_py.net.full_node_client import FullNodeClient from starknet_py.net.models import StarknetChainId, Transaction from starknet_py.net.signer import BaseSigner from starknet_py.utils.typed_data import TypedData @@ -30,7 +30,7 @@ def sign_message( # Create an Account instance with the signer you've implemented custom_signer = CustomSigner() - client = GatewayClient("testnet") + client = FullNodeClient(node_url="your.node.url") account = Account( client=client, address=0x1111, diff --git a/starknet_py/tests/e2e/docs/guide/test_sign_offchain_message.py b/starknet_py/tests/e2e/docs/guide/test_sign_offchain_message.py index e12e6e947..b77589d13 100644 --- a/starknet_py/tests/e2e/docs/guide/test_sign_offchain_message.py +++ b/starknet_py/tests/e2e/docs/guide/test_sign_offchain_message.py @@ -7,7 +7,7 @@ async def test_sign_offchain_message(account): # docs: start from starknet_py.net.account.account import Account - from starknet_py.net.gateway_client import GatewayClient + from starknet_py.net.full_node_client import FullNodeClient from starknet_py.net.models import StarknetChainId from starknet_py.net.signer.stark_curve_signer import KeyPair from starknet_py.utils.typed_data import TypedData @@ -52,7 +52,7 @@ async def test_sign_offchain_message(account): # docs: start # Create an Account instance - client = GatewayClient("testnet") + client = FullNodeClient(node_url="your.node.url") account = Account( client=client, address="0x1111", diff --git a/starknet_py/tests/e2e/docs/quickstart/test_creating_account.py b/starknet_py/tests/e2e/docs/quickstart/test_creating_account.py index cce994805..ae1a7734a 100644 --- a/starknet_py/tests/e2e/docs/quickstart/test_creating_account.py +++ b/starknet_py/tests/e2e/docs/quickstart/test_creating_account.py @@ -4,23 +4,17 @@ @pytest.mark.asyncio -async def test_creating_account(network): +async def test_creating_account(): # pylint: disable=import-outside-toplevel, unused-variable # docs: start from starknet_py.net.account.account import Account - from starknet_py.net.gateway_client import GatewayClient + from starknet_py.net.full_node_client import FullNodeClient from starknet_py.net.models.chains import StarknetChainId from starknet_py.net.signer.stark_curve_signer import KeyPair - testnet = "testnet" - # docs: end - testnet = network - # docs: start - - # Creates an instance of account which is already deployed (testnet) - + # Creates an instance of account which is already deployed # Account using transaction version=1 (has __validate__ function) - client = GatewayClient(net=testnet) + client = FullNodeClient(node_url="your.node.url") account = Account( client=client, address="0x4321",