Merge remote-tracking branch 'origin/feature/rng' into HEAD
This commit is contained in:
commit
5ee3cba043
13 changed files with 407 additions and 123 deletions
|
|
@ -234,7 +234,6 @@ class database_api_impl : public std::enable_shared_from_this<database_api_impl>
|
||||||
vector<offer_history_object> get_offer_history_by_item(const offer_history_id_type lower_id, const nft_id_type item, uint32_t limit) const;
|
vector<offer_history_object> get_offer_history_by_item(const offer_history_id_type lower_id, const nft_id_type item, uint32_t limit) const;
|
||||||
vector<offer_history_object> get_offer_history_by_bidder(const offer_history_id_type lower_id, const account_id_type bidder_account_id, uint32_t limit) const;
|
vector<offer_history_object> get_offer_history_by_bidder(const offer_history_id_type lower_id, const account_id_type bidder_account_id, uint32_t limit) const;
|
||||||
|
|
||||||
|
|
||||||
uint32_t api_limit_get_lower_bound_symbol = 100;
|
uint32_t api_limit_get_lower_bound_symbol = 100;
|
||||||
uint32_t api_limit_get_limit_orders = 300;
|
uint32_t api_limit_get_limit_orders = 300;
|
||||||
uint32_t api_limit_get_limit_orders_by_account = 101;
|
uint32_t api_limit_get_limit_orders_by_account = 101;
|
||||||
|
|
@ -248,6 +247,9 @@ class database_api_impl : public std::enable_shared_from_this<database_api_impl>
|
||||||
|
|
||||||
// Account Role
|
// Account Role
|
||||||
vector<account_role_object> get_account_roles_by_owner(account_id_type owner) const;
|
vector<account_role_object> get_account_roles_by_owner(account_id_type owner) const;
|
||||||
|
// rng
|
||||||
|
vector<uint64_t> get_random_number_ex(uint64_t minimum, uint64_t maximum, uint64_t selections, bool duplicates) const;
|
||||||
|
uint64_t get_random_number(uint64_t bound) const;
|
||||||
|
|
||||||
//private:
|
//private:
|
||||||
const account_object* get_account_from_string( const std::string& name_or_id,
|
const account_object* get_account_from_string( const std::string& name_or_id,
|
||||||
|
|
@ -3185,6 +3187,59 @@ vector<account_role_object> database_api_impl::get_account_roles_by_owner(accoun
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
// //
|
||||||
|
// Random numbers //
|
||||||
|
// //
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
vector<uint64_t> database_api::get_random_number_ex(uint64_t minimum, uint64_t maximum, uint64_t selections, bool duplicates) const
|
||||||
|
{
|
||||||
|
return my->get_random_number_ex(minimum, maximum, selections, duplicates);
|
||||||
|
}
|
||||||
|
|
||||||
|
vector<uint64_t> database_api_impl::get_random_number_ex(uint64_t minimum, uint64_t maximum, uint64_t selections, bool duplicates) const
|
||||||
|
{
|
||||||
|
FC_ASSERT( selections <= 100000 );
|
||||||
|
if (duplicates == false) {
|
||||||
|
FC_ASSERT( maximum - minimum >= selections );
|
||||||
|
}
|
||||||
|
|
||||||
|
vector<uint64_t> v;
|
||||||
|
v.reserve(selections);
|
||||||
|
|
||||||
|
if (duplicates) {
|
||||||
|
for (uint64_t i = 0; i < selections; i++) {
|
||||||
|
int64_t rnd = _db.get_random_bits(maximum - minimum) + minimum;
|
||||||
|
v.push_back(rnd);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
vector<uint64_t> tmpv;
|
||||||
|
tmpv.reserve(selections);
|
||||||
|
for (uint64_t i = minimum; i < maximum; i++) {
|
||||||
|
tmpv.push_back(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (uint64_t i = 0; (i < selections) && (tmpv.size() > 0); i++) {
|
||||||
|
uint64_t idx = _db.get_random_bits(tmpv.size());
|
||||||
|
v.push_back(tmpv.at(idx));
|
||||||
|
tmpv.erase(tmpv.begin() + idx);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint64_t database_api::get_random_number(uint64_t bound) const
|
||||||
|
{
|
||||||
|
return my->get_random_number(bound);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint64_t database_api_impl::get_random_number(uint64_t bound) const {
|
||||||
|
vector<uint64_t> v = get_random_number_ex(0, bound, 1, false);
|
||||||
|
return v.at(0);
|
||||||
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
// //
|
// //
|
||||||
// Private methods //
|
// Private methods //
|
||||||
|
|
|
||||||
|
|
@ -935,6 +935,27 @@ class database_api
|
||||||
//////////////////
|
//////////////////
|
||||||
vector<account_role_object> get_account_roles_by_owner(account_id_type owner) const;
|
vector<account_role_object> get_account_roles_by_owner(account_id_type owner) const;
|
||||||
private:
|
private:
|
||||||
|
/////////////////////////////
|
||||||
|
// Random number generator //
|
||||||
|
/////////////////////////////
|
||||||
|
/**
|
||||||
|
* @brief Returns the random number
|
||||||
|
* @param minimum Lower bound of segment containing random number
|
||||||
|
* @param maximum Upper bound of segment containing random number
|
||||||
|
* @param selections Number of random numbers to return
|
||||||
|
* @param duplicates Allow duplicated numbers
|
||||||
|
* @return Vector containing random numbers from segment [minimum, maximum)
|
||||||
|
*/
|
||||||
|
vector<uint64_t> get_random_number_ex(uint64_t minimum, uint64_t maximum, uint64_t selections, bool duplicates) const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Returns the random number
|
||||||
|
* @param bound Upper bound of segment containing random number
|
||||||
|
* @return Random number from segment [0, bound)
|
||||||
|
*/
|
||||||
|
uint64_t get_random_number(uint64_t bound) const;
|
||||||
|
|
||||||
|
private:
|
||||||
std::shared_ptr< database_api_impl > my;
|
std::shared_ptr< database_api_impl > my;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -1125,4 +1146,7 @@ FC_API(graphene::app::database_api,
|
||||||
|
|
||||||
// Account Roles
|
// Account Roles
|
||||||
(get_account_roles_by_owner)
|
(get_account_roles_by_owner)
|
||||||
|
// rngs
|
||||||
|
(get_random_number_ex)
|
||||||
|
(get_random_number)
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -142,6 +142,8 @@ add_library( graphene_chain
|
||||||
nft_lottery_evaluator.cpp
|
nft_lottery_evaluator.cpp
|
||||||
nft_lottery_object.cpp
|
nft_lottery_object.cpp
|
||||||
|
|
||||||
|
random_number_evaluator.cpp
|
||||||
|
|
||||||
${HEADERS}
|
${HEADERS}
|
||||||
${PROTOCOL_HEADERS}
|
${PROTOCOL_HEADERS}
|
||||||
"${CMAKE_CURRENT_BINARY_DIR}/include/graphene/chain/hardfork.hpp"
|
"${CMAKE_CURRENT_BINARY_DIR}/include/graphene/chain/hardfork.hpp"
|
||||||
|
|
|
||||||
|
|
@ -53,6 +53,7 @@
|
||||||
#include <graphene/chain/custom_account_authority_object.hpp>
|
#include <graphene/chain/custom_account_authority_object.hpp>
|
||||||
#include <graphene/chain/offer_object.hpp>
|
#include <graphene/chain/offer_object.hpp>
|
||||||
#include <graphene/chain/account_role_object.hpp>
|
#include <graphene/chain/account_role_object.hpp>
|
||||||
|
#include <graphene/chain/random_number_object.hpp>
|
||||||
|
|
||||||
#include <graphene/chain/nft_object.hpp>
|
#include <graphene/chain/nft_object.hpp>
|
||||||
|
|
||||||
|
|
@ -101,6 +102,7 @@
|
||||||
#include <graphene/chain/son_wallet_withdraw_evaluator.hpp>
|
#include <graphene/chain/son_wallet_withdraw_evaluator.hpp>
|
||||||
#include <graphene/chain/sidechain_address_evaluator.hpp>
|
#include <graphene/chain/sidechain_address_evaluator.hpp>
|
||||||
#include <graphene/chain/sidechain_transaction_evaluator.hpp>
|
#include <graphene/chain/sidechain_transaction_evaluator.hpp>
|
||||||
|
#include <graphene/chain/random_number_evaluator.hpp>
|
||||||
|
|
||||||
#include <graphene/chain/protocol/fee_schedule.hpp>
|
#include <graphene/chain/protocol/fee_schedule.hpp>
|
||||||
|
|
||||||
|
|
@ -207,6 +209,9 @@ const uint8_t account_role_object::type_id;
|
||||||
const uint8_t nft_lottery_balance_object::space_id;
|
const uint8_t nft_lottery_balance_object::space_id;
|
||||||
const uint8_t nft_lottery_balance_object::type_id;
|
const uint8_t nft_lottery_balance_object::type_id;
|
||||||
|
|
||||||
|
const uint8_t random_number_object::space_id;
|
||||||
|
const uint8_t random_number_object::type_id;
|
||||||
|
|
||||||
void database::initialize_evaluators()
|
void database::initialize_evaluators()
|
||||||
{
|
{
|
||||||
_operation_evaluators.resize(255);
|
_operation_evaluators.resize(255);
|
||||||
|
|
@ -321,6 +326,7 @@ void database::initialize_evaluators()
|
||||||
register_evaluator<sidechain_transaction_sign_evaluator>();
|
register_evaluator<sidechain_transaction_sign_evaluator>();
|
||||||
register_evaluator<sidechain_transaction_send_evaluator>();
|
register_evaluator<sidechain_transaction_send_evaluator>();
|
||||||
register_evaluator<sidechain_transaction_settle_evaluator>();
|
register_evaluator<sidechain_transaction_settle_evaluator>();
|
||||||
|
register_evaluator<random_number_store_evaluator>();
|
||||||
}
|
}
|
||||||
|
|
||||||
void database::initialize_indexes()
|
void database::initialize_indexes()
|
||||||
|
|
@ -412,6 +418,7 @@ void database::initialize_indexes()
|
||||||
add_index< primary_index<offer_history_index > >();
|
add_index< primary_index<offer_history_index > >();
|
||||||
add_index< primary_index<nft_lottery_balance_index > >();
|
add_index< primary_index<nft_lottery_balance_index > >();
|
||||||
add_index< primary_index<son_stats_index > >();
|
add_index< primary_index<son_stats_index > >();
|
||||||
|
add_index< primary_index<random_number_index > >();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -423,6 +423,9 @@ struct get_impacted_account_visitor
|
||||||
void operator()( const sidechain_transaction_settle_operation& op ) {
|
void operator()( const sidechain_transaction_settle_operation& op ) {
|
||||||
_impacted.insert( op.payer );
|
_impacted.insert( op.payer );
|
||||||
}
|
}
|
||||||
|
void operator()( const random_number_store_operation& op ) {
|
||||||
|
_impacted.insert( op.account );
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
void graphene::chain::operation_get_impacted_accounts( const operation& op, flat_set<account_id_type>& result, bool ignore_custom_operation_required_auths ) {
|
void graphene::chain::operation_get_impacted_accounts( const operation& op, flat_set<account_id_type>& result, bool ignore_custom_operation_required_auths ) {
|
||||||
|
|
|
||||||
|
|
@ -57,6 +57,7 @@
|
||||||
#include <graphene/chain/protocol/son_wallet_deposit.hpp>
|
#include <graphene/chain/protocol/son_wallet_deposit.hpp>
|
||||||
#include <graphene/chain/protocol/son_wallet_withdraw.hpp>
|
#include <graphene/chain/protocol/son_wallet_withdraw.hpp>
|
||||||
#include <graphene/chain/protocol/sidechain_transaction.hpp>
|
#include <graphene/chain/protocol/sidechain_transaction.hpp>
|
||||||
|
#include <graphene/chain/protocol/random_number.hpp>
|
||||||
|
|
||||||
namespace graphene { namespace chain {
|
namespace graphene { namespace chain {
|
||||||
|
|
||||||
|
|
@ -188,7 +189,8 @@ namespace graphene { namespace chain {
|
||||||
sidechain_transaction_settle_operation,
|
sidechain_transaction_settle_operation,
|
||||||
nft_lottery_token_purchase_operation,
|
nft_lottery_token_purchase_operation,
|
||||||
nft_lottery_reward_operation,
|
nft_lottery_reward_operation,
|
||||||
nft_lottery_end_operation
|
nft_lottery_end_operation,
|
||||||
|
random_number_store_operation
|
||||||
> operation;
|
> operation;
|
||||||
|
|
||||||
/// @} // operations group
|
/// @} // operations group
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,25 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
namespace graphene { namespace chain {
|
||||||
|
|
||||||
|
struct random_number_store_operation : public base_operation
|
||||||
|
{
|
||||||
|
struct fee_parameters_type { uint64_t fee = 5000 * GRAPHENE_BLOCKCHAIN_PRECISION; };
|
||||||
|
|
||||||
|
asset fee;
|
||||||
|
|
||||||
|
account_id_type account;
|
||||||
|
vector<uint64_t> random_number;
|
||||||
|
std::string data;
|
||||||
|
|
||||||
|
account_id_type fee_payer()const { return account; }
|
||||||
|
};
|
||||||
|
|
||||||
|
} } // graphene::chain
|
||||||
|
|
||||||
|
FC_REFLECT( graphene::chain::random_number_store_operation::fee_parameters_type, (fee) )
|
||||||
|
FC_REFLECT( graphene::chain::random_number_store_operation, (fee)
|
||||||
|
(account)
|
||||||
|
(random_number)
|
||||||
|
(data) )
|
||||||
|
|
||||||
|
|
@ -183,6 +183,7 @@ namespace graphene { namespace chain {
|
||||||
son_wallet_withdraw_object_type,
|
son_wallet_withdraw_object_type,
|
||||||
sidechain_address_object_type,
|
sidechain_address_object_type,
|
||||||
sidechain_transaction_object_type,
|
sidechain_transaction_object_type,
|
||||||
|
random_number_object_type,
|
||||||
OBJECT_TYPE_COUNT ///< Sentry value which contains the number of different object types
|
OBJECT_TYPE_COUNT ///< Sentry value which contains the number of different object types
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -259,6 +260,7 @@ namespace graphene { namespace chain {
|
||||||
class son_wallet_withdraw_object;
|
class son_wallet_withdraw_object;
|
||||||
class sidechain_address_object;
|
class sidechain_address_object;
|
||||||
class sidechain_transaction_object;
|
class sidechain_transaction_object;
|
||||||
|
class random_number_object;
|
||||||
|
|
||||||
typedef object_id< protocol_ids, account_object_type, account_object> account_id_type;
|
typedef object_id< protocol_ids, account_object_type, account_object> account_id_type;
|
||||||
typedef object_id< protocol_ids, asset_object_type, asset_object> asset_id_type;
|
typedef object_id< protocol_ids, asset_object_type, asset_object> asset_id_type;
|
||||||
|
|
@ -298,6 +300,7 @@ namespace graphene { namespace chain {
|
||||||
typedef object_id< protocol_ids, son_wallet_withdraw_object_type, son_wallet_withdraw_object> son_wallet_withdraw_id_type;
|
typedef object_id< protocol_ids, son_wallet_withdraw_object_type, son_wallet_withdraw_object> son_wallet_withdraw_id_type;
|
||||||
typedef object_id< protocol_ids, sidechain_address_object_type, sidechain_address_object> sidechain_address_id_type;
|
typedef object_id< protocol_ids, sidechain_address_object_type, sidechain_address_object> sidechain_address_id_type;
|
||||||
typedef object_id< protocol_ids, sidechain_transaction_object_type,sidechain_transaction_object> sidechain_transaction_id_type;
|
typedef object_id< protocol_ids, sidechain_transaction_object_type,sidechain_transaction_object> sidechain_transaction_id_type;
|
||||||
|
typedef object_id< protocol_ids, random_number_object_type, random_number_object> random_number_id_type;
|
||||||
|
|
||||||
// implementation types
|
// implementation types
|
||||||
class global_property_object;
|
class global_property_object;
|
||||||
|
|
@ -499,6 +502,7 @@ FC_REFLECT_ENUM( graphene::chain::object_type,
|
||||||
(son_wallet_withdraw_object_type)
|
(son_wallet_withdraw_object_type)
|
||||||
(sidechain_address_object_type)
|
(sidechain_address_object_type)
|
||||||
(sidechain_transaction_object_type)
|
(sidechain_transaction_object_type)
|
||||||
|
(random_number_object_type)
|
||||||
(OBJECT_TYPE_COUNT)
|
(OBJECT_TYPE_COUNT)
|
||||||
)
|
)
|
||||||
FC_REFLECT_ENUM( graphene::chain::impl_object_type,
|
FC_REFLECT_ENUM( graphene::chain::impl_object_type,
|
||||||
|
|
@ -587,7 +591,7 @@ FC_REFLECT_TYPENAME( graphene::chain::son_wallet_deposit_id_type )
|
||||||
FC_REFLECT_TYPENAME( graphene::chain::son_wallet_withdraw_id_type )
|
FC_REFLECT_TYPENAME( graphene::chain::son_wallet_withdraw_id_type )
|
||||||
FC_REFLECT_TYPENAME( graphene::chain::sidechain_address_id_type )
|
FC_REFLECT_TYPENAME( graphene::chain::sidechain_address_id_type )
|
||||||
FC_REFLECT_TYPENAME( graphene::chain::sidechain_transaction_id_type )
|
FC_REFLECT_TYPENAME( graphene::chain::sidechain_transaction_id_type )
|
||||||
|
FC_REFLECT_TYPENAME( graphene::chain::random_number_id_type )
|
||||||
|
|
||||||
FC_REFLECT( graphene::chain::void_t, )
|
FC_REFLECT( graphene::chain::void_t, )
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,19 @@
|
||||||
|
#pragma once
|
||||||
|
#include <graphene/chain/database.hpp>
|
||||||
|
#include <graphene/chain/evaluator.hpp>
|
||||||
|
#include <graphene/chain/protocol/operations.hpp>
|
||||||
|
#include <graphene/chain/protocol/types.hpp>
|
||||||
|
|
||||||
|
namespace graphene { namespace chain {
|
||||||
|
|
||||||
|
class random_number_store_evaluator : public evaluator<random_number_store_evaluator>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
typedef random_number_store_operation operation_type;
|
||||||
|
|
||||||
|
void_result do_evaluate( const random_number_store_operation& o );
|
||||||
|
object_id_type do_apply( const random_number_store_operation& o );
|
||||||
|
};
|
||||||
|
|
||||||
|
} } // graphene::chain
|
||||||
|
|
||||||
|
|
@ -0,0 +1,41 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
namespace graphene { namespace chain {
|
||||||
|
using namespace graphene::db;
|
||||||
|
|
||||||
|
class random_number_object : public abstract_object<random_number_object>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
static const uint8_t space_id = protocol_ids;
|
||||||
|
static const uint8_t type_id = random_number_object_type;
|
||||||
|
|
||||||
|
account_id_type account; /* account who requested random number */
|
||||||
|
time_point_sec timestamp; /* date and time when the number is read */
|
||||||
|
vector<uint64_t> random_number; /* random number(s) */
|
||||||
|
std::string data; /* custom data in json format */
|
||||||
|
};
|
||||||
|
|
||||||
|
struct by_account;
|
||||||
|
struct by_timestamp;
|
||||||
|
using random_number_multi_index_type = multi_index_container<
|
||||||
|
random_number_object,
|
||||||
|
indexed_by<
|
||||||
|
ordered_unique< tag<by_id>,
|
||||||
|
member<object, object_id_type, &object::id>
|
||||||
|
>,
|
||||||
|
ordered_non_unique< tag<by_account>,
|
||||||
|
member<random_number_object, account_id_type, &random_number_object::account>
|
||||||
|
>,
|
||||||
|
ordered_non_unique< tag<by_timestamp>,
|
||||||
|
member<random_number_object, time_point_sec, &random_number_object::timestamp>
|
||||||
|
>
|
||||||
|
>
|
||||||
|
>;
|
||||||
|
using random_number_index = generic_index<random_number_object, random_number_multi_index_type>;
|
||||||
|
|
||||||
|
} } // graphene::chain
|
||||||
|
|
||||||
|
FC_REFLECT_DERIVED( graphene::chain::random_number_object, (graphene::db::object),
|
||||||
|
(account) (timestamp)
|
||||||
|
(random_number) (data) )
|
||||||
|
|
||||||
24
libraries/chain/random_number_evaluator.cpp
Normal file
24
libraries/chain/random_number_evaluator.cpp
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
#include <graphene/chain/random_number_evaluator.hpp>
|
||||||
|
#include <graphene/chain/random_number_object.hpp>
|
||||||
|
|
||||||
|
namespace graphene { namespace chain {
|
||||||
|
|
||||||
|
void_result random_number_store_evaluator::do_evaluate( const random_number_store_operation& op )
|
||||||
|
{ try {
|
||||||
|
|
||||||
|
return void_result();
|
||||||
|
} FC_CAPTURE_AND_RETHROW( (op) ) }
|
||||||
|
|
||||||
|
object_id_type random_number_store_evaluator::do_apply( const random_number_store_operation& op )
|
||||||
|
{ try {
|
||||||
|
const auto& new_random_number_object = db().create<random_number_object>( [&]( random_number_object& obj ) {
|
||||||
|
obj.account = op.account;
|
||||||
|
obj.timestamp = db().head_block_time();
|
||||||
|
obj.random_number = op.random_number;
|
||||||
|
obj.data = op.data;
|
||||||
|
});
|
||||||
|
return new_random_number_object.id;
|
||||||
|
} FC_CAPTURE_AND_RETHROW( (op) ) }
|
||||||
|
|
||||||
|
} } // graphene::chain
|
||||||
|
|
||||||
|
|
@ -1903,6 +1903,32 @@ class wallet_api
|
||||||
bool broadcast /* = false */
|
bool broadcast /* = false */
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/** Get random numbers
|
||||||
|
* @brief Returns the random number
|
||||||
|
* @param minimum Lower bound of segment containing random number
|
||||||
|
* @param maximum Upper bound of segment containing random number
|
||||||
|
* @param selections Number of random numbers to return
|
||||||
|
* @param duplicates Allow duplicated numbers
|
||||||
|
* @param broadcast true if you wish to broadcast the transaction
|
||||||
|
* @return the signed version of the transaction
|
||||||
|
* @return Vector containing random numbers from segment [minimum, maximum)
|
||||||
|
*/
|
||||||
|
vector<uint64_t> get_random_number_ex(string account,
|
||||||
|
uint64_t minimum,
|
||||||
|
uint64_t maximum,
|
||||||
|
uint64_t selections,
|
||||||
|
bool duplicates,
|
||||||
|
bool broadcast);
|
||||||
|
|
||||||
|
/** Get random number
|
||||||
|
* @brief Returns the random number
|
||||||
|
* @param bound Upper bound of segment containing random number
|
||||||
|
* @return Random number from segment [0, bound)
|
||||||
|
*/
|
||||||
|
uint64_t get_random_number(string account,
|
||||||
|
uint64_t bound,
|
||||||
|
bool broadcast);
|
||||||
|
|
||||||
order_book get_order_book( const string& base, const string& quote, unsigned limit = 50);
|
order_book get_order_book( const string& base, const string& quote, unsigned limit = 50);
|
||||||
|
|
||||||
asset get_total_matched_bet_amount_for_betting_market_group(betting_market_group_id_type group_id);
|
asset get_total_matched_bet_amount_for_betting_market_group(betting_market_group_id_type group_id);
|
||||||
|
|
@ -2161,6 +2187,7 @@ class wallet_api
|
||||||
vector<custom_account_authority_object> get_custom_account_authorities_by_permission_id(custom_permission_id_type permission_id) const;
|
vector<custom_account_authority_object> get_custom_account_authorities_by_permission_id(custom_permission_id_type permission_id) const;
|
||||||
vector<custom_account_authority_object> get_custom_account_authorities_by_permission_name(string owner, string permission_name) const;
|
vector<custom_account_authority_object> get_custom_account_authorities_by_permission_name(string owner, string permission_name) const;
|
||||||
vector<authority> get_active_custom_account_authorities_by_operation(string owner, int operation_type) const;
|
vector<authority> get_active_custom_account_authorities_by_operation(string owner, int operation_type) const;
|
||||||
|
|
||||||
/////////
|
/////////
|
||||||
// NFT //
|
// NFT //
|
||||||
/////////
|
/////////
|
||||||
|
|
@ -2593,6 +2620,8 @@ FC_API( graphene::wallet::wallet_api,
|
||||||
(propose_fee_change)
|
(propose_fee_change)
|
||||||
(propose_dividend_asset_update)
|
(propose_dividend_asset_update)
|
||||||
(approve_proposal)
|
(approve_proposal)
|
||||||
|
(get_random_number_ex)
|
||||||
|
(get_random_number)
|
||||||
(dbg_make_uia)
|
(dbg_make_uia)
|
||||||
(dbg_make_mia)
|
(dbg_make_mia)
|
||||||
(dbg_push_blocks)
|
(dbg_push_blocks)
|
||||||
|
|
|
||||||
|
|
@ -3723,6 +3723,38 @@ public:
|
||||||
return _remote_db->get_active_custom_account_authorities_by_operation(get_account(owner).id, operation_type);
|
return _remote_db->get_active_custom_account_authorities_by_operation(get_account(owner).id, operation_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
vector<uint64_t> get_random_number_ex(string account,
|
||||||
|
uint64_t minimum,
|
||||||
|
uint64_t maximum,
|
||||||
|
uint64_t selections,
|
||||||
|
bool duplicates,
|
||||||
|
bool broadcast)
|
||||||
|
{
|
||||||
|
|
||||||
|
vector<uint64_t> v = _remote_db->get_random_number_ex(minimum, maximum, selections, duplicates);
|
||||||
|
|
||||||
|
random_number_store_operation op;
|
||||||
|
op.account = get_account(account).id;
|
||||||
|
op.random_number = v;
|
||||||
|
op.data = "";
|
||||||
|
|
||||||
|
signed_transaction trx;
|
||||||
|
trx.operations.push_back(op);
|
||||||
|
set_operation_fees( trx, _remote_db->get_global_properties().parameters.current_fees );
|
||||||
|
trx.validate();
|
||||||
|
sign_transaction( trx, broadcast );
|
||||||
|
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint64_t get_random_number(string account,
|
||||||
|
uint64_t bound,
|
||||||
|
bool broadcast)
|
||||||
|
{
|
||||||
|
vector<uint64_t> v = get_random_number_ex(account, 0, bound, 1, false, broadcast);
|
||||||
|
return v.at(0);
|
||||||
|
}
|
||||||
|
|
||||||
void dbg_make_uia(string creator, string symbol)
|
void dbg_make_uia(string creator, string symbol)
|
||||||
{
|
{
|
||||||
asset_options opts;
|
asset_options opts;
|
||||||
|
|
@ -5256,6 +5288,23 @@ vector<authority> wallet_api::get_active_custom_account_authorities_by_operation
|
||||||
return my->get_active_custom_account_authorities_by_operation(owner, operation_type);
|
return my->get_active_custom_account_authorities_by_operation(owner, operation_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
vector<uint64_t> wallet_api::get_random_number_ex(string account,
|
||||||
|
uint64_t minimum,
|
||||||
|
uint64_t maximum,
|
||||||
|
uint64_t selections,
|
||||||
|
bool duplicates,
|
||||||
|
bool broadcast)
|
||||||
|
{
|
||||||
|
return my->get_random_number_ex( account, minimum, maximum, selections, duplicates, broadcast );
|
||||||
|
}
|
||||||
|
|
||||||
|
uint64_t wallet_api::get_random_number(string account,
|
||||||
|
uint64_t bound,
|
||||||
|
bool broadcast)
|
||||||
|
{
|
||||||
|
return my->get_random_number( account, bound, broadcast );
|
||||||
|
}
|
||||||
|
|
||||||
global_property_object wallet_api::get_global_properties() const
|
global_property_object wallet_api::get_global_properties() const
|
||||||
{
|
{
|
||||||
return my->get_global_properties();
|
return my->get_global_properties();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue