From 12fe3efcce70db604ce071a23cfa9516886ceaf3 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 4 Mar 2017 00:50:37 +0200 Subject: [PATCH 1/6] Test --- basilisk/jumblr.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/basilisk/jumblr.c b/basilisk/jumblr.c index f2a7c59df..1cf3d87ae 100755 --- a/basilisk/jumblr.c +++ b/basilisk/jumblr.c @@ -99,6 +99,13 @@ char *jumblr_zlistreceivedbyaddress(struct supernet_info *myinfo,struct iguana_i return(bitcoind_passthru(coin->symbol,coin->chain->serverport,coin->chain->userpass,"z_listreceivedbyaddress",params)); } +char *jumblr_listreceivedbyaddress(struct supernet_info *myinfo,struct iguana_info *coin,char *addr) +{ + char params[1024]; + sprintf(params,"[\"%s\", 1]",addr); + return(bitcoind_passthru(coin->symbol,coin->chain->serverport,coin->chain->userpass,"listreceivedbyaddress",params)); +} + char *jumblr_zgetbalance(struct supernet_info *myinfo,struct iguana_info *coin,char *addr) { char params[1024]; @@ -109,9 +116,9 @@ char *jumblr_zgetbalance(struct supernet_info *myinfo,struct iguana_info *coin,c int64_t jumblr_receivedby(struct supernet_info *myinfo,struct iguana_info *coin,char *addr) { char *retstr; cJSON *retjson,*item; int32_t i,n; int64_t total = 0; - if ( (retstr= jumblr_zlistreceivedbyaddress(myinfo,coin,addr)) != 0 ) + if ( (retstr= jumblr_listreceivedbyaddress(myinfo,coin,addr)) != 0 ) { - printf("z_listreceivedbyaddress.(%s) -> (%s)\n",addr,retstr); + printf("listreceivedbyaddress.(%s) -> (%s)\n",addr,retstr); if ( (retjson= cJSON_Parse(retstr)) != 0 ) { if ( (n= cJSON_GetArraySize(retjson)) > 0 ) From 3e7aa0bcab15e9c72db43e9e9b0e7b0d41d03584 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 4 Mar 2017 00:54:08 +0200 Subject: [PATCH 2/6] Test --- basilisk/jumblr.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/basilisk/jumblr.c b/basilisk/jumblr.c index 1cf3d87ae..7b957e07e 100755 --- a/basilisk/jumblr.c +++ b/basilisk/jumblr.c @@ -99,11 +99,11 @@ char *jumblr_zlistreceivedbyaddress(struct supernet_info *myinfo,struct iguana_i return(bitcoind_passthru(coin->symbol,coin->chain->serverport,coin->chain->userpass,"z_listreceivedbyaddress",params)); } -char *jumblr_listreceivedbyaddress(struct supernet_info *myinfo,struct iguana_info *coin,char *addr) +char *jumblr_getreceivedbyaddress(struct supernet_info *myinfo,struct iguana_info *coin,char *addr) { char params[1024]; sprintf(params,"[\"%s\", 1]",addr); - return(bitcoind_passthru(coin->symbol,coin->chain->serverport,coin->chain->userpass,"listreceivedbyaddress",params)); + return(bitcoind_passthru(coin->symbol,coin->chain->serverport,coin->chain->userpass,"getreceivedbyaddress",params)); } char *jumblr_zgetbalance(struct supernet_info *myinfo,struct iguana_info *coin,char *addr) @@ -116,9 +116,9 @@ char *jumblr_zgetbalance(struct supernet_info *myinfo,struct iguana_info *coin,c int64_t jumblr_receivedby(struct supernet_info *myinfo,struct iguana_info *coin,char *addr) { char *retstr; cJSON *retjson,*item; int32_t i,n; int64_t total = 0; - if ( (retstr= jumblr_listreceivedbyaddress(myinfo,coin,addr)) != 0 ) + if ( (retstr= jumblr_getreceivedbyaddress(myinfo,coin,addr)) != 0 ) { - printf("listreceivedbyaddress.(%s) -> (%s)\n",addr,retstr); + printf("jumblr_getreceivedbyaddress.(%s) -> (%s)\n",addr,retstr); if ( (retjson= cJSON_Parse(retstr)) != 0 ) { if ( (n= cJSON_GetArraySize(retjson)) > 0 ) From 77339abe8be532fb18e4c1b9e88b8431d7a76b70 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 4 Mar 2017 00:58:24 +0200 Subject: [PATCH 3/6] Test --- basilisk/jumblr.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/basilisk/jumblr.c b/basilisk/jumblr.c index 7b957e07e..ca146101a 100755 --- a/basilisk/jumblr.c +++ b/basilisk/jumblr.c @@ -106,6 +106,13 @@ char *jumblr_getreceivedbyaddress(struct supernet_info *myinfo,struct iguana_inf return(bitcoind_passthru(coin->symbol,coin->chain->serverport,coin->chain->userpass,"getreceivedbyaddress",params)); } +char *jumblr_importprivkey(struct supernet_info *myinfo,struct iguana_info *coin,char *wifstr) +{ + char params[1024]; + sprintf(params,"[\"%s\", 0]",wifstr); + return(bitcoind_passthru(coin->symbol,coin->chain->serverport,coin->chain->userpass,"importprivkey",params)); +} + char *jumblr_zgetbalance(struct supernet_info *myinfo,struct iguana_info *coin,char *addr) { char params[1024]; @@ -115,11 +122,11 @@ char *jumblr_zgetbalance(struct supernet_info *myinfo,struct iguana_info *coin,c int64_t jumblr_receivedby(struct supernet_info *myinfo,struct iguana_info *coin,char *addr) { - char *retstr; cJSON *retjson,*item; int32_t i,n; int64_t total = 0; + char *retstr; int64_t total = 0; //cJSON *retjson,*item; int32_t i,n; if ( (retstr= jumblr_getreceivedbyaddress(myinfo,coin,addr)) != 0 ) { printf("jumblr_getreceivedbyaddress.(%s) -> (%s)\n",addr,retstr); - if ( (retjson= cJSON_Parse(retstr)) != 0 ) + /*if ( (retjson= cJSON_Parse(retstr)) != 0 ) { if ( (n= cJSON_GetArraySize(retjson)) > 0 ) { @@ -130,7 +137,8 @@ int64_t jumblr_receivedby(struct supernet_info *myinfo,struct iguana_info *coin, } } free_json(retjson); - } + }*/ + total = atof(retstr) * SATOSHIDEN; free(retstr); } return(total); @@ -335,7 +343,7 @@ r = 0; STRING_ARG(jumblr,setpassphrase,passphrase) { - cJSON *retjson; char KMDaddr[64],BTCaddr[64]; + cJSON *retjson; char KMDaddr[64],BTCaddr[64],wifstr[64]; bits256 privkey; if ( passphrase == 0 || passphrase[0] == 0 || (coin= iguana_coinfind("KMD")) == 0 || coin->FULLNODE >= 0 ) return(clonestr("{\"error\":\"no passphrase or no native komodod\"}")); else @@ -343,10 +351,14 @@ STRING_ARG(jumblr,setpassphrase,passphrase) safecopy(myinfo->jumblr_passphrase,passphrase,sizeof(myinfo->jumblr_passphrase)); retjson = cJSON_CreateObject(); jaddstr(retjson,"result","success"); - jumblr_privkey(myinfo,BTCaddr,KMDaddr,JUMBLR_DEPOSITPREFIX); + privkey = jumblr_privkey(myinfo,BTCaddr,KMDaddr,JUMBLR_DEPOSITPREFIX); + bitcoin_priv2wif(wifstr,privkey,coin->chain->wiftype); + jumblr_importprivkey(myinfo,coin,wifstr); jaddstr(retjson,"BTCdeposit","notyet"); jaddstr(retjson,"KMDdeposit",KMDaddr); - jumblr_privkey(myinfo,BTCaddr,KMDaddr,""); + privkey = jumblr_privkey(myinfo,BTCaddr,KMDaddr,""); + bitcoin_priv2wif(wifstr,privkey,coin->chain->wiftype); + jumblr_importprivkey(myinfo,coin,wifstr); jaddstr(retjson,"BTCjumblr","notyet"); jaddstr(retjson,"KMDjumblr",KMDaddr); return(jprint(retjson,1)); From 6905f3303a81e4dc8ce158b8266bcbd6df7ac8f0 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 4 Mar 2017 01:00:41 +0200 Subject: [PATCH 4/6] Test --- basilisk/jumblr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/basilisk/jumblr.c b/basilisk/jumblr.c index ca146101a..88a9460bd 100755 --- a/basilisk/jumblr.c +++ b/basilisk/jumblr.c @@ -109,7 +109,7 @@ char *jumblr_getreceivedbyaddress(struct supernet_info *myinfo,struct iguana_inf char *jumblr_importprivkey(struct supernet_info *myinfo,struct iguana_info *coin,char *wifstr) { char params[1024]; - sprintf(params,"[\"%s\", 0]",wifstr); + sprintf(params,"[\"%s\", false]",wifstr); return(bitcoind_passthru(coin->symbol,coin->chain->serverport,coin->chain->userpass,"importprivkey",params)); } From 9a554e11f19c10c8075f141d56903ef77854b3f9 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 4 Mar 2017 01:03:28 +0200 Subject: [PATCH 5/6] Test --- basilisk/jumblr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/basilisk/jumblr.c b/basilisk/jumblr.c index 88a9460bd..b2ae526e4 100755 --- a/basilisk/jumblr.c +++ b/basilisk/jumblr.c @@ -109,7 +109,7 @@ char *jumblr_getreceivedbyaddress(struct supernet_info *myinfo,struct iguana_inf char *jumblr_importprivkey(struct supernet_info *myinfo,struct iguana_info *coin,char *wifstr) { char params[1024]; - sprintf(params,"[\"%s\", false]",wifstr); + sprintf(params,"[\"%s\", \"\", false]",wifstr); return(bitcoind_passthru(coin->symbol,coin->chain->serverport,coin->chain->userpass,"importprivkey",params)); } From d73346719c75686a3319b8b13fb19190ca598c75 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 4 Mar 2017 01:06:24 +0200 Subject: [PATCH 6/6] Test --- iguana/tests/walletpassphrase | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/tests/walletpassphrase b/iguana/tests/walletpassphrase index dc5eae04e..94d46e776 100755 --- a/iguana/tests/walletpassphrase +++ b/iguana/tests/walletpassphrase @@ -1,4 +1,4 @@ #!/bin/bash #curl --url "http://127.0.0.1:7778" --data "{\"method\":\"walletpassphrase\",\"params\":[\"test\", 600]}" curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"bitcoinrpc\",\"method\":\"walletpassphrase\",\"password\":\"test\",\"timeout\":86444}" -curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"jumblr\",\"method\":\"setpassphrase\",\"passphrase\":\"test\"}" +curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"jumblr\",\"method\":\"setpassphrase\",\"passphrase\":\"jumblr test\"}"