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

refactor get_assets to accept id or name #1272

Merged
merged 18 commits into from
Feb 4, 2019

Conversation

oxarbitrage
Copy link
Member

pull request to start the work in #1051

the first commit refactor get_assets api call to accept name or id on the arguments.

i need you guys to take a look so i can continue in this way for all the calls if i can get a green light here.

this follow the same idea of what we did for all account api calls at: #989

libraries/app/database_api.cpp Outdated Show resolved Hide resolved
optional<asset_object> find_asset(asset_id_type id)const
{
auto rec = _remote_db->get_assets({id}).front();
auto rec = _remote_db->get_assets({asset_id_to_string(id)}).front();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks ugly as well.

Perhaps better to add another get_assets_by_id() API?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why didn't change find_asset(asset_id_type id) to find(string)? Is it an function that only used internally?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Anyway, I think cli_wallet is less important, it's fine to have some ugly code and slightly reduced performance.

libraries/app/database_api.cpp Outdated Show resolved Hide resolved
@abitmore
Copy link
Member

Good job. Thanks.

libraries/app/database_api.cpp Outdated Show resolved Hide resolved
libraries/app/database_api.cpp Outdated Show resolved Hide resolved
libraries/app/database_api.cpp Show resolved Hide resolved
libraries/app/database_api.cpp Outdated Show resolved Hide resolved
libraries/app/database_api.cpp Outdated Show resolved Hide resolved
@oxarbitrage
Copy link
Member Author

I exposed get_asset_id_from_string as we did before withget_account_id_from_string in this commit: d256af6

I think it can be of use and wont hurt to have them available for API users.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants