2016-01-20 15:15:29 +01:00
|
|
|
// Copyright (c) 2016 The Bitcoin Core developers
|
|
|
|
// Distributed under the MIT software license, see the accompanying
|
|
|
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
|
|
|
|
|
|
#ifndef BITCOIN_WALLET_RPCWALLET_H
|
|
|
|
#define BITCOIN_WALLET_RPCWALLET_H
|
|
|
|
|
2021-11-01 12:24:34 +01:00
|
|
|
#include <memory>
|
2017-09-08 01:30:28 +02:00
|
|
|
#include <string>
|
2021-11-01 12:24:34 +01:00
|
|
|
#include <vector>
|
2017-09-08 01:30:28 +02:00
|
|
|
|
2016-03-31 10:55:06 +02:00
|
|
|
class CRPCTable;
|
2017-09-08 01:30:28 +02:00
|
|
|
class CWallet;
|
2017-03-03 13:37:19 +01:00
|
|
|
class JSONRPCRequest;
|
2020-12-15 03:41:03 +01:00
|
|
|
class UniValue;
|
2021-07-13 18:30:17 +02:00
|
|
|
struct PartiallySignedTransaction;
|
|
|
|
class CTransaction;
|
2016-03-31 10:55:06 +02:00
|
|
|
|
2021-11-01 12:24:34 +01:00
|
|
|
namespace interfaces {
|
|
|
|
class Chain;
|
|
|
|
class Handler;
|
|
|
|
}
|
2022-04-23 09:46:44 +02:00
|
|
|
namespace util {
|
|
|
|
class Ref;
|
|
|
|
} // namespace util
|
2021-11-01 12:24:34 +01:00
|
|
|
|
2022-04-05 11:09:41 +02:00
|
|
|
//! Pointer to chain interface that needs to be declared as a global to be
|
|
|
|
//! accessible loadwallet and createwallet methods. Due to limitations of the
|
|
|
|
//! RPC framework, there's currently no direct way to pass in state to RPC
|
|
|
|
//! methods without globals.
|
|
|
|
extern interfaces::Chain* g_rpc_chain;
|
|
|
|
|
2021-11-01 12:24:34 +01:00
|
|
|
void RegisterWalletRPCCommands(interfaces::Chain& chain, std::vector<std::unique_ptr<interfaces::Handler>>& handlers);
|
2016-01-20 15:15:29 +01:00
|
|
|
|
2017-03-03 13:37:19 +01:00
|
|
|
/**
|
|
|
|
* Figures out what wallet, if any, to use for a JSONRPCRequest.
|
|
|
|
*
|
|
|
|
* @param[in] request JSONRPCRequest that wishes to access a wallet
|
2019-08-06 05:08:33 +02:00
|
|
|
* @return nullptr if no wallet should be used, or a pointer to the CWallet
|
2017-03-03 13:37:19 +01:00
|
|
|
*/
|
2021-04-01 19:28:43 +02:00
|
|
|
std::shared_ptr<CWallet> GetWalletForJSONRPCRequest(const JSONRPCRequest& request);
|
2017-03-03 13:37:19 +01:00
|
|
|
|
2022-02-27 10:36:28 +01:00
|
|
|
std::string HelpRequiringPassphrase();
|
2017-03-03 13:37:19 +01:00
|
|
|
void EnsureWalletIsUnlocked(CWallet *);
|
|
|
|
|
2020-12-17 13:46:20 +01:00
|
|
|
UniValue getaddressinfo(const JSONRPCRequest& request);
|
2018-02-20 03:29:22 +01:00
|
|
|
UniValue signrawtransactionwithwallet(const JSONRPCRequest& request);
|
2016-01-20 15:15:29 +01:00
|
|
|
#endif //BITCOIN_WALLET_RPCWALLET_H
|