Test
This commit is contained in:
@@ -347,6 +347,7 @@ static const CRPCCommand vRPCCommands[] =
|
|||||||
/* faucet */
|
/* faucet */
|
||||||
{ "faucet", "faucetfund", &faucetfund, true },
|
{ "faucet", "faucetfund", &faucetfund, true },
|
||||||
{ "faucet", "faucetget", &faucetget, true },
|
{ "faucet", "faucetget", &faucetget, true },
|
||||||
|
{ "faucet", "faucetaddress", &faucetaddress, true },
|
||||||
|
|
||||||
/* tokens */
|
/* tokens */
|
||||||
{ "tokens", "tokenorders", &tokenorders, true },
|
{ "tokens", "tokenorders", &tokenorders, true },
|
||||||
|
|||||||
@@ -223,6 +223,7 @@ extern UniValue tokenswapask(const UniValue& params, bool fHelp);
|
|||||||
extern UniValue tokenfillswap(const UniValue& params, bool fHelp);
|
extern UniValue tokenfillswap(const UniValue& params, bool fHelp);
|
||||||
extern UniValue faucetfund(const UniValue& params, bool fHelp);
|
extern UniValue faucetfund(const UniValue& params, bool fHelp);
|
||||||
extern UniValue faucetget(const UniValue& params, bool fHelp);
|
extern UniValue faucetget(const UniValue& params, bool fHelp);
|
||||||
|
UniValue faucetaddress(const UniValue& params, bool fHelp);
|
||||||
|
|
||||||
extern UniValue getnewaddress(const UniValue& params, bool fHelp); // in rpcwallet.cpp
|
extern UniValue getnewaddress(const UniValue& params, bool fHelp); // in rpcwallet.cpp
|
||||||
//extern UniValue getnewaddress64(const UniValue& params, bool fHelp); // in rpcwallet.cpp
|
//extern UniValue getnewaddress64(const UniValue& params, bool fHelp); // in rpcwallet.cpp
|
||||||
|
|||||||
@@ -4842,6 +4842,27 @@ int32_t ensure_CCrequirements()
|
|||||||
|
|
||||||
#include "../cc/CCfaucet.h"
|
#include "../cc/CCfaucet.h"
|
||||||
|
|
||||||
|
UniValue faucetaddress(const UniValue& params, bool fHelp)
|
||||||
|
{
|
||||||
|
UniValue result(UniValue::VOBJ); std::vector<unsigned char> pubkey; char destaddr[64];
|
||||||
|
if ( fHelp || params.size() > 1 )
|
||||||
|
throw runtime_error("faucetaddress [pubkey]\n");
|
||||||
|
if ( ensure_CCrequirements() < 0 )
|
||||||
|
throw runtime_error("to use CC contracts, you need to launch daemon with valid -pubkey= for an address in your wallet\n");
|
||||||
|
result.push_back(Pair("result", "success"));
|
||||||
|
if ( GetCCaddress(FAUCET_ASSETS,destaddr,pubkey2pk(pubkey)) != 0 )
|
||||||
|
result.push_back(Pair("AssetsCCaddress",destaddr));
|
||||||
|
if ( params.size() == 1 )
|
||||||
|
{
|
||||||
|
pubkey = ParseHex(params[0].get_str().c_str());
|
||||||
|
if ( GetCCaddress(FAUCET_ASSETS,destaddr,pubkey2pk(pubkey)) != 0 )
|
||||||
|
result.push_back(Pair("CCaddress",destaddr));
|
||||||
|
}
|
||||||
|
if ( GetCCaddress(FAUCET_ASSETS,destaddr,pubkey2pk(Mypubkey())) != 0 )
|
||||||
|
result.push_back(Pair("myCCaddress",destaddr));
|
||||||
|
return(result);
|
||||||
|
}
|
||||||
|
|
||||||
UniValue faucetfund(const UniValue& params, bool fHelp)
|
UniValue faucetfund(const UniValue& params, bool fHelp)
|
||||||
{
|
{
|
||||||
UniValue result(UniValue::VOBJ); uint64_t funds; std::string hex;
|
UniValue result(UniValue::VOBJ); uint64_t funds; std::string hex;
|
||||||
|
|||||||
Reference in New Issue
Block a user