|
@ -1044,6 +1044,13 @@ char *basilisk_swaplist(uint32_t origrequestid,uint32_t origquoteid) |
|
|
//,statebits; int32_t optionduration; struct basilisk_request R; bits256 privkey;
|
|
|
//,statebits; int32_t optionduration; struct basilisk_request R; bits256 privkey;
|
|
|
retjson = cJSON_CreateObject(); |
|
|
retjson = cJSON_CreateObject(); |
|
|
array = cJSON_CreateArray(); |
|
|
array = cJSON_CreateArray(); |
|
|
|
|
|
if ( origrequestid != 0 && origquoteid != 0 ) |
|
|
|
|
|
{ |
|
|
|
|
|
if ( (item= basilisk_remember(KMDtotals,BTCtotals,origrequestid,origquoteid)) != 0 ) |
|
|
|
|
|
jaddi(array,item); |
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
sprintf(fname,"%s/SWAPS/list",GLOBAL_DBDIR), OS_compatible_path(fname); |
|
|
sprintf(fname,"%s/SWAPS/list",GLOBAL_DBDIR), OS_compatible_path(fname); |
|
|
if ( (fp= fopen(fname,"rb")) != 0 ) |
|
|
if ( (fp= fopen(fname,"rb")) != 0 ) |
|
|
{ |
|
|
{ |
|
@ -1057,8 +1064,6 @@ char *basilisk_swaplist(uint32_t origrequestid,uint32_t origquoteid) |
|
|
r = (uint32_t)(G.LP_skipstatus[i] >> 32); |
|
|
r = (uint32_t)(G.LP_skipstatus[i] >> 32); |
|
|
q = (uint32_t)G.LP_skipstatus[i]; |
|
|
q = (uint32_t)G.LP_skipstatus[i]; |
|
|
if ( r == requestid && q == quoteid ) |
|
|
if ( r == requestid && q == quoteid ) |
|
|
{ |
|
|
|
|
|
if ( r != origrequestid || q != origquoteid ) |
|
|
|
|
|
{ |
|
|
{ |
|
|
item = cJSON_CreateObject(); |
|
|
item = cJSON_CreateObject(); |
|
|
jaddstr(item,"status","realtime"); |
|
|
jaddstr(item,"status","realtime"); |
|
@ -1066,22 +1071,18 @@ char *basilisk_swaplist(uint32_t origrequestid,uint32_t origquoteid) |
|
|
jaddnum(item,"quoteid",q); |
|
|
jaddnum(item,"quoteid",q); |
|
|
jaddi(array,item); |
|
|
jaddi(array,item); |
|
|
flag = 1; |
|
|
flag = 1; |
|
|
} |
|
|
|
|
|
break; |
|
|
break; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
if ( flag == 0 ) |
|
|
if ( flag == 0 ) |
|
|
{ |
|
|
{ |
|
|
if ( (item= basilisk_remember(KMDtotals,BTCtotals,requestid,quoteid)) != 0 ) |
|
|
if ( (item= basilisk_remember(KMDtotals,BTCtotals,requestid,quoteid)) != 0 ) |
|
|
{ |
|
|
|
|
|
jaddi(array,item); |
|
|
jaddi(array,item); |
|
|
//if ( (status= jstr(item,"status")) != 0 && strcmp(status,"pending") == 0 )
|
|
|
|
|
|
// break;
|
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
fclose(fp); |
|
|
fclose(fp); |
|
|
} |
|
|
} |
|
|
|
|
|
} |
|
|
jaddstr(retjson,"result","success"); |
|
|
jaddstr(retjson,"result","success"); |
|
|
jadd(retjson,"swaps",array); |
|
|
jadd(retjson,"swaps",array); |
|
|
if ( 0 && cJSON_GetArraySize(array) > 0 ) |
|
|
if ( 0 && cJSON_GetArraySize(array) > 0 ) |
|
|