Bitshares-Core  2.0.181105
BitShares blockchain implementation and command-line interface software
Public Member Functions | List of all members
graphene::app::database_api Class Reference

The database_api class implements the RPC API for the chain database. More...

#include <database_api.hpp>

Public Member Functions

 database_api (graphene::chain::database &db, const application_options *app_options=nullptr)
 
 ~database_api ()
 
fc::variants get_objects (const vector< object_id_type > &ids) const
 Get the objects corresponding to the provided IDs. More...
 
void set_subscribe_callback (std::function< void(const variant &)> cb, bool notify_remove_create)
 Register a callback handle which then can be used to subscribe to object database changes. More...
 
void set_pending_transaction_callback (std::function< void(const variant &signed_transaction_object)> cb)
 Register a callback handle which will get notified when a transaction is pushed to database. More...
 
void set_block_applied_callback (std::function< void(const variant &block_id)> cb)
 Register a callback handle which will get notified when a block is pushed to database. More...
 
void cancel_all_subscriptions ()
 Stop receiving any notifications. More...
 
optional< block_headerget_block_header (uint32_t block_num) const
 Retrieve a block header. More...
 
map< uint32_t, optional< block_header > > get_block_header_batch (const vector< uint32_t > block_nums) const
 Retrieve multiple block header by block numbers. More...
 
optional< signed_blockget_block (uint32_t block_num) const
 Retrieve a full, signed block. More...
 
processed_transaction get_transaction (uint32_t block_num, uint32_t trx_in_block) const
 used to fetch an individual transaction. More...
 
optional< signed_transactionget_recent_transaction_by_id (const transaction_id_type &id) const
 
chain_property_object get_chain_properties () const
 Retrieve the chain_property_object associated with the chain. More...
 
global_property_object get_global_properties () const
 Retrieve the current global_property_object. More...
 
fc::variant_object get_config () const
 Retrieve compile-time constants. More...
 
chain_id_type get_chain_id () const
 Get the chain ID. More...
 
dynamic_global_property_object get_dynamic_global_properties () const
 Retrieve the current dynamic_global_property_object. More...
 
vector< vector< account_id_type > > get_key_references (vector< public_key_type > key) const
 
bool is_public_key_registered (string public_key) const
 
account_id_type get_account_id_from_string (const std::string &name_or_id) const
 Get account object from a name or ID. More...
 
vector< optional< account_object > > get_accounts (const vector< std::string > &account_names_or_ids) const
 Get a list of accounts by ID. More...
 
vector< limit_order_objectget_account_limit_orders (const string &account_name_or_id, const string &base, const string &quote, uint32_t limit=101, optional< limit_order_id_type > ostart_id=optional< limit_order_id_type >(), optional< price > ostart_price=optional< price >())
 Fetch all orders relevant to the specified account and specified market, result orders are sorted descendingly by price. More...
 
std::map< string, full_accountget_full_accounts (const vector< string > &names_or_ids, bool subscribe)
 Fetch all objects relevant to the specified accounts and subscribe to updates. More...
 
optional< account_objectget_account_by_name (string name) const
 
vector< account_id_typeget_account_references (const std::string account_id_or_name) const
 
vector< optional< account_object > > lookup_account_names (const vector< string > &account_names) const
 Get a list of accounts by name. More...
 
map< string, account_id_typelookup_accounts (const string &lower_bound_name, uint32_t limit) const
 Get names and IDs for registered accounts. More...
 
vector< assetget_account_balances (const std::string &account_name_or_id, const flat_set< asset_id_type > &assets) const
 Get an account's balances in various assets. More...
 
vector< assetget_named_account_balances (const std::string &name, const flat_set< asset_id_type > &assets) const
 Semantically equivalent to get_account_balances, but takes a name instead of an ID. More...
 
vector< balance_objectget_balance_objects (const vector< address > &addrs) const
 
vector< assetget_vested_balances (const vector< balance_id_type > &objs) const
 
vector< vesting_balance_objectget_vesting_balances (const std::string account_id_or_name) const
 
uint64_t get_account_count () const
 Get the total number of accounts registered with the blockchain. More...
 
vector< optional< asset_object > > get_assets (const vector< asset_id_type > &asset_ids) const
 Get a list of assets by ID. More...
 
vector< asset_objectlist_assets (const string &lower_bound_symbol, uint32_t limit) const
 Get assets alphabetically by symbol name. More...
 
vector< optional< asset_object > > lookup_asset_symbols (const vector< string > &symbols_or_ids) const
 Get a list of assets by symbol. More...
 
uint64_t get_asset_count () const
 Get assets count. More...
 
vector< limit_order_objectget_limit_orders (asset_id_type a, asset_id_type b, uint32_t limit) const
 Get limit orders in a given market. More...
 
vector< call_order_objectget_call_orders (asset_id_type a, uint32_t limit) const
 Get call orders in a given asset. More...
 
vector< force_settlement_objectget_settle_orders (asset_id_type a, uint32_t limit) const
 Get forced settlement orders in a given asset. More...
 
vector< collateral_bid_objectget_collateral_bids (const asset_id_type asset, uint32_t limit, uint32_t start) const
 Get collateral_bid_objects for a given asset. More...
 
vector< call_order_objectget_margin_positions (const std::string account_id_or_name) const
 
void subscribe_to_market (std::function< void(const variant &)> callback, asset_id_type a, asset_id_type b)
 Request notification when the active orders in the market between two assets changes. More...
 
void unsubscribe_from_market (asset_id_type a, asset_id_type b)
 Unsubscribe from updates to a given market. More...
 
market_ticker get_ticker (const string &base, const string &quote) const
 Returns the ticker for the market assetA:assetB. More...
 
market_volume get_24_volume (const string &base, const string &quote) const
 Returns the 24 hour volume for the market assetA:assetB. More...
 
order_book get_order_book (const string &base, const string &quote, unsigned limit=50) const
 Returns the order book for the market base:quote. More...
 
vector< market_volumeget_top_markets (uint32_t limit) const
 Returns vector of 24 hour volume markets sorted by reverse base_volume Note: this API is experimental and subject to change in next releases. More...
 
vector< market_tradeget_trade_history (const string &base, const string &quote, fc::time_point_sec start, fc::time_point_sec stop, unsigned limit=100) const
 Returns recent trades for the market base:quote, ordered by time, most recent first. Note: Currently, timezone offsets are not supported. The time must be UTC. The range is [stop, start). In case when there are more than 100 trades occurred in the same second, this API only returns the first 100 records, can use another API get_trade_history_by_sequence to query for the rest. More...
 
vector< market_tradeget_trade_history_by_sequence (const string &base, const string &quote, int64_t start, fc::time_point_sec stop, unsigned limit=100) const
 Returns trades for the market base:quote, ordered by time, most recent first. Note: Currently, timezone offsets are not supported. The time must be UTC. The range is [stop, start). More...
 
vector< optional< witness_object > > get_witnesses (const vector< witness_id_type > &witness_ids) const
 Get a list of witnesses by ID. More...
 
fc::optional< witness_objectget_witness_by_account (const std::string account_id_or_name) const
 Get the witness owned by a given account. More...
 
map< string, witness_id_typelookup_witness_accounts (const string &lower_bound_name, uint32_t limit) const
 Get names and IDs for registered witnesses. More...
 
uint64_t get_witness_count () const
 Get the total number of witnesses registered with the blockchain. More...
 
vector< optional< committee_member_object > > get_committee_members (const vector< committee_member_id_type > &committee_member_ids) const
 Get a list of committee_members by ID. More...
 
fc::optional< committee_member_objectget_committee_member_by_account (const std::string account_id_or_name) const
 Get the committee_member owned by a given account. More...
 
map< string, committee_member_id_typelookup_committee_member_accounts (const string &lower_bound_name, uint32_t limit) const
 Get names and IDs for registered committee_members. More...
 
uint64_t get_committee_count () const
 Get the total number of committee registered with the blockchain. More...
 
vector< worker_objectget_all_workers () const
 Get all workers. More...
 
vector< optional< worker_object > > get_workers_by_account (const std::string account_id_or_name) const
 Get the workers owned by a given account. More...
 
uint64_t get_worker_count () const
 Get the total number of workers registered with the blockchain. More...
 
vector< variant > lookup_vote_ids (const vector< vote_id_type > &votes) const
 Given a set of votes, return the objects they are voting for. More...
 
std::string get_transaction_hex (const signed_transaction &trx) const
 Get a hexdump of the serialized binary form of a transaction. More...
 
std::string get_transaction_hex_without_sig (const signed_transaction &trx) const
 Get a hexdump of the serialized binary form of a signatures-stripped transaction. More...
 
set< public_key_typeget_required_signatures (const signed_transaction &trx, const flat_set< public_key_type > &available_keys) const
 
set< public_key_typeget_potential_signatures (const signed_transaction &trx) const
 
set< addressget_potential_address_signatures (const signed_transaction &trx) const
 
bool verify_authority (const signed_transaction &trx) const
 
bool verify_account_authority (const string &account_name_or_id, const flat_set< public_key_type > &signers) const
 
processed_transaction validate_transaction (const signed_transaction &trx) const
 
vector< fc::variant > get_required_fees (const vector< operation > &ops, asset_id_type id) const
 
vector< proposal_objectget_proposed_transactions (const std::string account_id_or_name) const
 
vector< blinded_balance_objectget_blinded_balances (const flat_set< commitment_type > &commitments) const
 
vector< withdraw_permission_objectget_withdraw_permissions_by_giver (const std::string account_id_or_name, withdraw_permission_id_type start, uint32_t limit) const
 Get non expired withdraw permission objects for a giver(ex:recurring customer) More...
 
vector< withdraw_permission_objectget_withdraw_permissions_by_recipient (const std::string account_id_or_name, withdraw_permission_id_type start, uint32_t limit) const
 Get non expired withdraw permission objects for a recipient(ex:service provider) More...
 

Detailed Description

The database_api class implements the RPC API for the chain database.

This API exposes accessors on the database which query state tracked by a blockchain validating node. This API is read-only; all modifications to the database must be performed via transactions. Transactions are broadcast via the network_broadcast_api.

Definition at line 122 of file database_api.hpp.

Constructor & Destructor Documentation

◆ database_api()

graphene::app::database_api::database_api ( graphene::chain::database db,
const application_options app_options = nullptr 
)

Definition at line 284 of file database_api.cpp.

◆ ~database_api()

graphene::app::database_api::~database_api ( )

Definition at line 287 of file database_api.cpp.

Member Function Documentation

◆ cancel_all_subscriptions()

void graphene::app::database_api::cancel_all_subscriptions ( )

Stop receiving any notifications.

This unsubscribes from all subscribed markets and objects.

Definition at line 395 of file database_api.cpp.

◆ get_24_volume()

market_volume graphene::app::database_api::get_24_volume ( const string &  base,
const string &  quote 
) const

Returns the 24 hour volume for the market assetA:assetB.

Parameters
aString name of the first asset
bString name of the second asset
Returns
The market volume over the past 24 hours

Definition at line 1370 of file database_api.cpp.

◆ get_account_balances()

vector< asset > graphene::app::database_api::get_account_balances ( const std::string &  account_name_or_id,
const flat_set< asset_id_type > &  assets 
) const

Get an account's balances in various assets.

Parameters
account_name_or_idID or name of the account to get balances for
assetsIDs of the assets to get balances of; if empty, get all assets account has a balance in
Returns
Balances of the account

Definition at line 944 of file database_api.cpp.

◆ get_account_by_name()

optional< account_object > graphene::app::database_api::get_account_by_name ( string  name) const

Definition at line 851 of file database_api.cpp.

◆ get_account_count()

uint64_t graphene::app::database_api::get_account_count ( ) const

Get the total number of accounts registered with the blockchain.

Definition at line 928 of file database_api.cpp.

◆ get_account_id_from_string()

account_id_type graphene::app::database_api::get_account_id_from_string ( const std::string &  name_or_id) const

Get account object from a name or ID.

Parameters
account_name_or_idID or name of the accounts
Returns
Account ID

Definition at line 638 of file database_api.cpp.

◆ get_account_limit_orders()

vector< limit_order_object > graphene::app::database_api::get_account_limit_orders ( const string &  account_name_or_id,
const string &  base,
const string &  quote,
uint32_t  limit = 101,
optional< limit_order_id_type ostart_id = optional<limit_order_id_type>(),
optional< price ostart_price = optional<price>() 
)

Fetch all orders relevant to the specified account and specified market, result orders are sorted descendingly by price.

Parameters
account_name_or_idThe name or ID of an account to retrieve
baseBase asset
quoteQuote asset
limitThe limitation of items each query can fetch, not greater than 101
start_idStart order id, fetch orders which price lower than this order, or price equal to this order but order ID greater than this order
start_priceFetch orders with price lower than or equal to this price
Returns
List of orders from account_name_or_id to the corresponding account
Note
  1. if account_name_or_id cannot be tied to an account, empty result will be returned
  2. start_id and start_price can be empty, if so the api will return the "first page" of orders; if start_id is specified, its price will be used to do page query preferentially, otherwise the start_price will be used; start_id and start_price may be used cooperatively in case of the order specified by start_id was just canceled accidentally, in such case, the result orders' price may lower or equal to start_price, but orders' id greater than start_id

Definition at line 666 of file database_api.cpp.

◆ get_account_references()

vector< account_id_type > graphene::app::database_api::get_account_references ( const std::string  account_id_or_name) const
Returns
all accounts that referr to the key or account id in their owner or active authorities.

Definition at line 865 of file database_api.cpp.

◆ get_accounts()

vector< optional< account_object > > graphene::app::database_api::get_accounts ( const vector< std::string > &  account_names_or_ids) const

Get a list of accounts by ID.

Parameters
account_names_or_idsIDs or names of the accounts to retrieve
Returns
The accounts corresponding to the provided IDs

This function has semantics identical to get_objects

Definition at line 643 of file database_api.cpp.

◆ get_all_workers()

vector< worker_object > graphene::app::database_api::get_all_workers ( ) const

Get all workers.

Returns
All the workers

Definition at line 1820 of file database_api.cpp.

◆ get_asset_count()

uint64_t graphene::app::database_api::get_asset_count ( ) const

Get assets count.

Returns
The assets count

Definition at line 1095 of file database_api.cpp.

◆ get_assets()

vector< optional< asset_object > > graphene::app::database_api::get_assets ( const vector< asset_id_type > &  asset_ids) const

Get a list of assets by ID.

Parameters
asset_idsIDs of the assets to retrieve
Returns
The assets corresponding to the provided IDs

This function has semantics identical to get_objects

Definition at line 1052 of file database_api.cpp.

◆ get_balance_objects()

vector< balance_object > graphene::app::database_api::get_balance_objects ( const vector< address > &  addrs) const
Returns
all unclaimed balance objects for a set of addresses

Definition at line 978 of file database_api.cpp.

◆ get_blinded_balances()

vector< blinded_balance_object > graphene::app::database_api::get_blinded_balances ( const flat_set< commitment_type > &  commitments) const
Returns
the set of blinded balance objects by commitment ID

Definition at line 2213 of file database_api.cpp.

◆ get_block()

optional< signed_block > graphene::app::database_api::get_block ( uint32_t  block_num) const

Retrieve a full, signed block.

Parameters
block_numHeight of the block to be returned
Returns
the referenced block, or null if no matching block was found

Definition at line 447 of file database_api.cpp.

◆ get_block_header()

optional< block_header > graphene::app::database_api::get_block_header ( uint32_t  block_num) const

Retrieve a block header.

Parameters
block_numHeight of the block whose header should be returned
Returns
header of the referenced block, or null if no matching block was found

Definition at line 420 of file database_api.cpp.

◆ get_block_header_batch()

map< uint32_t, optional< block_header > > graphene::app::database_api::get_block_header_batch ( const vector< uint32_t >  block_nums) const

Retrieve multiple block header by block numbers.

Parameters
block_numvector containing heights of the block whose header should be returned
Returns
array of headers of the referenced blocks, or null if no matching block was found

Definition at line 432 of file database_api.cpp.

◆ get_call_orders()

vector< call_order_object > graphene::app::database_api::get_call_orders ( asset_id_type  a,
uint32_t  limit 
) const

Get call orders in a given asset.

Parameters
aID of asset being called
limitMaximum number of orders to retrieve
Returns
The call orders, ordered from earliest to be called to latest

Definition at line 1171 of file database_api.cpp.

◆ get_chain_id()

chain_id_type graphene::app::database_api::get_chain_id ( ) const

Get the chain ID.

Definition at line 515 of file database_api.cpp.

◆ get_chain_properties()

chain_property_object graphene::app::database_api::get_chain_properties ( ) const

Retrieve the chain_property_object associated with the chain.

Definition at line 485 of file database_api.cpp.

◆ get_collateral_bids()

vector< collateral_bid_object > graphene::app::database_api::get_collateral_bids ( const asset_id_type  asset,
uint32_t  limit,
uint32_t  start 
) const

Get collateral_bid_objects for a given asset.

Parameters
aID of asset
limitMaximum number of objects to retrieve
startskip that many results
Returns
The settle orders, ordered from earliest settlement date to latest

Definition at line 1238 of file database_api.cpp.

◆ get_committee_count()

uint64_t graphene::app::database_api::get_committee_count ( ) const

Get the total number of committee registered with the blockchain.

Definition at line 1803 of file database_api.cpp.

◆ get_committee_member_by_account()

fc::optional< committee_member_object > graphene::app::database_api::get_committee_member_by_account ( const std::string  account_id_or_name) const

Get the committee_member owned by a given account.

Parameters
accountThe ID or name of the account whose committee_member should be retrieved
Returns
The committee_member object, or null if the account does not have a committee_member

Definition at line 1760 of file database_api.cpp.

◆ get_committee_members()

vector< optional< committee_member_object > > graphene::app::database_api::get_committee_members ( const vector< committee_member_id_type > &  committee_member_ids) const

Get a list of committee_members by ID.

Parameters
committee_member_idsIDs of the committee_members to retrieve
Returns
The committee_members corresponding to the provided IDs

This function has semantics identical to get_objects

Definition at line 1743 of file database_api.cpp.

◆ get_config()

fc::variant_object graphene::app::database_api::get_config ( ) const

Retrieve compile-time constants.

Definition at line 505 of file database_api.cpp.

◆ get_dynamic_global_properties()

dynamic_global_property_object graphene::app::database_api::get_dynamic_global_properties ( ) const

Retrieve the current dynamic_global_property_object.

Definition at line 525 of file database_api.cpp.

◆ get_full_accounts()

std::map< string, full_account > graphene::app::database_api::get_full_accounts ( const vector< string > &  names_or_ids,
bool  subscribe 
)

Fetch all objects relevant to the specified accounts and subscribe to updates.

Parameters
callbackFunction to call with updates
names_or_idsEach item must be the name or ID of an account to retrieve
Returns
Map of string from names_or_ids to the corresponding account

This function fetches all relevant objects for the given accounts, and subscribes to updates to the given accounts. If any of the strings in names_or_ids cannot be tied to an account, that input will be ignored. All other accounts will be retrieved and subscribed.

Definition at line 752 of file database_api.cpp.

◆ get_global_properties()

global_property_object graphene::app::database_api::get_global_properties ( ) const

Retrieve the current global_property_object.

Definition at line 495 of file database_api.cpp.

◆ get_key_references()

vector< vector< account_id_type > > graphene::app::database_api::get_key_references ( vector< public_key_type key) const

Definition at line 541 of file database_api.cpp.

◆ get_limit_orders()

vector< limit_order_object > graphene::app::database_api::get_limit_orders ( asset_id_type  a,
asset_id_type  b,
uint32_t  limit 
) const

Get limit orders in a given market.

Parameters
aID of asset being sold
bID of asset being purchased
limitMaximum number of orders to retrieve
Returns
The limit orders, ordered from least price to greatest

Definition at line 1134 of file database_api.cpp.

◆ get_margin_positions()

vector< call_order_object > graphene::app::database_api::get_margin_positions ( const std::string  account_id_or_name) const
Returns
all open margin positions for a given account id or name.

Definition at line 1214 of file database_api.cpp.

◆ get_named_account_balances()

vector< asset > graphene::app::database_api::get_named_account_balances ( const std::string &  name,
const flat_set< asset_id_type > &  assets 
) const

Semantically equivalent to get_account_balances, but takes a name instead of an ID.

Definition at line 973 of file database_api.cpp.

◆ get_objects()

fc::variants graphene::app::database_api::get_objects ( const vector< object_id_type > &  ids) const

Get the objects corresponding to the provided IDs.

Parameters
idsIDs of the objects to retrieve
Returns
The objects retrieved, in the order they are mentioned in ids

If any of the provided IDs does not map to an object, a null variant is returned in its position.

Definition at line 320 of file database_api.cpp.

◆ get_order_book()

order_book graphene::app::database_api::get_order_book ( const string &  base,
const string &  quote,
unsigned  limit = 50 
) const

Returns the order book for the market base:quote.

Parameters
baseString name of the first asset
quoteString name of the second asset
depthof the order book. Up to depth of each asks and bids, capped at 50. Prioritizes most moderate of each
Returns
Order book of the market

Definition at line 1389 of file database_api.cpp.

◆ get_potential_address_signatures()

set< address > graphene::app::database_api::get_potential_address_signatures ( const signed_transaction trx) const

Definition at line 1987 of file database_api.cpp.

◆ get_potential_signatures()

set< public_key_type > graphene::app::database_api::get_potential_signatures ( const signed_transaction trx) const

This method will return the set of all public keys that could possibly sign for a given transaction. This call can be used by wallets to filter their set of public keys to just the relevant subset prior to calling get_required_signatures to get the minimum subset.

Definition at line 1983 of file database_api.cpp.

◆ get_proposed_transactions()

vector< proposal_object > graphene::app::database_api::get_proposed_transactions ( const std::string  account_id_or_name) const
Returns
the set of proposed transactions relevant to the specified account id.

Definition at line 2183 of file database_api.cpp.

◆ get_recent_transaction_by_id()

optional< signed_transaction > graphene::app::database_api::get_recent_transaction_by_id ( const transaction_id_type id) const

If the transaction has not expired, this method will return the transaction for the given ID or it will return NULL if it is not known. Just because it is not known does not mean it wasn't included in the blockchain.

Definition at line 462 of file database_api.cpp.

◆ get_required_fees()

vector< fc::variant > graphene::app::database_api::get_required_fees ( const vector< operation > &  ops,
asset_id_type  id 
) const

For each operation calculate the required fee in the specified asset type. If the asset type does not have a valid core_exchange_rate

Definition at line 2094 of file database_api.cpp.

◆ get_required_signatures()

set< public_key_type > graphene::app::database_api::get_required_signatures ( const signed_transaction trx,
const flat_set< public_key_type > &  available_keys 
) const

This API will take a partially signed transaction and a set of public keys that the owner has the ability to sign for and return the minimal subset of public keys that should add signatures to the transaction.

Definition at line 1968 of file database_api.cpp.

◆ get_settle_orders()

vector< force_settlement_object > graphene::app::database_api::get_settle_orders ( asset_id_type  a,
uint32_t  limit 
) const

Get forced settlement orders in a given asset.

Parameters
aID of asset being settled
limitMaximum number of orders to retrieve
Returns
The settle orders, ordered from earliest settlement date to latest

Definition at line 1193 of file database_api.cpp.

◆ get_ticker()

market_ticker graphene::app::database_api::get_ticker ( const string &  base,
const string &  quote 
) const

Returns the ticker for the market assetA:assetB.

Parameters
aString name of the first asset
bString name of the second asset
Returns
The market ticker for the past 24 hours.

Definition at line 1298 of file database_api.cpp.

◆ get_top_markets()

vector< market_volume > graphene::app::database_api::get_top_markets ( uint32_t  limit) const

Returns vector of 24 hour volume markets sorted by reverse base_volume Note: this API is experimental and subject to change in next releases.

Parameters
limitMax number of results
Returns
Desc Sorted volume vector

Definition at line 1434 of file database_api.cpp.

◆ get_trade_history()

vector< market_trade > graphene::app::database_api::get_trade_history ( const string &  base,
const string &  quote,
fc::time_point_sec  start,
fc::time_point_sec  stop,
unsigned  limit = 100 
) const

Returns recent trades for the market base:quote, ordered by time, most recent first. Note: Currently, timezone offsets are not supported. The time must be UTC. The range is [stop, start). In case when there are more than 100 trades occurred in the same second, this API only returns the first 100 records, can use another API get_trade_history_by_sequence to query for the rest.

Parameters
basesymbol or ID of the base asset
quotesymbol or ID of the quote asset
startStart time as a UNIX timestamp, the latest trade to retrieve
stopStop time as a UNIX timestamp, the earliest trade to retrieve
limitNumber of trasactions to retrieve, capped at 100.
Returns
Recent transactions in the market

Definition at line 1467 of file database_api.cpp.

◆ get_trade_history_by_sequence()

vector< market_trade > graphene::app::database_api::get_trade_history_by_sequence ( const string &  base,
const string &  quote,
int64_t  start,
fc::time_point_sec  stop,
unsigned  limit = 100 
) const

Returns trades for the market base:quote, ordered by time, most recent first. Note: Currently, timezone offsets are not supported. The time must be UTC. The range is [stop, start).

Parameters
basesymbol or ID of the base asset
quotesymbol or ID of the quote asset
startStart sequence as an Integer, the latest trade to retrieve
stopStop time as a UNIX timestamp, the earliest trade to retrieve
limitNumber of trasactions to retrieve, capped at 100
Returns
Transactions in the market

Definition at line 1556 of file database_api.cpp.

◆ get_transaction()

processed_transaction graphene::app::database_api::get_transaction ( uint32_t  block_num,
uint32_t  trx_in_block 
) const

used to fetch an individual transaction.

Definition at line 457 of file database_api.cpp.

◆ get_transaction_hex()

std::string graphene::app::database_api::get_transaction_hex ( const signed_transaction trx) const

Get a hexdump of the serialized binary form of a transaction.

Definition at line 1946 of file database_api.cpp.

◆ get_transaction_hex_without_sig()

std::string graphene::app::database_api::get_transaction_hex_without_sig ( const signed_transaction trx) const

Get a hexdump of the serialized binary form of a signatures-stripped transaction.

Definition at line 1956 of file database_api.cpp.

◆ get_vested_balances()

vector< asset > graphene::app::database_api::get_vested_balances ( const vector< balance_id_type > &  objs) const

Definition at line 1007 of file database_api.cpp.

◆ get_vesting_balances()

vector< vesting_balance_object > graphene::app::database_api::get_vesting_balances ( const std::string  account_id_or_name) const

Definition at line 1025 of file database_api.cpp.

◆ get_withdraw_permissions_by_giver()

vector< withdraw_permission_object > graphene::app::database_api::get_withdraw_permissions_by_giver ( const std::string  account_id_or_name,
withdraw_permission_id_type  start,
uint32_t  limit 
) const

Get non expired withdraw permission objects for a giver(ex:recurring customer)

Parameters
accountAccount ID or name to get objects from
startWithdraw permission objects(1.12.X) before this ID will be skipped in results. Pagination purposes.
limitMaximum number of objects to retrieve
Returns
Withdraw permission objects for the account

Definition at line 2238 of file database_api.cpp.

◆ get_withdraw_permissions_by_recipient()

vector< withdraw_permission_object > graphene::app::database_api::get_withdraw_permissions_by_recipient ( const std::string  account_id_or_name,
withdraw_permission_id_type  start,
uint32_t  limit 
) const

Get non expired withdraw permission objects for a recipient(ex:service provider)

Parameters
accountAccount ID or name to get objects from
startWithdraw permission objects(1.12.X) before this ID will be skipped in results. Pagination purposes.
limitMaximum number of objects to retrieve
Returns
Withdraw permission objects for the account

Definition at line 2260 of file database_api.cpp.

◆ get_witness_by_account()

fc::optional< witness_object > graphene::app::database_api::get_witness_by_account ( const std::string  account_id_or_name) const

Get the witness owned by a given account.

Parameters
account_id_or_nameThe ID of the account whose witness should be retrieved
Returns
The witness object, or null if the account does not have a witness

Definition at line 1684 of file database_api.cpp.

◆ get_witness_count()

uint64_t graphene::app::database_api::get_witness_count ( ) const

Get the total number of witnesses registered with the blockchain.

Definition at line 1727 of file database_api.cpp.

◆ get_witnesses()

vector< optional< witness_object > > graphene::app::database_api::get_witnesses ( const vector< witness_id_type > &  witness_ids) const

Get a list of witnesses by ID.

Parameters
witness_idsIDs of the witnesses to retrieve
Returns
The witnesses corresponding to the provided IDs

This function has semantics identical to get_objects

Definition at line 1667 of file database_api.cpp.

◆ get_worker_count()

uint64_t graphene::app::database_api::get_worker_count ( ) const

Get the total number of workers registered with the blockchain.

Definition at line 1855 of file database_api.cpp.

◆ get_workers_by_account()

vector< optional< worker_object > > graphene::app::database_api::get_workers_by_account ( const std::string  account_id_or_name) const

Get the workers owned by a given account.

Parameters
account_id_or_nameThe ID or name of the account whose worker should be retrieved
Returns
The worker object, or null if the account does not have a worker

Definition at line 1836 of file database_api.cpp.

◆ is_public_key_registered()

bool graphene::app::database_api::is_public_key_registered ( string  public_key) const

Determine whether a textual representation of a public key (in Base-58 format) is currently linked to any registered (i.e. non-stealth) account on the blockchain

Parameters
public_keyPublic key
Returns
Whether a public key is known

Definition at line 603 of file database_api.cpp.

◆ list_assets()

vector< asset_object > graphene::app::database_api::list_assets ( const string &  lower_bound_symbol,
uint32_t  limit 
) const

Get assets alphabetically by symbol name.

Parameters
lower_bound_symbolLower bound of symbol names to retrieve
limitMaximum number of assets to fetch (must not exceed 101)
Returns
The assets found

Definition at line 1072 of file database_api.cpp.

◆ lookup_account_names()

vector< optional< account_object > > graphene::app::database_api::lookup_account_names ( const vector< string > &  account_names) const

Get a list of accounts by name.

Parameters
account_namesNames of the accounts to retrieve
Returns
The accounts holding the provided names

This function has semantics identical to get_objects

Definition at line 887 of file database_api.cpp.

◆ lookup_accounts()

map< string, account_id_type > graphene::app::database_api::lookup_accounts ( const string &  lower_bound_name,
uint32_t  limit 
) const

Get names and IDs for registered accounts.

Parameters
lower_bound_nameLower bound of the first name to return
limitMaximum number of results to return – must not exceed 1000
Returns
Map of account names to corresponding IDs

Definition at line 905 of file database_api.cpp.

◆ lookup_asset_symbols()

vector< optional< asset_object > > graphene::app::database_api::lookup_asset_symbols ( const vector< string > &  symbols_or_ids) const

Get a list of assets by symbol.

Parameters
asset_symbolsSymbols or stringified IDs of the assets to retrieve
Returns
The assets corresponding to the provided symbols or IDs

This function has semantics identical to get_objects

Definition at line 1105 of file database_api.cpp.

◆ lookup_committee_member_accounts()

map< string, committee_member_id_type > graphene::app::database_api::lookup_committee_member_accounts ( const string &  lower_bound_name,
uint32_t  limit 
) const

Get names and IDs for registered committee_members.

Parameters
lower_bound_nameLower bound of the first name to return
limitMaximum number of results to return – must not exceed 1000
Returns
Map of committee_member names to corresponding IDs

Definition at line 1775 of file database_api.cpp.

◆ lookup_vote_ids()

vector< variant > graphene::app::database_api::lookup_vote_ids ( const vector< vote_id_type > &  votes) const

Given a set of votes, return the objects they are voting for.

This will be a mixture of committee_member_object, witness_objects, and worker_objects

The results will be in the same order as the votes. Null will be returned for any vote ids that are not found.

Definition at line 1873 of file database_api.cpp.

◆ lookup_witness_accounts()

map< string, witness_id_type > graphene::app::database_api::lookup_witness_accounts ( const string &  lower_bound_name,
uint32_t  limit 
) const

Get names and IDs for registered witnesses.

Parameters
lower_bound_nameLower bound of the first name to return
limitMaximum number of results to return – must not exceed 1000
Returns
Map of witness names to corresponding IDs

Definition at line 1699 of file database_api.cpp.

◆ set_block_applied_callback()

void graphene::app::database_api::set_block_applied_callback ( std::function< void(const variant &block_id)>  cb)

Register a callback handle which will get notified when a block is pushed to database.

Parameters
cbThe callback handle to register

Definition at line 385 of file database_api.cpp.

◆ set_pending_transaction_callback()

void graphene::app::database_api::set_pending_transaction_callback ( std::function< void(const variant &signed_transaction_object)>  cb)

Register a callback handle which will get notified when a transaction is pushed to database.

Parameters
cbThe callback handle to register

Note: a transaction can be pushed to database and be popped from database several times while processing, before and after included in a block. Everytime when a push is done, the client will be notified.

Definition at line 375 of file database_api.cpp.

◆ set_subscribe_callback()

void graphene::app::database_api::set_subscribe_callback ( std::function< void(const variant &)>  cb,
bool  notify_remove_create 
)

Register a callback handle which then can be used to subscribe to object database changes.

Parameters
cbThe callback handle to register
nofity_remove_createWhether subscribe to universal object creation and removal events. If this is set to true, the API server will notify all newly created objects and ID of all newly removed objects to the client, no matter whether client subscribed to the objects. By default, API servers don't allow subscribing to universal events, which can be changed on server startup.

Definition at line 356 of file database_api.cpp.

◆ subscribe_to_market()

void graphene::app::database_api::subscribe_to_market ( std::function< void(const variant &)>  callback,
asset_id_type  a,
asset_id_type  b 
)

Request notification when the active orders in the market between two assets changes.

Parameters
callbackCallback method which is called when the market changes
aFirst asset ID
bSecond asset ID

Callback will be passed a variant containing a vector<pair<operation, operation_result>>. The vector will contain, in order, the operations which changed the market, and their results.

Definition at line 1264 of file database_api.cpp.

◆ unsubscribe_from_market()

void graphene::app::database_api::unsubscribe_from_market ( asset_id_type  a,
asset_id_type  b 
)

Unsubscribe from updates to a given market.

Parameters
aFirst asset ID
bSecond asset ID

Definition at line 1276 of file database_api.cpp.

◆ validate_transaction()

processed_transaction graphene::app::database_api::validate_transaction ( const signed_transaction trx) const

Validates a transaction against the current state without broadcasting it on the network.

Definition at line 2084 of file database_api.cpp.

◆ verify_account_authority()

bool graphene::app::database_api::verify_account_authority ( const string &  account_name_or_id,
const flat_set< public_key_type > &  signers 
) const
Returns
true if the signers have enough authority to authorize an account

Definition at line 2066 of file database_api.cpp.

◆ verify_authority()

bool graphene::app::database_api::verify_authority ( const signed_transaction trx) const
Returns
true of the trx has all of the required signatures, otherwise throws an exception

Definition at line 2052 of file database_api.cpp.


The documentation for this class was generated from the following files: