|
@ -105,25 +105,21 @@ char *issue_LP_getprices(char *destip,uint16_t destport) |
|
|
|
|
|
|
|
|
char *LP_apicall(struct iguana_info *coin,char *method,char *params) |
|
|
char *LP_apicall(struct iguana_info *coin,char *method,char *params) |
|
|
{ |
|
|
{ |
|
|
cJSON *retjson,*resultjson; char *retstr; |
|
|
cJSON *retjson; char *retstr; |
|
|
if ( coin->electrum != 0 ) |
|
|
if ( coin->electrum != 0 ) |
|
|
{ |
|
|
{ |
|
|
if ( (retjson= electrum_submit(coin->symbol,coin->electrum,&retjson,method,params,LP_HTTP_TIMEOUT)) != 0 ) |
|
|
if ( (retjson= electrum_submit(coin->symbol,coin->electrum,&retjson,method,params,LP_HTTP_TIMEOUT)) != 0 ) |
|
|
{ |
|
|
{ |
|
|
printf("got.%p (%s)\n",retjson,jprint(retjson,0)); |
|
|
retstr = jprint(retjson,0); |
|
|
if ( (resultjson= jobj(retjson,"result")) != 0 ) |
|
|
//printf("got.%p (%s)\n",retjson,retstr);
|
|
|
{ |
|
|
|
|
|
retstr = jprint(resultjson,0); |
|
|
|
|
|
free_json(retjson); |
|
|
|
|
|
return(retstr); |
|
|
return(retstr); |
|
|
} else return(jprint(retjson,1)); |
|
|
|
|
|
} return(clonestr("{\"error\":\"electrum no response\"}")); |
|
|
} return(clonestr("{\"error\":\"electrum no response\"}")); |
|
|
} else return(bitcoind_passthru(coin->symbol,coin->serverport,coin->userpass,method,params)); |
|
|
} else return(bitcoind_passthru(coin->symbol,coin->serverport,coin->userpass,method,params)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
cJSON *bitcoin_json(struct iguana_info *coin,char *method,char *params) |
|
|
cJSON *bitcoin_json(struct iguana_info *coin,char *method,char *params) |
|
|
{ |
|
|
{ |
|
|
cJSON *resultjson,*retjson = 0; char *retstr; |
|
|
cJSON *retjson = 0; char *retstr; |
|
|
// "getinfo", "getrawmempool", "paxprice", "gettxout", "getrawtransaction", "getblock", "listunspent", "listtransactions", "validateaddress", "importprivkey"
|
|
|
// "getinfo", "getrawmempool", "paxprice", "gettxout", "getrawtransaction", "getblock", "listunspent", "listtransactions", "validateaddress", "importprivkey"
|
|
|
// bitcoind_passthru callers: "importaddress", "estimatefee", "getblockhash", "sendrawtransaction", "signrawtransaction"
|
|
|
// bitcoind_passthru callers: "importaddress", "estimatefee", "getblockhash", "sendrawtransaction", "signrawtransaction"
|
|
|
if ( coin != 0 ) |
|
|
if ( coin != 0 ) |
|
@ -146,12 +142,12 @@ cJSON *bitcoin_json(struct iguana_info *coin,char *method,char *params) |
|
|
if ( (retjson= electrum_submit(coin->symbol,coin->electrum,&retjson,method,params,LP_HTTP_TIMEOUT)) != 0 ) |
|
|
if ( (retjson= electrum_submit(coin->symbol,coin->electrum,&retjson,method,params,LP_HTTP_TIMEOUT)) != 0 ) |
|
|
{ |
|
|
{ |
|
|
//printf("electrum %s.%s -> (%s)\n",method,params,jprint(retjson,0));
|
|
|
//printf("electrum %s.%s -> (%s)\n",method,params,jprint(retjson,0));
|
|
|
if ( (resultjson= jobj(retjson,"result")) != 0 ) |
|
|
/*if ( (resultjson= jobj(retjson,"result")) != 0 )
|
|
|
{ |
|
|
{ |
|
|
resultjson = jduplicate(resultjson); |
|
|
resultjson = jduplicate(resultjson); |
|
|
free_json(retjson); |
|
|
free_json(retjson); |
|
|
retjson = resultjson; |
|
|
retjson = resultjson; |
|
|
} |
|
|
}*/ |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} else retjson = cJSON_Parse("{\"result\":\"disabled\"}"); |
|
|
} else retjson = cJSON_Parse("{\"result\":\"disabled\"}"); |
|
|