From 5de1d1aab193ca877c38e5ed64d8c8a2d01d07ca Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 27 Jul 2018 01:41:30 -1100 Subject: [PATCH] Asset list --- src/cc/CCassetstx.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/cc/CCassetstx.cpp b/src/cc/CCassetstx.cpp index 3700f4db7..4f3682855 100644 --- a/src/cc/CCassetstx.cpp +++ b/src/cc/CCassetstx.cpp @@ -83,7 +83,20 @@ UniValue AssetInfo(uint256 assetid) UniValue AssetList() { - UniValue result(UniValue::VOBJ); + UniValue result(UniValue::VARR); std::vector > addressIndex; struct CCcontract_info *cp,C; uint256 txid; CTransaction vintx; std::vector origpubkey; std::string name,description; char str[65]; + cp = CCinit(&C,EVAL_ASSETS); + SetCCtxids(addressIndex,cp->normaladdr); + for (std::vector >::const_iterator it=unspentOutputs.begin(); it!=unspentOutputs.end(); it++) + { + txid = it->first.txhash; + if ( GetTransaction(txid,vintx,hashBlock,false) != 0 ) + { + if ( vintx.vout.size() > 0 && DecodeAssetCreateOpRet(vintx.vout[vintx.vout.size()-1].scriptPubKey,origpubkey,name,description) != 0 ) + { + result.push_back(uint256_str(str,txid)); + } + } + } return(result); }