Browse Source

Inuse api

patch-3
jl777 7 years ago
parent
commit
9d1ce395e8
  1. 5
      iguana/exchanges/LP_commands.c
  2. 21
      iguana/exchanges/LP_utxo.c
  3. 3
      iguana/exchanges/inuse

5
iguana/exchanges/LP_commands.c

@ -140,6 +140,7 @@ balances(address)\n\
fundvalue(address="", holdings=[], divisor=0)\n\
orderbook(base, rel, duration=3600)\n\
getprices()\n\
inuse()\n\
getmyprice(base, rel)\n\
getprice(base, rel)\n\
//sendmessage(base=coin, rel="", pubkey=zero, <argjson method2>)\n\
@ -527,6 +528,10 @@ jpg(srcfile, destfile, power2=7, password, data="", required, ind=0)\n\
{
return(LP_sendrawtransaction(coin,jstr(argjson,"signedtx")));
}
else if ( strcmp(method,"inuse") == 0 )
{
return(jprint(LP_inuse_json(),1));
}
else if ( strcmp(method,"getrawtransaction") == 0 )
{
return(jprint(LP_gettx(coin,jbits256(argjson,"txid"),0),1));

21
iguana/exchanges/LP_utxo.c

@ -27,6 +27,27 @@ struct LP_inuse_info
} LP_inuse[1024];
int32_t LP_numinuse;
cJSON *LP_inuse_json()
{
int32_t i; cJSON *item,*array; struct LP_inuse_info *lp;
array = cJSON_CreateArray();
for (i=0; i<LP_numinuse; i++)
{
lp = &LP_inuse[i];
if ( lp->expiration != 0 )
{
item = cJSON_CreateObject();
jaddnum(item,"expiration",lp->expiration);
jaddbits256(item,"txid",lp->txid);
jaddnum(item,"vout",lp->vout);
if ( bits256_nonz(lp->otherpub) != 0 )
jaddbits256(item,"otherpub",lp->otherpub);
jaddi(array,item);
}
}
return(array);
}
struct LP_inuse_info *_LP_inuse_find(bits256 txid,int32_t vout)
{
int32_t i;

3
iguana/exchanges/inuse

@ -0,0 +1,3 @@
#!/bin/bash
source userpass
curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"inuse\"}"
Loading…
Cancel
Save