Skip to content
This repository has been archived by the owner on Dec 1, 2023. It is now read-only.

Allow hex params in calldata for deployments through Account #318

Merged
merged 4 commits into from
Dec 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/nile/core/account.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,8 @@ async def deploy_contract(
deployer_address or UNIVERSAL_DEPLOYER_ADDRESS
)

max_fee, _, calldata = await self._process_arguments(max_fee, 0, calldata)

await deploy_with_deployer(
self,
contract_name,
Expand Down
7 changes: 5 additions & 2 deletions tests/commands/test_account.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ async def test_declare(mock_declare, mock_get_class, mock_hash, mock_deploy):
@pytest.mark.parametrize("deployer_address", [None, 0xDE0])
@pytest.mark.parametrize("watch_mode", [None, "debug"])
@pytest.mark.parametrize("abi", [None, "TEST_ABI"])
@pytest.mark.parametrize("calldata", [["0x123", 456]])
@pytest.mark.parametrize("overriding_path", [None, PATH])
@patch("nile.core.account.deploy_account", return_value=(MOCK_ADDRESS, MOCK_INDEX))
@patch("nile.core.deploy.get_class_hash", return_value=0x434343)
Expand All @@ -160,6 +161,7 @@ async def test_deploy_contract(
mock_get_class,
mock_deploy,
overriding_path,
calldata,
abi,
watch_mode,
deployer_address,
Expand All @@ -169,7 +171,6 @@ async def test_deploy_contract(
contract_name = "contract"
salt = 4
unique = True
calldata = []
alias = "my_contract"
max_fee = 1

Expand All @@ -190,12 +191,14 @@ async def test_deploy_contract(
deployer_address = normalize_number(UNIVERSAL_DEPLOYER_ADDRESS)

# Check values are correctly passed to 'deploy_with_deployer'
exp_calldata = [normalize_number(x) for x in calldata]

mock_deploy_contract.assert_called_with(
account,
contract_name,
salt,
unique,
calldata,
exp_calldata,
alias,
deployer_address,
max_fee,
Expand Down