Skip to content

Commit

Permalink
chore: reduce bundle size (#7897)
Browse files Browse the repository at this point in the history
  • Loading branch information
kaladinlight authored Oct 4, 2024
1 parent ba43c41 commit 69f963f
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 10 deletions.
3 changes: 3 additions & 0 deletions react-app-rewired/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ const reactAppRewireConfig = {
// we should probably align with whatever solution is chosen.)
_.merge(config, {
resolve: {
alias: {
'@ledgerhq/cryptoassets': false,
},
fallback: {
crypto: require.resolve('crypto-browserify'),
http: require.resolve('stream-http'),
Expand Down
4 changes: 3 additions & 1 deletion scripts/generateAssetData/coingecko.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import {
import type { Asset } from '@shapeshiftoss/types'
import axios from 'axios'

import { colorMap } from './../../src/lib/asset-service/service/colorMap'
import {
arbitrum,
arbitrumNova,
Expand All @@ -30,6 +29,9 @@ import {
polygon,
solana,
} from './baseAssets'
import colormap from './color-map.json'

export const colorMap: Record<string, string> = colormap

type Token = {
chainId: number
Expand Down
File renamed without changes.
4 changes: 3 additions & 1 deletion scripts/generateAssetData/cosmos/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ import { cosmosChainId } from '@shapeshiftoss/caip'
import type { Asset } from '@shapeshiftoss/types'
import axios from 'axios'

import { colorMap } from '../../../src/lib/asset-service/service/colorMap'
import { atom } from '../baseAssets'
import colormap from '../color-map.json'

export const colorMap: Record<string, string> = colormap

type CosmosAsset = {
denom: string
Expand Down
4 changes: 3 additions & 1 deletion scripts/generateAssetData/ethTokens/uniswap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ import { ethChainId as chainId, toAssetId } from '@shapeshiftoss/caip'
import type { Asset } from '@shapeshiftoss/types'
import axios from 'axios'

import { colorMap } from '../../../src/lib/asset-service/service/colorMap'
import colormap from '../color-map.json'

export const colorMap: Record<string, string> = colormap

type UniswapToken = {
chainId: number
Expand Down
2 changes: 1 addition & 1 deletion scripts/generateAssetData/generateColorMap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ const generateColorMap = async () => {

await fs.promises.writeFile(
// note: cwd is the root of the monorepo, *not* the script directory
'src/lib/asset-service/service/color-map.json',
'scripts/generateAssetData/color-map.json',
// beautify the file for github diff.
JSON.stringify(colorMap, null, 2),
)
Expand Down
4 changes: 0 additions & 4 deletions src/lib/asset-service/service/colorMap.ts

This file was deleted.

3 changes: 1 addition & 2 deletions src/lib/portals/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { getConfig } from 'config'
import qs from 'qs'
import { getAddress, isAddressEqual, zeroAddress } from 'viem'
import { queryClient } from 'context/QueryClientProvider/queryClient'
import { colorMap } from 'lib/asset-service/service/colorMap'

import generatedAssetData from '../../lib/asset-service/service/generatedAssetData.json'
import { CHAIN_ID_TO_PORTALS_NETWORK } from './constants'
Expand Down Expand Up @@ -230,7 +229,7 @@ export const portalTokenToAsset = ({

return {
...explorerData,
color: colorMap[assetId] ?? '#FFFFFF',
color: assets[assetId]?.color ?? '#FFFFFF',
// This looks weird but we need this - l.165 check above nulls the type safety of this object, so we cast it back
...(iconOrIcons as { icon: string } | { icons: string[]; icon: undefined }),
name,
Expand Down

0 comments on commit 69f963f

Please sign in to comment.