jl777 7 years ago
parent
commit
a6b934d24d
  1. 10
      iguana/exchanges/LP_utxo.c
  2. 2
      iguana/exchanges/balance
  3. 2
      iguana/exchanges/install

10
iguana/exchanges/LP_utxo.c

@ -296,16 +296,20 @@ cJSON *LP_address_utxos(struct iguana_info *coin,char *coinaddr,int32_t electrum
cJSON *LP_address_balance(struct iguana_info *coin,char *coinaddr,int32_t electrumret) cJSON *LP_address_balance(struct iguana_info *coin,char *coinaddr,int32_t electrumret)
{ {
cJSON *array,*retjson; double balance = 0.; cJSON *array,*retjson; int32_t i,n; uint64_t balance = 0;
if ( (array= LP_address_utxos(coin,coinaddr,1)) != 0 ) if ( (array= LP_address_utxos(coin,coinaddr,1)) != 0 )
{ {
if ( (n= cJSON_GetArraySize(array)) > 0 )
{
for (i=0; i<n; i++)
balance += j64bits(jitem(array,i),"value");
}
} }
retjson = cJSON_CreateObject(); retjson = cJSON_CreateObject();
jaddstr(retjson,"result","success"); jaddstr(retjson,"result","success");
jaddstr(retjson,"coin",coin->symbol); jaddstr(retjson,"coin",coin->symbol);
jaddstr(retjson,"address",coinaddr); jaddstr(retjson,"address",coinaddr);
jaddnum(retjson,"balance",balance); jaddnum(retjson,"balance",dstr(balance));
return(retjson); return(retjson);
} }

2
iguana/exchanges/balance

@ -1,3 +1,3 @@
#!/bin/bash #!/bin/bash
source userpass source userpass
curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"balance\",\"coin\":\"BTC\",\"address\":\"1DPDsPCNNCF5SHhPPrddXcJe78rM6CBcH3\"}" curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"balance\",\"coin\":\"KMD\",\"address\":\"RHV2As4rox97BuE3LK96vMeNY8VsGRTmBj\"}"

2
iguana/exchanges/install

@ -1,5 +1,5 @@
#!/bin/bash #!/bin/bash
cp electrum snapshot_balance snapshot_loop secretaddresses dividends snapshot goals goal portfolio autoprice deletemessages getmessages debug register registerall buy sell bestfit orderbook client run_osx client_osx run coins disable enable myprice myprices getcoins getpeers getpeersIP getprices getutxos help inv setprice status utxos ../dexscripts cp balance listunspent electrum snapshot_balance snapshot_loop secretaddresses dividends snapshot goals goal portfolio autoprice deletemessages getmessages debug register registerall buy sell bestfit orderbook client run_osx client_osx run coins disable enable myprice myprices getcoins getpeers getpeersIP getprices getutxos help inv setprice status utxos ../dexscripts
cd ../dexscripts cd ../dexscripts
#cp ../exchanges/passphrase ../exchanges/userpass . #cp ../exchanges/passphrase ../exchanges/userpass .
#echo you will need to have a passphrase file with your passphrase and userpass file with userpass value in dexscripts dir #echo you will need to have a passphrase file with your passphrase and userpass file with userpass value in dexscripts dir

Loading…
Cancel
Save