Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
account_query_db.hpp
Go to the documentation of this file.
1#pragma once
5
6namespace sysio::chain_apis {
13 public:
14
23
29
37
43 void commit_block(const chain::block_state_ptr& block );
44
55
56 std::vector<permission_level> accounts;
57 std::vector<chain::public_key_type> keys;
58 };
59
67 std::optional<chain::permission_level> authorizing_account;
68 std::optional<chain::public_key_type> authorizing_key;
71 };
72
73 std::vector<account_result> accounts;
74 };
83
84 private:
85 std::unique_ptr<struct account_query_db_impl> _impl;
86 };
87
88}
89
90namespace fc {
98 if (a.permission.empty()) {
99 v = a.actor.to_string();
100 } else {
102 ("actor", a.actor.to_string())
103 ("permission", a.permission.to_string());
104 }
105 }
106
114 if (v.is_string()) {
115 from_variant(v, a.actor);
116 a.permission = {};
117 } else if (v.is_object()) {
118 const auto& vo = v.get_object();
119 if(vo.contains("actor"))
120 from_variant(vo["actor"], a.actor);
121 else
122 SYS_THROW(sysio::chain::invalid_http_request, "Missing Actor field");
123
124 if(vo.contains("permission") && vo.size() == 2)
125 from_variant(vo["permission"], a.permission);
126 else if (vo.size() == 1)
127 a.permission = {};
128 else
129 SYS_THROW(sysio::chain::invalid_http_request, "Unrecognized fields in account");
130 }
131 }
132}
133
135FC_REFLECT( sysio::chain_apis::account_query_db::get_accounts_by_authorizers_result::account_result, (account_name)(permission_name)(authorizing_account)(authorizing_key)(weight)(threshold))
#define SYS_THROW(exc_type, FORMAT,...)
An order-preserving dictionary of variants.
stores null, int64, uint64, double, bool, string, std::vector<variant>, and variant_object's.
Definition variant.hpp:191
variant_object & get_object()
Definition variant.cpp:554
bool is_object() const
Definition variant.cpp:363
bool is_string() const
Definition variant.cpp:314
get_accounts_by_authorizers_result get_accounts_by_authorizers(const get_accounts_by_authorizers_params &args) const
account_query_db & operator=(account_query_db &&)
account_query_db(account_query_db &&)
account_query_db(const class sysio::chain::controller &chain)
void commit_block(const chain::block_state_ptr &block)
void cache_transaction_trace(const chain::transaction_trace_ptr &trace)
namespace sysio::chain
Definition authority.cpp:3
void from_variant(const fc::variant &v, sysio::chain::chain_id_type &cid)
void to_variant(const sysio::chain::shared_public_key &var, fc::variant &vo)
Definition authority.cpp:4
std::shared_ptr< transaction_trace > transaction_trace_ptr
Definition trace.hpp:20
std::shared_ptr< block_state > block_state_ptr
uint16_t weight_type
Definition types.hpp:238
const GenericPointer< typename T::ValueType > T2 T::AllocatorType & a
Definition pointer.h:1181
#define FC_REFLECT(TYPE, MEMBERS)
Specializes fc::reflector for TYPE.
Definition reflect.hpp:311
unsigned int uint32_t
Definition stdint.h:126
Immutable except for fc::from_variant.
Definition name.hpp:43