Bitcoin Core
32.1.0
P2P Digital Currency
Toggle main menu visibility
Loading...
Searching...
No Matches
src
wallet
rpc
util.h
Go to the documentation of this file.
1
// Copyright (c) 2017-present The Bitcoin Core developers
2
// Distributed under the MIT software license, see the accompanying
3
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
4
5
#ifndef BITCOIN_WALLET_RPC_UTIL_H
6
#define BITCOIN_WALLET_RPC_UTIL_H
7
8
#include <rpc/util.h>
9
#include <
script/script.h
>
10
#include <
wallet/wallet.h
>
11
12
#include <any>
13
#include <memory>
14
#include <optional>
15
#include <string>
16
#include <string_view>
17
#include <vector>
18
19
class
JSONRPCRequest
;
20
class
UniValue
;
21
struct
bilingual_str
;
22
23
namespace
wallet
{
24
enum class
DatabaseStatus
;
25
struct
WalletContext
;
26
27
extern
const
std::string
HELP_REQUIRING_PASSPHRASE
;
28
29
inline
const
RPCResult
RESULT_LAST_PROCESSED_BLOCK
{
RPCResult::Type::OBJ
,
"lastprocessedblock"
,
"hash and height of the block this information was generated on"
,{
30
{
RPCResult::Type::STR_HEX
,
"hash"
,
"hash of the block this information was generated on"
},
31
{
RPCResult::Type::NUM
,
"height"
,
"height of the block this information was generated on"
}}
32
};
33
40
std::shared_ptr<CWallet>
GetWalletForJSONRPCRequest
(
const
JSONRPCRequest
&
request
);
41
std::optional<std::string>
GetWalletNameFromJSONRPCRequest
(
const
JSONRPCRequest
&
request
);
46
std::string
EnsureUniqueWalletName
(
const
JSONRPCRequest
&
request
, std::optional<std::string_view> wallet_name);
47
48
void
EnsureWalletIsUnlocked
(
const
CWallet
&);
49
WalletContext
&
EnsureWalletContext
(
const
std::any& context);
50
51
bool
GetAvoidReuseFlag
(
const
CWallet
&
wallet
,
const
UniValue
& param);
52
std::string
LabelFromValue
(
const
UniValue
& value);
54
void
PushParentDescriptors
(
const
CWallet
&
wallet
,
const
CScript
& script_pubkey,
UniValue
& entry);
55
56
void
HandleWalletError
(
const
std::shared_ptr<CWallet>&
wallet
,
DatabaseStatus
& status,
bilingual_str
& error);
57
void
AppendLastProcessedBlock
(
UniValue
& entry,
const
CWallet
&
wallet
)
EXCLUSIVE_LOCKS_REQUIRED
(
wallet
.cs_wallet);
58
}
// namespace wallet
59
60
#endif
// BITCOIN_WALLET_RPC_UTIL_H
CScript
Serialized script, used inside transaction inputs and outputs.
Definition
script.h:406
CWallet
A CWallet maintains a set of transactions and balances, and provides the ability to create new transa...
Definition
wallet.h:310
JSONRPCRequest
Definition
request.h:55
UniValue
Definition
univalue.h:22
request
const std::string request
Definition
httpserver_tests.cpp:252
wallet
Definition
coin_selection.cpp:31
wallet::GetWalletForJSONRPCRequest
std::shared_ptr< CWallet > GetWalletForJSONRPCRequest(const JSONRPCRequest &request)
Figures out what wallet, if any, to use for a JSONRPCRequest.
Definition
util.cpp:62
wallet::RESULT_LAST_PROCESSED_BLOCK
const RPCResult RESULT_LAST_PROCESSED_BLOCK
Definition
util.h:29
wallet::HandleWalletError
void HandleWalletError(const std::shared_ptr< CWallet > &wallet, DatabaseStatus &status, bilingual_str &error)
Definition
util.cpp:124
wallet::EnsureWalletIsUnlocked
void EnsureWalletIsUnlocked(const CWallet &wallet)
Definition
util.cpp:85
wallet::EnsureUniqueWalletName
std::string EnsureUniqueWalletName(const JSONRPCRequest &request, std::optional< std::string_view > wallet_name)
Ensures that a wallet name is specified across the endpoint and wallet_name.
Definition
util.cpp:33
wallet::HELP_REQUIRING_PASSPHRASE
const std::string HELP_REQUIRING_PASSPHRASE
Definition
util.cpp:20
wallet::PushParentDescriptors
void PushParentDescriptors(const CWallet &wallet, const CScript &script_pubkey, UniValue &entry)
Fetch parent descriptors of this scriptPubKey.
Definition
util.cpp:112
wallet::EnsureWalletContext
WalletContext & EnsureWalletContext(const std::any &context)
Definition
util.cpp:92
wallet::LabelFromValue
std::string LabelFromValue(const UniValue &value)
Definition
util.cpp:101
wallet::AppendLastProcessedBlock
void AppendLastProcessedBlock(UniValue &entry, const CWallet &wallet)
Definition
util.cpp:156
wallet::GetAvoidReuseFlag
bool GetAvoidReuseFlag(const CWallet &wallet, const UniValue ¶m)
Definition
util.cpp:22
wallet::GetWalletNameFromJSONRPCRequest
std::optional< std::string > GetWalletNameFromJSONRPCRequest(const JSONRPCRequest &request)
Definition
util.cpp:53
wallet::DatabaseStatus
DatabaseStatus
Definition
db.h:180
script.h
RPCResult
Definition
util.h:307
RPCResult::Type::NUM
@ NUM
Definition
util.h:312
RPCResult::Type::STR_HEX
@ STR_HEX
Special string with only hex chars.
Definition
util.h:317
RPCResult::Type::OBJ
@ OBJ
Definition
util.h:309
WalletContext
Definition
context.h:36
bilingual_str
Bilingual messages:
Definition
translation.h:24
wallet::WalletContext
Definition
context.h:36
EXCLUSIVE_LOCKS_REQUIRED
#define EXCLUSIVE_LOCKS_REQUIRED(...)
Definition
threadsafety.h:49
wallet.h
DatabaseStatus
DatabaseStatus
Definition
db.h:180
Generated on
for Bitcoin Core by
1.18.0