Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Enable extended_asset to be encoded from array #7487

Merged
merged 1 commit into from
Aug 8, 2019
Merged
Changes from all commits
Commits
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
14 changes: 14 additions & 0 deletions libraries/chain/include/eosio/chain/asset.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,5 +114,19 @@ inline void from_variant(const fc::variant& var, eosio::chain::asset& vo) {
}
}

namespace fc {
inline void from_variant(const fc::variant& var, eosio::chain::extended_asset& vo) {
if( var.is_array() ) {
const auto& va = var.get_array();
from_variant(va.at(0), vo.quantity);
from_variant(va.at(1), vo.contract);
} else {
const auto& vars = var.get_object();
from_variant(vars["quantity"], vo.quantity);
from_variant(vars["contract"], vo.contract);
}
}
}

FC_REFLECT(eosio::chain::asset, (amount)(sym))
FC_REFLECT(eosio::chain::extended_asset, (quantity)(contract) )