| 159 | } |
| 160 | |
| 161 | void ChainDataModel::getAssetImpl(QString assetIdentifier, Asset* const * assetInContainer) |
| 162 | { |
| 163 | try { |
| 164 | ilog("Fetching asset ${asset}", ("asset", assetIdentifier.toStdString())); |
| 165 | auto result = m_db_api->lookup_asset_symbols({assetIdentifier.toStdString()}); |
| 166 | |
| 167 | // Run in main thread |
| 168 | Q_EMIT queueExecute([this,result,assetInContainer](){ |
| 169 | ilog("Processing result ${r}", ("r", result)); |
| 170 | auto itr = m_assets.iterator_to(*assetInContainer); |
| 171 | |
| 172 | if (result.size() == 0 || !result.front()) { |
| 173 | (*itr)->deleteLater(); |
| 174 | m_assets.erase(itr); |
| 175 | } else { |
| 176 | m_assets.modify(itr, |
| 177 | [=](Asset* a){ |
| 178 | a->setProperty("symbol", QString::fromStdString(result.front()->symbol)); |
| 179 | a->setProperty("id", ObjectId(result.front()->id.instance())); |
| 180 | a->setProperty("precision", result.front()->precision); |
| 181 | }); |
| 182 | } |
| 183 | }); |
| 184 | } |
| 185 | catch ( const fc::exception& e ) |
| 186 | { |
| 187 | Q_EMIT exceptionThrown(QString::fromStdString(e.to_string())); |
| 188 | } |
| 189 | } |
| 190 | |
| 191 | void ChainDataModel::getAccountImpl(QString accountIdentifier, Account* const * accountInContainer) |
| 192 | { |
nothing calls this directly
no test coverage detected