From df9a65195508bf21ba31d485aa7effedf10e1554 Mon Sep 17 00:00:00 2001 From: ddoktorski <45050160+ddoktorski@users.noreply.github.com> Date: Wed, 31 Jan 2024 12:50:22 +0100 Subject: [PATCH] Add `Account.deploy_account_v3` static method (#1265) * Add `_prepare_account_to_deploy` function * Rename `Account.deploy_account` to have `v1` postfix * Add `Account.deploy_account_v3` function * Make if condition shorter * Rename parse calls related methods * Rename `execute` to `execute_v1` * Update docstrings --- starknet_py/contract.py | 4 +- starknet_py/net/account/account.py | 172 +++++++++++++----- starknet_py/net/account/base_account.py | 2 +- starknet_py/tests/e2e/account/account_test.py | 52 ++++-- .../tests/e2e/client/full_node_test.py | 2 +- .../test_deploy_prefunded_account.py | 4 +- .../e2e/docs/code_examples/test_account.py | 4 +- .../e2e/docs/guide/test_cairo1_contract.py | 2 +- .../e2e/docs/guide/test_deploying_with_udc.py | 2 +- .../docs/guide/test_executing_transactions.py | 2 +- .../tests/e2e/docs/guide/test_multicall.py | 2 +- .../test_account_comparison.py | 4 +- .../e2e/docs/quickstart/test_using_account.py | 2 +- starknet_py/tests/e2e/fixtures/accounts.py | 2 +- starknet_py/tests/e2e/fixtures/contracts.py | 2 +- 15 files changed, 184 insertions(+), 74 deletions(-) diff --git a/starknet_py/contract.py b/starknet_py/contract.py index eb2c730ff..1c6266f42 100644 --- a/starknet_py/contract.py +++ b/starknet_py/contract.py @@ -241,7 +241,7 @@ async def deploy( calldata=constructor_args, cairo_version=self._cairo_version, ) - res = await self._account.execute( + res = await self._account.execute_v1( calls=deploy_call, nonce=nonce, max_fee=max_fee, auto_estimate=auto_estimate ) @@ -728,7 +728,7 @@ async def deploy_contract( calldata=constructor_args, cairo_version=cairo_version, ) - res = await account.execute( + res = await account.execute_v1( calls=deploy_call, nonce=nonce, max_fee=max_fee, auto_estimate=auto_estimate ) diff --git a/starknet_py/net/account/account.py b/starknet_py/net/account/account.py index 23c91d8fe..8969f3b8a 100644 --- a/starknet_py/net/account/account.py +++ b/starknet_py/net/account/account.py @@ -550,7 +550,7 @@ async def sign_deploy_account_v3_transaction( signature = self.signer.sign_transaction(deploy_account_tx) return _add_signature_to_transaction(deploy_account_tx, signature) - async def execute( + async def execute_v1( self, calls: Calls, *, @@ -592,7 +592,7 @@ def verify_message(self, typed_data: TypedData, signature: List[int]) -> bool: return verify_message_signature(message_hash, signature, self.signer.public_key) @staticmethod - async def deploy_account( + async def deploy_account_v1( *, address: AddressRepresentation, class_hash: int, @@ -605,53 +605,41 @@ async def deploy_account( max_fee: Optional[int] = None, auto_estimate: bool = False, ) -> AccountDeploymentResult: - # pylint: disable=too-many-locals """ Deploys an account contract with provided class_hash on Starknet and returns an AccountDeploymentResult that allows waiting for transaction acceptance. Provided address must be first prefunded with enough tokens, otherwise the method will fail. - If using Client for either TESTNET or MAINNET, this method will verify if the address balance - is high enough to cover deployment costs. + If using Client for MAINNET, GOERLI, SEPOLIA or SEPOLIA_INTEGRATION, this method will verify + if the address balance is high enough to cover deployment costs. - :param address: calculated and prefunded address of the new account. - :param class_hash: class_hash of the account contract to be deployed. - :param salt: salt used to calculate the address. + :param address: Calculated and prefunded address of the new account. + :param class_hash: Class hash of the account contract to be deployed. + :param salt: Salt used to calculate the address. :param key_pair: KeyPair used to calculate address and sign deploy account transaction. - :param client: a Client instance used for deployment. - :param chain: id of the Starknet chain used. - :param constructor_calldata: optional calldata to account contract constructor. If ``None`` is passed, + :param client: Client instance used for deployment. + :param chain: Id of the Starknet chain used. + :param constructor_calldata: Optional calldata to account contract constructor. If ``None`` is passed, ``[key_pair.public_key]`` will be used as calldata. :param nonce: Nonce of the transaction. - :param max_fee: max fee to be paid for deployment, must be less or equal to the amount of tokens prefunded. + :param max_fee: Max fee to be paid for deployment, must be less or equal to the amount of tokens prefunded. :param auto_estimate: Use automatic fee estimation, not recommend as it may lead to high costs. """ - address = parse_address(address) calldata = ( constructor_calldata if constructor_calldata is not None else [key_pair.public_key] ) - if address != ( - computed := compute_address( - salt=salt, - class_hash=class_hash, - constructor_calldata=calldata, - deployer_address=0, - ) - ): - raise ValueError( - f"Provided address {hex(address)} is different than computed address {hex(computed)} " - f"for the given class_hash and salt." - ) - - account = Account( + account = _prepare_account_to_deploy( address=address, - client=client, + class_hash=class_hash, + salt=salt, key_pair=key_pair, + client=client, chain=chain, + calldata=calldata, ) deploy_account_tx = await account.sign_deploy_account_v1_transaction( @@ -663,12 +651,7 @@ async def deploy_account( auto_estimate=auto_estimate, ) - if chain in ( - StarknetChainId.SEPOLIA_TESTNET, - StarknetChainId.SEPOLIA_INTEGRATION, - StarknetChainId.GOERLI, - StarknetChainId.MAINNET, - ): + if chain in StarknetChainId: balance = await account.get_balance() if balance < deploy_account_tx.max_fee: raise ValueError( @@ -681,6 +664,70 @@ async def deploy_account( hash=result.transaction_hash, account=account, _client=account.client ) + @staticmethod + async def deploy_account_v3( + *, + address: AddressRepresentation, + class_hash: int, + salt: int, + key_pair: KeyPair, + client: Client, + chain: StarknetChainId, + constructor_calldata: Optional[List[int]] = None, + nonce: int = 0, + l1_resource_bounds: Optional[ResourceBounds] = None, + auto_estimate: bool = False, + ) -> AccountDeploymentResult: + """ + Deploys an account contract with provided class_hash on Starknet and returns + an AccountDeploymentResult that allows waiting for transaction acceptance. + + Provided address must be first prefunded with enough tokens, otherwise the method will fail. + + :param address: Calculated and prefunded address of the new account. + :param class_hash: Class hash of the account contract to be deployed. + :param salt: Salt used to calculate the address. + :param key_pair: KeyPair used to calculate address and sign deploy account transaction. + :param client: Client instance used for deployment. + :param chain: Id of the Starknet chain used. + :param constructor_calldata: Optional calldata to account contract constructor. If ``None`` is passed, + ``[key_pair.public_key]`` will be used as calldata. + :param nonce: Nonce of the transaction. + :param l1_resource_bounds: Max amount and max price per unit of L1 gas (in Fri) used when executing + this transaction. + :param auto_estimate: Use automatic fee estimation, not recommend as it may lead to high costs. + """ + calldata = ( + constructor_calldata + if constructor_calldata is not None + else [key_pair.public_key] + ) + + account = _prepare_account_to_deploy( + address=address, + class_hash=class_hash, + salt=salt, + key_pair=key_pair, + client=client, + chain=chain, + calldata=calldata, + ) + + deploy_account_tx = await account.sign_deploy_account_v3_transaction( + class_hash=class_hash, + contract_address_salt=salt, + constructor_calldata=calldata, + nonce=nonce, + l1_resource_bounds=l1_resource_bounds, + auto_estimate=auto_estimate, + ) + + result = await client.deploy_account(deploy_account_tx) + + return AccountDeploymentResult( + hash=result.transaction_hash, account=account, _client=account.client + ) + def _default_token_address_for_chain( self, chain_id: Optional[StarknetChainId] = None ) -> str: @@ -697,6 +744,39 @@ def _default_token_address_for_chain( return FEE_CONTRACT_ADDRESS +def _prepare_account_to_deploy( + address: AddressRepresentation, + class_hash: int, + salt: int, + key_pair: KeyPair, + client: Client, + chain: StarknetChainId, + calldata: List[int], +) -> Account: + # pylint: disable=too-many-arguments + address = parse_address(address) + + if address != ( + computed := compute_address( + salt=salt, + class_hash=class_hash, + constructor_calldata=calldata, + deployer_address=0, + ) + ): + raise ValueError( + f"Provided address {hex(address)} is different than computed address {hex(computed)} " + f"for the given class_hash and salt." + ) + + return Account( + address=address, + client=client, + key_pair=key_pair, + chain=chain, + ) + + def _is_sierra_contract(data: Dict[str, Any]) -> bool: return "sierra_program" in data @@ -721,19 +801,19 @@ def _add_resource_bounds_to_transaction( def _parse_calls(cairo_version: int, calls: Calls) -> List[int]: if cairo_version == 1: - parsed_calls = _parse_calls_v2(ensure_iterable(calls)) - wrapped_calldata = _execute_payload_serializer_v2.serialize( + parsed_calls = _parse_calls_cairo_v1(ensure_iterable(calls)) + wrapped_calldata = _execute_payload_serializer_v1.serialize( {"calls": parsed_calls} ) else: call_descriptions, calldata = _merge_calls(ensure_iterable(calls)) - wrapped_calldata = _execute_payload_serializer.serialize( + wrapped_calldata = _execute_payload_serializer_v0.serialize( {"call_array": call_descriptions, "calldata": calldata} ) return wrapped_calldata -def _parse_call(call: Call, entire_calldata: List) -> Tuple[Dict, List]: +def _parse_call_cairo_v0(call: Call, entire_calldata: List) -> Tuple[Dict, List]: _data = { "to": call.to_addr, "selector": call.selector, @@ -749,13 +829,13 @@ def _merge_calls(calls: Iterable[Call]) -> Tuple[List[Dict], List[int]]: call_descriptions = [] entire_calldata = [] for call in calls: - data, entire_calldata = _parse_call(call, entire_calldata) + data, entire_calldata = _parse_call_cairo_v0(call, entire_calldata) call_descriptions.append(data) return call_descriptions, entire_calldata -def _parse_calls_v2(calls: Iterable[Call]) -> List[Dict]: +def _parse_calls_cairo_v1(calls: Iterable[Call]) -> List[Dict]: calls_parsed = [] for call in calls: _data = { @@ -769,7 +849,7 @@ def _parse_calls_v2(calls: Iterable[Call]) -> List[Dict]: _felt_serializer = FeltSerializer() -_call_description = StructSerializer( +_call_description_cairo_v0 = StructSerializer( OrderedDict( to=_felt_serializer, selector=_felt_serializer, @@ -777,7 +857,7 @@ def _parse_calls_v2(calls: Iterable[Call]) -> List[Dict]: data_len=_felt_serializer, ) ) -_call_description_v2 = StructSerializer( +_call_description_cairo_v1 = StructSerializer( OrderedDict( to=_felt_serializer, selector=_felt_serializer, @@ -785,14 +865,14 @@ def _parse_calls_v2(calls: Iterable[Call]) -> List[Dict]: ) ) -_execute_payload_serializer = PayloadSerializer( +_execute_payload_serializer_v0 = PayloadSerializer( OrderedDict( - call_array=ArraySerializer(_call_description), + call_array=ArraySerializer(_call_description_cairo_v0), calldata=ArraySerializer(_felt_serializer), ) ) -_execute_payload_serializer_v2 = PayloadSerializer( +_execute_payload_serializer_v1 = PayloadSerializer( OrderedDict( - calls=ArraySerializer(_call_description_v2), + calls=ArraySerializer(_call_description_cairo_v1), ) ) diff --git a/starknet_py/net/account/base_account.py b/starknet_py/net/account/base_account.py index 9f87b9516..0085eadcc 100644 --- a/starknet_py/net/account/base_account.py +++ b/starknet_py/net/account/base_account.py @@ -264,7 +264,7 @@ async def sign_deploy_account_v3_transaction( """ @abstractmethod - async def execute( + async def execute_v1( self, calls: Calls, *, diff --git a/starknet_py/tests/e2e/account/account_test.py b/starknet_py/tests/e2e/account/account_test.py index 0abe0c5d8..7006d2262 100644 --- a/starknet_py/tests/e2e/account/account_test.py +++ b/starknet_py/tests/e2e/account/account_test.py @@ -13,6 +13,7 @@ Call, DeployAccountTransaction, DeployAccountTransactionResponse, + DeployAccountTransactionV3, EstimatedFee, InvokeTransactionV3, ResourceBounds, @@ -105,7 +106,7 @@ async def test_sending_multicall(account, map_contract, key, val): map_contract.functions["put"].prepare(key=key, value=val), ] - res = await account.execute(calls=calls, max_fee=int(1e20)) + res = await account.execute_v1(calls=calls, max_fee=int(1e20)) await account.client.wait_for_tx(res.transaction_hash) (value,) = await map_contract.functions["get"].call(key=key) @@ -151,7 +152,7 @@ async def test_get_nonce(account, map_contract): address = map_contract.address block = await account.client.get_block(block_number="latest") - tx = await account.execute( + tx = await account.execute_v1( Call( to_addr=address, selector=get_selector_from_name("put"), calldata=[10, 20] ), @@ -445,10 +446,10 @@ async def test_sign_deploy_account_v3_transaction_auto_estimate( @pytest.mark.asyncio -async def test_deploy_account(client, deploy_account_details_factory, map_contract): +async def test_deploy_account_v1(client, deploy_account_details_factory, map_contract): address, key_pair, salt, class_hash = await deploy_account_details_factory.get() - deploy_result = await Account.deploy_account( + deploy_result = await Account.deploy_account_v1( address=address, class_hash=class_hash, salt=salt, @@ -464,7 +465,11 @@ async def test_deploy_account(client, deploy_account_details_factory, map_contra assert isinstance(account, BaseAccount) assert account.address == address - res = await account.execute( + transaction = await client.get_transaction(tx_hash=deploy_result.hash) + assert isinstance(transaction, DeployAccountTransaction) + assert transaction.constructor_calldata == [key_pair.public_key] + + res = await account.execute_v1( calls=Call( to_addr=map_contract.address, selector=get_selector_from_name("put"), @@ -477,6 +482,31 @@ async def test_deploy_account(client, deploy_account_details_factory, map_contra assert tx_receipt.execution_status == TransactionExecutionStatus.SUCCEEDED +@pytest.mark.asyncio +async def test_deploy_account_v3(client, deploy_account_details_factory): + address, key_pair, salt, class_hash = await deploy_account_details_factory.get() + + deploy_result = await Account.deploy_account_v3( + address=address, + class_hash=class_hash, + salt=salt, + key_pair=key_pair, + client=client, + chain=StarknetChainId.GOERLI, + l1_resource_bounds=MAX_RESOURCE_BOUNDS_L1, + ) + await deploy_result.wait_for_acceptance() + + account = deploy_result.account + + assert isinstance(account, BaseAccount) + assert account.address == address + + transaction = await client.get_transaction(tx_hash=deploy_result.hash) + assert isinstance(transaction, DeployAccountTransactionV3) + assert transaction.constructor_calldata == [key_pair.public_key] + + @pytest.mark.asyncio async def test_deploy_account_raises_on_incorrect_address( client, deploy_account_details_factory @@ -487,7 +517,7 @@ async def test_deploy_account_raises_on_incorrect_address( ValueError, match=f"Provided address {hex(0x111)} is different than computed address {hex(address)}", ): - await Account.deploy_account( + await Account.deploy_account_v1( address=0x111, class_hash=class_hash, salt=salt, @@ -513,7 +543,7 @@ async def test_deploy_account_raises_on_no_enough_funds( ValueError, match="Not enough tokens at the specified address to cover deployment costs", ): - await Account.deploy_account( + await Account.deploy_account_v1( address=address, class_hash=class_hash, salt=salt, @@ -540,7 +570,7 @@ async def test_deploy_account_passes_on_enough_funds( transaction_hash=0x1 ) - await Account.deploy_account( + await Account.deploy_account_v1( address=address, class_hash=class_hash, salt=salt, @@ -573,7 +603,7 @@ async def test_deploy_account_uses_custom_calldata( ) await res.wait_for_acceptance() - deploy_result = await Account.deploy_account( + deploy_result = await Account.deploy_account_v1( address=address, class_hash=class_hash, salt=salt, @@ -668,7 +698,7 @@ async def test_argent_cairo1_account_deploy( class_hash=argent_cairo1_account_class_hash, argent_calldata=True ) - deploy_result = await Account.deploy_account( + deploy_result = await Account.deploy_account_v1( address=address, class_hash=class_hash, salt=salt, @@ -714,7 +744,7 @@ async def test_argent_cairo1_account_execute( selector=get_selector_from_name("increase_balance"), calldata=[value], ) - execute = await argent_cairo1_account.execute( + execute = await argent_cairo1_account.execute_v1( calls=increase_balance_by_20_call, max_fee=int(1e16) ) await argent_cairo1_account.client.wait_for_tx(tx_hash=execute.transaction_hash) diff --git a/starknet_py/tests/e2e/client/full_node_test.py b/starknet_py/tests/e2e/client/full_node_test.py index ec08704e8..0a06c4059 100644 --- a/starknet_py/tests/e2e/client/full_node_test.py +++ b/starknet_py/tests/e2e/client/full_node_test.py @@ -118,7 +118,7 @@ async def test_get_transaction_receipt_deploy_account( client, deploy_account_details_factory ): address, key_pair, salt, class_hash = await deploy_account_details_factory.get() - deploy_result = await Account.deploy_account( + deploy_result = await Account.deploy_account_v1( address=address, class_hash=class_hash, salt=salt, 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 2aad15618..7ce6284d0 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 @@ -58,8 +58,8 @@ async def test_deploy_prefunded_account( chain = chain_from_network(net=network, chain=StarknetChainId.GOERLI) # docs: start - # Use `Account.deploy_account` static method to deploy an account - account_deployment_result = await Account.deploy_account( + # Use `Account.deploy_account_v1` static method to deploy an account + account_deployment_result = await Account.deploy_account_v1( address=address, class_hash=class_hash, salt=salt, 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 9ee8ee09f..6c833d585 100644 --- a/starknet_py/tests/e2e/docs/code_examples/test_account.py +++ b/starknet_py/tests/e2e/docs/code_examples/test_account.py @@ -27,7 +27,7 @@ def test_init(): @pytest.mark.asyncio async def test_execute(account, contract_address): # docs-start: execute - resp = await account.execute( + resp = await account.execute_v1( Call( to_addr=contract_address, selector=get_selector_from_name("increase_balance"), @@ -43,7 +43,7 @@ async def test_execute(account, contract_address): calldata=[123], ) # docs-start: execute - resp = await account.execute(calls=[call1, call2], auto_estimate=True) + resp = await account.execute_v1(calls=[call1, call2], auto_estimate=True) # docs-end: execute 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 79fc063b5..1bfa7f93b 100644 --- a/starknet_py/tests/e2e/docs/guide/test_cairo1_contract.py +++ b/starknet_py/tests/e2e/docs/guide/test_cairo1_contract.py @@ -74,7 +74,7 @@ async def test_cairo1_contract( salt=salt, ) - res = await account.execute(calls=contract_deployment.call, max_fee=MAX_FEE) + res = await account.execute_v1(calls=contract_deployment.call, max_fee=MAX_FEE) await account.client.wait_for_tx(res.transaction_hash) # The contract has been deployed and can be found at contract_deployment.address diff --git a/starknet_py/tests/e2e/docs/guide/test_deploying_with_udc.py b/starknet_py/tests/e2e/docs/guide/test_deploying_with_udc.py index 79059cacd..a40ad3bb8 100644 --- a/starknet_py/tests/e2e/docs/guide/test_deploying_with_udc.py +++ b/starknet_py/tests/e2e/docs/guide/test_deploying_with_udc.py @@ -65,7 +65,7 @@ async def test_deploying_with_udc( ) # Once call is prepared, it can be executed with an account (preferred way) - resp = await account.execute(deploy_call, max_fee=int(1e16)) + resp = await account.execute_v1(deploy_call, max_fee=int(1e16)) # docs: end deploy_call, _ = deployer.create_contract_deployment( diff --git a/starknet_py/tests/e2e/docs/guide/test_executing_transactions.py b/starknet_py/tests/e2e/docs/guide/test_executing_transactions.py index 2dc0892df..80719cf4f 100644 --- a/starknet_py/tests/e2e/docs/guide/test_executing_transactions.py +++ b/starknet_py/tests/e2e/docs/guide/test_executing_transactions.py @@ -13,7 +13,7 @@ async def test_executing_transactions(account, map_contract): to_addr=address, selector=get_selector_from_name("put"), calldata=[20, 20] ) - resp = await account.execute(calls=call, max_fee=int(1e16)) + resp = await account.execute_v1(calls=call, max_fee=int(1e16)) await account.client.wait_for_tx(resp.transaction_hash) # docs: end diff --git a/starknet_py/tests/e2e/docs/guide/test_multicall.py b/starknet_py/tests/e2e/docs/guide/test_multicall.py index cfa40b2bf..84941d706 100644 --- a/starknet_py/tests/e2e/docs/guide/test_multicall.py +++ b/starknet_py/tests/e2e/docs/guide/test_multicall.py @@ -18,7 +18,7 @@ async def test_multicall(account, deployed_balance_contract): calls = [increase_balance_by_20_call, increase_balance_by_20_call] # Execute one transaction with multiple calls - resp = await account.execute(calls=calls, max_fee=int(1e16)) + resp = await account.execute_v1(calls=calls, max_fee=int(1e16)) await account.client.wait_for_tx(resp.transaction_hash) # docs: end diff --git a/starknet_py/tests/e2e/docs/migration_guide/test_account_comparison.py b/starknet_py/tests/e2e/docs/migration_guide/test_account_comparison.py index c37af4611..16e2f40af 100644 --- a/starknet_py/tests/e2e/docs/migration_guide/test_account_comparison.py +++ b/starknet_py/tests/e2e/docs/migration_guide/test_account_comparison.py @@ -40,9 +40,9 @@ async def test_account_comparison(gateway_account, map_contract): # docs-3: start # Using execute method - await account_client.execute(call, max_fee) + await account_client.execute_v1(call, max_fee) # becomes - await account.execute(call, max_fee=max_fee) + await account.execute_v1(call, max_fee=max_fee) # docs-3: end diff --git a/starknet_py/tests/e2e/docs/quickstart/test_using_account.py b/starknet_py/tests/e2e/docs/quickstart/test_using_account.py index 38d3afa9c..f4610f626 100644 --- a/starknet_py/tests/e2e/docs/quickstart/test_using_account.py +++ b/starknet_py/tests/e2e/docs/quickstart/test_using_account.py @@ -45,7 +45,7 @@ async def test_using_account(account, map_compiled_contract): ] # Executes only one transaction with prepared calls - transaction_response = await account.execute(calls=calls, max_fee=int(1e16)) + transaction_response = await account.execute_v1(calls=calls, max_fee=int(1e16)) await account.client.wait_for_tx(transaction_response.transaction_hash) # docs: end diff --git a/starknet_py/tests/e2e/fixtures/accounts.py b/starknet_py/tests/e2e/fixtures/accounts.py index d8f03782b..c7b849dcd 100644 --- a/starknet_py/tests/e2e/fixtures/accounts.py +++ b/starknet_py/tests/e2e/fixtures/accounts.py @@ -213,7 +213,7 @@ async def argent_cairo1_account( class_hash=argent_cairo1_account_class_hash, argent_calldata=True, ) - deploy_result = await Account.deploy_account( + deploy_result = await Account.deploy_account_v1( address=address, class_hash=class_hash, salt=salt, diff --git a/starknet_py/tests/e2e/fixtures/contracts.py b/starknet_py/tests/e2e/fixtures/contracts.py index 632456210..7510d73e3 100644 --- a/starknet_py/tests/e2e/fixtures/contracts.py +++ b/starknet_py/tests/e2e/fixtures/contracts.py @@ -151,7 +151,7 @@ async def deploy_v1_contract( calldata=calldata, cairo_version=1, ) - res = await account.execute(calls=deploy_call, max_fee=MAX_FEE) + res = await account.execute_v1(calls=deploy_call, max_fee=MAX_FEE) await account.client.wait_for_tx(res.transaction_hash) return Contract(address, abi, provider=account, cairo_version=1)