Comments (1)
i can reformat handler like this in Mce/abe.py
http://127.0.0.1:7074/Celtoken/getaddressbalances/17iZJ8gbitwcMeufCzgNNb2XmreMJwRGGPpEPR
{"hash": 1, "result": [{"qty": 2498, "name": "celtoken", "assetref": "181-267-63185"}], "error": null}
hope someone helps
def handle_getaddressbalances(abe, page):
chain = page['chain']
page['template'] = "%(body)s"
page['body'] = "";
#page['body'] += "ok";
#page['body'] +=json.dumps({'4': 5, '6': 7}, sort_keys=True,indent=4, separators=(',', ': '));
data = {};
data["result"] = [];
address = wsgiref.util.shift_path_info(page['env'])
if address in (None, '') or page['env']['PATH_INFO'] != '':
raise PageNotFound()
version, pubkeyhash = util.decode_check_address_multichain(address)
if pubkeyhash is None:
raise PageNotFound()
try:
row = abe.store.selectrow("""select pubkey_id from pubkey where pubkey_hash = ?""",
(abe.store.binin(pubkeyhash),) )
assets_resp = abe.store.get_assets(chain)
if len(assets_resp) is 0:
body += ['None']
elif row is not None:
pubkey_id = int(row[0])
assetdict = {}
for asset in assets_resp:
# use escaped form as dict key
name = asset.get('name','').encode('unicode-escape')
assetdict[name] = asset
print(assetdict);
for row in abe.store.selectall("""
select a.name, a.prefix, b.balance from asset_address_balance b join asset a on (a.asset_id=b.asset_id)
where b.balance>0 and b.pubkey_id=?""",
(pubkey_id, )):
name, prefix, balance = row
if name is None:
name=''
name = name.encode('unicode-escape')
asset = assetdict[ name ]
assetref = asset['assetref']
num_tx = abe.store.get_number_of_transactions_for_asset_address(chain, assetref, pubkey_id)
if assetref.endswith(str(prefix)):
balance_display_qty = util.format_display_quantity(asset, balance)
#{"result":[{"name":"celtoken","assetref":"181-267-63185","qty":2466}],"error":null,"id":1510266218,"hash":"aee3bc630b94161ca2817f1f8b326328"}
print(escape(chain.name))
data["result"].append({"name":name,"assetref":assetref,"qty":balance})
#body += ['</table>']
data["error"]=None;
data["hash"]=1;
except Exception as e:
print( ['<div class="alert alert-danger" role="alert">', 'Failed to get asset information: '+str(e), '</div>']);
data["error"]=str(e);
data["hash"]=1;
pass
page['body'] += json.dumps(data);
return;
from multichain-explorer.
Related Issues (20)
- Sometimes explore is very slowly HOT 2
- It will always be "connection refused" and multichaind will always to abort HOT 2
- RPC failed: [Errno socket error] [Errno 111] Connection refused catch_up_rpc: abort
- Assetref encoded
- Can't use MySQL db HOT 2
- sendwithdata - show raw data or json in explorer
- getaddressbalances and getunspent
- native currency not show with "getaddressbalances" function in non-owned wallets
- Mysql & Postgresql
- SQL - not working HOT 1
- Is it possible to use Mongodb ?
- code to show amount ?
- Configuration of Multichain.conf
- KeyError: '5a8ec07be00d3cf3824377aa0f1cfb7c' HOT 1
- [Questions] Is possibile to run multichain for CryptoNight algoritm? HOT 2
- Multichain 2.0 Support HOT 7
- Dangerous use of .index in Parse Functions (Error on parse_new_issuance_metadata_10007) HOT 2
- Error while syncing blocks HOT 2
- Multichain-Explorer Status No Connection
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from multichain-explorer.