Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
4de5208a04
  1. 55
      deprecated/obsolete.h
  2. 1
      iguana/iguana_wallet.c
  3. 47
      iguana/main.c

55
deprecated/obsolete.h

@ -18543,6 +18543,61 @@ len = 0;
printf("wt %.8f P.%d -> [%d] pkind.%d deposits %.8f spent %.8f\n",dstr(weights[pkind]),pkind,i,p.pkind,dstr(deposits),dstr(spent)); printf("wt %.8f P.%d -> [%d] pkind.%d deposits %.8f spent %.8f\n",dstr(weights[pkind]),pkind,i,p.pkind,dstr(deposits),dstr(spent));
} }
} }
/*if ( (retstr= iguana_orderbook("bitfinex","BTC","USD",10)) != 0 )
{
if ( (aveprice= tradebots_update(&Fbtc_usd,"bitfinex","BTC","USD",retstr,1)) != 0 )
{
Fbtc = _pairaved(avebtc,aveprice);
avebtc = _pairaved(Ebtc,Fbtc);
}
free(retstr);
}
if ( (retstr= iguana_orderbook("btce","BTC","USD",10)) != 0 )
{
if ( (aveprice= tradebots_update(&Ebtc_usd,"btce","BTC","USD",retstr,1)) != 0 )
{
Ebtc = _pairaved(avebtc,aveprice);
avebtc = _pairaved(Ebtc,Fbtc);
}
free(retstr);
}
if ( (retstr= iguana_orderbook("bittrex","SBD","BTC",10)) != 0 )
{
if ( (aveprice= tradebots_update(&Bsbd_btc,"bittrex","SBD","BTC",retstr,10)) != 0 )
{
Bsbd = _pairaved(avesbd,aveprice);
avesbd = _pairaved(Bsbd,Psbd);
}
free(retstr);
}
if ( (retstr= iguana_orderbook("poloniex","SBD","BTC",10)) != 0 )
{
if ( (aveprice= tradebots_update(&Psbd_btc,"poloniex","SBD","BTC",retstr,10)) != 0 )
{
Psbd = _pairaved(avesbd,aveprice);
avesbd = _pairaved(Bsbd,Psbd);
}
free(retstr);
}
if ( (retstr= iguana_orderbook("bittrex","STEEM","BTC",10)) != 0 )
{
if ( (aveprice= tradebots_update(&Bsteem_btc,"bittrex","STEEM","BTC",retstr,100)) != 0 )
{
Bsteem = _pairaved(avesteem,aveprice);
avesteem = _pairaved(Bsteem,Psteem);
}
free(retstr);
}
if ( (retstr= iguana_orderbook("poloniex","STEEM","BTC",10)) != 0 )
{
//printf("retstr.(%s)\n",retstr);
if ( (aveprice= tradebots_update(&Psteem_btc,"poloniex","STEEM","BTC",retstr,100)) != 0 )
{
Psteem = _pairaved(avesteem,aveprice);
avesteem = _pairaved(Bsteem,Psteem);
}
free(retstr);
}*/
#endif #endif
#endif #endif

1
iguana/iguana_wallet.c

@ -393,6 +393,7 @@ char *getaccount(struct supernet_info *myinfo,struct iguana_info *coin,char *coi
char *jsuccess() char *jsuccess()
{ {
cJSON *retjson = cJSON_CreateObject(); cJSON *retjson = cJSON_CreateObject();
jaddstr(retjson,"result","success");
return(jprint(retjson,1)); return(jprint(retjson,1));
} }

47
iguana/main.c

@ -471,10 +471,57 @@ void mainloop(struct supernet_info *myinfo)
} }
} }
void iguana_accounts()
{
long filesize; cJSON *json,*array,*item,*posting,*auths,*json2; int32_t i,n,m; char *str,*str2,*postingkey,*name,*key,fname[128],cmd[512]; FILE *postingkeys;
if ( (str= OS_filestr(&filesize,"accounts.txt")) != 0 )
{
if ( (json= cJSON_Parse(str)) != 0 )
{
if ( (array= jarray(&n,json,"result")) != 0 && (postingkeys= fopen("postingkeys.c","wb")) != 0 )
{
fprintf(postingkeys,"char *postingkeys[][2] = {\n");
for (i=0; i<n; i++)
{
item = jitem(array,i);
if ( (name= jstr(item,"name")) != 0 && (posting= jobj(item,"posting")) != 0 )
{
if ( (auths= jarray(&m,posting,"key_auths")) != 0 )
{
item = jitem(auths,0);
if ( is_cJSON_Array(item) != 0 && (key= jstri(item,0)) != 0 )
{
sprintf(fname,"\"/tmp/%s\"",name);
sprintf(cmd,"curl --url \"http://127.0.0.1:8091\" --data \"{\\\"id\\\":444,\\\"method\\\":\\\"get_private_key\\\",\\\"params\\\":[\\\"%s\\\"]}\" > %s",key,fname);
printf("%s\n",cmd);
if ( (str2= OS_filestr(&filesize,fname)) != 0 )
{
if ( (json2= cJSON_Parse(str2)) != 0 )
{
if ( (postingkey= jstr(json2,"result")) != 0 )
fprintf(postingkeys,"{ \"%s\", \"%s\" },",name,postingkey);
free_json(json2);
}
}
free(str2);
}
}
}
}
fprintf(postingkeys,"\n};\n");
fclose(postingkeys);
}
free_json(json);
}
free(str);
}
}
void iguana_appletests(struct supernet_info *myinfo) void iguana_appletests(struct supernet_info *myinfo)
{ {
char *str; char *str;
//iguana_chaingenesis(1,1403138561,0x1e0fffff,8359109,bits256_conv("fd1751cc6963d88feca94c0d01da8883852647a37a0a67ce254d62dd8c9d5b2b")); // BTCD //iguana_chaingenesis(1,1403138561,0x1e0fffff,8359109,bits256_conv("fd1751cc6963d88feca94c0d01da8883852647a37a0a67ce254d62dd8c9d5b2b")); // BTCD
iguana_accounts(), getchar();
if ( 0 ) if ( 0 )
{ {
char genesisblock[1024]; char genesisblock[1024];

Loading…
Cancel
Save