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

Update Account.send API #218

Merged
merged 2 commits into from
Oct 3, 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
3 changes: 1 addition & 2 deletions src/nile/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,7 @@ def send(signer, address_or_alias, method, params, network, max_fee=None):
method, address_or_alias, [x for x in params]
)
)
if not is_alias(address_or_alias):
address_or_alias = normalize_number(address_or_alias)
# Account.send is part of the public API, so it accepts addresses as string
ericnordelo marked this conversation as resolved.
Show resolved Hide resolved
out = account.send(address_or_alias, method, params, max_fee=max_fee)
print(out)

Expand Down
10 changes: 4 additions & 6 deletions src/nile/core/account.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from dotenv import load_dotenv

from nile import accounts, deployments
from nile.common import is_alias
from nile.core.call_or_invoke import call_or_invoke
from nile.core.deploy import deploy
from nile.utils import normalize_number
Expand Down Expand Up @@ -77,13 +78,10 @@ def deploy(self):
return address, index

def send(self, address_or_alias, method, calldata, max_fee, nonce=None):
"""
Execute a tx going through an Account contract.
"""Execute a tx going through an Account contract."""
if not is_alias(address_or_alias):
address_or_alias = normalize_number(address_or_alias)

If address_or_alias is an int, address is assumed.

If address_or_alias is a str, alias is assumed.
"""
target_address, _ = (
next(deployments.load(address_or_alias, self.network), None)
or address_or_alias
Expand Down