From 518ab483ae866892bc1fddc84a3f4ec96dc07e33 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 27 Oct 2017 12:58:34 +0300 Subject: [PATCH] Test --- iguana/exchanges/LP_commands.c | 8 +++++++- iguana/exchanges/LP_remember.c | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/iguana/exchanges/LP_commands.c b/iguana/exchanges/LP_commands.c index dcd987aee..0dbb60c1c 100644 --- a/iguana/exchanges/LP_commands.c +++ b/iguana/exchanges/LP_commands.c @@ -116,8 +116,10 @@ sell(base, rel, price, basevolume, timeout=10, duration=3600, nonce, pubkey="")\ withdraw(coin, outputs[])\n\ sendrawtransaction(coin, signedtx)\n\ swapstatus()\n\ -recentswaps(limit=3)\n\ +swapstatus(coin)\n\ +swapstatus(base, rel)\n\ swapstatus(requestid, quoteid)\n\ +recentswaps(limit=3)\n\ public API:\n \ getcoins()\n\ getcoin(coin)\n\ @@ -422,6 +424,10 @@ stop()\n\ uint32_t requestid,quoteid; if ( (requestid= juint(argjson,"requestid")) != 0 && (quoteid= juint(argjson,"quoteid")) != 0 ) return(basilisk_swapentry(requestid,quoteid)); + else if ( coin != 0 && coin[0] != 0 ) + return(basilisk_swapentries(coin,0)); + else if ( base != 0 && base[0] != 0 && rel != 0 && rel[0] != 0 ) + return(basilisk_swapentries(base,rel)); else return(basilisk_swaplist(0,0)); } else if ( strcmp(method,"lastnonce") == 0 ) diff --git a/iguana/exchanges/LP_remember.c b/iguana/exchanges/LP_remember.c index c5dfc1c56..b0738f0c6 100644 --- a/iguana/exchanges/LP_remember.c +++ b/iguana/exchanges/LP_remember.c @@ -1256,6 +1256,38 @@ char *basilisk_swapentry(uint32_t requestid,uint32_t quoteid) return(retstr); } +char *basilisk_swapentries(char *refbase,char *refrel) +{ + char *liststr,*base,*rel; cJSON *retjson,*array,*item,*retarray; int32_t i,n; + retarray = cJSON_CreateArray(); + if ( (liststr= basilisk_swaplist(0,0)) != 0 ) + { + //printf("swapentry.(%s)\n",liststr); + if ( (retjson= cJSON_Parse(liststr)) != 0 ) + { + if ( (array= jarray(&n,retjson,"swaps")) != 0 ) + { + for (i=0; i