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));
}
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)
{
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)
{
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 )
return(clonestr("{\"error\":\"no remote\"}"));
retjson = cJSON_CreateObject();
@ -830,12 +821,15 @@ STRING_AND_THREEINTS(bitcoinrpc,listtransactions,account,count,skip,includewatch
{
if ( (coinaddr= jstr(jitem(array,i),0)) != 0 )
{
vouts = 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 )
{
for (j=0; j<m; j++,total++)
{
txid = jbits256(jitem(txids,j),0);
vout = jint(jitem(vouts,j),0);
if ( skip < -count )
break;
else
@ -847,16 +841,18 @@ STRING_AND_THREEINTS(bitcoinrpc,listtransactions,account,count,skip,includewatch
"category": "receive",
"amount": 0.50000000,
"label": "",
"vout": 1,
"confirmations": 24466,
"blockhash": "00000000000000000517ce625737579f91162c46ad9eaccad0f52ca13715b156",
"blockindex": 78,
"blocktime": 1448045745,
"txid": "a40ab455941314a154e2606ff34d52a1001c7059d2c364bb16d6a8edef0abf09",
}*/
item = cJSON_CreateObject();
jaddstr(item,"account",wacct->account);
jaddstr(item,"address",coinaddr);
jaddbits256(item,"txid",txid);
jaddnum(item,"vout",vout);
//return(bitcoinrpc_getrawtransaction(IGUANA_CALLARGS,txid,1));
jaddi(retarray,item);
}
}
@ -933,23 +929,52 @@ TWO_INTS(bitcoinrpc,listaccounts,minconf,includewatchonly)
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 )
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;
if ( remoteaddr != 0 )
return(clonestr("{\"error\":\"no remote\"}"));
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;
if ( remoteaddr != 0 )
@ -958,13 +983,13 @@ SS_D_I_SS(bitcoinrpc,sendfrom,fromaccount,toaddress,amount,minconf,comment,comme
return(jsuccess());
}
DOUBLE_ARG(bitcoinrpc,settxfee,amount)
SS_D_I_SS(bitcoinrpc,sendfrom,fromaccount,toaddress,amount,minconf,comment,comment2)
{
cJSON *retjson;
if ( remoteaddr != 0 )
return(clonestr("{\"error\":\"no remote\"}"));
retjson = cJSON_CreateObject();
return(jprint(retjson,1));
return(jsuccess());
}
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\"}"));
}
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)
{
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));
}
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)
{
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));
}
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)
{
struct iguana_info *ptr;
@ -628,6 +584,38 @@ STRING_AND_INT(iguana,bundlehashes,activecoin,height)
} 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
#include "../includes/iguana_apiundefs.h"

41
includes/iguana_apideclares.h

@ -14,7 +14,6 @@
******************************************************************************/
ZERO_ARGS(bitcoinrpc,getinfo);
ZERO_ARGS(bitcoinrpc,getblockcount);
ZERO_ARGS(bitcoinrpc,getbestblockhash);
@ -29,13 +28,6 @@ TWOINTS_AND_ARRAY(bitcoinrpc,listunspent,minconf,maxconf,array);
STRING_ARG(bitcoinrpc,decodescript,script);
STRING_ARG(bitcoinrpc,decoderawtransaction,rawtx);
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);
STRING_ARG(bitcoinrpc,validatepubkey,pubkey);
@ -45,12 +37,12 @@ ZERO_ARGS(bitcoinrpc,walletlock);
TWOSTRINGS_AND_INT(bitcoinrpc,walletpassphrase,password,permanentfile,timeout);
THREE_STRINGS(bitcoinrpc,encryptwallet,passphrase,password,permanentfile);
FOUR_STRINGS(bitcoinrpc,walletpassphrasechange,oldpassword,newpassword,oldpermanentfile,permanentfile);
// accounts
STRING_ARG(bitcoinrpc,getnewaddress,account); //
TWOSTRINGS_AND_INT(bitcoinrpc,importprivkey,wif,account,rescan); //
STRING_ARG(bitcoinrpc,dumpprivkey,address); //
INT_ARRAY_STRING(bitcoinrpc,createmultisig,M,array,account); //
STRING_ARG(bitcoinrpc,dumpwallet,filename);
STRING_ARG(bitcoinrpc,backupwallet,filename);
STRING_ARG(bitcoinrpc,importwallet,filename);
STRING_ARG(bitcoinrpc,getnewaddress,account);
TWOSTRINGS_AND_INT(bitcoinrpc,importprivkey,wif,account,rescan);
STRING_ARG(bitcoinrpc,dumpprivkey,address);
STRING_AND_THREEINTS(bitcoinrpc,listtransactions,account,count,skip,includewatchonly);
THREE_INTS(bitcoinrpc,listreceivedbyaddress,minconf,includeempty,flag);
@ -65,21 +57,29 @@ STRING_ARG(bitcoinrpc,getaccount,address);
STRING_ARG(bitcoinrpc,getaccountaddress,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); //
THREE_STRINGS(bitcoinrpc,verifymessage,address,sig,message); //
HASH_AND_TWOINTS(bitcoinrpc,listsinceblock,blockhash,target,flag); //
// maybe later
ZERO_ARGS(bitcoinrpc,gettxoutsetinfo);
INT_AND_ARRAY(bitcoinrpc,lockunspent,flag,array);
ZERO_ARGS(bitcoinrpc,listlockunspent);
ZERO_ARGS(bitcoinrpc,getrawchangeaddress);
ZERO_ARGS(bitcoinrpc,checkwallet);
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,peers,activecoin);
@ -163,7 +163,6 @@ ZERO_ARGS(SuperNET,stop);
HASH_AND_STRING(SuperNET,saveconf,wallethash,confjsonstr);
HASH_ARRAY_STRING(SuperNET,layer,mypriv,otherpubs,str);
STRING_ARG(SuperNET,bitcoinrpc,setcoin);
STRING_ARG(SuperNET,myipaddr,ipaddr);
STRING_ARG(SuperNET,setmyipaddr,ipaddr);

Loading…
Cancel
Save