Browse Source

Listtransactions

jl777
jl777 7 years ago
parent
commit
4a164ff1fc
  1. 6
      iguana/exchanges/LP_commands.c
  2. 21
      iguana/exchanges/LP_rpc.c
  3. 3
      iguana/exchanges/listtransactions

6
iguana/exchanges/LP_commands.c

@ -607,6 +607,12 @@ jpg(srcfile, destfile, power2=7, password, data="", required, ind=0)\n\
{
return(LP_unlockedspend(ctx,coin,jbits256(argjson,"txid")));
}
// cJSON *LP_listtransactions(char *symbol,char *coinaddr,int32_t count,int32_t skip)
else if ( strcmp(method,"listtransactions") == 0 )
{
if ( (ptr= LP_coinfind(coin)) != 0 )
return(jprint(LP_listtransactions(coin,ptr->smartaddr,juint(argjson,"count"),juint(argjson,"skip")),1));
}
else if ( strcmp(method,"getrawtransaction") == 0 )
{
return(jprint(LP_gettx("stats_JSON",coin,jbits256(argjson,"txid"),0),1));

21
iguana/exchanges/LP_rpc.c

@ -495,6 +495,27 @@ cJSON *LP_listreceivedbyaddress(char *symbol,char *coinaddr)
} else return(electrum_address_gethistory(symbol,coin->electrum,&retjson,coinaddr,zero));
}
cJSON *LP_listtransactions(char *symbol,char *coinaddr,int32_t count,int32_t skip)
{
char buf[128],*addr; bits256 zero; cJSON *retjson,*array,*item; int32_t i,n; struct iguana_info *coin;
if ( symbol == 0 || symbol[0] == 0 )
return(cJSON_Parse("{\"error\":\"null symbol\"}"));
coin = LP_coinfind(symbol);
if ( coin == 0 || (IAMLP == 0 && coin->inactive != 0) )
return(cJSON_Parse("{\"error\":\"no coin\"}"));
memset(zero.bytes,0,sizeof(zero));
if ( coin->electrum == 0 )
{
if ( count == 0 )
count = 10;
sprintf(buf,"[\"\", %d, %d, true]",count,skip);
if ( (array= bitcoin_json(coin,"listtransactions",buf)) != 0 )
return(array);
elsereturn(cJSON_Parse("[]"));
} else return(electrum_address_gethistory(symbol,coin->electrum,&retjson,coinaddr,zero));
}
int64_t LP_listunspent_parseitem(struct iguana_info *coin,bits256 *txidp,int32_t *voutp,int32_t *heightp,cJSON *item)
{
int64_t satoshis = 0;

3
iguana/exchanges/listtransactions

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