diff --git a/basilisk/smartaddress.c b/basilisk/smartaddress.c index 89710c477..af6458bff 100755 --- a/basilisk/smartaddress.c +++ b/basilisk/smartaddress.c @@ -61,7 +61,7 @@ cJSON *smartaddress_json(struct smartaddress *ap) printf("smartjson.(%s)\n",jprint(ap->typejson,0)); //jadd(item,"type",ap->typejson); array = cJSON_CreateArray(); - if ( (n= cJSON_GetArraySize(ap->typejson)) > 0 ) + if ( is_cJSON_Array(ap->typejson) != 0 && (n= cJSON_GetArraySize(ap->typejson)) > 0 ) { jadd(retjson,"type",jitem(ap->typejson,0)); for (j=1; jnumsmartaddrs < sizeof(myinfo->smartaddrs)/sizeof(*myinfo->smartaddrs) ) { for (i=0; inumsmartaddrs; i++) @@ -124,7 +124,13 @@ int32_t _smartaddress_add(struct supernet_info *myinfo,bits256 privkey,char *sym } } } - jaddistr(ap->typejson,symbol); + item = cJSON_CreateObject(); + strcpy(tmp,symbol), touppercase(tmp), jaddstr(item,"s",tmp); + if ( maxbid != 0. ) + jaddnum(item,"b",maxbid); + if ( minask != 0. ) + jaddnum(item,"a",minask); + jaddi(ap->typejson,item); return(i+1); } ap = &myinfo->smartaddrs[myinfo->numsmartaddrs];