diff --git a/iguana/exchanges/LP_commands.c b/iguana/exchanges/LP_commands.c index fe548f12a..8263111c6 100644 --- a/iguana/exchanges/LP_commands.c +++ b/iguana/exchanges/LP_commands.c @@ -116,6 +116,7 @@ pricearray(base, rel, starttime=0, endtime=0, timescale=60) -> [timestamp, avebi getrawtransaction(coin, txid)\n\ inventory(coin, reset=0, [passphrase=])\n\ lastnonce()\n\ +cancel(uuid)\n\ buy(base, rel, price, relvolume, timeout=10, duration=3600, nonce)\n\ sell(base, rel, price, basevolume, timeout=10, duration=3600, nonce)\n\ withdraw(coin, outputs[], broadcast=0)\n\ @@ -304,6 +305,10 @@ jpg(srcfile, destfile, power2=7, password, data="", required, ind=0)\n\ LP_deletemessages(jint(argjson,"firsti"),jint(argjson,"num")); return(clonestr("{\"result\":\"success\"}")); }*/ + else if ( strcmp(method,"cancel") == 0 ) + { + return(LP_cancel_order(jstr(argjson,"uuid"))); + } else if ( strcmp(method,"recentswaps") == 0 ) { return(LP_recent_swaps(jint(argjson,"limit"),0)); diff --git a/iguana/exchanges/LP_ordermatch.c b/iguana/exchanges/LP_ordermatch.c index 346287e6b..81b92cf71 100644 --- a/iguana/exchanges/LP_ordermatch.c +++ b/iguana/exchanges/LP_ordermatch.c @@ -623,6 +623,17 @@ int32_t LP_alice_eligible(uint32_t quotetime) return(Alice_expiration == 0 || time(NULL) < Alice_expiration); } +char *LP_cancel_order(char *uuidstr) +{ + if ( uuidstr != 0 && strcmp(LP_Alicequery.uuidstr[0],uuidstr) == 0 ) + { + LP_failedmsg(LP_Alicequery.R.requestid,LP_Alicequery.R.quoteid,-9998,LP_Alicequery.uuidstr); + LP_alicequery_clear(); + clonestr("{\"result\":\"success\",\"status\":\"uuid canceled\"}") + } + return(clonestr("{\"error\":\"uuid not cancellable\"}")); +} + char *LP_connectedalice(struct LP_quoteinfo *qp,char *pairstr) // alice { cJSON *retjson; char otheraddr[64],*msg; double bid,ask,price,qprice; int32_t pairsock = -1; int32_t DEXselector = 0; struct LP_utxoinfo *autxo,A,B,*butxo; struct basilisk_swap *swap; struct iguana_info *coin;