Skip to content

Commit

Permalink
Simplify tokenAddress()
Browse files Browse the repository at this point in the history
  • Loading branch information
gabmontes committed Apr 16, 2024
1 parent 76c2943 commit 2be1b6d
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions packages/erc-20-lib/src/token-address.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,9 @@

const { findTokenBySymbol } = require('token-list')

// TODO remove the default chain id from here
const tokenAddress = function (symbol, chainId = 1) {
const token =
findTokenBySymbol(symbol, chainId) ||
findTokenBySymbol(symbol.toLowerCase(), chainId)
return token && token.address
const tokenAddress = function (symbol, chainId) {
const token = findTokenBySymbol(symbol, chainId)
return token?.address
}

module.exports = tokenAddress

0 comments on commit 2be1b6d

Please sign in to comment.