xrpld
Toggle main menu visibility
Loading...
Searching...
No Matches
xrpld
rpc
handlers
admin
UnlList.cpp
1
#include <xrpld/app/main/Application.h>
2
#include <xrpld/app/misc/ValidatorList.h>
3
#include <xrpld/rpc/Context.h>
4
5
#include <xrpl/json/json_value.h>
6
#include <xrpl/protocol/PublicKey.h>
7
#include <xrpl/protocol/jss.h>
8
#include <xrpl/protocol/tokens.h>
9
10
#include <
utility
>
11
12
namespace
xrpl
{
13
14
json::Value
15
doUnlList
(
rpc::JsonContext
& context)
16
{
17
json::Value
obj(
json::ValueType::Object
);
18
19
context.
app
.
getValidators
().
forEachListed
(
20
[&unl = obj[jss::unl]](
PublicKey
const
& publicKey,
bool
trusted) {
21
json::Value
node(
json::ValueType::Object
);
22
23
node[jss::pubkey_validator] =
toBase58
(
TokenType::NodePublic
, publicKey);
24
node[jss::trusted] = trusted;
25
26
unl.
append
(std::move(node));
27
});
28
29
return
obj;
30
}
31
32
}
// namespace xrpl
json::Value
Represents a JSON value.
Definition
json_value.h:117
json::Value::append
Value & append(Value const &value)
Append value to array at the end.
Definition
json_value.cpp:997
xrpl::PublicKey
A public key.
Definition
PublicKey.h:53
xrpl::ServiceRegistry::getValidators
virtual ValidatorList & getValidators()=0
xrpl::ValidatorList::forEachListed
void forEachListed(std::function< void(PublicKey const &, bool)> func) const
Invokes the callback once for every listed validation public key.
Definition
ValidatorList.cpp:1643
json::ValueType::Object
@ Object
object value (collection of name/value pairs).
Definition
json_value.h:29
xrpl
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition
algorithm.h:5
xrpl::toBase58
std::string toBase58(AccountID const &v)
Convert AccountID to base58 checked string.
Definition
AccountID.cpp:95
xrpl::doUnlList
json::Value doUnlList(rpc::JsonContext &context)
Definition
UnlList.cpp:15
xrpl::TokenType::NodePublic
@ NodePublic
Definition
tokens.h:21
xrpl::rpc::Context::app
Application & app
Definition
Context.h:29
xrpl::rpc::JsonContext
Definition
Context.h:41
utility
Generated by
1.17.0