|
20 | 20 | #include "walletdb.h" |
21 | 21 | #include "zpivchain.h" |
22 | 22 |
|
| 23 | +#include "sapling/key_io_sapling.h" |
| 24 | + |
23 | 25 | #include <stdint.h> |
24 | 26 |
|
25 | 27 | #include "libzerocoin/Coin.h" |
@@ -495,6 +497,29 @@ UniValue getnewstakingaddress(const JSONRPCRequest& request) |
495 | 497 | return EncodeDestination(GetNewAddressFromLabel("coldstaking", request.params, CChainParams::STAKING_ADDRESS), CChainParams::STAKING_ADDRESS); |
496 | 498 | } |
497 | 499 |
|
| 500 | +UniValue getnewshieldedaddress(const JSONRPCRequest& request) |
| 501 | +{ |
| 502 | + if (request.fHelp || request.params.size() > 1) |
| 503 | + throw std::runtime_error( |
| 504 | + "getnewshieldedaddress\n" |
| 505 | + "\nReturns a new shielded address for receiving payments.\n" |
| 506 | + "\nArguments:\n" |
| 507 | + "\nResult:\n" |
| 508 | + "\"address\" (string) The new shielded address.\n" |
| 509 | + "\nExamples:\n" |
| 510 | + + HelpExampleCli("getnewshieldedaddress", "") |
| 511 | + + HelpExampleRpc("getnewshieldedaddress", "") |
| 512 | + ); |
| 513 | + |
| 514 | + EnsureWallet(); |
| 515 | + |
| 516 | + LOCK2(cs_main, pwalletMain->cs_wallet); |
| 517 | + |
| 518 | + EnsureWalletIsUnlocked(); |
| 519 | + |
| 520 | + return KeyIO::EncodePaymentAddress(pwalletMain->GenerateNewSaplingZKey()); |
| 521 | +} |
| 522 | + |
498 | 523 | UniValue delegatoradd(const JSONRPCRequest& request) |
499 | 524 | { |
500 | 525 | if (request.fHelp || request.params.size() < 1 || request.params.size() > 2) |
@@ -5005,6 +5030,9 @@ const CRPCCommand vWalletRPCCommands[] = |
5005 | 5030 | { "wallet", "delegatoradd", &delegatoradd, true }, |
5006 | 5031 | { "wallet", "delegatorremove", &delegatorremove, true }, |
5007 | 5032 |
|
| 5033 | + /** Sapling functions */ |
| 5034 | + { "wallet", "getnewshieldedaddress", &getnewshieldedaddress, true }, |
| 5035 | + |
5008 | 5036 | /** Account functions (deprecated) */ |
5009 | 5037 | { "wallet", "getaccountaddress", &getaccountaddress, true }, |
5010 | 5038 | { "wallet", "getaccount", &getaccount, true }, |
|
0 commit comments