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

Commit

Permalink
Update Account.send API (#218)
Browse files Browse the repository at this point in the history
* fix: update Account.send API

* fix: typo
  • Loading branch information
ericnordelo authored Oct 3, 2022
1 parent 07bc5eb commit 2a2710f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
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
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

0 comments on commit 2a2710f

Please sign in to comment.