Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

native currency not show with "getaddressbalances" function in non-owned wallets #36

Open
agramajo opened this issue Jan 29, 2018 · 0 comments

Comments

@agramajo
Copy link

Hi,

With this approach in code (use getaddressbalances), we can not see the balance in non-owned wallet.

multichain-explorer/Mce/abe.py

Lines 1854 to 1874 in 4f0749d

# Display native currency if the blockchain has one
if abe.get_blockchainparams(chain).get('initial-block-reward', 0) > 0:
body += ['<h3>Native Balance</h3>']
try:
resp = util.jsonrpc(multichain_name, url, "getaddressbalances", address)
if len(resp) is 0:
body += ['None']
else:
body += ['<ul>']
for balance in resp:
if str(balance['assetref']) is '':
body += ['<li>', str(balance['qty']), '</li>']
body += ['</ul>']
except util.JsonrpcException as e:
msg= "Failed to get balance for address: JSON-RPC error({0}): {1}".format(e.code, e.message)
body += ['<div class="alert alert-danger" role="warning">', msg, '</div>']
return
except IOError as e:
msg= "Failed to get balance for address: I/O error({0}): {1}".format(e.errno, e.strerror)
body += ['<div class="alert alert-danger" role="alert">', msg, '</div>']
return
)

Check this:

node1 (seed and with multichain explorer):

chain1: getaddressbalances 1BjxiATbrwntty1PQx95kk3fcV6FKNWAq4y3e7
{"method":"getaddressbalances","params":["1BjxiATbrwntty1PQx95kk3fcV6FKNWAq4y3e7"],"id":1,"chain_name":"chain1"}

[
    {
        "assetref" : "",
        "qty" : 0.00000000,
        "raw" : 0
    }
]

chain1: getaddresses                                             
{"method":"getaddresses","params":[],"id":1,"chain_name":"chain1"}

[
    "1DMsbx13P5iP42DLmdPiWmVCwRNQDPSo13b2PP"
]

chain1: getaddressbalances 1DMsbx13P5iP42DLmdPiWmVCwRNQDPSo13b2PP
{"method":"getaddressbalances","params":["1DMsbx13P5iP42DLmdPiWmVCwRNQDPSo13b2PP"],"id":1,"chain_name":"chain1"}

[
    {
        "assetref" : "",
        "qty" : 1000015.00000000,
        "raw" : 100001500000000
    }
]

Explorer address 1DMsbx13P5iP42DLmdPiWmVCwRNQDPSo13b2PP

image

node2: with address 1BjxiATbrwntty1PQx95kk3fcV6FKNWAq4y3e7

chain1: getaddresses           
{"method":"getaddresses","params":[],"id":1,"chain_name":"chain1"}

[
    "1BjxiATbrwntty1PQx95kk3fcV6FKNWAq4y3e7"
]
chain1: getaddressbalances 1BjxiATbrwntty1PQx95kk3fcV6FKNWAq4y3e7
{"method":"getaddressbalances","params":["1BjxiATbrwntty1PQx95kk3fcV6FKNWAq4y3e7"],"id":1,"chain_name":"chain1"}

[
    {
        "assetref" : "",
        "qty" : 12.00000000,
        "raw" : 1200000000
    }
]

Explorer address 1BjxiATbrwntty1PQx95kk3fcV6FKNWAq4y3e7

image

Do you know if exists a better solution? I am starting to dig in the code to understand and try to fix it.

Regards and thanks for Multichain.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant