diff --git a/iguana/iguana777.h b/iguana/iguana777.h index bd7cc2119..aba2d382a 100755 --- a/iguana/iguana777.h +++ b/iguana/iguana777.h @@ -686,63 +686,6 @@ int32_t is_bitcoinrpc(char *method); char *iguana_bitcoinRPC(struct supernet_info *myinfo,char *method,cJSON *json,char *remoteaddr); cJSON *iguana_pubkeyjson(struct iguana_info *coin,char *pubkeystr); -// API functions -char *iguana_getinfo(struct supernet_info *myinfo,struct iguana_info *coin); -char *iguana_getbestblockhash(struct supernet_info *myinfo,struct iguana_info *coin); -char *iguana_getblockcount(struct supernet_info *myinfo,struct iguana_info *coin); -char *iguana_listsinceblock(struct supernet_info *myinfo,struct iguana_info *coin,bits256 blockhash,int32_t target); -char *iguana_getreceivedbyaccount(struct supernet_info *myinfo,struct iguana_info *coin,char *account,int32_t minconf); -char *iguana_listreceivedbyaccount(struct supernet_info *myinfo,struct iguana_info *coin,char *account,int32_t includeempty); - -char *iguana_getaccountaddress(struct supernet_info *myinfo,struct iguana_info *coin,char *account); -char *iguana_setaccount(struct supernet_info *myinfo,struct iguana_info *coin,char *account); -char *iguana_getaccount(struct supernet_info *myinfo,struct iguana_info *coin,char *account); -char *iguana_getaddressesbyaccount(struct supernet_info *myinfo,struct iguana_info *coin,char *account); -char *iguana_listaddressgroupings(struct supernet_info *myinfo,struct iguana_info *coin); -char *iguana_getbalance(struct supernet_info *myinfo,struct iguana_info *coin,char *account,int32_t minconf); -char *iguana_listaccounts(struct supernet_info *myinfo,struct iguana_info *coin,int32_t minconf); - -char *iguana_move(struct supernet_info *myinfo,struct iguana_info *coin,char *fromaccount,char *toaccount,double amount,int32_t minconf,char *comment); -char *iguana_sendfrom(struct supernet_info *myinfo,struct iguana_info *coin,char *fromaccount,char *toaddress,double amount,int32_t minconf,char *comment,char *comment2); -char *iguana_sendmany(struct supernet_info *myinfo,struct iguana_info *coin,char *fromaccount,cJSON *payments,int32_t minconf,char *comment); - -char *iguana_dumpprivkey(struct supernet_info *myinfo,struct iguana_info *coin,char *address); -char *iguana_importprivkey(struct supernet_info *myinfo,struct iguana_info *coin,char *wip); -char *iguana_dumpwallet(struct supernet_info *myinfo,struct iguana_info *coin); -char *iguana_importwallet(struct supernet_info *myinfo,struct iguana_info *coin,char *wallet); -char *iguana_walletpassphrase(struct supernet_info *myinfo,struct iguana_info *coin,char *passphrase,int32_t timeout); -char *iguana_walletpassphrasechange(struct supernet_info *myinfo,struct iguana_info *coin,char *oldpassphrase,char *newpassphrase); -char *iguana_walletlock(struct supernet_info *myinfo,struct iguana_info *coin); -char *iguana_encryptwallet(struct supernet_info *myinfo,struct iguana_info *coin,char *passphrase); -char *iguana_checkwallet(struct supernet_info *myinfo,struct iguana_info *coin); -char *iguana_repairwallet(struct supernet_info *myinfo,struct iguana_info *coin); -char *iguana_backupwallet(struct supernet_info *myinfo,struct iguana_info *coin,char *filename); - -char *iguana_signmessage(struct supernet_info *myinfo,struct iguana_info *coin,char *address,char *message); -char *iguana_verifymessage(struct supernet_info *myinfo,struct iguana_info *coin,char *address,char *sig,char *message); -char *iguana_validatepubkey(struct supernet_info *myinfo,struct iguana_info *coin,char *pubkey); -char *iguana_getnewaddress(struct supernet_info *myinfo,struct iguana_info *coin,char *account); -char *iguana_makekeypair(struct supernet_info *myinfo,struct iguana_info *coin); -char *iguana_vanitygen(struct supernet_info *myinfo,struct iguana_info *coin,char *vanity); -char *iguana_createmultisig(struct supernet_info *myinfo,struct iguana_info *coin,int32_t M,cJSON *pubkeys,char *account); - -char *iguana_getrawchangeaddress(struct supernet_info *myinfo,struct iguana_info *coin,char *account); -char *iguana_settxfee(struct supernet_info *myinfo,struct iguana_info *coin,double amount); -char *iguana_listtransactions(struct supernet_info *myinfo,struct iguana_info *coin,char *account,int32_t count,int32_t from); -char *iguana_listunspent(struct supernet_info *myinfo,struct iguana_info *coin,int32_t minconf,int32_t maxconf); -char *iguana_lockunspent(struct supernet_info *myinfo,struct iguana_info *coin,char *filename); -char *iguana_listlockunspent(struct supernet_info *myinfo,struct iguana_info *coin,char *unlock,cJSON *array); -char *iguana_gettxout(struct supernet_info *myinfo,struct iguana_info *coin,bits256 txid,int32_t vout,int32_t mempool); -char *iguana_gettxoutsetinfo(struct supernet_info *myinfo,struct iguana_info *coin); -char *iguana_getrawtransaction(struct supernet_info *myinfo,struct iguana_info *coin,bits256 txid,int32_t verbose); -char *iguana_createrawtransaction(struct supernet_info *myinfo,struct iguana_info *coin,cJSON *vins,cJSON *vouts); -char *iguana_decoderawtransaction(struct supernet_info *myinfo,struct iguana_info *coin,char *rawtx); -char *iguana_decodescript(struct supernet_info *myinfo,struct iguana_info *coin,char *script); -char *iguana_signrawtransaction(struct supernet_info *myinfo,struct iguana_info *coin,char *rawtx,cJSON *vins,cJSON *privkeys); -char *iguana_sendrawtransaction(struct supernet_info *myinfo,struct iguana_info *coin,char *rawtx); -char *iguana_sendtoaddress(struct supernet_info *myinfo,struct iguana_info *coin,char *address,double amount,char *comment,char *comment2); -char *iguana_getreceivedbyaddress(struct supernet_info *myinfo,struct iguana_info *coin,char *address,int32_t minconf); -char *iguana_listreceivedbyaddress(struct supernet_info *myinfo,struct iguana_info *coin,int32_t minconf,int32_t includeempty); - +#include "../includes/iguana_api.h" #endif diff --git a/iguana/iguana_json.c b/iguana/iguana_json.c index a593ecf5d..0c043ce5c 100755 --- a/iguana/iguana_json.c +++ b/iguana/iguana_json.c @@ -692,7 +692,7 @@ char *ramchain_coinparser(struct supernet_info *myinfo,struct iguana_info *coin, else if ( strcmp(method,"getaccountaddress") == 0 ) return(iguana_getaccountaddress(myinfo,coin,jstr(json,"account"))); else if ( strcmp(method,"setaccount") == 0 ) - return(iguana_setaccount(myinfo,coin,jstr(json,"account"))); + return(iguana_setaccount(myinfo,coin,jstr(json,"address"),jstr(json,"account"))); else if ( strcmp(method,"getaccount") == 0 ) return(iguana_getaccount(myinfo,coin,jstr(json,"account"))); else if ( strcmp(method,"getaddressesbyaccount") == 0 ) @@ -732,9 +732,9 @@ char *ramchain_coinparser(struct supernet_info *myinfo,struct iguana_info *coin, else if ( strcmp(method,"listunspent") == 0 ) return(iguana_listunspent(myinfo,coin,juint(json,"minconf"),juint(json,"maxconf"))); else if ( strcmp(method,"lockunspent") == 0 ) - return(iguana_lockunspent(myinfo,coin,jstr(json,"filename"))); + return(iguana_lockunspent(myinfo,coin,juint(json,"flag"),jobj(json,"array"))); else if ( strcmp(method,"listlockunspent") == 0 ) - return(iguana_listlockunspent(myinfo,coin,jstr(json,"unlock"),jobj(json,"array"))); + return(iguana_listlockunspent(myinfo,coin)); else if ( strcmp(method,"gettxout") == 0 ) return(iguana_gettxout(myinfo,coin,jbits256(json,"txid"),juint(json,"vout"),juint(json,"mempool"))); else if ( strcmp(method,"gettxoutsetinfo") == 0 ) diff --git a/iguana/iguana_recv.c b/iguana/iguana_recv.c index c4b0e47bd..eab1b05e4 100755 --- a/iguana/iguana_recv.c +++ b/iguana/iguana_recv.c @@ -334,7 +334,7 @@ struct iguana_bundle *iguana_bundleset(struct iguana_info *coin,struct iguana_bl if ( block != origblock ) iguana_blockcopy(coin,block,origblock); *blockp = block; - if ( bits256_nonz(block->RO.prev_block) > 0 ) + if ( 0 && bits256_nonz(block->RO.prev_block) > 0 ) iguana_patch(coin,block); if ( (bp= iguana_bundlefind(coin,&bp,&bundlei,block->RO.hash2)) != 0 ) { diff --git a/iguana/iguana_rpc.c b/iguana/iguana_rpc.c index dd582c3ad..72998a573 100755 --- a/iguana/iguana_rpc.c +++ b/iguana/iguana_rpc.c @@ -387,7 +387,7 @@ static char *listunspent(RPCARGS) static char *lockunspent(RPCARGS) { - return(sglue2(0,myinfo,coin,remoteaddr,"ramchain","lockunspent","unlock",params[0],"array",params[1])); + return(sglue2(0,myinfo,coin,remoteaddr,"ramchain","lockunspent","flag",params[0],"array",params[1])); } static char *listlockunspent(RPCARGS) diff --git a/iguana/iguana_tx.c b/iguana/iguana_tx.c index 5543619ae..1db34c4a1 100755 --- a/iguana/iguana_tx.c +++ b/iguana/iguana_tx.c @@ -39,13 +39,13 @@ char *iguana_listunspent(struct supernet_info *myinfo,struct iguana_info *coin,i } -char *iguana_lockunspent(struct supernet_info *myinfo,struct iguana_info *coin,char *filename) +char *iguana_lockunspent(struct supernet_info *myinfo,struct iguana_info *coin,int32_t flag,cJSON *array) { return(clonestr("{\"error\":\"notyet\"}")); } -char *iguana_listlockunspent(struct supernet_info *myinfo,struct iguana_info *coin,char *unlock,cJSON *array) +char *iguana_listlockunspent(struct supernet_info *myinfo,struct iguana_info *coin) { return(clonestr("{\"error\":\"notyet\"}")); } diff --git a/iguana/iguana_wallet.c b/iguana/iguana_wallet.c index 0dd618ea1..cd4c7870e 100755 --- a/iguana/iguana_wallet.c +++ b/iguana/iguana_wallet.c @@ -184,7 +184,7 @@ char *iguana_getaccountaddress(struct supernet_info *myinfo,struct iguana_info * } -char *iguana_setaccount(struct supernet_info *myinfo,struct iguana_info *coin,char *account) +char *iguana_setaccount(struct supernet_info *myinfo,struct iguana_info *coin,char *address,char *account) { return(clonestr("{\"error\":\"notyet\"}")); } diff --git a/includes/iguana_api.h b/includes/iguana_api.h new file mode 100755 index 000000000..6b260620b --- /dev/null +++ b/includes/iguana_api.h @@ -0,0 +1,25 @@ +/****************************************************************************** + * Copyright © 2014-2015 The SuperNET Developers. * + * * + * See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at * + * the top-level directory of this distribution for the individual copyright * + * holder information and the developer policies on copyright and licensing. * + * * + * Unless otherwise agreed in a custom licensing agreement, no part of the * + * SuperNET software, including this file may be copied, modified, propagated * + * or distributed except according to the terms contained in the LICENSE file * + * * + * Removal or modification of this copyright notice is prohibited. * + * * + ******************************************************************************/ + +#ifndef IGUANA_API_H +#define IGUANA_API_H + +#include "iguana_apidefs.h" +#include "iguana_apideclares.h" +#undef IGUANA_ARGS + +#include "iguana_apiundefs.h" + +#endif \ No newline at end of file diff --git a/includes/iguana_apideclares.h b/includes/iguana_apideclares.h new file mode 100755 index 000000000..6ecfd3e87 --- /dev/null +++ b/includes/iguana_apideclares.h @@ -0,0 +1,183 @@ +/****************************************************************************** + * Copyright © 2014-2015 The SuperNET Developers. * + * * + * See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at * + * the top-level directory of this distribution for the individual copyright * + * holder information and the developer policies on copyright and licensing. * + * * + * Unless otherwise agreed in a custom licensing agreement, no part of the * + * SuperNET software, including this file may be copied, modified, propagated * + * or distributed except according to the terms contained in the LICENSE file * + * * + * Removal or modification of this copyright notice is prohibited. * + * * + ******************************************************************************/ + +/* from https://bitcoin.org/en/developer-reference#rpcs + Block Chain RPCs + GetBestBlockHash: returns the header hash of the most recent block on the best block chain. New in 0.9.0 + GetBlock: gets a block with a particular header hash from the local block database either as a JSON object or as a serialized block. + GetBlockChainInfo: provides information about the current state of the block chain. New in 0.9.2, Updated in 0.10.0 + GetBlockCount: returns the number of blocks in the local best block chain. + GetBlockHash: returns the header hash of a block at the given height in the local best block chain. + GetChainTips: returns information about the highest-height block (tip) of each local block chain. New in 0.10.0 + GetDifficulty: returns the proof-of-work difficulty as a multiple of the minimum difficulty. + GetMemPoolInfo: returns information about the node’s current transaction memory pool. New in 0.10.0 + GetRawMemPool: returns all transaction identifiers (TXIDs) in the memory pool as a JSON array, or detailed information about each transaction in the memory pool as a JSON object. + GetTxOut: returns details about a transaction output. Only unspent transaction outputs (UTXOs) are guaranteed to be available. + GetTxOutProof: returns a hex-encoded proof that one or more specified transactions were included in a block. New in 0.11.0 + GetTxOutSetInfo: returns statistics about the confirmed unspent transaction output (UTXO) set. Note that this call may take some time and that it only counts outputs from confirmed transactions—it does not count outputs from the memory pool. + VerifyChain: verifies each entry in the local block chain database. + VerifyTxOutProof: verifies that a proof points to one or more transactions in a block, returning the transactions the proof commits to and throwing an RPC error if the block is not in our best block chain. New in 0.11.0 + Control RPCs + GetInfo: prints various information about the node and the network. Updated in 0.10.0, Deprecated + Help: lists all available public RPC commands, or gets help for the specified RPC. Commands which are unavailable will not be listed, such as wallet RPCs if wallet support is disabled. + Stop: safely shuts down the Bitcoin Core server. + Generating RPCs + Generate: nearly instantly generates blocks (in regtest mode only) New in master + GetGenerate: returns true if the node is set to generate blocks using its CPU. + SetGenerate: enables or disables hashing to attempt to find the next block. Updated in master + Mining RPCs + GetBlockTemplate: gets a block template or proposal for use with mining software. + GetMiningInfo: returns various mining-related information. Updated in master + GetNetworkHashPS: returns the estimated current or historical network hashes per second based on the last n blocks. + PrioritiseTransaction: adds virtual priority or fee to a transaction, allowing it to be accepted into blocks mined by this node (or miners which use this node) with a lower priority or fee. (It can also remove virtual priority or fee, requiring the transaction have a higher priority or fee to be accepted into a locally-mined block.) New in 0.10.0 + SubmitBlock: accepts a block, verifies it is a valid addition to the block chain, and broadcasts it to the network. Extra parameters are ignored by Bitcoin Core but may be used by mining pools or other programs. + Network RPCs + AddNode: attempts to add or remove a node from the addnode list, or to try a connection to a node once. + GetAddedNodeInfo: returns information about the given added node, or all added nodes (except onetry nodes). Only nodes which have been manually added using the addnode RPC will have their information displayed. + GetConnectionCount: returns the number of connections to other nodes. + GetNetTotals: returns information about network traffic, including bytes in, bytes out, and the current time. + GetNetworkInfo: returns information about the node’s connection to the network. New in 0.9.2, Updated in 0.10.0 + GetPeerInfo: returns data about each connected network node. Updated in 0.10.0 + Ping: sends a P2P ping message to all connected nodes to measure ping time. Results are provided by the getpeerinfo RPC pingtime and pingwait fields as decimal seconds. The P2P ping message is handled in a queue with all other commands, so it measures processing backlog, not just network ping. + Raw Transaction RPCs + CreateRawTransaction: creates an unsigned serialized transaction that spends a previous output to a new output with a P2PKH or P2SH address. The transaction is not stored in the wallet or transmitted to the network. + DecodeRawTransaction: decodes a serialized transaction hex string into a JSON object describing the transaction. + DecodeScript: decodes a hex-encoded P2SH redeem script. + GetRawTransaction: gets a hex-encoded serialized transaction or a JSON object describing the transaction. By default, Bitcoin Core only stores complete transaction data for UTXOs and your own transactions, so the RPC may fail on historic transactions unless you use the non-default txindex=1 in your Bitcoin Core startup settings. + SendRawTransaction: validates a transaction and broadcasts it to the peer-to-peer network. + SignRawTransaction: signs a transaction in the serialized transaction format using private keys stored in the wallet or provided in the call. + Utility RPCs + CreateMultiSig: creates a P2SH multi-signature address. + EstimateFee: estimates the transaction fee per kilobyte that needs to be paid for a transaction to be included within a certain number of blocks. New in 0.10.0 + EstimatePriority: estimates the priority that a transaction needs in order to be included within a certain number of blocks as a free high-priority transaction. New in 0.10.0 + ValidateAddress: returns information about the given Bitcoin address. + VerifyMessage: verifies a signed message. + Wallet RPCs + Note: the wallet RPCs are only available if Bitcoin Core was built with wallet support, which is the default. + + AddMultiSigAddress: adds a P2SH multisig address to the wallet. + BackupWallet: safely copies wallet.dat to the specified file, which can be a directory or a path with filename. + DumpPrivKey: returns the wallet-import-format (WIP) private key corresponding to an address. (But does not remove it from the wallet.) + DumpWallet: creates or overwrites a file with all wallet keys in a human-readable format. + EncryptWallet: encrypts the wallet with a passphrase. This is only to enable encryption for the first time. After encryption is enabled, you will need to enter the passphrase to use private keys. + GetAccountAddress: returns the current Bitcoin address for receiving payments to this account. If the account doesn’t exist, it creates both the account and a new address for receiving payment. Once a payment has been received to an address, future calls to this RPC for the same account will return a different address. + GetAccount: returns the name of the account associated with the given address. + GetAddressesByAccount: returns a list of every address assigned to a particular account. + GetBalance: gets the balance in decimal bitcoins across all accounts or for a particular account. + GetNewAddress: returns a new Bitcoin address for receiving payments. If an account is specified, payments received with the address will be credited to that account. + GetRawChangeAddress: returns a new Bitcoin address for receiving change. This is for use with raw transactions, not normal use. + GetReceivedByAccount: returns the total amount received by addresses in a particular account from transactions with the specified number of confirmations. It does not count coinbase transactions. + GetReceivedByAddress: returns the total amount received by the specified address in transactions with the specified number of confirmations. It does not count coinbase transactions. + GetTransaction: gets detailed information about an in-wallet transaction. Updated in 0.10.0 + GetUnconfirmedBalance: returns the wallet’s total unconfirmed balance. + GetWalletInfo: provides information about the wallet. New in 0.9.2 + ImportAddress: adds an address or pubkey script to the wallet without the associated private key, allowing you to watch for transactions affecting that address or pubkey script without being able to spend any of its outputs. New in 0.10.0 + ImportPrivKey: adds a private key to your wallet. The key should be formatted in the wallet import format created by the dumpprivkey RPC. + ImportWallet: imports private keys from a file in wallet dump file format (see the dumpwallet RPC). These keys will be added to the keys currently in the wallet. This call may need to rescan all or parts of the block chain for transactions affecting the newly-added keys, which may take several minutes. + KeyPoolRefill: fills the cache of unused pre-generated keys (the keypool). + ListAccounts: lists accounts and their balances. Updated in 0.10.0 + ListAddressGroupings: lists groups of addresses that may have had their common ownership made public by common use as inputs in the same transaction or from being used as change from a previous transaction. + ListLockUnspent: returns a list of temporarily unspendable (locked) outputs. + ListReceivedByAccount: lists the total number of bitcoins received by each account. Updated in 0.10.0 + ListReceivedByAddress: lists the total number of bitcoins received by each address. Updated in 0.10.0 + ListSinceBlock: gets all transactions affecting the wallet which have occurred since a particular block, plus the header hash of a block at a particular depth. Updated in 0.10.0 + ListTransactions: returns the most recent transactions that affect the wallet. Updated in 0.10.0 + ListUnspent: returns an array of unspent transaction outputs belonging to this wallet. Updated in 0.10.0 + LockUnspent: temporarily locks or unlocks specified transaction outputs. A locked transaction output will not be chosen by automatic coin selection when spending bitcoins. Locks are stored in memory only, so nodes start with zero locked outputs and the locked output list is always cleared when a node stops or fails. + Move: moves a specified amount from one account in your wallet to another using an off-block-chain transaction. + SendFrom: spends an amount from a local account to a bitcoin address. + SendMany: creates and broadcasts a transaction which sends outputs to multiple addresses. + SendToAddress: spends an amount to a given address. + SetAccount: puts the specified address in the given account. + SetTxFee: sets the transaction fee per kilobyte paid by transactions created by this wallet. + SignMessage: signs a message with the private key of an address. + WalletLock: removes the wallet encryption key from memory, locking the wallet. After calling this method, you will need to call walletpassphrase again before being able to call any methods which require the wallet to be unlocked. + WalletPassphrase: stores the wallet decryption key in memory for the indicated number of seconds. Issuing the walletpassphrase command while the wallet is already unlocked will set a new unlock time that overrides the old one. + WalletPassphraseChange: changes the wallet passphrase from ‘old passphrase’ to ‘new passphrase’. + Removed RPCs + GetHashesPerSec: was removed in Bitcoin Core master (unreleased). It returned a recent hashes per second performance measurement when the node was generating blocks. + GetWork: was removed in Bitcoin Core 0.10.0. + RPCs + Warning icon Warning: the block chain and memory pool can include arbitrary data which several of the commands below will return in hex format. If you convert this data to another format in an executable context, it could be used in an exploit. For example, displaying a pubkey script as ASCII text in a webpage could add arbitrary Javascript to that page and create a cross-site scripting (XSS) exploit. To avoid problems, please treat block chain and memory pool data as an arbitrary input from an untrusted source. + + */ + +ZERO_ARGS(getinfo); +ZERO_ARGS(getbestblockhash); +ZERO_ARGS(getblockcount); +ZERO_ARGS(listaddressgroupings); +ZERO_ARGS(getinfo); +ZERO_ARGS(walletlock); +ZERO_ARGS(checkwallet); +ZERO_ARGS(repairwallet); +ZERO_ARGS(makekeypair); +ZERO_ARGS(gettxoutsetinfo); +ZERO_ARGS(dumpwallet); +ZERO_ARGS(listlockunspent); + +INT_ARG(listaccounts,minconf); + +TWO_INTS(listunspent,minconf,maxconf); +TWO_INTS(listreceivedbyaddress,minconf,includeempty); + +STRING_ARG(backupwallet,filename); +STRING_ARG(encryptwallet,passphrase); +STRING_ARG(validatepubkey,pubkey); +STRING_ARG(getnewaddress,account); +STRING_ARG(vanitygen,vanity); +STRING_ARG(getrawchangeaddress,account); +STRING_ARG(sendrawtransaction,rawtx); + +STRING_ARG(getaddressesbyaccount,account); +STRING_ARG(getaccountaddress,account); +STRING_ARG(getaccount,address); +STRING_ARG(getaccountaddress,account); +STRING_ARG(dumpprivkey,address); +STRING_ARG(importprivkey,wif); +STRING_ARG(importwallet,filename); +STRING_ARG(decoderawtransaction,rawtx); +STRING_ARG(decodescript,script); + +TWO_STRINGS(setaccount,address,account); +TWO_STRINGS(walletpassphrasechange,oldpassphrase,newpassphrase); +TWO_STRINGS(signmessage,address,message); + +THREE_STRINGS(verifymessage,address,sig,message); + +STRING_AND_INT(getreceivedbyaccount,account,includeempty); +STRING_AND_INT(listreceivedbyaccount,account,includeempty); +STRING_AND_INT(getbalance,account,minconf); +STRING_AND_INT(walletpassphrase,passphrase,timeout); +STRING_AND_INT(getreceivedbyaddress,address,minconf); + +HASH_AND_INT(listsinceblock,blockhash,target); +HASH_AND_INT(getrawtransaction,txid,verbose); + +STRING_AND_TWOINTS(listtransactions,account,count,from); + +HASH_AND_TWOINTS(gettxout,txid,vout,mempool); + +DOUBLE_ARG(settxfee,amount); + +INT_AND_ARRAY(lockunspent,flag,array); +INT_ARRAY_STRING(createmultisig,M,array,account); + +TWO_ARRAYS(createrawtransaction,vins,vouts); +STRING_AND_TWOARRAYS(signrawtransaction,rawtx,vins,privkeys); + +SS_D_I_S(move,fromaccount,toaccount,amount,minconf,comment); +SS_D_I_SS(sendfrom,fromaccount,toaddress,amount,minconf,comment,comment2); +S_A_I_S(sendmany,fromaccount,array,minconf,comment); +S_D_SS(sendtoaddress,address,amount,comment,comment2); diff --git a/includes/iguana_apidefs.h b/includes/iguana_apidefs.h new file mode 100755 index 000000000..e55eba054 --- /dev/null +++ b/includes/iguana_apidefs.h @@ -0,0 +1,44 @@ + +#define IGUANA_ARGS struct supernet_info *myinfo,struct iguana_info *coin +#define IGUANA_CFUNC0(name) char *iguana_ ## name(IGUANA_ARGS) +#define IGUANA_CFUNC_S(name,str) char *iguana_ ## name(IGUANA_ARGS,char *str) +#define IGUANA_CFUNC_I(name,val) char *iguana_ ## name(IGUANA_ARGS,int32_t val) +#define IGUANA_CFUNC_SA(name,str,array) char *iguana_ ## name(IGUANA_ARGS,char *str,cJSON *array) +#define IGUANA_CFUNC_AA(name,array,array2) char *iguana_ ## name(IGUANA_ARGS,cJSON *array,cJSON *array2) +#define IGUANA_CFUNC_SAA(name,str,array,array2) char *iguana_ ## name(IGUANA_ARGS,char *str,cJSON *array,cJSON *array2) +#define IGUANA_CFUNC_IA(name,val,array) char *iguana_ ## name(IGUANA_ARGS,int32_t val,cJSON *array) +#define IGUANA_CFUNC_IAS(name,val,array,str) char *iguana_ ## name(IGUANA_ARGS,int32_t val,cJSON *array,char *str) +#define IGUANA_CFUNC_II(name,val,val2) char *iguana_ ## name(IGUANA_ARGS,int32_t val,int32_t val2) +#define IGUANA_CFUNC_SS(name,str,str2) char *iguana_ ## name(IGUANA_ARGS,char *str,char *str2) +#define IGUANA_CFUNC_SSS(name,str,str2,str3) char *iguana_ ## name(IGUANA_ARGS,char *str,char *str2,char *str3) +#define IGUANA_CFUNC_SI(name,str,val) char *iguana_ ## name(IGUANA_ARGS,char *str,int32_t val) +#define IGUANA_CFUNC_SII(name,str,val,val2) char *iguana_ ## name(IGUANA_ARGS,char *str,int32_t val,int32_t val2) +#define IGUANA_CFUNC_HI(name,hash,val) char *iguana_ ## name(IGUANA_ARGS,bits256 hash,int32_t val) +#define IGUANA_CFUNC_HII(name,hash,val,val2) char *iguana_ ## name(IGUANA_ARGS,bits256 hash,int32_t val,int32_t val2) +#define IGUANA_CFUNC_D(name,val) char *iguana_ ## name(IGUANA_ARGS,double val) +#define IGUANA_CFUNC_SSDIS(name,str,str2,amount,val,str3) char *iguana_ ## name(IGUANA_ARGS,char *str,char *str2,double amount,int32_t val,char *str3) +#define IGUANA_CFUNC_SSDISS(name,str,str2,amount,val,str3,str4) char *iguana_ ## name(IGUANA_ARGS,char *str,char *str2,double amount,int32_t val,char *str3,char *str4) +#define IGUANA_CFUNC_SAIS(name,str,array,val,str2) char *iguana_ ## name(IGUANA_ARGS,char *str,cJSON *array,int32_t val,char *str2) +#define IGUANA_CFUNC_SDSS(name,str,amount,str2,str3) char *iguana_ ## name(IGUANA_ARGS,char *str,double amount,char *str2,char *str3) + +// API functions +#define ZERO_ARGS IGUANA_CFUNC0 +#define INT_ARG IGUANA_CFUNC_I +#define TWO_INTS IGUANA_CFUNC_II +#define STRING_ARG IGUANA_CFUNC_S +#define TWO_STRINGS IGUANA_CFUNC_SS +#define THREE_STRINGS IGUANA_CFUNC_SSS +#define STRING_AND_INT IGUANA_CFUNC_SI +#define STRING_AND_TWOINTS IGUANA_CFUNC_SII +#define HASH_AND_INT IGUANA_CFUNC_HI +#define HASH_AND_TWOINTS IGUANA_CFUNC_HII +#define DOUBLE_ARG IGUANA_CFUNC_D +#define STRING_AND_ARRAY IGUANA_CFUNC_SA +#define STRING_AND_TWOARRAYS IGUANA_CFUNC_SAA +#define TWO_ARRAYS IGUANA_CFUNC_AA +#define INT_AND_ARRAY IGUANA_CFUNC_IA +#define INT_ARRAY_STRING IGUANA_CFUNC_IAS +#define SS_D_I_S IGUANA_CFUNC_SSDIS +#define SS_D_I_SS IGUANA_CFUNC_SSDISS +#define S_A_I_S IGUANA_CFUNC_SAIS +#define S_D_SS IGUANA_CFUNC_SDSS diff --git a/includes/iguana_apiundefs.h b/includes/iguana_apiundefs.h new file mode 100755 index 000000000..d192f8b80 --- /dev/null +++ b/includes/iguana_apiundefs.h @@ -0,0 +1,21 @@ + +#undef S_D_SS +#undef S_A_I_S +#undef SS_D_I_S +#undef SS_D_I_SS +#undef ZERO_ARGS +#undef INT_ARG +#undef TWO_INTS +#undef STRING_ARG +#undef TWO_STRINGS +#undef THREE_STRINGS +#undef STRING_AND_INT +#undef STRING_AND_TWOINTS +#undef HASH_AND_INT +#undef HASH_AND_TWOINTS +#undef DOUBLE_ARG +#undef STRING_AND_ARRAY +#undef INT_AND_ARRAY +#undef INT_ARRAY_STRING +#undef TWO_ARRAYS +#undef STRING_AND_TWOARRAYS \ No newline at end of file