Skip to content
Open
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
6 changes: 3 additions & 3 deletions pyhmy/blockchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -718,9 +718,9 @@ def get_total_supply(
"""
method = "hmyv2_getTotalSupply"
try:
rpc_request( method,
endpoint = endpoint,
timeout = timeout )[ "result" ]
return rpc_request( method,
endpoint = endpoint,
timeout = timeout )[ "result" ]
except KeyError as exception:
raise InvalidRPCReplyError( method, endpoint ) from exception

Expand Down
13 changes: 13 additions & 0 deletions tests/request-pyhmy/test_blockchain_return_values.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from pyhmy import blockchain


def test_get_total_supply_returns_rpc_result( monkeypatch ):
expected = "15260238647.49999999480981481"

def mock_rpc_request( method, endpoint = None, timeout = None ):
assert method == "hmyv2_getTotalSupply"
return { "result": expected }

monkeypatch.setattr( blockchain, "rpc_request", mock_rpc_request )

assert blockchain.get_total_supply() == expected