Skip to content

Commit

Permalink
fix: only return valid address names
Browse files Browse the repository at this point in the history
  • Loading branch information
thepiwo authored and kenodressel committed Mar 22, 2023
1 parent 908a36a commit fa88567
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions modules/cache/logic/cacheLogic.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const axios = require('axios');
const requireESM = require('esm')(module);
// use to handle es6 import/export
const { decodeEvents, SOPHIA_TYPES } = requireESM('@aeternity/aepp-sdk/es/contract/aci/transformation');
const { Crypto } = require('@aeternity/aepp-sdk');
const aeternity = require('../../aeternity/logic/aeternity');
const cache = require('../utils/cache');
const queueLogic = require('../../queue/logic/queueLogic');
Expand Down Expand Up @@ -245,10 +246,12 @@ const CacheLogic = {
const chainNames = await CacheLogic.fetchMdwChainNames();

return Object.entries(chainNames).reduce(((acc, [pubkey, names]) => {
const profile = profiles.find(p => p.author === pubkey);
const preferredChainName = profile ? profile.preferredChainName : null;
if (Crypto.isAddressValid(pubkey)) {
const profile = profiles.find(p => p.author === pubkey);
const preferredChainName = profile ? profile.preferredChainName : null;

acc[pubkey] = preferredChainName || names[0];
acc[pubkey] = preferredChainName || names[0];
}
return acc;
}), {});
}, cache.shortCacheTime);
Expand Down

0 comments on commit fa88567

Please sign in to comment.