MCPcopy Create free account
hub / github.com/cryptonomex/graphene / getAssetImpl

Method getAssetImpl

programs/light_client/ChainDataModel.cpp:161–189  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

159}
160
161void 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
191void ChainDataModel::getAccountImpl(QString accountIdentifier, Account* const * accountInContainer)
192{

Callers

nothing calls this directly

Calls 5

lookup_asset_symbolsMethod · 0.80
eraseMethod · 0.80
sizeMethod · 0.45
modifyMethod · 0.45
instanceMethod · 0.45

Tested by

no test coverage detected