Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge develop to hardfork #1577

Merged
merged 144 commits into from
Feb 14, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
144 commits
Select commit Hold shift + click to select a range
78a6fa5
refactor get_assets to accept id or name
oxarbitrage Aug 22, 2018
8a5fae4
change argument name
oxarbitrage Aug 22, 2018
90bd426
keep get_assets with vector of ids for internal use
oxarbitrage Aug 22, 2018
ee0a8ce
refactor get_limit_orders to accept asset symbol or id
oxarbitrage Aug 23, 2018
80a5624
apply some changes from @abit review
oxarbitrage Aug 23, 2018
482f72c
add const to new reference arguments
oxarbitrage Aug 23, 2018
b1d6a97
get_call_orders asset symbol or id support
oxarbitrage Aug 30, 2018
82c4fb1
get_settle_orders asset symbol or id support
oxarbitrage Aug 30, 2018
fc6cec0
get_collateral_bids asset symbol or id support
oxarbitrage Aug 30, 2018
ce849a4
subscribe_to_market and unsubscribe_from_market asset symbol or id s…
oxarbitrage Aug 30, 2018
9e0fa4f
get_requiered_fees asset symbol or id support
oxarbitrage Aug 30, 2018
6d274b3
Ported network mapper from old bitshares
pmconrad Mar 28, 2016
0e412c5
Adapted to lastest fc, ported parallel execution from muse
pmconrad Sep 6, 2018
5f699b4
Fix: waiting for a promise with a timeout can lead to the promise err…
pmconrad Oct 31, 2018
0abcff9
Allow required plugins
nathanielhourt Nov 7, 2018
b5362ce
Clean up plugin loader
nathanielhourt Nov 8, 2018
3e683ed
Merge commit 'refs/pull/1427/head' of https://github.com/bitshares/bi…
oxarbitrage Nov 14, 2018
f5031bd
move plugins option to witness_node executable
oxarbitrage Nov 15, 2018
adef6a2
fix cli wallet test
oxarbitrage Nov 15, 2018
9647ad1
remove double space line
oxarbitrage Nov 15, 2018
ce35a79
add default plugin values to option
oxarbitrage Nov 17, 2018
58ad814
remove not needed check
oxarbitrage Nov 18, 2018
7089d2a
fix delayed node
oxarbitrage Nov 30, 2018
1dd719f
use auto load plugins in delayed node
oxarbitrage Dec 5, 2018
a8020a7
reverse delayed node and only add auto to needed plugins
oxarbitrage Dec 17, 2018
1326a5c
make plugins option work in delayed
oxarbitrage Dec 17, 2018
53d3538
create test
jmjatlanta Dec 25, 2018
20a2f62
catching exception if history_object no longer in memory
jmjatlanta Dec 25, 2018
3503768
limit subscribed accounts to 100
jmjatlanta Dec 27, 2018
08e4ea9
Add ilog message when plugin starts
jmjatlanta Dec 28, 2018
bbd6773
Reduce warning messages, constructor still throws
jmjatlanta Dec 28, 2018
f52636d
Squelch memaccess and parentheses warnings
jmjatlanta Dec 28, 2018
d4231ad
fixed comparison warnings
jmjatlanta Dec 28, 2018
bea4a5d
revert accidental change
jmjatlanta Dec 28, 2018
3284797
Fixed linker error
pmconrad Dec 30, 2018
8bce57a
Merge pull request #1502 from bitshares/jmj_1459
jmjatlanta Dec 31, 2018
71821e3
Merge pull request #1505 from pmconrad/linker_fix
pmconrad Dec 31, 2018
ebc8603
use find instead of try/catch
jmjatlanta Dec 31, 2018
143ee6f
Merge pull request #1494 from bitshares/jmj_1490
jmjatlanta Dec 31, 2018
c6474f9
Do not subscribe to associated accounts
jmjatlanta Jan 1, 2019
667e44a
Revert adding compile switches -Wno-???
jmjatlanta Jan 1, 2019
1588275
Reduce warning messages, constructor still throws
jmjatlanta Dec 28, 2018
c97988b
Squelch memaccess and parentheses warnings
jmjatlanta Dec 28, 2018
52b0fe3
fixed comparison warnings
jmjatlanta Dec 28, 2018
33d6d99
revert accidental change
jmjatlanta Dec 28, 2018
d3c2b57
Revert adding compile switches -Wno-???
jmjatlanta Jan 1, 2019
004708d
fix merge conflict
jmjatlanta Jan 1, 2019
a978805
prevent throw in destructor
jmjatlanta Jan 2, 2019
14f71f2
removed boost signals (no longer used)
jmjatlanta Jan 4, 2019
4907f56
Merge pull request #1514 from bitshares/jmj_1512
jmjatlanta Jan 6, 2019
e338fdb
refactor template instantiation
jmjatlanta Jan 7, 2019
07bedf7
switch variable from size_t to uint64_t
jmjatlanta Jan 7, 2019
53feeff
Reject get_key_references with > 100 keys
jmjatlanta Jan 7, 2019
87dcfa1
Remove use of skip_fork_db flag
jmjatlanta Jan 7, 2019
7fa01fb
change seq. counter 'next' used by db indexes to uint64_t
jmjatlanta Jan 7, 2019
fc2ab66
Merge pull request #1499 from bitshares/jmj_1472
jmjatlanta Jan 7, 2019
329cb41
Merge branch 'jmj_1504' of ssh://github.com/bitshares/bitshares-core …
jmjatlanta Jan 8, 2019
0e6b07e
added template specialization for mac release builds
jmjatlanta Jan 8, 2019
b4bd649
Make sure price_to_string works and throws as it should
jmjatlanta Jan 8, 2019
834e476
Separate throws from edge cases that should work
jmjatlanta Jan 11, 2019
aae2b4c
Merge pull request #1518 from bitshares/jmj_1186
jmjatlanta Jan 14, 2019
e9f0312
Fix comment typo
jmjatlanta Jan 14, 2019
60e8a8d
shut down without calling exit
jmjatlanta Jan 14, 2019
7c3968b
prevent segfault when destructing application obj
jmjatlanta Jan 14, 2019
0229957
Added human-readable message to assert
jmjatlanta Jan 14, 2019
28875e1
fixed long lines
jmjatlanta Jan 14, 2019
596d7e9
Merge pull request #1531 from bitshares/jmj_1018
jmjatlanta Jan 14, 2019
3b0891a
keep return value
jmjatlanta Jan 15, 2019
7462d39
Fix typo
jmjatlanta Jan 15, 2019
d2bf27e
Merge pull request #1527 from bitshares/jmj_1313
jmjatlanta Jan 15, 2019
a590c25
remove useless check
oxarbitrage Jan 16, 2019
caf7f7f
add default value to trusted-node
oxarbitrage Jan 16, 2019
bac55a4
Merge branch 'develop' into pull1427_2
oxarbitrage Jan 16, 2019
6e11c31
Remove gui_version file which is no longer used
abitmore Jan 16, 2019
241e605
Remove old testnet files
abitmore Jan 16, 2019
8e41bdd
Merge pull request #1533 from bitshares/cleanup
pmconrad Jan 17, 2019
e198552
remove default option in delayed plugin
oxarbitrage Jan 17, 2019
540a536
add readme to libraries and programs
oxarbitrage Jan 18, 2019
46e248e
Remove create-genesis-json
jmjatlanta Jan 18, 2019
e49c049
Removed comment
jmjatlanta Jan 18, 2019
9fc8983
Removed comment
jmjatlanta Jan 18, 2019
bbcbed0
Merge pull request #1437 from oxarbitrage/pull1427_2
oxarbitrage Jan 20, 2019
f2acea8
add utilities, net libraries, change app description
oxarbitrage Jan 21, 2019
1bad92a
resolve conflict
jmjatlanta Jan 21, 2019
4f079fa
remove category column
oxarbitrage Jan 22, 2019
f3da528
change some descriptions in libraries
oxarbitrage Jan 22, 2019
8624fad
change some descriptions in programs
oxarbitrage Jan 22, 2019
a4588a6
add subprograms
oxarbitrage Jan 22, 2019
6669fb9
Merge pull request #1529 from bitshares/jmj_1110
jmjatlanta Jan 22, 2019
41bff6e
add egenesis library description
oxarbitrage Jan 24, 2019
10f5282
Fix CMake Doxygen Perl reference
jmjatlanta Jan 24, 2019
f2a0b4d
Merge pull request #1511 from bitshares/jmj_1246b
jmjatlanta Jan 24, 2019
accc381
catch exception in destructor
jmjatlanta Jan 24, 2019
a26dc47
fix warnings in test
jmjatlanta Jan 24, 2019
fa0e647
Merge pull request #1510 from bitshares/jmj_1246
jmjatlanta Jan 25, 2019
cf2682f
add es-objects-start-es-after-block option
oxarbitrage Jan 25, 2019
063221c
Merge pull request #1539 from bitshares/jmj_1418
oxarbitrage Jan 25, 2019
bc48dae
change cat-parts from old to active
oxarbitrage Jan 25, 2019
0dff411
Merge pull request #1534 from oxarbitrage/issue1532
oxarbitrage Jan 25, 2019
95b4aa6
Rename API param operation_id to operation_type
abitmore Jan 26, 2019
893607f
Merge pull request #1544 from bitshares/op-type
oxarbitrage Jan 27, 2019
aa469bc
remove special case 0 for start after block in both ES plugins
oxarbitrage Jan 27, 2019
db640be
Merge branch 'develop' into issue1051
oxarbitrage Jan 29, 2019
8aa3ebd
Try to make docker build work again
pmconrad Jan 29, 2019
16206f9
Remove unused boost::serialization dependency
pmconrad Jan 29, 2019
b579a54
Implement API changes
jmjatlanta Jan 29, 2019
4c0062c
Try to avoid travis timeouts better
pmconrad Jan 29, 2019
f7212d7
Try to resolve "Bad substitution" error
pmconrad Jan 30, 2019
a4211b6
Removed unused boost-locale dependency
pmconrad Jan 30, 2019
f5cd910
Only install required boost packages, not all - should remove locale …
pmconrad Jan 30, 2019
da0dba2
Build more stuff, run tests in parallel
pmconrad Jan 30, 2019
d589b5b
Minor Dockerfile improvements
pmconrad Jan 30, 2019
fb61b93
travis: switch to xenial build env
pmconrad Jan 30, 2019
ee18179
Merge pull request #1541 from oxarbitrage/es_objects_start_after_block
oxarbitrage Jan 30, 2019
dbd7eee
Modified build time expectations
pmconrad Jan 30, 2019
62db8bf
Bumped fc + removed unused boost libs from travis + docker
pmconrad Jan 30, 2019
708f017
Install libtool in docker build
pmconrad Jan 30, 2019
e1eb934
travis: adjust expected sonar time
pmconrad Jan 30, 2019
5503152
Merge pull request #1547 from bitshares/build_simplification
pmconrad Jan 31, 2019
052531b
refactor get_top_markets
oxarbitrage Jan 31, 2019
c0ac898
Moved impl to fee_schedule.hpp
jmjatlanta Feb 1, 2019
2efac1f
Merge pull request #4 from bitshares/oxarbitrage-issue1051
oxarbitrage Feb 1, 2019
04f20af
refactor for in-place construction
oxarbitrage Feb 1, 2019
18ac80a
rename name_or_id with symbol_or_id
oxarbitrage Feb 2, 2019
d256af6
expose get_asset_id_from_string
oxarbitrage Feb 2, 2019
9eab093
change asset id or name to asset id or symbol in descriptions of api.hpp
oxarbitrage Feb 3, 2019
a38b558
change some more docs
oxarbitrage Feb 4, 2019
21a4d76
Fixed crash on empty/invalid node pubkey
pmconrad Feb 4, 2019
5b4e51a
Merge pull request #1272 from oxarbitrage/issue1051
oxarbitrage Feb 4, 2019
f1e4480
Merge pull request #1516 from bitshares/jmj_1504
jmjatlanta Feb 5, 2019
82baee3
add network_mapper
oxarbitrage Feb 5, 2019
c539336
Merge pull request #1549 from oxarbitrage/issue842_2
oxarbitrage Feb 5, 2019
cd26cad
Merge pull request #1555 from pmconrad/network_mapper
oxarbitrage Feb 5, 2019
5cefa46
change status of network mapper
oxarbitrage Feb 5, 2019
f66c9a5
bump FC for std::min macOS
jmjatlanta Feb 5, 2019
487bdcc
Merge pull request #1559 from bitshares/oxarbitrage-patch-4
oxarbitrage Feb 5, 2019
c9b3751
Merge pull request #1561 from bitshares/jmj_1560
jmjatlanta Feb 5, 2019
d7ca28e
Merge pull request #1562 from bitshares/develop
oxarbitrage Feb 6, 2019
8047742
Merge 'develop' into develop-to-hardfork
abitmore Feb 12, 2019
50fd492
Reduce number of db queries in get_call_orders API
abitmore Feb 12, 2019
2d5eb6c
add default empty result to get_ticker
oxarbitrage Feb 12, 2019
359e199
Merge pull request #1579 from bitshares/oxarbitrage-patch-1
oxarbitrage Feb 12, 2019
8fea035
Merge pull request #1580 from bitshares/release
oxarbitrage Feb 12, 2019
bedc84a
Merge branch 'develop' into develop-to-hardfork
abitmore Feb 13, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 18 additions & 15 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,12 @@ cache: ccache
git:
depth: 1

dist: trusty
dist: xenial

sudo: true

install:
- echo "deb http://de.archive.ubuntu.com/ubuntu xenial main restricted universe multiverse" | sudo tee -a /etc/apt/sources.list
- sudo apt-get update
- sudo apt-get install --allow-unauthenticated g++ libboost-all-dev cmake libreadline-dev libssl-dev autoconf parallel ccache
- sudo apt-get install --allow-unauthenticated libboost-thread-dev libboost-iostreams-dev libboost-date-time-dev libboost-system-dev libboost-filesystem-dev libboost-program-options-dev libboost-chrono-dev libboost-test-dev libboost-context-dev libboost-regex-dev libboost-coroutine-dev cmake parallel

addons:
sonarcloud:
Expand All @@ -27,16 +25,21 @@ env:
- CCACHE_SLOPPINESS=include_file_ctime,include_file_mtime,time_macros

script:
- 'echo $((`date +%s` - 120)) >_start_time'
- programs/build_helpers/buildstep -s 3500
- ccache -s
- '( [ `ccache -s | grep "files in cache" | cut -c 20-` = 0 ] && touch _empty_cache ) || true'
- sed -i '/tests/d' libraries/fc/CMakeLists.txt
- cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_FLAGS=--coverage -DCMAKE_CXX_FLAGS=--coverage -DBoost_USE_STATIC_LIBS=OFF -DCMAKE_CXX_OUTPUT_EXTENSION_REPLACE=ON .
- 'which build-wrapper-linux-x86-64 && build-wrapper-linux-x86-64 --out-dir bw-output make -j 2 cli_wallet witness_node chain_test cli_test || make -j 2 cli_wallet witness_node chain_test cli_test'
- programs/build_helpers/buildstep Prepare 1 "sed -i '/tests/d' libraries/fc/CMakeLists.txt"
- programs/build_helpers/buildstep cmake 5 "cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_FLAGS=--coverage -DCMAKE_CXX_FLAGS=--coverage -DBoost_USE_STATIC_LIBS=OFF -DCMAKE_CXX_OUTPUT_EXTENSION_REPLACE=ON ."
- programs/build_helpers/buildstep make.cli_wallet 1600 "programs/build_helpers/make_with_sonar bw-output -j 2 cli_wallet"
- programs/build_helpers/buildstep make.witness_node 300 "programs/build_helpers/make_with_sonar bw-output -j 2 witness_node"
- programs/build_helpers/buildstep make.serializer 45 "programs/build_helpers/make_with_sonar bw-output -j 2 js_operation_serializer"
- programs/build_helpers/buildstep make.get_dev_key 10 "programs/build_helpers/make_with_sonar bw-output -j 2 get_dev_key"
- programs/build_helpers/buildstep make.chain_test 900 "programs/build_helpers/make_with_sonar bw-output -j 2 chain_test"
- programs/build_helpers/buildstep make.cli_test 200 "programs/build_helpers/make_with_sonar bw-output -j 2 cli_test"
- programs/build_helpers/buildstep make.perf_test 120 "programs/build_helpers/make_with_sonar bw-output -j 2 performance_test"
- set -o pipefail
- '[ $((`date +%s` - `cat _start_time`)) -gt $((42 * 60)) ] && touch _empty_cache || true'
- '[ -r _empty_cache ] || tests/chain_test 2>&1 | cat'
- '[ -r _empty_cache ] || tests/cli_test 2>&1 | cat'
- 'find libraries/[acdenptuw]*/CMakeFiles/*.dir programs/[cdgjsw]*/CMakeFiles/*.dir -type d | while read d; do gcov -o "$d" "${d/CMakeFiles*.dir//}"/*.cpp; done >/dev/null'
- '[ -r _empty_cache ] || ( which sonar-scanner && sonar-scanner || true )'
- '[ ! -r _empty_cache ] || ( echo "WARNING! Skipped some tests due to compile time! Please restart with populated cache." && false )'
- programs/build_helpers/buildstep run.chain_test 240 "libraries/fc/tests/run-parallel-tests.sh tests/chain_test"
- programs/build_helpers/buildstep run.cli_test 30 "libraries/fc/tests/run-parallel-tests.sh tests/cli_test"
- programs/build_helpers/buildstep prepare.sonar 20 'find libraries/[acdenptuw]*/CMakeFiles/*.dir programs/[cdgjsw]*/CMakeFiles/*.dir -type d | while read d; do gcov -o "$d" "${d/CMakeFiles*.dir//}"/*.cpp; done >/dev/null'
- programs/build_helpers/buildstep run.sonar 400 "which sonar-scanner && sonar-scanner || true"
- programs/build_helpers/buildstep end 0
- ccache -s
5 changes: 1 addition & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,9 @@ LIST(APPEND BOOST_COMPONENTS thread
system
filesystem
program_options
signals
serialization
chrono
unit_test_framework
context
locale)
context)
SET( Boost_USE_STATIC_LIBS ON CACHE STRING "ON or OFF" )

IF( WIN32 )
Expand Down
22 changes: 16 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,25 @@ RUN \
cmake \
git \
libbz2-dev \
libreadline-dev \
libboost-all-dev \
libcurl4-openssl-dev \
libssl-dev \
libncurses-dev \
libboost-thread-dev \
libboost-iostreams-dev \
libboost-date-time-dev \
libboost-system-dev \
libboost-filesystem-dev \
libboost-program-options-dev \
libboost-chrono-dev \
libboost-test-dev \
libboost-context-dev \
libboost-regex-dev \
libboost-coroutine-dev \
libtool \
doxygen \
ca-certificates \
fish \
&& \
apt-get update -y && \
apt-get install -y fish && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

Expand All @@ -38,9 +47,10 @@ RUN \
git submodule update --init --recursive && \
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DGRAPHENE_DISABLE_UNITY_BUILD=ON \
. && \
make witness_node cli_wallet && \
install -s programs/witness_node/witness_node programs/cli_wallet/cli_wallet /usr/local/bin && \
make witness_node cli_wallet get_dev_key && \
install -s programs/witness_node/witness_node programs/genesis_util/get_dev_key programs/cli_wallet/cli_wallet /usr/local/bin && \
#
# Obtain version
mkdir /etc/bitshares && \
Expand Down
1 change: 0 additions & 1 deletion gui_version

This file was deleted.

20 changes: 20 additions & 0 deletions libraries/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# BitShares Libraries

The libraries are the core of the project and defines everything where applications can build on top.

A **graphene** blockchain software will use the `app` library to define what the application will do, what services it will offer. The blockchain is defined by the `chain` library and include all the objects, types, operations, protocols that builds current consensus blockchain. The lowest level in memory database of Bitshares is developed at the `db` library. The `fc` is a helper module broadly used in the libraries code, `egenesis` will help with the genesis file, `plugins` will be loaded optionally to the application. Wallet software like the cli_wallet will benefit from the `wallet` library.

Code in libraries is the most important part of **bitshares-core** project and it is maintained by the Bitshares Core Team and contributors.
# Available Libraries

Folder | Name | Description | Status
---|---|---|---
[app](app) | Application | Bundles component libraries (chain, network, plugins) into a useful application. Also provides API access. | Active
[chain](chain) | Blockchain | Defines all objects, operations and types. This include the consensus protocol, defines the whole blockchain behaviour. | Active
[db](db) | Database | Defines the internal database graphene uses. | Active
[egenesis](egenesis) | Genesis | Hardcodes the `genesis.json` file into the `witness_node` executable.| Active
[fc](fc) | Fast-compiling C++ library | https://github.com/bitshares/bitshares-fc | Active
[net](net) | Network | The graphene p2p layer. | Active
[plugins](plugins) | Plugins | Collection of singleton designed modules used for extending the bitshares-core. | Active
[utilities](utilities) | Utilities | Common utility calls used in applications or other libraries. | Active
[wallet](wallet) | Wallet | Wallet definition for the `cli_wallet` software. | Active
44 changes: 28 additions & 16 deletions libraries/app/api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
#include <graphene/chain/worker_object.hpp>

#include <fc/crypto/hex.hpp>
#include <fc/smart_ref_impl.hpp>
#include <fc/thread/future.hpp>

namespace graphene { namespace app {
Expand Down Expand Up @@ -101,7 +100,7 @@ namespace graphene { namespace app {
}
else if( api_name == "asset_api" )
{
_asset_api = std::make_shared< asset_api >( std::ref( *_app.chain_database() ) );
_asset_api = std::make_shared< asset_api >( _app );
}
else if( api_name == "orders_api" )
{
Expand Down Expand Up @@ -284,10 +283,12 @@ namespace graphene { namespace app {
return *_debug_api;
}

vector<order_history_object> history_api::get_fill_order_history( asset_id_type a, asset_id_type b, uint32_t limit )const
vector<order_history_object> history_api::get_fill_order_history( std::string asset_a, std::string asset_b, uint32_t limit )const
{
FC_ASSERT(_app.chain_database());
const auto& db = *_app.chain_database();
asset_id_type a = database_api.get_asset_id_from_string( asset_a );
asset_id_type b = database_api.get_asset_id_from_string( asset_b );
if( a > b ) std::swap(a,b);
const auto& history_idx = db.get_index_type<graphene::market_history::history_index>().indices().get<by_key>();
history_key hkey;
Expand Down Expand Up @@ -345,7 +346,7 @@ namespace graphene { namespace app {
}

vector<operation_history_object> history_api::get_account_history_operations( const std::string account_id_or_name,
int operation_id,
int operation_type,
operation_history_id_type start,
operation_history_id_type stop,
unsigned limit) const
Expand All @@ -368,17 +369,17 @@ namespace graphene { namespace app {
{
if( node->operation_id.instance.value <= start.instance.value ) {

if(node->operation_id(db).op.which() == operation_id)
if(node->operation_id(db).op.which() == operation_type)
result.push_back( node->operation_id(db) );
}
}
if( node->next == account_transaction_history_id_type() )
node = nullptr;
else node = &node->next(db);
}
if( stop.instance.value == 0 && result.size() < limit ) {
const account_transaction_history_object head = account_transaction_history_id_type()(db);
if( head.account == account && head.operation_id(db).op.which() == operation_id )
result.push_back(head.operation_id(db));
auto head = db.find(account_transaction_history_id_type());
if (head != nullptr && head->account == account && head->operation_id(db).op.which() == operation_type)
result.push_back(head->operation_id(db));
}
return result;
}
Expand Down Expand Up @@ -443,11 +444,13 @@ namespace graphene { namespace app {
return result;
}

vector<bucket_object> history_api::get_market_history( asset_id_type a, asset_id_type b,
vector<bucket_object> history_api::get_market_history( std::string asset_a, std::string asset_b,
uint32_t bucket_seconds, fc::time_point_sec start, fc::time_point_sec end )const
{ try {
FC_ASSERT(_app.chain_database());
const auto& db = *_app.chain_database();
asset_id_type a = database_api.get_asset_id_from_string( asset_a );
asset_id_type b = database_api.get_asset_id_from_string( asset_b );
vector<bucket_object> result;
result.reserve(200);

Expand All @@ -467,7 +470,7 @@ namespace graphene { namespace app {
++itr;
}
return result;
} FC_CAPTURE_AND_RETHROW( (a)(b)(bucket_seconds)(start)(end) ) }
} FC_CAPTURE_AND_RETHROW( (asset_a)(asset_b)(bucket_seconds)(start)(end) ) }

crypto_api::crypto_api(){};

Expand Down Expand Up @@ -526,12 +529,17 @@ namespace graphene { namespace app {
}

// asset_api
asset_api::asset_api(graphene::chain::database& db) : _db(db) { }
asset_api::asset_api(graphene::app::application& app) :
_db( *app.chain_database()),
database_api( std::ref(*app.chain_database()), &(app.get_options())
) { }
asset_api::~asset_api() { }

vector<account_asset_balance> asset_api::get_asset_holders( asset_id_type asset_id, uint32_t start, uint32_t limit ) const {
vector<account_asset_balance> asset_api::get_asset_holders( std::string asset, uint32_t start, uint32_t limit ) const {
FC_ASSERT(limit <= 100);

asset_id_type asset_id = database_api.get_asset_id_from_string( asset );

const auto& bal_idx = _db.get_index_type< account_balance_index >().indices().get< by_asset_balance >();
auto range = bal_idx.equal_range( boost::make_tuple( asset_id ) );

Expand Down Expand Up @@ -562,9 +570,10 @@ namespace graphene { namespace app {
return result;
}
// get number of asset holders.
int asset_api::get_asset_holders_count( asset_id_type asset_id ) const {
int asset_api::get_asset_holders_count( std::string asset ) const {

const auto& bal_idx = _db.get_index_type< account_balance_index >().indices().get< by_asset_balance >();
asset_id_type asset_id = database_api.get_asset_id_from_string( asset );
auto range = bal_idx.equal_range( boost::make_tuple( asset_id ) );

int count = boost::distance(range) - 1;
Expand Down Expand Up @@ -607,8 +616,8 @@ namespace graphene { namespace app {
return plugin->tracked_groups();
}

vector< limit_order_group > orders_api::get_grouped_limit_orders( asset_id_type base_asset_id,
asset_id_type quote_asset_id,
vector< limit_order_group > orders_api::get_grouped_limit_orders( std::string base_asset,
std::string quote_asset,
uint16_t group,
optional<price> start,
uint32_t limit )const
Expand All @@ -619,6 +628,9 @@ namespace graphene { namespace app {
const auto& limit_groups = plugin->limit_order_groups();
vector< limit_order_group > result;

asset_id_type base_asset_id = database_api.get_asset_id_from_string( base_asset );
asset_id_type quote_asset_id = database_api.get_asset_id_from_string( quote_asset );

price max_price = price::max( base_asset_id, quote_asset_id );
price min_price = price::min( base_asset_id, quote_asset_id );
if( start.valid() && !start->is_null() )
Expand Down
Loading