Skip to content

Commit

Permalink
Add square icons to Relay Chain
Browse files Browse the repository at this point in the history
  • Loading branch information
ted-palmer committed May 20, 2024
1 parent f3b31c1 commit 2fc7a5b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
2 changes: 2 additions & 0 deletions packages/sdk/src/types/RelayChain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ export type RelayChain = {
icon?: {
dark?: string
light?: string
squaredDark?: string
squaredLight?: string
}
currency?: {
id?: string
Expand Down
13 changes: 9 additions & 4 deletions packages/sdk/src/utils/chain.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type { Chain } from 'viem'
import type { RelayChain, paths } from '../types/index.js'
import * as viemChains from 'viem/chains'
import { ASSETS_RELAY_API } from '../constants/servers.js'

type RelayAPIChain = Required<
NonNullable<
Expand Down Expand Up @@ -56,8 +57,10 @@ export const configureViemChain = (
...chain,
viemChain,
icon: {
dark: `https://assets.relay.link/icons/${chain.id}/dark.png`,
light: `https://assets.relay.link/icons/${chain.id}/light.png`,
dark: `${ASSETS_RELAY_API}/icons/${chain.id}/dark.png`,
light: `${ASSETS_RELAY_API}/icons/${chain.id}/light.png`,
squaredDark: `${ASSETS_RELAY_API}/icons/square/${chain.id}/dark.png`,
squaredLight: `${ASSETS_RELAY_API}/icons/square/${chain.id}/light.png`,
},
}
}
Expand All @@ -76,8 +79,10 @@ export const convertViemChainToRelayChain = (chain: Chain): RelayChain => {
? chain.rpcUrls.default.webSocket[0] ?? ''
: '',
icon: {
dark: `https://assets.relay.link/icons/${chain.id}/dark.png`,
light: `https://assets.relay.link/icons/${chain.id}/light.png`,
dark: `${ASSETS_RELAY_API}/icons/${chain.id}/dark.png`,
light: `${ASSETS_RELAY_API}/icons/${chain.id}/light.png`,
squaredDark: `${ASSETS_RELAY_API}/icons/square/${chain.id}/dark.png`,
squaredLight: `${ASSETS_RELAY_API}/icons/square/${chain.id}/light.png`,
},
currency: chain.nativeCurrency,
explorerUrl: chain.blockExplorers?.default.url ?? '',
Expand Down

0 comments on commit 2fc7a5b

Please sign in to comment.