Compare commits

...

3 commits

Author SHA1 Message Date
baris g
8147b4ec84 modified: .gitignore 2022-09-19 17:46:26 +00:00
baris g
807e90099d fc::variant and fc::option changes
std and fc namespaces causing conflict for option, variant...
2022-09-17 23:53:43 +03:00
baris g
1a21c3f432 Small changes for clang14
Clang14 changes
2022-09-17 21:31:15 +03:00
8 changed files with 155 additions and 159 deletions

7
.gitignore vendored
View file

@ -26,12 +26,6 @@ programs/cli_wallet/cli_wallet
programs/js_operation_serializer/js_operation_serializer programs/js_operation_serializer/js_operation_serializer
programs/witness_node/witness_node programs/witness_node/witness_node
tests/app_test
tests/chain_bench
tests/chain_test
tests/intense_test
tests/performance_test
doxygen doxygen
wallet.json wallet.json
@ -48,3 +42,4 @@ object_database/*
.vscode .vscode
.DS_Store .DS_Store
.idea .idea
/.cache/clangd/*

View file

@ -277,7 +277,7 @@ namespace graphene { namespace db {
{ {
static_assert( object_id::space_id == Object::space_id, "Space ID mismatch!" ); static_assert( object_id::space_id == Object::space_id, "Space ID mismatch!" );
static_assert( object_id::type_id == Object::type_id, "Type_ID mismatch!" ); static_assert( object_id::type_id == Object::type_id, "Type_ID mismatch!" );
if( id.instance >= next ) return nullptr; if( (const unsigned long) id.instance >= next ) return nullptr;
return content[id.instance.value >> chunkbits][id.instance.value & _mask]; return content[id.instance.value >> chunkbits][id.instance.value & _mask];
}; };

View file

@ -217,6 +217,7 @@ public:
private: private:
void create_redeem_script(const fc::ecc::public_key &user_key_data, const std::vector<std::pair<fc::ecc::public_key, uint16_t>> &keys_data); void create_redeem_script(const fc::ecc::public_key &user_key_data, const std::vector<std::pair<fc::ecc::public_key, uint16_t>> &keys_data);
public:
uint32_t latency_; uint32_t latency_;
}; };

View file

@ -84,16 +84,16 @@ struct from_which_visitor
return result; // converted from StaticVariant to Result automatically due to return type return result; // converted from StaticVariant to Result automatically due to return type
} }
const variant& v; const fc::variant& v;
const uint32_t _max_depth; const uint32_t _max_depth;
from_which_visitor( const variant& _v, uint32_t max_depth ) : v(_v), _max_depth(max_depth) {} from_which_visitor( const fc::variant& _v, uint32_t max_depth ) : v(_v), _max_depth(max_depth) {}
}; };
} // namespace impl } // namespace impl
template< typename T > template< typename T >
T from_which_variant( int which, const variant& v, uint32_t max_depth ) T from_which_variant( int which, const fc::variant& v, uint32_t max_depth )
{ {
// Parse a variant for a known which() // Parse a variant for a known which()
T dummy; T dummy;

View file

@ -47,7 +47,7 @@ typedef uint16_t transaction_handle_type;
* of the given type, with the new operator. * of the given type, with the new operator.
*/ */
object* create_object( const variant& v ); object* create_object( const fc::variant& v );
struct plain_keys struct plain_keys
{ {
@ -306,13 +306,13 @@ class wallet_api
fc::ecc::private_key derive_private_key(const std::string& prefix_string, int sequence_number) const; fc::ecc::private_key derive_private_key(const std::string& prefix_string, int sequence_number) const;
variant info(); fc::variant info();
/** Returns info such as client version, git version of graphene/fc, version of boost, openssl. /** Returns info such as client version, git version of graphene/fc, version of boost, openssl.
* @returns compile time info and client and dependencies versions * @returns compile time info and client and dependencies versions
*/ */
variant_object about() const; fc::variant_object about() const;
optional<signed_block_with_info> get_block( uint32_t num ); fc::optional<signed_block_with_info> get_block( uint32_t num );
vector<optional<signed_block>> get_blocks(uint32_t block_num_from, uint32_t block_num_to)const; vector<fc::optional<signed_block>> get_blocks(uint32_t block_num_from, uint32_t block_num_to)const;
/** Returns the number of accounts registered on the blockchain /** Returns the number of accounts registered on the blockchain
* @returns the number of registered accounts * @returns the number of registered accounts
*/ */
@ -460,7 +460,7 @@ class wallet_api
* @param id the id of the object to return * @param id the id of the object to return
* @returns the requested object * @returns the requested object
*/ */
variant get_object(object_id_type id) const; fc::variant get_object(object_id_type id) const;
/** Returns the current wallet filename. /** Returns the current wallet filename.
* *
@ -1127,7 +1127,7 @@ class wallet_api
* @returns the signed transaction updating the asset * @returns the signed transaction updating the asset
*/ */
signed_transaction update_asset(string symbol, signed_transaction update_asset(string symbol,
optional<string> new_issuer, fc::optional<string> new_issuer,
asset_options new_options, asset_options new_options,
bool broadcast = false); bool broadcast = false);
@ -1465,8 +1465,8 @@ class wallet_api
* @param broadcast true if you wish to broadcast the transaction. * @param broadcast true if you wish to broadcast the transaction.
*/ */
signed_transaction update_son_vesting_balances(string owner_account, signed_transaction update_son_vesting_balances(string owner_account,
optional<vesting_balance_id_type> new_deposit, fc::optional<vesting_balance_id_type> new_deposit,
optional<vesting_balance_id_type> new_pay_vb, fc::optional<vesting_balance_id_type> new_pay_vb,
bool broadcast = false); bool broadcast = false);
/** Modify status of the SON owned by the given account to maintenance. /** Modify status of the SON owned by the given account to maintenance.
@ -1519,21 +1519,21 @@ class wallet_api
* @brief Get active SON wallet * @brief Get active SON wallet
* @return Active SON wallet object * @return Active SON wallet object
*/ */
optional<son_wallet_object> get_active_son_wallet(); fc::optional<son_wallet_object> get_active_son_wallet();
/** /**
* @brief Get SON wallet that was active for a given time point * @brief Get SON wallet that was active for a given time point
* @param time_point Time point * @param time_point Time point
* @return SON wallet object, for the wallet that was active for a given time point * @return SON wallet object, for the wallet that was active for a given time point
*/ */
optional<son_wallet_object> get_son_wallet_by_time_point(time_point_sec time_point); fc::optional<son_wallet_object> get_son_wallet_by_time_point(time_point_sec time_point);
/** /**
* @brief Get full list of SON wallets * @brief Get full list of SON wallets
* @param limit Maximum number of results to return * @param limit Maximum number of results to return
* @return A list of SON wallet objects * @return A list of SON wallet objects
*/ */
vector<optional<son_wallet_object>> get_son_wallets(uint32_t limit); vector<fc::optional<son_wallet_object>> get_son_wallets(uint32_t limit);
/** Adds sidechain address owned by the given account for a given sidechain. /** Adds sidechain address owned by the given account for a given sidechain.
* *
@ -1572,14 +1572,14 @@ class wallet_api
* @param account the name or id of the account who owns the address * @param account the name or id of the account who owns the address
* @returns the list of all sidechain addresses owned by given account. * @returns the list of all sidechain addresses owned by given account.
*/ */
vector<optional<sidechain_address_object>> get_sidechain_addresses_by_account(string account); vector<fc::optional<sidechain_address_object>> get_sidechain_addresses_by_account(string account);
/** Retrieves all sidechain addresses registered for a given sidechain. /** Retrieves all sidechain addresses registered for a given sidechain.
* *
* @param sidechain the name of the sidechain * @param sidechain the name of the sidechain
* @returns the list of all sidechain addresses registered for a given sidechain. * @returns the list of all sidechain addresses registered for a given sidechain.
*/ */
vector<optional<sidechain_address_object>> get_sidechain_addresses_by_sidechain(sidechain_type sidechain); vector<fc::optional<sidechain_address_object>> get_sidechain_addresses_by_sidechain(sidechain_type sidechain);
/** Retrieves sidechain address owned by given account for a given sidechain. /** Retrieves sidechain address owned by given account for a given sidechain.
* *
@ -1642,7 +1642,7 @@ class wallet_api
share_type daily_pay, share_type daily_pay,
string name, string name,
string url, string url,
variant worker_settings, fc::variant worker_settings,
bool broadcast = false bool broadcast = false
); );
@ -1908,7 +1908,7 @@ class wallet_api
* @return the signed transaction changing your vote proxy settings * @return the signed transaction changing your vote proxy settings
*/ */
signed_transaction set_voting_proxy(string account_to_modify, signed_transaction set_voting_proxy(string account_to_modify,
optional<string> voting_account, fc::optional<string> voting_account,
bool broadcast = false); bool broadcast = false);
/** Set your vote for the number of witnesses and committee_members in the system. /** Set your vote for the number of witnesses and committee_members in the system.
@ -2340,13 +2340,13 @@ class wallet_api
string name, string name,
string symbol, string symbol,
string base_uri, string base_uri,
optional<string> revenue_partner, fc::optional<string> revenue_partner,
optional<uint16_t> revenue_split, fc::optional<uint16_t> revenue_split,
bool is_transferable, bool is_transferable,
bool is_sellable, bool is_sellable,
optional<account_role_id_type> role_id, fc::optional<account_role_id_type> role_id,
optional<share_type> max_supply, fc::optional<share_type> max_supply,
optional<nft_lottery_options> lottery_options, fc::optional<nft_lottery_options> lottery_options,
bool broadcast); bool broadcast);
/** /**
@ -2366,14 +2366,14 @@ class wallet_api
*/ */
signed_transaction nft_metadata_update(string owner_account_id_or_name, signed_transaction nft_metadata_update(string owner_account_id_or_name,
nft_metadata_id_type nft_metadata_id, nft_metadata_id_type nft_metadata_id,
optional<string> name, fc::optional<string> name,
optional<string> symbol, fc::optional<string> symbol,
optional<string> base_uri, fc::optional<string> base_uri,
optional<string> revenue_partner, fc::optional<string> revenue_partner,
optional<uint16_t> revenue_split, fc::optional<uint16_t> revenue_split,
optional<bool> is_transferable, fc::optional<bool> is_transferable,
optional<bool> is_sellable, fc::optional<bool> is_sellable,
optional<account_role_id_type> role_id, fc::optional<account_role_id_type> role_id,
bool broadcast); bool broadcast);
/** /**
@ -2405,7 +2405,7 @@ class wallet_api
* @param token_id NFT ID * @param token_id NFT ID
* @return NFT owner account ID * @return NFT owner account ID
*/ */
optional<account_id_type> nft_owner_of(const nft_id_type token_id) const; fc::optional<account_id_type> nft_owner_of(const nft_id_type token_id) const;
/** /**
* @brief Transfers NFT safely * @brief Transfers NFT safely
@ -2470,7 +2470,7 @@ class wallet_api
* @param token_id NFT ID * @param token_id NFT ID
* @return NFT approved account ID * @return NFT approved account ID
*/ */
optional<account_id_type> nft_get_approved(const nft_id_type token_id) const; fc::optional<account_id_type> nft_get_approved(const nft_id_type token_id) const;
/** /**
* @brief Returns operator approved state for all NFT owned by owner * @brief Returns operator approved state for all NFT owned by owner
@ -2493,7 +2493,7 @@ class wallet_api
asset maximum_price, asset maximum_price,
bool buying_item, bool buying_item,
time_point_sec offer_expiration_date, time_point_sec offer_expiration_date,
optional<memo_data> memo, fc::optional<memo_data> memo,
bool broadcast); bool broadcast);
signed_transaction create_bid(string bidder_account_id_or_name, signed_transaction create_bid(string bidder_account_id_or_name,
asset bid_price, asset bid_price,
@ -2502,16 +2502,16 @@ class wallet_api
signed_transaction cancel_offer(string issuer_account_id_or_name, signed_transaction cancel_offer(string issuer_account_id_or_name,
offer_id_type offer_id, offer_id_type offer_id,
bool broadcast); bool broadcast);
vector<offer_object> list_offers(uint32_t limit, optional<offer_id_type> lower_id) const; vector<offer_object> list_offers(uint32_t limit, fc::optional<offer_id_type> lower_id) const;
vector<offer_object> list_sell_offers(uint32_t limit, optional<offer_id_type> lower_id) const; vector<offer_object> list_sell_offers(uint32_t limit, fc::optional<offer_id_type> lower_id) const;
vector<offer_object> list_buy_offers(uint32_t limit, optional<offer_id_type> lower_id) const; vector<offer_object> list_buy_offers(uint32_t limit, fc::optional<offer_id_type> lower_id) const;
vector<offer_history_object> list_offer_history(uint32_t limit, optional<offer_history_id_type> lower_id) const; vector<offer_history_object> list_offer_history(uint32_t limit, fc::optional<offer_history_id_type> lower_id) const;
vector<offer_object> get_offers_by_issuer(string issuer_account_id_or_name, vector<offer_object> get_offers_by_issuer(string issuer_account_id_or_name,
uint32_t limit, optional<offer_id_type> lower_id) const; uint32_t limit, fc::optional<offer_id_type> lower_id) const;
vector<offer_object> get_offers_by_item(const nft_id_type item, uint32_t limit, optional<offer_id_type> lower_id) const; vector<offer_object> get_offers_by_item(const nft_id_type item, uint32_t limit, fc::optional<offer_id_type> lower_id) const;
vector<offer_history_object> get_offer_history_by_issuer(string issuer_account_id_or_name, uint32_t limit, optional<offer_history_id_type> lower_id) const; vector<offer_history_object> get_offer_history_by_issuer(string issuer_account_id_or_name, uint32_t limit, fc::optional<offer_history_id_type> lower_id) const;
vector<offer_history_object> get_offer_history_by_item(const nft_id_type item, uint32_t limit, optional<offer_history_id_type> lower_id) const; vector<offer_history_object> get_offer_history_by_item(const nft_id_type item, uint32_t limit, fc::optional<offer_history_id_type> lower_id) const;
vector<offer_history_object> get_offer_history_by_bidder(string bidder_account_id_or_name, uint32_t limit, optional<offer_history_id_type> lower_id) const; vector<offer_history_object> get_offer_history_by_bidder(string bidder_account_id_or_name, uint32_t limit, fc::optional<offer_history_id_type> lower_id) const;
signed_transaction create_account_role(string owner_account_id_or_name, signed_transaction create_account_role(string owner_account_id_or_name,
string name, string name,
@ -2522,13 +2522,13 @@ class wallet_api
bool broadcast); bool broadcast);
signed_transaction update_account_role(string owner_account_id_or_name, signed_transaction update_account_role(string owner_account_id_or_name,
account_role_id_type role_id, account_role_id_type role_id,
optional<string> name, fc::optional<string> name,
optional<string> metadata, fc::optional<string> metadata,
flat_set<int> operations_to_add, flat_set<int> operations_to_add,
flat_set<int> operations_to_remove, flat_set<int> operations_to_remove,
flat_set<account_id_type> accounts_to_add, flat_set<account_id_type> accounts_to_add,
flat_set<account_id_type> accounts_to_remove, flat_set<account_id_type> accounts_to_remove,
optional<time_point_sec> valid_to, fc::optional<time_point_sec> valid_to,
bool broadcast); bool broadcast);
signed_transaction delete_account_role(string owner_account_id_or_name, signed_transaction delete_account_role(string owner_account_id_or_name,
account_role_id_type role_id, account_role_id_type role_id,
@ -2545,7 +2545,7 @@ class wallet_api
void flood_network(string prefix, uint32_t number_of_transactions); void flood_network(string prefix, uint32_t number_of_transactions);
void network_add_nodes( const vector<string>& nodes ); void network_add_nodes( const vector<string>& nodes );
vector< variant > network_get_connected_peers(); vector< fc::variant > network_get_connected_peers();
/** /**
* Used to transfer from one set of blinded balances to another * Used to transfer from one set of blinded balances to another

View file

@ -149,7 +149,7 @@ public:
}; };
template<class T> template<class T>
optional<T> maybe_id( const string& name_or_id ) fc::optional<T> maybe_id( const string& name_or_id )
{ {
if( std::isdigit( name_or_id.front() ) ) if( std::isdigit( name_or_id.front() ) )
{ {
@ -161,7 +161,7 @@ optional<T> maybe_id( const string& name_or_id )
{ // not an ID { // not an ID
} }
} }
return optional<T>(); return fc::optional<T>();
} }
string address_to_shorthash( const address& addr ) string address_to_shorthash( const address& addr )
@ -378,11 +378,11 @@ private:
} }
fc::mutex _subscribed_object_changed_mutex; fc::mutex _subscribed_object_changed_mutex;
void subscribed_object_changed(const variant& changed_objects_variant) void subscribed_object_changed(const fc::variant& changed_objects_variant)
{ {
fc::scoped_lock<fc::mutex> lock(_resync_mutex); fc::scoped_lock<fc::mutex> lock(_resync_mutex);
fc::variants changed_objects = changed_objects_variant.get_array(); fc::variants changed_objects = changed_objects_variant.get_array();
for (const variant& changed_object_variant : changed_objects) for (const fc::variant& changed_object_variant : changed_objects)
{ {
// changed_object_variant is either the object, or just the id if the object was removed // changed_object_variant is either the object, or just the id if the object was removed
if (changed_object_variant.is_object()) if (changed_object_variant.is_object())
@ -555,12 +555,12 @@ public:
} }
init_prototype_ops(); init_prototype_ops();
_remote_db->set_block_applied_callback( [this](const variant& block_id ) _remote_db->set_block_applied_callback( [this](const fc::variant& block_id )
{ {
on_block_applied( block_id ); on_block_applied( block_id );
} ); } );
_remote_db->set_subscribe_callback( [this](const variant& object ) _remote_db->set_subscribe_callback( [this](const fc::variant& object )
{ {
on_subscribe_callback( object ); on_subscribe_callback( object );
}, false ); }, false );
@ -599,12 +599,12 @@ public:
} }
} }
void on_block_applied( const variant& block_id ) void on_block_applied( const fc::variant& block_id )
{ {
fc::async([this]{resync();}, "Resync after block"); fc::async([this]{resync();}, "Resync after block");
} }
void on_subscribe_callback( const variant& object ) void on_subscribe_callback( const fc::variant& object )
{ {
//idump((object)); //idump((object));
fc::async([this, object]{subscribed_object_changed(object);}, "Object changed"); fc::async([this, object]{subscribed_object_changed(object);}, "Object changed");
@ -668,7 +668,7 @@ public:
s->set_fee(op); s->set_fee(op);
} }
variant info() const fc::variant info() const
{ {
auto chain_props = get_chain_properties(); auto chain_props = get_chain_properties();
auto global_props = get_global_properties(); auto global_props = get_global_properties();
@ -778,14 +778,14 @@ public:
"." + fc::to_string(id.instance.value); "." + fc::to_string(id.instance.value);
return asset_id; return asset_id;
} }
optional<asset_object> find_asset(asset_id_type id)const fc::optional<asset_object> find_asset(asset_id_type id)const
{ {
auto rec = _remote_db->get_assets({asset_id_to_string(id)}).front(); auto rec = _remote_db->get_assets({asset_id_to_string(id)}).front();
if( rec ) if( rec )
_asset_cache[id] = *rec; _asset_cache[id] = *rec;
return rec; return rec;
} }
optional<asset_object> find_asset(string asset_symbol_or_id)const fc::optional<asset_object> find_asset(string asset_symbol_or_id)const
{ {
FC_ASSERT( asset_symbol_or_id.size() > 0 ); FC_ASSERT( asset_symbol_or_id.size() > 0 );
@ -799,7 +799,7 @@ public:
if( rec ) if( rec )
{ {
if( rec->symbol != asset_symbol_or_id ) if( rec->symbol != asset_symbol_or_id )
return optional<asset_object>(); return fc::optional<asset_object>();
_asset_cache[rec->get_id()] = *rec; _asset_cache[rec->get_id()] = *rec;
} }
@ -822,7 +822,7 @@ public:
asset_id_type get_asset_id(string asset_symbol_or_id) const asset_id_type get_asset_id(string asset_symbol_or_id) const
{ {
FC_ASSERT( asset_symbol_or_id.size() > 0 ); FC_ASSERT( asset_symbol_or_id.size() > 0 );
vector<optional<asset_object>> opt_asset; vector<fc::optional<asset_object>> opt_asset;
if( std::isdigit( asset_symbol_or_id.front() ) ) if( std::isdigit( asset_symbol_or_id.front() ) )
return fc::variant(asset_symbol_or_id, 1).as<asset_id_type>( 1 ); return fc::variant(asset_symbol_or_id, 1).as<asset_id_type>( 1 );
opt_asset = _remote_db->lookup_asset_symbols( {asset_symbol_or_id} ); opt_asset = _remote_db->lookup_asset_symbols( {asset_symbol_or_id} );
@ -1063,11 +1063,11 @@ public:
account_ids_to_send.push_back( account_id ); account_ids_to_send.push_back( account_id );
++it; ++it;
} }
std::vector< optional< account_object > > accounts = _remote_db->get_accounts(account_ids_to_send); std::vector< fc::optional< account_object > > accounts = _remote_db->get_accounts(account_ids_to_send);
// server response should be same length as request // server response should be same length as request
FC_ASSERT( accounts.size() == account_ids_to_send.size() ); FC_ASSERT( accounts.size() == account_ids_to_send.size() );
size_t i = 0; size_t i = 0;
for( const optional< account_object >& acct : accounts ) for( const fc::optional< account_object >& acct : accounts )
{ {
account_object& old_acct = old_accounts[i]; account_object& old_acct = old_accounts[i];
if( !acct.valid() ) if( !acct.valid() )
@ -1652,14 +1652,14 @@ public:
signed_transaction update_asset(string symbol, signed_transaction update_asset(string symbol,
optional<string> new_issuer, fc::optional<string> new_issuer,
asset_options new_options, asset_options new_options,
bool broadcast /* = false */) bool broadcast /* = false */)
{ try { { try {
optional<asset_object> asset_to_update = find_asset(symbol); fc::optional<asset_object> asset_to_update = find_asset(symbol);
if (!asset_to_update) if (!asset_to_update)
FC_THROW("No asset with that symbol exists!"); FC_THROW("No asset with that symbol exists!");
optional<account_id_type> new_issuer_account_id; fc::optional<account_id_type> new_issuer_account_id;
if (new_issuer) if (new_issuer)
{ {
account_object new_issuer_account = get_account(*new_issuer); account_object new_issuer_account = get_account(*new_issuer);
@ -1684,7 +1684,7 @@ public:
bitasset_options new_options, bitasset_options new_options,
bool broadcast /* = false */) bool broadcast /* = false */)
{ try { { try {
optional<asset_object> asset_to_update = find_asset(symbol); fc::optional<asset_object> asset_to_update = find_asset(symbol);
if (!asset_to_update) if (!asset_to_update)
FC_THROW("No asset with that symbol exists!"); FC_THROW("No asset with that symbol exists!");
@ -1705,7 +1705,7 @@ public:
dividend_asset_options new_options, dividend_asset_options new_options,
bool broadcast /* = false */) bool broadcast /* = false */)
{ try { { try {
optional<asset_object> asset_to_update = find_asset(symbol); fc::optional<asset_object> asset_to_update = find_asset(symbol);
if (!asset_to_update) if (!asset_to_update)
FC_THROW("No asset with that symbol exists!"); FC_THROW("No asset with that symbol exists!");
@ -1726,7 +1726,7 @@ public:
flat_set<string> new_feed_producers, flat_set<string> new_feed_producers,
bool broadcast /* = false */) bool broadcast /* = false */)
{ try { { try {
optional<asset_object> asset_to_update = find_asset(symbol); fc::optional<asset_object> asset_to_update = find_asset(symbol);
if (!asset_to_update) if (!asset_to_update)
FC_THROW("No asset with that symbol exists!"); FC_THROW("No asset with that symbol exists!");
@ -1751,7 +1751,7 @@ public:
price_feed feed, price_feed feed,
bool broadcast /* = false */) bool broadcast /* = false */)
{ try { { try {
optional<asset_object> asset_to_update = find_asset(symbol); fc::optional<asset_object> asset_to_update = find_asset(symbol);
if (!asset_to_update) if (!asset_to_update)
FC_THROW("No asset with that symbol exists!"); FC_THROW("No asset with that symbol exists!");
@ -1774,7 +1774,7 @@ public:
bool broadcast /* = false */) bool broadcast /* = false */)
{ try { { try {
account_object from_account = get_account(from); account_object from_account = get_account(from);
optional<asset_object> asset_to_fund = find_asset(symbol); fc::optional<asset_object> asset_to_fund = find_asset(symbol);
if (!asset_to_fund) if (!asset_to_fund)
FC_THROW("No asset with that symbol exists!"); FC_THROW("No asset with that symbol exists!");
asset_object core_asset = get_asset(asset_id_type()); asset_object core_asset = get_asset(asset_id_type());
@ -1798,7 +1798,7 @@ public:
bool broadcast /* = false */) bool broadcast /* = false */)
{ try { { try {
account_object from_account = get_account(from); account_object from_account = get_account(from);
optional<asset_object> asset_to_reserve = find_asset(symbol); fc::optional<asset_object> asset_to_reserve = find_asset(symbol);
if (!asset_to_reserve) if (!asset_to_reserve)
FC_THROW("No asset with that symbol exists!"); FC_THROW("No asset with that symbol exists!");
@ -1818,7 +1818,7 @@ public:
price settle_price, price settle_price,
bool broadcast /* = false */) bool broadcast /* = false */)
{ try { { try {
optional<asset_object> asset_to_settle = find_asset(symbol); fc::optional<asset_object> asset_to_settle = find_asset(symbol);
if (!asset_to_settle) if (!asset_to_settle)
FC_THROW("No asset with that symbol exists!"); FC_THROW("No asset with that symbol exists!");
@ -1840,7 +1840,7 @@ public:
string symbol, string symbol,
bool broadcast /* = false */) bool broadcast /* = false */)
{ try { { try {
optional<asset_object> asset_to_settle = find_asset(symbol); fc::optional<asset_object> asset_to_settle = find_asset(symbol);
if (!asset_to_settle) if (!asset_to_settle)
FC_THROW("No asset with that symbol exists!"); FC_THROW("No asset with that symbol exists!");
@ -2175,8 +2175,8 @@ public:
} FC_CAPTURE_AND_RETHROW( (owner_account)(broadcast) ) } } FC_CAPTURE_AND_RETHROW( (owner_account)(broadcast) ) }
signed_transaction update_son_vesting_balances(string owner_account, signed_transaction update_son_vesting_balances(string owner_account,
optional<vesting_balance_id_type> new_deposit, fc::optional<vesting_balance_id_type> new_deposit,
optional<vesting_balance_id_type> new_pay_vb, fc::optional<vesting_balance_id_type> new_pay_vb,
bool broadcast /* = false */) bool broadcast /* = false */)
{ try { { try {
son_object son = get_son(owner_account); son_object son = get_son(owner_account);
@ -2249,7 +2249,7 @@ public:
std::string acc_id = account_id_to_string(obj->son_account); std::string acc_id = account_id_to_string(obj->son_account);
owners.push_back(acc_id); owners.push_back(acc_id);
} }
vector< optional< account_object> > accs = _remote_db->get_accounts(owners); vector< fc::optional< account_object> > accs = _remote_db->get_accounts(owners);
std::remove_if(son_objects.begin(), son_objects.end(), std::remove_if(son_objects.begin(), son_objects.end(),
[](const fc::optional<son_object>& obj) -> bool { return obj.valid(); }); [](const fc::optional<son_object>& obj) -> bool { return obj.valid(); });
map<string, son_id_type> result; map<string, son_id_type> result;
@ -2296,17 +2296,17 @@ public:
return result; return result;
} FC_CAPTURE_AND_RETHROW() } } FC_CAPTURE_AND_RETHROW() }
optional<son_wallet_object> get_active_son_wallet() fc::optional<son_wallet_object> get_active_son_wallet()
{ try { { try {
return _remote_db->get_active_son_wallet(); return _remote_db->get_active_son_wallet();
} FC_CAPTURE_AND_RETHROW() } } FC_CAPTURE_AND_RETHROW() }
optional<son_wallet_object> get_son_wallet_by_time_point(time_point_sec time_point) fc::optional<son_wallet_object> get_son_wallet_by_time_point(time_point_sec time_point)
{ try { { try {
return _remote_db->get_son_wallet_by_time_point(time_point); return _remote_db->get_son_wallet_by_time_point(time_point);
} FC_CAPTURE_AND_RETHROW() } } FC_CAPTURE_AND_RETHROW() }
vector<optional<son_wallet_object>> get_son_wallets(uint32_t limit) vector<fc::optional<son_wallet_object>> get_son_wallets(uint32_t limit)
{ try { { try {
return _remote_db->get_son_wallets(limit); return _remote_db->get_son_wallets(limit);
} FC_CAPTURE_AND_RETHROW() } } FC_CAPTURE_AND_RETHROW() }
@ -2482,7 +2482,7 @@ public:
} FC_CAPTURE_AND_RETHROW( (witness_name)(url)(block_signing_key)(broadcast) ) } } FC_CAPTURE_AND_RETHROW( (witness_name)(url)(block_signing_key)(broadcast) ) }
template<typename WorkerInit> template<typename WorkerInit>
static WorkerInit _create_worker_initializer( const variant& worker_settings ) static WorkerInit _create_worker_initializer( const fc::variant& worker_settings )
{ {
WorkerInit result; WorkerInit result;
from_variant( worker_settings, result, GRAPHENE_MAX_NESTED_OBJECTS ); from_variant( worker_settings, result, GRAPHENE_MAX_NESTED_OBJECTS );
@ -2496,7 +2496,7 @@ public:
share_type daily_pay, share_type daily_pay,
string name, string name,
string url, string url,
variant worker_settings, fc::variant worker_settings,
bool broadcast bool broadcast
) )
{ {
@ -2569,7 +2569,7 @@ public:
flat_set<vote_id_type> new_votes( acct.options.votes ); flat_set<vote_id_type> new_votes( acct.options.votes );
fc::variants objects = _remote_db->get_objects( query_ids ); fc::variants objects = _remote_db->get_objects( query_ids );
for( const variant& obj : objects ) for( const fc::variant& obj : objects )
{ {
worker_object wo; worker_object wo;
from_variant( obj, wo, GRAPHENE_MAX_NESTED_OBJECTS ); from_variant( obj, wo, GRAPHENE_MAX_NESTED_OBJECTS );
@ -3069,7 +3069,7 @@ public:
} FC_CAPTURE_AND_RETHROW( (voting_account)(witnesses_to_approve)(witnesses_to_reject)(desired_number_of_witnesses)(broadcast) ) } } FC_CAPTURE_AND_RETHROW( (voting_account)(witnesses_to_approve)(witnesses_to_reject)(desired_number_of_witnesses)(broadcast) ) }
signed_transaction set_voting_proxy(string account_to_modify, signed_transaction set_voting_proxy(string account_to_modify,
optional<string> voting_account, fc::optional<string> voting_account,
bool broadcast /* = false */) bool broadcast /* = false */)
{ try { { try {
account_object account_object_to_modify = get_account(account_to_modify); account_object account_object_to_modify = get_account(account_to_modify);
@ -3398,17 +3398,17 @@ public:
std::map<string,std::function<string(fc::variant,const fc::variants&)>> get_result_formatters() const std::map<string,std::function<string(fc::variant,const fc::variants&)>> get_result_formatters() const
{ {
std::map<string,std::function<string(fc::variant,const fc::variants&)> > m; std::map<string,std::function<string(fc::variant,const fc::variants&)> > m;
m["help"] = [](variant result, const fc::variants& a) m["help"] = [](fc::variant result, const fc::variants& a)
{ {
return result.get_string(); return result.get_string();
}; };
m["gethelp"] = [](variant result, const fc::variants& a) m["gethelp"] = [](fc::variant result, const fc::variants& a)
{ {
return result.get_string(); return result.get_string();
}; };
m["get_account_history"] = [this](variant result, const fc::variants& a) m["get_account_history"] = [this](fc::variant result, const fc::variants& a)
{ {
auto r = result.as<vector<operation_detail>>( GRAPHENE_MAX_NESTED_OBJECTS ); auto r = result.as<vector<operation_detail>>( GRAPHENE_MAX_NESTED_OBJECTS );
std::stringstream ss; std::stringstream ss;
@ -3425,7 +3425,7 @@ public:
return ss.str(); return ss.str();
}; };
m["get_relative_account_history"] = [this](variant result, const fc::variants& a) m["get_relative_account_history"] = [this](fc::variant result, const fc::variants& a)
{ {
auto r = result.as<vector<operation_detail>>( GRAPHENE_MAX_NESTED_OBJECTS ); auto r = result.as<vector<operation_detail>>( GRAPHENE_MAX_NESTED_OBJECTS );
std::stringstream ss; std::stringstream ss;
@ -3443,7 +3443,7 @@ public:
return ss.str(); return ss.str();
}; };
m["list_account_balances"] = [this](variant result, const fc::variants& a) m["list_account_balances"] = [this](fc::variant result, const fc::variants& a)
{ {
auto r = result.as<vector<asset>>( GRAPHENE_MAX_NESTED_OBJECTS ); auto r = result.as<vector<asset>>( GRAPHENE_MAX_NESTED_OBJECTS );
vector<asset_object> asset_recs; vector<asset_object> asset_recs;
@ -3458,7 +3458,7 @@ public:
return ss.str(); return ss.str();
}; };
m["list_core_accounts"] = [this](variant result, const fc::variants& a) m["list_core_accounts"] = [this](fc::variant result, const fc::variants& a)
{ {
std::stringstream ss; std::stringstream ss;
@ -3473,7 +3473,7 @@ public:
return ss.str(); return ss.str();
}; };
m["get_blind_balances"] = [this](variant result, const fc::variants& a) m["get_blind_balances"] = [this](fc::variant result, const fc::variants& a)
{ {
auto r = result.as<vector<asset>>( GRAPHENE_MAX_NESTED_OBJECTS ); auto r = result.as<vector<asset>>( GRAPHENE_MAX_NESTED_OBJECTS );
vector<asset_object> asset_recs; vector<asset_object> asset_recs;
@ -3487,7 +3487,7 @@ public:
return ss.str(); return ss.str();
}; };
m["transfer_to_blind"] = [this](variant result, const fc::variants& a) m["transfer_to_blind"] = [this](fc::variant result, const fc::variants& a)
{ {
auto r = result.as<blind_confirmation>( GRAPHENE_MAX_NESTED_OBJECTS ); auto r = result.as<blind_confirmation>( GRAPHENE_MAX_NESTED_OBJECTS );
std::stringstream ss; std::stringstream ss;
@ -3500,7 +3500,7 @@ public:
} }
return ss.str(); return ss.str();
}; };
m["blind_transfer"] = [this](variant result, const fc::variants& a) m["blind_transfer"] = [this](fc::variant result, const fc::variants& a)
{ {
auto r = result.as<blind_confirmation>( GRAPHENE_MAX_NESTED_OBJECTS ); auto r = result.as<blind_confirmation>( GRAPHENE_MAX_NESTED_OBJECTS );
std::stringstream ss; std::stringstream ss;
@ -3513,7 +3513,7 @@ public:
} }
return ss.str(); return ss.str();
}; };
m["receive_blind_transfer"] = [this](variant result, const fc::variants& a) m["receive_blind_transfer"] = [this](fc::variant result, const fc::variants& a)
{ {
auto r = result.as<blind_receipt>( GRAPHENE_MAX_NESTED_OBJECTS ); auto r = result.as<blind_receipt>( GRAPHENE_MAX_NESTED_OBJECTS );
std::stringstream ss; std::stringstream ss;
@ -3521,7 +3521,7 @@ public:
ss << as.amount_to_pretty_string( r.amount ) << " " << r.from_label << " => " << r.to_label << " " << r.memo <<"\n"; ss << as.amount_to_pretty_string( r.amount ) << " " << r.from_label << " => " << r.to_label << " " << r.memo <<"\n";
return ss.str(); return ss.str();
}; };
m["blind_history"] = [this](variant result, const fc::variants& a) m["blind_history"] = [this](fc::variant result, const fc::variants& a)
{ {
auto records = result.as<vector<blind_receipt>>( GRAPHENE_MAX_NESTED_OBJECTS ); auto records = result.as<vector<blind_receipt>>( GRAPHENE_MAX_NESTED_OBJECTS );
std::stringstream ss; std::stringstream ss;
@ -3536,7 +3536,7 @@ public:
} }
return ss.str(); return ss.str();
}; };
m["get_upcoming_tournaments"] = m["get_tournaments"] = m["get_tournaments_by_state"] = [this](variant result, const fc::variants& a) m["get_upcoming_tournaments"] = m["get_tournaments"] = m["get_tournaments_by_state"] = [this](fc::variant result, const fc::variants& a)
{ {
const vector<tournament_object> tournaments = result.as<vector<tournament_object> >( GRAPHENE_MAX_NESTED_OBJECTS ); const vector<tournament_object> tournaments = result.as<vector<tournament_object> >( GRAPHENE_MAX_NESTED_OBJECTS );
std::stringstream ss; std::stringstream ss;
@ -3584,7 +3584,7 @@ public:
} }
return ss.str(); return ss.str();
}; };
m["get_tournament"] = [this](variant result, const fc::variants& a) m["get_tournament"] = [this](fc::variant result, const fc::variants& a)
{ {
std::stringstream ss; std::stringstream ss;
@ -3685,7 +3685,7 @@ public:
return ss.str(); return ss.str();
}; };
m["get_order_book"] = [this](variant result, const fc::variants& a) m["get_order_book"] = [this](fc::variant result, const fc::variants& a)
{ {
auto orders = result.as<order_book>( GRAPHENE_MAX_NESTED_OBJECTS ); auto orders = result.as<order_book>( GRAPHENE_MAX_NESTED_OBJECTS );
auto bids = orders.bids; auto bids = orders.bids;
@ -3901,7 +3901,7 @@ public:
fc::from_variant_visitor<asset_update_dividend_operation>( changed_values, changed_op, GRAPHENE_MAX_NESTED_OBJECTS ) fc::from_variant_visitor<asset_update_dividend_operation>( changed_values, changed_op, GRAPHENE_MAX_NESTED_OBJECTS )
); );
optional<asset_object> asset_to_update = find_asset(changed_op.asset_to_update); fc::optional<asset_object> asset_to_update = find_asset(changed_op.asset_to_update);
if (!asset_to_update) if (!asset_to_update)
FC_THROW("No asset with that symbol exists!"); FC_THROW("No asset with that symbol exists!");
@ -4208,15 +4208,15 @@ public:
} }
} }
vector< variant > network_get_connected_peers() vector< fc::variant > network_get_connected_peers()
{ {
use_network_node_api(); use_network_node_api();
const auto peers = (*_remote_net_node)->get_connected_peers(); const auto peers = (*_remote_net_node)->get_connected_peers();
vector< variant > result; vector< fc::variant > result;
result.reserve( peers.size() ); result.reserve( peers.size() );
for( const auto& peer : peers ) for( const auto& peer : peers )
{ {
variant v; fc::variant v;
fc::to_variant( peer, v, GRAPHENE_MAX_NESTED_OBJECTS ); fc::to_variant( peer, v, GRAPHENE_MAX_NESTED_OBJECTS );
result.push_back( v ); result.push_back( v );
} }
@ -4337,9 +4337,9 @@ public:
fc::api<network_broadcast_api> _remote_net_broadcast; fc::api<network_broadcast_api> _remote_net_broadcast;
fc::api<history_api> _remote_hist; fc::api<history_api> _remote_hist;
fc::api<bookie_api> _remote_bookie; fc::api<bookie_api> _remote_bookie;
optional< fc::api<network_node_api> > _remote_net_node; fc::optional< fc::api<network_node_api> > _remote_net_node;
optional< fc::api<graphene::debug_witness::debug_api> > _remote_debug; fc::optional< fc::api<graphene::debug_witness::debug_api> > _remote_debug;
optional< fc::api<graphene::peerplays_sidechain::sidechain_api> > _remote_sidechain; fc::optional< fc::api<graphene::peerplays_sidechain::sidechain_api> > _remote_sidechain;
flat_map<string, operation> _prototype_ops; flat_map<string, operation> _prototype_ops;
@ -4615,12 +4615,12 @@ bool wallet_api::copy_wallet_file(string destination_filename)
return my->copy_wallet_file(destination_filename); return my->copy_wallet_file(destination_filename);
} }
optional<signed_block_with_info> wallet_api::get_block(uint32_t num) fc::optional<signed_block_with_info> wallet_api::get_block(uint32_t num)
{ {
return my->_remote_db->get_block(num); return my->_remote_db->get_block(num);
} }
vector<optional<signed_block>> wallet_api::get_blocks(uint32_t block_num_from, uint32_t block_num_to) const vector<fc::optional<signed_block>> wallet_api::get_blocks(uint32_t block_num_from, uint32_t block_num_to) const
{ {
return my->_remote_db->get_blocks(block_num_from, block_num_to); return my->_remote_db->get_blocks(block_num_from, block_num_to);
} }
@ -4834,7 +4834,7 @@ string wallet_api::serialize_transaction( signed_transaction tx )const
return fc::to_hex(fc::raw::pack(tx)); return fc::to_hex(fc::raw::pack(tx));
} }
variant wallet_api::get_object( object_id_type id ) const fc::variant wallet_api::get_object( object_id_type id ) const
{ {
return my->_remote_db->get_objects({id}); return my->_remote_db->get_objects({id});
} }
@ -5073,7 +5073,7 @@ string wallet_api::normalize_brain_key(string s) const
return detail::normalize_brain_key( s ); return detail::normalize_brain_key( s );
} }
variant wallet_api::info() fc::variant wallet_api::info()
{ {
return my->info(); return my->info();
} }
@ -5146,7 +5146,7 @@ signed_transaction wallet_api::buy_ticket( asset_id_type lottery, account_id_typ
} }
signed_transaction wallet_api::update_asset(string symbol, signed_transaction wallet_api::update_asset(string symbol,
optional<string> new_issuer, fc::optional<string> new_issuer,
asset_options new_options, asset_options new_options,
bool broadcast /* = false */) bool broadcast /* = false */)
{ {
@ -5333,8 +5333,8 @@ signed_transaction wallet_api::activate_deregistered_son(const string & owner_ac
signed_transaction wallet_api::update_son_vesting_balances(string owner_account, signed_transaction wallet_api::update_son_vesting_balances(string owner_account,
optional<vesting_balance_id_type> new_deposit, fc::optional<vesting_balance_id_type> new_deposit,
optional<vesting_balance_id_type> new_pay_vb, fc::optional<vesting_balance_id_type> new_pay_vb,
bool broadcast /* = false */) bool broadcast /* = false */)
{ {
return my->update_son_vesting_balances(owner_account, new_deposit, new_pay_vb, broadcast); return my->update_son_vesting_balances(owner_account, new_deposit, new_pay_vb, broadcast);
@ -5365,17 +5365,17 @@ map<son_id_type, string> wallet_api::get_son_network_status()
return my->get_son_network_status(); return my->get_son_network_status();
} }
optional<son_wallet_object> wallet_api::get_active_son_wallet() fc::optional<son_wallet_object> wallet_api::get_active_son_wallet()
{ {
return my->get_active_son_wallet(); return my->get_active_son_wallet();
} }
optional<son_wallet_object> wallet_api::get_son_wallet_by_time_point(time_point_sec time_point) fc::optional<son_wallet_object> wallet_api::get_son_wallet_by_time_point(time_point_sec time_point)
{ {
return my->get_son_wallet_by_time_point(time_point); return my->get_son_wallet_by_time_point(time_point);
} }
vector<optional<son_wallet_object>> wallet_api::get_son_wallets(uint32_t limit) vector<fc::optional<son_wallet_object>> wallet_api::get_son_wallets(uint32_t limit)
{ {
return my->get_son_wallets(limit); return my->get_son_wallets(limit);
} }
@ -5421,13 +5421,13 @@ signed_transaction wallet_api::sidechain_withdrawal_transaction(const string &so
withdraw_amount); withdraw_amount);
} }
vector<optional<sidechain_address_object>> wallet_api::get_sidechain_addresses_by_account(string account) vector<fc::optional<sidechain_address_object>> wallet_api::get_sidechain_addresses_by_account(string account)
{ {
account_id_type account_id = get_account_id(account); account_id_type account_id = get_account_id(account);
return my->_remote_db->get_sidechain_addresses_by_account(account_id); return my->_remote_db->get_sidechain_addresses_by_account(account_id);
} }
vector<optional<sidechain_address_object>> wallet_api::get_sidechain_addresses_by_sidechain(sidechain_type sidechain) vector<fc::optional<sidechain_address_object>> wallet_api::get_sidechain_addresses_by_sidechain(sidechain_type sidechain)
{ {
return my->_remote_db->get_sidechain_addresses_by_sidechain(sidechain); return my->_remote_db->get_sidechain_addresses_by_sidechain(sidechain);
} }
@ -5457,7 +5457,7 @@ signed_transaction wallet_api::create_worker(
share_type daily_pay, share_type daily_pay,
string name, string name,
string url, string url,
variant worker_settings, fc::variant worker_settings,
bool broadcast /* = false */) bool broadcast /* = false */)
{ {
return my->create_worker( owner_account, work_begin_date, work_end_date, return my->create_worker( owner_account, work_begin_date, work_end_date,
@ -5570,7 +5570,7 @@ signed_transaction wallet_api::update_witness_votes(string voting_account,
} }
signed_transaction wallet_api::set_voting_proxy(string account_to_modify, signed_transaction wallet_api::set_voting_proxy(string account_to_modify,
optional<string> voting_account, fc::optional<string> voting_account,
bool broadcast /* = false */) bool broadcast /* = false */)
{ {
return my->set_voting_proxy(account_to_modify, voting_account, broadcast); return my->set_voting_proxy(account_to_modify, voting_account, broadcast);
@ -5653,7 +5653,7 @@ void wallet_api::network_add_nodes( const vector<string>& nodes )
my->network_add_nodes( nodes ); my->network_add_nodes( nodes );
} }
vector< variant > wallet_api::network_get_connected_peers() vector< fc::variant > wallet_api::network_get_connected_peers()
{ {
return my->network_get_connected_peers(); return my->network_get_connected_peers();
} }
@ -5979,7 +5979,7 @@ vector< signed_transaction > wallet_api_impl::import_balance( string name_or_id,
} }
else else
{ {
optional< private_key_type > key = wif_to_key( wif_key ); fc::optional< private_key_type > key = wif_to_key( wif_key );
FC_ASSERT( key.valid(), "Invalid private key" ); FC_ASSERT( key.valid(), "Invalid private key" );
fc::ecc::public_key pk = key->get_public_key(); fc::ecc::public_key pk = key->get_public_key();
addrs.push_back( pk ); addrs.push_back( pk );
@ -7402,13 +7402,13 @@ signed_transaction wallet_api::nft_metadata_create(string owner_account_id_or_na
string name, string name,
string symbol, string symbol,
string base_uri, string base_uri,
optional<string> revenue_partner, fc::optional<string> revenue_partner,
optional<uint16_t> revenue_split, fc::optional<uint16_t> revenue_split,
bool is_transferable, bool is_transferable,
bool is_sellable, bool is_sellable,
optional<account_role_id_type> role_id, fc::optional<account_role_id_type> role_id,
optional<share_type> max_supply, fc::optional<share_type> max_supply,
optional<nft_lottery_options> lottery_options, fc::optional<nft_lottery_options> lottery_options,
bool broadcast) bool broadcast)
{ {
account_object owner_account = my->get_account(owner_account_id_or_name); account_object owner_account = my->get_account(owner_account_id_or_name);
@ -7445,14 +7445,14 @@ signed_transaction wallet_api::nft_metadata_create(string owner_account_id_or_na
signed_transaction wallet_api::nft_metadata_update(string owner_account_id_or_name, signed_transaction wallet_api::nft_metadata_update(string owner_account_id_or_name,
nft_metadata_id_type nft_metadata_id, nft_metadata_id_type nft_metadata_id,
optional<string> name, fc::optional<string> name,
optional<string> symbol, fc::optional<string> symbol,
optional<string> base_uri, fc::optional<string> base_uri,
optional<string> revenue_partner, fc::optional<string> revenue_partner,
optional<uint16_t> revenue_split, fc::optional<uint16_t> revenue_split,
optional<bool> is_transferable, fc::optional<bool> is_transferable,
optional<bool> is_sellable, fc::optional<bool> is_sellable,
optional<account_role_id_type> role_id, fc::optional<account_role_id_type> role_id,
bool broadcast) bool broadcast)
{ {
account_object owner_account = my->get_account(owner_account_id_or_name); account_object owner_account = my->get_account(owner_account_id_or_name);
@ -7518,7 +7518,7 @@ uint64_t wallet_api::nft_get_balance(string owner_account_id_or_name) const
return my->_remote_db->nft_get_balance(owner_account.id); return my->_remote_db->nft_get_balance(owner_account.id);
} }
optional<account_id_type> wallet_api::nft_owner_of(const nft_id_type token_id) const fc::optional<account_id_type> wallet_api::nft_owner_of(const nft_id_type token_id) const
{ {
return my->_remote_db->nft_owner_of(token_id); return my->_remote_db->nft_owner_of(token_id);
} }
@ -7600,7 +7600,7 @@ signed_transaction wallet_api::nft_set_approval_for_all(string owner_account_id_
return my->sign_transaction( trx, broadcast ); return my->sign_transaction( trx, broadcast );
} }
optional<account_id_type> wallet_api::nft_get_approved(const nft_id_type token_id) const fc::optional<account_id_type> wallet_api::nft_get_approved(const nft_id_type token_id) const
{ {
return my->_remote_db->nft_get_approved(token_id); return my->_remote_db->nft_get_approved(token_id);
} }
@ -7638,7 +7638,7 @@ signed_transaction wallet_api::create_offer(set<nft_id_type> item_ids,
asset maximum_price, asset maximum_price,
bool buying_item, bool buying_item,
time_point_sec offer_expiration_date, time_point_sec offer_expiration_date,
optional<memo_data> memo, fc::optional<memo_data> memo,
bool broadcast) bool broadcast)
{ {
account_object issuer_account = my->get_account(issuer_accound_id_or_name); account_object issuer_account = my->get_account(issuer_accound_id_or_name);
@ -7698,7 +7698,7 @@ signed_transaction wallet_api::cancel_offer(string issuer_account_id_or_name,
return my->sign_transaction( trx, broadcast ); return my->sign_transaction( trx, broadcast );
} }
vector<offer_object> wallet_api::list_offers(uint32_t limit, optional<offer_id_type> lower_id) const vector<offer_object> wallet_api::list_offers(uint32_t limit, fc::optional<offer_id_type> lower_id) const
{ {
offer_id_type lb_id; offer_id_type lb_id;
if(lower_id) if(lower_id)
@ -7706,7 +7706,7 @@ vector<offer_object> wallet_api::list_offers(uint32_t limit, optional<offer_id_t
return my->_remote_db->list_offers(lb_id, limit); return my->_remote_db->list_offers(lb_id, limit);
} }
vector<offer_object> wallet_api::list_sell_offers(uint32_t limit, optional<offer_id_type> lower_id) const vector<offer_object> wallet_api::list_sell_offers(uint32_t limit, fc::optional<offer_id_type> lower_id) const
{ {
offer_id_type lb_id; offer_id_type lb_id;
if(lower_id) if(lower_id)
@ -7714,7 +7714,7 @@ vector<offer_object> wallet_api::list_sell_offers(uint32_t limit, optional<offer
return my->_remote_db->list_sell_offers(lb_id, limit); return my->_remote_db->list_sell_offers(lb_id, limit);
} }
vector<offer_object> wallet_api::list_buy_offers(uint32_t limit, optional<offer_id_type> lower_id) const vector<offer_object> wallet_api::list_buy_offers(uint32_t limit, fc::optional<offer_id_type> lower_id) const
{ {
offer_id_type lb_id; offer_id_type lb_id;
if(lower_id) if(lower_id)
@ -7722,7 +7722,7 @@ vector<offer_object> wallet_api::list_buy_offers(uint32_t limit, optional<offer_
return my->_remote_db->list_buy_offers(lb_id, limit); return my->_remote_db->list_buy_offers(lb_id, limit);
} }
vector<offer_history_object> wallet_api::list_offer_history(uint32_t limit, optional<offer_history_id_type> lower_id) const vector<offer_history_object> wallet_api::list_offer_history(uint32_t limit, fc::optional<offer_history_id_type> lower_id) const
{ {
offer_history_id_type lb_id; offer_history_id_type lb_id;
if(lower_id) if(lower_id)
@ -7731,7 +7731,7 @@ vector<offer_history_object> wallet_api::list_offer_history(uint32_t limit, opti
} }
vector<offer_object> wallet_api::get_offers_by_issuer(string issuer_account_id_or_name, vector<offer_object> wallet_api::get_offers_by_issuer(string issuer_account_id_or_name,
uint32_t limit, optional<offer_id_type> lower_id) const uint32_t limit, fc::optional<offer_id_type> lower_id) const
{ {
offer_id_type lb_id; offer_id_type lb_id;
if(lower_id) if(lower_id)
@ -7740,7 +7740,7 @@ vector<offer_object> wallet_api::get_offers_by_issuer(string issuer_account_id_o
return my->_remote_db->get_offers_by_issuer(lb_id, issuer_account.id, limit); return my->_remote_db->get_offers_by_issuer(lb_id, issuer_account.id, limit);
} }
vector<offer_object> wallet_api::get_offers_by_item(const nft_id_type item, uint32_t limit, optional<offer_id_type> lower_id) const vector<offer_object> wallet_api::get_offers_by_item(const nft_id_type item, uint32_t limit, fc::optional<offer_id_type> lower_id) const
{ {
offer_id_type lb_id; offer_id_type lb_id;
if(lower_id) if(lower_id)
@ -7748,7 +7748,7 @@ vector<offer_object> wallet_api::get_offers_by_item(const nft_id_type item, uint
return my->_remote_db->get_offers_by_item(lb_id, item, limit); return my->_remote_db->get_offers_by_item(lb_id, item, limit);
} }
vector<offer_history_object> wallet_api::get_offer_history_by_issuer(string issuer_account_id_or_name, uint32_t limit, optional<offer_history_id_type> lower_id) const vector<offer_history_object> wallet_api::get_offer_history_by_issuer(string issuer_account_id_or_name, uint32_t limit, fc::optional<offer_history_id_type> lower_id) const
{ {
offer_history_id_type lb_id; offer_history_id_type lb_id;
if(lower_id) if(lower_id)
@ -7757,7 +7757,7 @@ vector<offer_history_object> wallet_api::get_offer_history_by_issuer(string issu
return my->_remote_db->get_offer_history_by_issuer(lb_id, issuer_account.id, limit); return my->_remote_db->get_offer_history_by_issuer(lb_id, issuer_account.id, limit);
} }
vector<offer_history_object> wallet_api::get_offer_history_by_item(const nft_id_type item, uint32_t limit, optional<offer_history_id_type> lower_id) const vector<offer_history_object> wallet_api::get_offer_history_by_item(const nft_id_type item, uint32_t limit, fc::optional<offer_history_id_type> lower_id) const
{ {
offer_history_id_type lb_id; offer_history_id_type lb_id;
if(lower_id) if(lower_id)
@ -7765,7 +7765,7 @@ vector<offer_history_object> wallet_api::get_offer_history_by_item(const nft_id_
return my->_remote_db->get_offer_history_by_item(lb_id, item, limit); return my->_remote_db->get_offer_history_by_item(lb_id, item, limit);
} }
vector<offer_history_object> wallet_api::get_offer_history_by_bidder(string bidder_account_id_or_name, uint32_t limit, optional<offer_history_id_type> lower_id) const vector<offer_history_object> wallet_api::get_offer_history_by_bidder(string bidder_account_id_or_name, uint32_t limit, fc::optional<offer_history_id_type> lower_id) const
{ {
offer_history_id_type lb_id; offer_history_id_type lb_id;
if(lower_id) if(lower_id)
@ -7802,13 +7802,13 @@ signed_transaction wallet_api::create_account_role(string owner_account_id_or_na
signed_transaction wallet_api::update_account_role(string owner_account_id_or_name, signed_transaction wallet_api::update_account_role(string owner_account_id_or_name,
account_role_id_type role_id, account_role_id_type role_id,
optional<string> name, fc::optional<string> name,
optional<string> metadata, fc::optional<string> metadata,
flat_set<int> operations_to_add, flat_set<int> operations_to_add,
flat_set<int> operations_to_remove, flat_set<int> operations_to_remove,
flat_set<account_id_type> accounts_to_add, flat_set<account_id_type> accounts_to_add,
flat_set<account_id_type> accounts_to_remove, flat_set<account_id_type> accounts_to_remove,
optional<time_point_sec> valid_to, fc::optional<time_point_sec> valid_to,
bool broadcast) bool broadcast)
{ {
account_object owner_account = my->get_account(owner_account_id_or_name); account_object owner_account = my->get_account(owner_account_id_or_name);

View file

@ -79,7 +79,7 @@ BOOST_AUTO_TEST_CASE(elasticsearch_account_history) {
es.query = query; es.query = query;
auto res = graphene::utilities::simpleQuery(es); auto res = graphene::utilities::simpleQuery(es);
variant j = fc::json::from_string(res); fc::variant j = fc::json::from_string(res);
auto total = j["count"].as_string(); auto total = j["count"].as_string();
BOOST_CHECK_EQUAL(total, "5"); BOOST_CHECK_EQUAL(total, "5");
@ -163,7 +163,7 @@ BOOST_AUTO_TEST_CASE(elasticsearch_objects) {
es.query = query; es.query = query;
auto res = graphene::utilities::simpleQuery(es); auto res = graphene::utilities::simpleQuery(es);
variant j = fc::json::from_string(res); fc::variant j = fc::json::from_string(res);
auto total = j["count"].as_string(); auto total = j["count"].as_string();
BOOST_CHECK_EQUAL(total, "2"); BOOST_CHECK_EQUAL(total, "2");

View file

@ -89,7 +89,7 @@ BOOST_AUTO_TEST_CASE( flat_index_test )
price_feed current_feed; price_feed current_feed;
current_feed.settlement_price = bitusd.amount(100) / asset(100); current_feed.settlement_price = bitusd.amount(100) / asset(100);
publish_feed(bitusd, sam, current_feed); publish_feed(bitusd, sam, current_feed);
FC_ASSERT( bitusd.bitasset_data_id->instance == 0 ); FC_ASSERT( bitusd.bitasset_data_id->instance == (const fc::unsigned_int) 0 );
FC_ASSERT( !(*bitusd.bitasset_data_id)(db).current_feed.settlement_price.is_null() ); FC_ASSERT( !(*bitusd.bitasset_data_id)(db).current_feed.settlement_price.is_null() );
try { try {
auto ses = db._undo_db.start_undo_session(); auto ses = db._undo_db.start_undo_session();