Skip to content

Commit

Permalink
Use v3 in test_account_sign_without_execute
Browse files Browse the repository at this point in the history
  • Loading branch information
franciszekjob committed Jan 9, 2025
1 parent 16a27b4 commit 42d1372
Showing 1 changed file with 12 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import pytest

from starknet_py.net.account.account import Account
from starknet_py.net.models.transaction import DeclareV2, DeployAccountV1, InvokeV1
from starknet_py.net.client_models import ResourceBounds
from starknet_py.net.models.transaction import DeclareV3, DeployAccountV3, InvokeV3


@pytest.mark.asyncio
Expand All @@ -16,31 +17,33 @@ async def test_account_sign_without_execute(
compiled_contract,
compiled_class_hash,
) = sierra_minimal_compiled_contract_and_class_hash
max_fee = 100000
resource_bounds = ResourceBounds(max_amount=5000, max_price_per_unit=int(1e12))

# docs: start
from starknet_py.net.client_models import Call

# Create a signed Invoke transaction
call = Call(to_addr=address, selector=selector, calldata=calldata)
invoke_transaction = await account.sign_invoke_v1(call, max_fee=max_fee)
invoke_transaction = await account.sign_invoke_v3(
call, l1_resource_bounds=resource_bounds
)

# Create a signed Declare transaction
declare_transaction = await account.sign_declare_v2(
declare_transaction = await account.sign_declare_v3(
compiled_contract,
compiled_class_hash=compiled_class_hash,
auto_estimate=True,
)

# Create a signed DeployAccount transaction
deploy_account_transaction = await account.sign_deploy_account_v1(
deploy_account_transaction = await account.sign_deploy_account_v3(
class_hash=class_hash,
contract_address_salt=salt,
constructor_calldata=calldata,
max_fee=max_fee,
l1_resource_bounds=resource_bounds,
)
# docs: end

assert isinstance(invoke_transaction, InvokeV1)
assert isinstance(declare_transaction, DeclareV2)
assert isinstance(deploy_account_transaction, DeployAccountV1)
assert isinstance(invoke_transaction, InvokeV3)
assert isinstance(declare_transaction, DeclareV3)
assert isinstance(deploy_account_transaction, DeployAccountV3)

0 comments on commit 42d1372

Please sign in to comment.