Merge branch 'feature/marketplace' into feature/nft_market_rbac
This commit is contained in:
commit
ea1473a260
2 changed files with 50 additions and 2 deletions
|
|
@ -203,6 +203,8 @@ class database_api_impl : public std::enable_shared_from_this<database_api_impl>
|
|||
uint64_t nft_get_total_supply(const nft_metadata_id_type nft_metadata_id) const;
|
||||
nft_object nft_token_by_index(const nft_metadata_id_type nft_metadata_id, const uint64_t token_idx) const;
|
||||
nft_object nft_token_of_owner_by_index(const nft_metadata_id_type nft_metadata_id, const account_id_type owner, const uint64_t token_idx) const;
|
||||
vector<nft_object> nft_get_all_tokens() const;
|
||||
vector<nft_object> nft_get_tokens_by_owner(const account_id_type owner) const;
|
||||
|
||||
// Marketplace
|
||||
vector<offer_object> list_offers(const offer_id_type lower_id, uint32_t limit) const;
|
||||
|
|
@ -2558,6 +2560,37 @@ nft_object database_api_impl::nft_token_of_owner_by_index(const nft_metadata_id_
|
|||
return {};
|
||||
}
|
||||
|
||||
vector<nft_object> database_api::nft_get_all_tokens() const
|
||||
{
|
||||
return my->nft_get_all_tokens();
|
||||
}
|
||||
|
||||
vector<nft_object> database_api_impl::nft_get_all_tokens() const
|
||||
{
|
||||
const auto &idx_nft = _db.get_index_type<nft_index>().indices().get<by_id>();
|
||||
vector<nft_object> result;
|
||||
for (auto itr = idx_nft.begin(); itr != idx_nft.end(); ++itr) {
|
||||
result.push_back(*itr);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
vector<nft_object> database_api::nft_get_tokens_by_owner(const account_id_type owner) const
|
||||
{
|
||||
return my->nft_get_tokens_by_owner(owner);
|
||||
}
|
||||
|
||||
vector<nft_object> database_api_impl::nft_get_tokens_by_owner(const account_id_type owner) const
|
||||
{
|
||||
const auto &idx_nft = _db.get_index_type<nft_index>().indices().get<by_owner>();
|
||||
auto idx_nft_range = idx_nft.equal_range(owner);
|
||||
vector<nft_object> result;
|
||||
for (auto itr = idx_nft_range.first; itr != idx_nft_range.second; ++itr) {
|
||||
result.push_back(*itr);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
vector<custom_account_authority_object> database_api::get_custom_account_authorities(const account_id_type account) const
|
||||
{
|
||||
return my->get_custom_account_authorities(account);
|
||||
|
|
|
|||
|
|
@ -796,14 +796,27 @@ class database_api
|
|||
nft_object nft_token_by_index(const nft_metadata_id_type nft_metadata_id, const uint64_t token_idx) const;
|
||||
|
||||
/**
|
||||
* @brief Returns NFT URI
|
||||
* @brief Returns NFT by owner and index
|
||||
* @param nft_metadata_id NFT metadata ID
|
||||
* @param owner NFT owner
|
||||
* @param token_idx NFT index in the list of tokens
|
||||
* @return NFT URI
|
||||
* @return NFT object
|
||||
*/
|
||||
nft_object nft_token_of_owner_by_index(const nft_metadata_id_type nft_metadata_id, const account_id_type owner, const uint64_t token_idx) const;
|
||||
|
||||
/**
|
||||
* @brief Returns list of all available NTF's
|
||||
* @return List of all available NFT's
|
||||
*/
|
||||
vector<nft_object> nft_get_all_tokens() const;
|
||||
|
||||
/**
|
||||
* @brief Returns NFT's owned by owner
|
||||
* @param owner NFT owner
|
||||
* @return List of NFT owned by owner
|
||||
*/
|
||||
vector<nft_object> nft_get_tokens_by_owner(const account_id_type owner) const;
|
||||
|
||||
//////////////////
|
||||
// MARKET PLACE //
|
||||
//////////////////
|
||||
|
|
@ -973,6 +986,8 @@ FC_API(graphene::app::database_api,
|
|||
(nft_get_total_supply)
|
||||
(nft_token_by_index)
|
||||
(nft_token_of_owner_by_index)
|
||||
(nft_get_all_tokens)
|
||||
(nft_get_tokens_by_owner)
|
||||
|
||||
// Marketplace
|
||||
(list_offers)
|
||||
|
|
|
|||
Loading…
Reference in a new issue