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

Commit

Permalink
Merge pull request #4283 from golemfactory/payment_cli
Browse files Browse the repository at this point in the history
Fix golemcli account info
  • Loading branch information
jiivan authored Jun 6, 2019
2 parents be842fc + 3566ebf commit 7c15833
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
15 changes: 12 additions & 3 deletions golem/interface/client/account.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import datetime
import getpass
import sys
from typing import Dict, Any
from typing import (
Any,
Dict,
TYPE_CHECKING,
)

from decimal import Decimal
from ethereum.utils import denoms
Expand All @@ -11,13 +15,17 @@
from golem.core.deferred import sync_wait
from golem.interface.command import Argument, command, group

if TYPE_CHECKING:
# pylint: disable=unused-import
from golem.rpc.session import ClientProxy

MIN_LENGTH = 5
MIN_SCORE = 2


@group(help="Manage account")
class Account:
client = None
client: 'ClientProxy'

amount_arg = Argument('amount', help='Amount to withdraw, eg 1.45')
address_arg = Argument('destination', help='Address to send the funds to')
Expand All @@ -37,7 +45,8 @@ def info(self) -> Dict[str, Any]: # pylint: disable=no-self-use

computing_trust = sync_wait(client.get_computing_trust(node_key))
requesting_trust = sync_wait(client.get_requesting_trust(node_key))
payment_address = sync_wait(client.get_payment_address())
# pylint: disable=protected-access
payment_address = sync_wait(client._call('pay.ident'))

balance = sync_wait(client.get_balance())

Expand Down
7 changes: 6 additions & 1 deletion tests/golem/interface/test_client_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,12 @@ def test_show(self):
client.get_node.return_value = node
client.get_computing_trust.return_value = .01
client.get_requesting_trust.return_value = .02
client.get_payment_address.return_value = 'f0f0f0ababab'

def call(uri, *_args, **_kwargs):
if uri == 'pay.ident':
return 'f0f0f0ababab'
return None
client._call.side_effect = call
client.get_balance.return_value = {
'gnt': 3 * denoms.ether,
'av_gnt': 2 * denoms.ether,
Expand Down

0 comments on commit 7c15833

Please sign in to comment.