|
|
@ -2860,15 +2860,15 @@ bits256 basilisk_swap_spendtxid(struct supernet_info *myinfo,char *symbol,char * |
|
|
|
// listtransactions or listspents
|
|
|
|
destaddr[0] = 0; |
|
|
|
memset(&spendtxid,0,sizeof(spendtxid)); |
|
|
|
char str[65]; printf("swap %s spendtxid.(%s)\n",symbol,bits256_str(str,utxotxid)); |
|
|
|
//char str[65]; printf("swap %s spendtxid.(%s)\n",symbol,bits256_str(str,utxotxid));
|
|
|
|
if ( iguana_isnotarychain(symbol) >= 0 ) |
|
|
|
{ |
|
|
|
//[{"type":"sent","confirmations":379,"height":275311,"timestamp":1492084664,"txid":"8703c5517bc57db38134058370a14e99b8e662b99ccefa2061dea311bbd02b8b","vout":0,"amount":117.50945263,"spendtxid":"cf2509e076fbb9b22514923df916b7aacb1391dce9c7e1460b74947077b12510","vin":0,"paid":{"type":"paid","txid":"cf2509e076fbb9b22514923df916b7aacb1391dce9c7e1460b74947077b12510","height":275663,"timestamp":1492106024,"vouts":[{"RUDpN6PEBsE7ZFbGjUxk1W3QVsxnjBLYw6":117.50935263}]}}]
|
|
|
|
basilisk_swap_getcoinaddr(myinfo,symbol,coinaddr,utxotxid,vout); |
|
|
|
printf("spendtxid %s dest.(%s)\n",symbol,coinaddr); |
|
|
|
//printf("spendtxid %s dest.(%s)\n",symbol,coinaddr);
|
|
|
|
if ( coinaddr[0] != 0 && (retstr= dex_listtransactions(myinfo,0,0,0,symbol,coinaddr,100,0)) != 0 ) |
|
|
|
{ |
|
|
|
printf("listtransactions.(%s)\n",retstr); |
|
|
|
//printf("listtransactions.(%s)\n",retstr);
|
|
|
|
if ( (array= cJSON_Parse(retstr)) != 0 ) |
|
|
|
{ |
|
|
|
if ( (n= cJSON_GetArraySize(array)) > 0 ) |
|
|
@ -2882,15 +2882,15 @@ bits256 basilisk_swap_spendtxid(struct supernet_info *myinfo,char *symbol,char * |
|
|
|
spendtxid = jbits256(item,"hash"); |
|
|
|
if ( (array2= jarray(&m,item,"inputs")) != 0 && m == 1 ) |
|
|
|
{ |
|
|
|
printf("found inputs with %s\n",bits256_str(str,spendtxid)); |
|
|
|
//printf("found inputs with %s\n",bits256_str(str,spendtxid));
|
|
|
|
txid = jbits256(jitem(array2,0),"output_hash"); |
|
|
|
if ( bits256_cmp(txid,utxotxid) == 0 ) |
|
|
|
{ |
|
|
|
printf("matched %s\n",bits256_str(str,txid)); |
|
|
|
//printf("matched %s\n",bits256_str(str,txid));
|
|
|
|
if ( (array2= jarray(&m,item,"outputs")) != 0 && m == 1 && (addr= jstr(jitem(array2,0),"address")) != 0 ) |
|
|
|
{ |
|
|
|
strcpy(destaddr,addr); |
|
|
|
printf("set addr.(%s)\n",addr); |
|
|
|
//printf("set addr.(%s)\n",addr);
|
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|