Skip to content

Commit

Permalink
fix: dont crash if contractName api fails
Browse files Browse the repository at this point in the history
  • Loading branch information
sirpy committed Nov 5, 2024
1 parent 92b14d7 commit 8394e4f
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/lib/userStorage/FeedStorage.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { retry } from '../utils/async'
import Config from '../../config/config'
import logger from '../../lib/logger/js-logger'
import { fireEvent, REWARD_RECEIVED } from '../analytics/analytics'
import API from '../../lib/API'
import { type UserStorage } from './UserStorageClass'
import { FeedCategories } from './FeedCategory'
import type { FeedFilter } from './UserStorage'
Expand Down Expand Up @@ -554,7 +553,6 @@ export class FeedStorage {

async getCounterParty(feedEvent) {
const addressField = getEventDirection(feedEvent)
const chainId = feedEvent.chainId ?? this.wallet.networkId

log.debug('getCounterParty:', feedEvent.data.receiptEvent, feedEvent.id, feedEvent.txType)

Expand All @@ -569,7 +567,10 @@ export class FeedStorage {
const isBridgeOrBuy = [TxType.TX_BRIDGE_IN, TxType.TX_BRIDGE_OUT, TxType.TX_BUYGD].includes(feedEvent.txType)

if (isContract !== '0x' && !isBridgeOrBuy) {
feedEvent.data.counterPartyFullName = await API.getContractName(address, chainId)
feedEvent.data.counterPartyFullName = await this.wallet.getContractName(address).catch(e => {
log.error('getCounterParty: getContractName failed', e.message, e)
return 'Unknown Contract'
})
}

let profile = await this._readProfileCache(address)
Expand Down

0 comments on commit 8394e4f

Please sign in to comment.