Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/cowprotocol/cowswap into de…
Browse files Browse the repository at this point in the history
…velop
  • Loading branch information
shoom3301 committed Oct 18, 2023
2 parents 5ed0800 + 878afbb commit 7810c75
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 2 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# Changelog

## [1.48.5](https://github.com/cowprotocol/cowswap/compare/v1.48.4...v1.48.5) (2023-10-18)


### Features

* deploy to IPFS ([#3237](https://github.com/cowprotocol/cowswap/issues/3237)) ([e69af4d](https://github.com/cowprotocol/cowswap/commit/e69af4d7140e384180c98b4c5175b341a2e9a542))


### Bug Fixes

* display token logos from CoW Protocol correctly ([#3244](https://github.com/cowprotocol/cowswap/issues/3244)) ([caaf980](https://github.com/cowprotocol/cowswap/commit/caaf9800da89e1df21cdffe2afc4eaa98260d0c3))

## [1.48.4](https://github.com/cowprotocol/cowswap/compare/v1.48.3...v1.48.4) (2023-10-18)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,29 @@ function getTokenLogoURI(address: string, chainId: SupportedChainId = SupportedC

const currencyLogoCache = new Map<string, Array<string>>()

const COW_PROTOCOL_REPO = 'cowprotocol/token-lists'
function getLogoURI(currency: Currency | null): string | null {
if (!currency) return null

const logoURI = (currency as Currency & { logoURI: string }).logoURI

if (!logoURI) return null

// Always lowercase logo URI if it's from CoW Protocol repo
// Because CoW Protocol repo has all logos in lowercase
if (logoURI.includes(COW_PROTOCOL_REPO)) return logoURI.toLowerCase()

return logoURI
}

// TODO: must be refactored
export default function useCurrencyLogoURIs(currency?: Currency | null): string[] {
const currencyAddress = currency ? (currency.isNative ? NATIVE_CURRENCY_BUY_ADDRESS : currency.address) : null
// There is a modification of Token in useDetectNativeToken()
const externalLogo = useProxyTokenLogo(currency?.chainId, currencyAddress)
const cacheKey = `${currencyAddress}|${currency?.chainId}`
const cached = currencyLogoCache.get(cacheKey)
const logoURI = currency ? (currency as Currency & { logoURI: string }).logoURI : null
const logoURI = getLogoURI(currency || null)
const imageOverride = currency?.isToken ? ADDRESS_IMAGE_OVERRIDE[currency.address] : null

if (cached) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cowswap",
"version": "1.48.4",
"version": "1.48.5",
"description": "CoW Swap",
"main": "index.js",
"author": "",
Expand Down

0 comments on commit 7810c75

Please sign in to comment.