diff --git a/src/rpcserver.cpp b/src/rpcserver.cpp index a7e16652a..0330c8939 100644 --- a/src/rpcserver.cpp +++ b/src/rpcserver.cpp @@ -369,6 +369,7 @@ static const CRPCCommand vRPCCommands[] = /* dice */ { "dice", "dicefund", &dicefund, true }, + { "dice", "diceaddfunds", &diceaddfunds, true }, { "dice", "dicebet", &dicebet, true }, { "dice", "diceaddress", &diceaddress, true }, diff --git a/src/rpcserver.h b/src/rpcserver.h index 9144b874a..c0e29020e 100644 --- a/src/rpcserver.h +++ b/src/rpcserver.h @@ -235,6 +235,7 @@ extern UniValue rewardslock(const UniValue& params, bool fHelp); extern UniValue rewardsunlock(const UniValue& params, bool fHelp); extern UniValue diceaddress(const UniValue& params, bool fHelp); extern UniValue dicefund(const UniValue& params, bool fHelp); +extern UniValue diceaddfunds(const UniValue& params, bool fHelp); extern UniValue dicebet(const UniValue& params, bool fHelp); extern UniValue lottoaddress(const UniValue& params, bool fHelp); extern UniValue ponziaddress(const UniValue& params, bool fHelp); diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 7dac48746..653add7a9 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -5029,7 +5029,7 @@ UniValue rewardsaddfunding(const UniValue& params, bool fHelp) { result.push_back(Pair("result", "success")); result.push_back(Pair("hex", hex)); - } else result.push_back(Pair("error", "couldnt create rewards lock transaction")); + } else result.push_back(Pair("error", "couldnt create rewards addfunding transaction")); return(result); } @@ -5109,6 +5109,25 @@ UniValue dicefund(const UniValue& params, bool fHelp) return(result); } +UniValue diceaddfunds(const UniValue& params, bool fHelp) +{ + UniValue result(UniValue::VOBJ); char *name; uint256 fundingtxid; uint64_t amount; std::string hex; + if ( fHelp || params.size() != 3 ) + throw runtime_error("diceaddfunds name fundingtxid amount\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"); + name = (char *)params[0].get_str().c_str(); + fundingtxid = Parseuint256((char *)params[1].get_str().c_str()); + amount = atof(params[2].get_str().c_str()) * COIN; + hex = DiceAddfunding(0,name,fundingtxid,amount); + if ( hex.size() > 0 ) + { + result.push_back(Pair("result", "success")); + result.push_back(Pair("hex", hex)); + } else result.push_back(Pair("error", "couldnt create dice addfunding transaction")); + return(result); +} + UniValue dicebet(const UniValue& params, bool fHelp) { UniValue result(UniValue::VOBJ); std::string hex; uint64_t amount,odds;