-
Notifications
You must be signed in to change notification settings - Fork 76
Add nile-account
flag to set Nile artifacts path
#315
Changes from all commits
de7a04b
4996bdc
d639ffa
f44e22d
8bbc137
c57224c
8052418
3b55c9e
4c482bd
1d879f4
72b9c25
e8e0edf
8c26a0b
7722a76
3419026
9965aa3
cac7199
1991538
1086930
835d310
5033b53
0e2df27
e96e95f
96e3e1d
825ff94
28ae116
424bc90
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -129,7 +129,7 @@ async def deploy( | |
): | ||
"""Deploy a StarkNet smart contract.""" | ||
if not ignore_account: | ||
account = await Account(signer, network) | ||
account = await Account(signer, network, watch_mode=watch_mode) | ||
await account.deploy_contract( | ||
contract_name, | ||
salt, | ||
|
@@ -159,6 +159,7 @@ async def deploy( | |
@click.option("--max_fee", nargs=1) | ||
@click.option("--alias") | ||
@click.option("--overriding_path") | ||
@click.option("--nile_account", is_flag=True) | ||
@network_option | ||
@mainnet_token_option | ||
@watch_option | ||
|
@@ -171,16 +172,18 @@ async def declare( | |
alias, | ||
overriding_path, | ||
token, | ||
nile_account, | ||
): | ||
"""Declare a StarkNet smart contract through an Account.""" | ||
account = await Account(signer, network) | ||
account = await Account(signer, network, watch_mode=watch_mode) | ||
await account.declare( | ||
contract_name, | ||
alias=alias, | ||
max_fee=max_fee, | ||
overriding_path=overriding_path, | ||
mainnet_token=token, | ||
watch_mode=watch_mode, | ||
nile_account=nile_account, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what about making it a constructor argument and object attribute? i.e. it could be leaner if we eventually need it for other operations, and it would debloat the function's arguments. although right now it's the same since it's just here There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can maybe add this in the future, but I don't think this would work here. The point of IMO a better fix would be to iterate both paths checking for the target contract. That way, we don't have to worry about any of this. I already have a working example of this improvement, but for the sake of getting this shipped, I decided not to include it |
||
) | ||
|
||
|
||
|
@@ -228,7 +231,7 @@ async def send( | |
watch_mode, | ||
): | ||
"""Invoke a contract's method through an Account.""" | ||
account = await Account(signer, network) | ||
account = await Account(signer, network, watch_mode=watch_mode) | ||
print( | ||
"Calling {} on {} with params: {}".format( | ||
method, address_or_alias, [x for x in params] | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,11 +9,14 @@ | |
|
||
from nile.utils import normalize_number, str_to_felt | ||
|
||
pt = os.path.dirname(os.path.realpath(__file__)).replace("/core", "") | ||
CONTRACTS_DIRECTORY = "contracts" | ||
BUILD_DIRECTORY = "artifacts" | ||
TEMP_DIRECTORY = ".temp" | ||
ABIS_DIRECTORY = f"{BUILD_DIRECTORY}/abis" | ||
NILE_ROOT_PATH = os.path.dirname(os.path.realpath(__file__)).replace("/core", "") | ||
NILE_BUILD_DIR = f"{NILE_ROOT_PATH}/{BUILD_DIRECTORY}" | ||
NILE_ABIS_DIR = f"{NILE_ROOT_PATH}/{ABIS_DIRECTORY}" | ||
NILE_ARTIFACTS_PATH = (NILE_BUILD_DIR, NILE_ABIS_DIR) | ||
DEPLOYMENTS_FILENAME = "deployments.txt" | ||
DECLARATIONS_FILENAME = "declarations.txt" | ||
ACCOUNTS_FILENAME = "accounts.json" | ||
|
@@ -22,7 +25,7 @@ | |
TRANSACTION_VERSION = 1 | ||
QUERY_VERSION_BASE = 2**128 | ||
QUERY_VERSION = QUERY_VERSION_BASE + TRANSACTION_VERSION | ||
ETH_TOKEN_ABI = f"{pt}/artifacts/abis/ERC20.json" | ||
ETH_TOKEN_ABI = f"{NILE_ABIS_DIR}/ERC20.json" | ||
ETH_TOKEN_ADDRESS = "0x49D36570D4E46F48E99674BD3FCC84644DDD6B96F7C741B1562B82F9E004DC7" | ||
UNIVERSAL_DEPLOYER_ADDRESS = ( | ||
# subject to change | ||
|
@@ -137,8 +140,7 @@ def get_class_hash(contract_name, overriding_path=None): | |
|
||
def get_account_class_hash(contract="Account"): | ||
"""Return the class_hash of an Account contract.""" | ||
pt = os.path.dirname(os.path.realpath(__file__)).replace("/core", "") | ||
overriding_path = (f"{pt}/artifacts", f"{pt}/artifacts/abis") | ||
overriding_path = (NILE_BUILD_DIR, NILE_ABIS_DIR) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 😍 |
||
return get_class_hash(contract, overriding_path=overriding_path) | ||
|
||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you add tests for this?