Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
c3f1f51560
  1. 65
      iguana/iguana_wallet.c
  2. 76
      iguana/ramchain_api.c
  3. 41
      includes/iguana_apideclares.h

65
iguana/iguana_wallet.c

@ -408,15 +408,6 @@ char *getnewaddress(struct supernet_info *myinfo,struct iguana_info *coin,char *
return(jprint(retjson,1)); return(jprint(retjson,1));
} }
INT_ARRAY_STRING(bitcoinrpc,createmultisig,M,array,account)
{
cJSON *retjson;
if ( remoteaddr != 0 )
return(clonestr("{\"error\":\"no remote\"}"));
retjson = cJSON_CreateObject();
return(jprint(retjson,1));
}
STRING_ARG(bitcoinrpc,validateaddress,address) STRING_ARG(bitcoinrpc,validateaddress,address)
{ {
cJSON *retjson; int32_t i; uint8_t addrtype,rmd160[20],pubkey[65]; struct iguana_info *other; char checkaddr[64],str[256]; cJSON *retjson; int32_t i; uint8_t addrtype,rmd160[20],pubkey[65]; struct iguana_info *other; char checkaddr[64],str[256];
@ -814,7 +805,7 @@ STRING_AND_INT(bitcoinrpc,getreceivedbyaccount,account,minconf)
STRING_AND_THREEINTS(bitcoinrpc,listtransactions,account,count,skip,includewatchonly) STRING_AND_THREEINTS(bitcoinrpc,listtransactions,account,count,skip,includewatchonly)
{ {
cJSON *retjson,*retarray,*txids,*item,*array; int32_t i,j,total,m,n = 0; struct iguana_waccount *wacct; char *coinaddr; cJSON *retjson,*retarray,*txids,*vouts,*item,*array; int32_t vout,i,j,total,m,n = 0; struct iguana_waccount *wacct; char *coinaddr; bits256 txid;
if ( remoteaddr != 0 ) if ( remoteaddr != 0 )
return(clonestr("{\"error\":\"no remote\"}")); return(clonestr("{\"error\":\"no remote\"}"));
retjson = cJSON_CreateObject(); retjson = cJSON_CreateObject();
@ -830,12 +821,15 @@ STRING_AND_THREEINTS(bitcoinrpc,listtransactions,account,count,skip,includewatch
{ {
if ( (coinaddr= jstr(jitem(array,i),0)) != 0 ) if ( (coinaddr= jstr(jitem(array,i),0)) != 0 )
{ {
vouts = cJSON_CreateArray();
txids = cJSON_CreateArray(); txids = cJSON_CreateArray();
iguana_addressreceived(myinfo,coin,json,remoteaddr,txids,0,coinaddr,1); iguana_addressreceived(myinfo,coin,json,remoteaddr,txids,vouts,coinaddr,1);
if ( (m= cJSON_GetArraySize(txids)) > 0 ) if ( (m= cJSON_GetArraySize(txids)) > 0 )
{ {
for (j=0; j<m; j++,total++) for (j=0; j<m; j++,total++)
{ {
txid = jbits256(jitem(txids,j),0);
vout = jint(jitem(vouts,j),0);
if ( skip < -count ) if ( skip < -count )
break; break;
else else
@ -847,16 +841,18 @@ STRING_AND_THREEINTS(bitcoinrpc,listtransactions,account,count,skip,includewatch
"category": "receive", "category": "receive",
"amount": 0.50000000, "amount": 0.50000000,
"label": "", "label": "",
"vout": 1,
"confirmations": 24466, "confirmations": 24466,
"blockhash": "00000000000000000517ce625737579f91162c46ad9eaccad0f52ca13715b156", "blockhash": "00000000000000000517ce625737579f91162c46ad9eaccad0f52ca13715b156",
"blockindex": 78, "blockindex": 78,
"blocktime": 1448045745, "blocktime": 1448045745,
"txid": "a40ab455941314a154e2606ff34d52a1001c7059d2c364bb16d6a8edef0abf09",
}*/ }*/
item = cJSON_CreateObject(); item = cJSON_CreateObject();
jaddstr(item,"account",wacct->account); jaddstr(item,"account",wacct->account);
jaddstr(item,"address",coinaddr); jaddstr(item,"address",coinaddr);
jaddbits256(item,"txid",txid);
jaddnum(item,"vout",vout);
//return(bitcoinrpc_getrawtransaction(IGUANA_CALLARGS,txid,1));
jaddi(retarray,item); jaddi(retarray,item);
} }
} }
@ -933,23 +929,52 @@ TWO_INTS(bitcoinrpc,listaccounts,minconf,includewatchonly)
return(jprint(retjson,1)); return(jprint(retjson,1));
} }
ZERO_ARGS(bitcoinrpc,listaddressgroupings) HASH_AND_TWOINTS(bitcoinrpc,listsinceblock,blockhash,target,flag)
{ {
cJSON *retjson = cJSON_CreateObject();
return(jprint(retjson,1));
}
STRING_AND_INT(bitcoinrpc,getreceivedbyaddress,address,minconf)
{
cJSON *retjson = cJSON_CreateObject();
return(jprint(retjson,1));
}
INT_ARRAY_STRING(bitcoinrpc,createmultisig,M,array,ignore)
{
cJSON *retjson;
if ( remoteaddr != 0 ) if ( remoteaddr != 0 )
return(clonestr("{\"error\":\"no remote\"}")); return(clonestr("{\"error\":\"no remote\"}"));
return(clonestr("{\"result\":\"success\"}")); retjson = cJSON_CreateObject();
return(jprint(retjson,1));
} }
S_D_SS(bitcoinrpc,sendtoaddress,address,amount,comment,comment2) INT_ARRAY_STRING(bitcoinrpc,addmultisig,M,array,account) //
{ {
cJSON *retjson; cJSON *retjson;
if ( remoteaddr != 0 ) if ( remoteaddr != 0 )
return(clonestr("{\"error\":\"no remote\"}")); return(clonestr("{\"error\":\"no remote\"}"));
retjson = cJSON_CreateObject(); retjson = cJSON_CreateObject();
return(jsuccess()); return(jprint(retjson,1));
} }
SS_D_I_SS(bitcoinrpc,sendfrom,fromaccount,toaddress,amount,minconf,comment,comment2) STRING_AND_INT(bitcoinrpc,sendrawtransaction,rawtx,allowhighfees)
{
cJSON *retjson = cJSON_CreateObject();
return(jprint(retjson,1));
}
DOUBLE_ARG(bitcoinrpc,settxfee,amount)
{
cJSON *retjson;
if ( remoteaddr != 0 )
return(clonestr("{\"error\":\"no remote\"}"));
retjson = cJSON_CreateObject();
return(jprint(retjson,1));
}
S_D_SS(bitcoinrpc,sendtoaddress,address,amount,comment,comment2)
{ {
cJSON *retjson; cJSON *retjson;
if ( remoteaddr != 0 ) if ( remoteaddr != 0 )
@ -958,13 +983,13 @@ SS_D_I_SS(bitcoinrpc,sendfrom,fromaccount,toaddress,amount,minconf,comment,comme
return(jsuccess()); return(jsuccess());
} }
DOUBLE_ARG(bitcoinrpc,settxfee,amount) SS_D_I_SS(bitcoinrpc,sendfrom,fromaccount,toaddress,amount,minconf,comment,comment2)
{ {
cJSON *retjson; cJSON *retjson;
if ( remoteaddr != 0 ) if ( remoteaddr != 0 )
return(clonestr("{\"error\":\"no remote\"}")); return(clonestr("{\"error\":\"no remote\"}"));
retjson = cJSON_CreateObject(); retjson = cJSON_CreateObject();
return(jprint(retjson,1)); return(jsuccess());
} }
SS_D_I_S(bitcoinrpc,move,fromaccount,toaccount,amount,minconf,comment) SS_D_I_S(bitcoinrpc,move,fromaccount,toaccount,amount,minconf,comment)

76
iguana/ramchain_api.c

@ -252,12 +252,6 @@ STRING_ARG(bitcoinrpc,validatepubkey,pubkeystr)
return(clonestr("{\"error\":\"invalid pubkey\"}")); return(clonestr("{\"error\":\"invalid pubkey\"}"));
} }
HASH_AND_TWOINTS(bitcoinrpc,listsinceblock,blockhash,target,flag)
{
cJSON *retjson = cJSON_CreateObject();
return(jprint(retjson,1));
}
cJSON *iguana_scriptobj(struct iguana_info *coin,uint8_t rmd160[20],char *coinaddr,char *asmstr,uint8_t *script,int32_t scriptlen) cJSON *iguana_scriptobj(struct iguana_info *coin,uint8_t rmd160[20],char *coinaddr,char *asmstr,uint8_t *script,int32_t scriptlen)
{ {
struct vin_info V; int32_t i,plen,asmtype; char pubkeystr[130],rmdstr[41]; cJSON *addrobj,*scriptobj=0; struct vin_info V; int32_t i,plen,asmtype; char pubkeystr[130],rmdstr[41]; cJSON *addrobj,*scriptobj=0;
@ -545,31 +539,6 @@ STRING_ARRAY_OBJ_STRING(bitcoinrpc,signrawtransaction,rawtx,vins,privkeys,sighas
return(jprint(retjson,1)); return(jprint(retjson,1));
} }
STRING_AND_INT(bitcoinrpc,sendrawtransaction,rawtx,allowhighfees)
{
cJSON *retjson = cJSON_CreateObject();
return(jprint(retjson,1));
}
// unspents
ZERO_ARGS(bitcoinrpc,gettxoutsetinfo)
{
cJSON *retjson = cJSON_CreateObject();
return(jprint(retjson,1));
}
INT_AND_ARRAY(bitcoinrpc,lockunspent,flag,array)
{
cJSON *retjson = cJSON_CreateObject();
return(jprint(retjson,1));
}
ZERO_ARGS(bitcoinrpc,listlockunspent)
{
cJSON *retjson = cJSON_CreateObject();
return(jprint(retjson,1));
}
TWOINTS_AND_ARRAY(bitcoinrpc,listunspent,minconf,maxconf,array) TWOINTS_AND_ARRAY(bitcoinrpc,listunspent,minconf,maxconf,array)
{ {
int32_t numrmds; uint8_t *rmdarray; cJSON *retjson = cJSON_CreateArray(); int32_t numrmds; uint8_t *rmdarray; cJSON *retjson = cJSON_CreateArray();
@ -584,19 +553,6 @@ TWOINTS_AND_ARRAY(bitcoinrpc,listunspent,minconf,maxconf,array)
return(jprint(retjson,1)); return(jprint(retjson,1));
} }
STRING_AND_INT(bitcoinrpc,getreceivedbyaddress,address,minconf)
{
cJSON *retjson = cJSON_CreateObject();
return(jprint(retjson,1));
}
// single address/account funcs
ZERO_ARGS(bitcoinrpc,getrawchangeaddress)
{
cJSON *retjson = cJSON_CreateObject();
return(jprint(retjson,1));
}
STRING_AND_INT(iguana,bundleaddresses,activecoin,height) STRING_AND_INT(iguana,bundleaddresses,activecoin,height)
{ {
struct iguana_info *ptr; struct iguana_info *ptr;
@ -628,6 +584,38 @@ STRING_AND_INT(iguana,bundlehashes,activecoin,height)
} else return(clonestr("{\"error\":\"activecoin is not active\"}")); } else return(clonestr("{\"error\":\"activecoin is not active\"}"));
} }
// low priority RPC
ZERO_ARGS(bitcoinrpc,gettxoutsetinfo)
{
cJSON *retjson = cJSON_CreateObject();
return(jprint(retjson,1));
}
INT_AND_ARRAY(bitcoinrpc,lockunspent,flag,array)
{
cJSON *retjson = cJSON_CreateObject();
return(jprint(retjson,1));
}
ZERO_ARGS(bitcoinrpc,listlockunspent)
{
cJSON *retjson = cJSON_CreateObject();
return(jprint(retjson,1));
}
ZERO_ARGS(bitcoinrpc,listaddressgroupings)
{
if ( remoteaddr != 0 )
return(clonestr("{\"error\":\"no remote\"}"));
return(clonestr("{\"result\":\"success\"}"));
}
ZERO_ARGS(bitcoinrpc,getrawchangeaddress)
{
cJSON *retjson = cJSON_CreateObject();
return(jprint(retjson,1));
}
#undef IGUANA_ARGS #undef IGUANA_ARGS
#include "../includes/iguana_apiundefs.h" #include "../includes/iguana_apiundefs.h"

41
includes/iguana_apideclares.h

@ -14,7 +14,6 @@
******************************************************************************/ ******************************************************************************/
ZERO_ARGS(bitcoinrpc,getinfo); ZERO_ARGS(bitcoinrpc,getinfo);
ZERO_ARGS(bitcoinrpc,getblockcount); ZERO_ARGS(bitcoinrpc,getblockcount);
ZERO_ARGS(bitcoinrpc,getbestblockhash); ZERO_ARGS(bitcoinrpc,getbestblockhash);
@ -29,13 +28,6 @@ TWOINTS_AND_ARRAY(bitcoinrpc,listunspent,minconf,maxconf,array);
STRING_ARG(bitcoinrpc,decodescript,script); STRING_ARG(bitcoinrpc,decodescript,script);
STRING_ARG(bitcoinrpc,decoderawtransaction,rawtx); STRING_ARG(bitcoinrpc,decoderawtransaction,rawtx);
ARRAY_OBJ_INT(bitcoinrpc,createrawtransaction,vins,vouts,locktime); ARRAY_OBJ_INT(bitcoinrpc,createrawtransaction,vins,vouts,locktime);
STRING_ARRAY_OBJ_STRING(bitcoinrpc,signrawtransaction,rawtx,vins,privkeys,sighash); //
STRING_AND_INT(bitcoinrpc,sendrawtransaction,rawtx,allowhighfees); //
SS_D_I_S(bitcoinrpc,move,fromaccount,toaccount,amount,minconf,comment); //
SS_D_I_SS(bitcoinrpc,sendfrom,fromaccount,toaddress,amount,minconf,comment,comment2); //
S_A_I_S(bitcoinrpc,sendmany,fromaccount,array,minconf,comment); //
S_D_SS(bitcoinrpc,sendtoaddress,address,amount,comment,comment2); //
ZERO_ARGS(bitcoinrpc,makekeypair); ZERO_ARGS(bitcoinrpc,makekeypair);
STRING_ARG(bitcoinrpc,validatepubkey,pubkey); STRING_ARG(bitcoinrpc,validatepubkey,pubkey);
@ -45,12 +37,12 @@ ZERO_ARGS(bitcoinrpc,walletlock);
TWOSTRINGS_AND_INT(bitcoinrpc,walletpassphrase,password,permanentfile,timeout); TWOSTRINGS_AND_INT(bitcoinrpc,walletpassphrase,password,permanentfile,timeout);
THREE_STRINGS(bitcoinrpc,encryptwallet,passphrase,password,permanentfile); THREE_STRINGS(bitcoinrpc,encryptwallet,passphrase,password,permanentfile);
FOUR_STRINGS(bitcoinrpc,walletpassphrasechange,oldpassword,newpassword,oldpermanentfile,permanentfile); FOUR_STRINGS(bitcoinrpc,walletpassphrasechange,oldpassword,newpassword,oldpermanentfile,permanentfile);
STRING_ARG(bitcoinrpc,dumpwallet,filename);
// accounts STRING_ARG(bitcoinrpc,backupwallet,filename);
STRING_ARG(bitcoinrpc,getnewaddress,account); // STRING_ARG(bitcoinrpc,importwallet,filename);
TWOSTRINGS_AND_INT(bitcoinrpc,importprivkey,wif,account,rescan); // STRING_ARG(bitcoinrpc,getnewaddress,account);
STRING_ARG(bitcoinrpc,dumpprivkey,address); // TWOSTRINGS_AND_INT(bitcoinrpc,importprivkey,wif,account,rescan);
INT_ARRAY_STRING(bitcoinrpc,createmultisig,M,array,account); // STRING_ARG(bitcoinrpc,dumpprivkey,address);
STRING_AND_THREEINTS(bitcoinrpc,listtransactions,account,count,skip,includewatchonly); STRING_AND_THREEINTS(bitcoinrpc,listtransactions,account,count,skip,includewatchonly);
THREE_INTS(bitcoinrpc,listreceivedbyaddress,minconf,includeempty,flag); THREE_INTS(bitcoinrpc,listreceivedbyaddress,minconf,includeempty,flag);
@ -65,21 +57,29 @@ STRING_ARG(bitcoinrpc,getaccount,address);
STRING_ARG(bitcoinrpc,getaccountaddress,account); STRING_ARG(bitcoinrpc,getaccountaddress,account);
TWO_STRINGS(bitcoinrpc,setaccount,address,account); TWO_STRINGS(bitcoinrpc,setaccount,address,account);
// maybe later INT_ARRAY_STRING(bitcoinrpc,createmultisig,M,array,ignore); //
INT_ARRAY_STRING(bitcoinrpc,addmultisig,M,array,account); //
STRING_ARRAY_OBJ_STRING(bitcoinrpc,signrawtransaction,rawtx,vins,privkeys,sighash); //
STRING_AND_INT(bitcoinrpc,sendrawtransaction,rawtx,allowhighfees); //
SS_D_I_S(bitcoinrpc,move,fromaccount,toaccount,amount,minconf,comment); //
SS_D_I_SS(bitcoinrpc,sendfrom,fromaccount,toaddress,amount,minconf,comment,comment2); //
S_A_I_S(bitcoinrpc,sendmany,fromaccount,array,minconf,comment); //
S_D_SS(bitcoinrpc,sendtoaddress,address,amount,comment,comment2); //
DOUBLE_ARG(bitcoinrpc,settxfee,amount);
HASH_AND_TWOINTS(bitcoinrpc,listsinceblock,blockhash,target,flag); //
TWO_STRINGS(bitcoinrpc,signmessage,address,message); // TWO_STRINGS(bitcoinrpc,signmessage,address,message); //
THREE_STRINGS(bitcoinrpc,verifymessage,address,sig,message); // THREE_STRINGS(bitcoinrpc,verifymessage,address,sig,message); //
HASH_AND_TWOINTS(bitcoinrpc,listsinceblock,blockhash,target,flag); // // maybe later
ZERO_ARGS(bitcoinrpc,gettxoutsetinfo); ZERO_ARGS(bitcoinrpc,gettxoutsetinfo);
INT_AND_ARRAY(bitcoinrpc,lockunspent,flag,array); INT_AND_ARRAY(bitcoinrpc,lockunspent,flag,array);
ZERO_ARGS(bitcoinrpc,listlockunspent); ZERO_ARGS(bitcoinrpc,listlockunspent);
ZERO_ARGS(bitcoinrpc,getrawchangeaddress); ZERO_ARGS(bitcoinrpc,getrawchangeaddress);
ZERO_ARGS(bitcoinrpc,checkwallet); ZERO_ARGS(bitcoinrpc,checkwallet);
ZERO_ARGS(bitcoinrpc,repairwallet); ZERO_ARGS(bitcoinrpc,repairwallet);
STRING_ARG(bitcoinrpc,dumpwallet,filename);
STRING_ARG(bitcoinrpc,backupwallet,filename);
STRING_ARG(bitcoinrpc,importwallet,filename);
DOUBLE_ARG(bitcoinrpc,settxfee,amount);
STRING_ARG(iguana,initfastfind,activecoin); STRING_ARG(iguana,initfastfind,activecoin);
STRING_ARG(iguana,peers,activecoin); STRING_ARG(iguana,peers,activecoin);
@ -163,7 +163,6 @@ ZERO_ARGS(SuperNET,stop);
HASH_AND_STRING(SuperNET,saveconf,wallethash,confjsonstr); HASH_AND_STRING(SuperNET,saveconf,wallethash,confjsonstr);
HASH_ARRAY_STRING(SuperNET,layer,mypriv,otherpubs,str); HASH_ARRAY_STRING(SuperNET,layer,mypriv,otherpubs,str);
STRING_ARG(SuperNET,bitcoinrpc,setcoin); STRING_ARG(SuperNET,bitcoinrpc,setcoin);
STRING_ARG(SuperNET,myipaddr,ipaddr); STRING_ARG(SuperNET,myipaddr,ipaddr);
STRING_ARG(SuperNET,setmyipaddr,ipaddr); STRING_ARG(SuperNET,setmyipaddr,ipaddr);

Loading…
Cancel
Save