Skip to content

Commit 23e1d1d

Browse files
feat: [sc-12048] 🧶 [frontend] Make bundle smaller (#2911)
Co-authored-by: Jakub Swierczek <jakub.swierczek@outlook.com>
1 parent 413f2ef commit 23e1d1d

File tree

894 files changed

+16073
-35099
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

894 files changed

+16073
-35099
lines changed

‎.codesandbox/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
FROM node:16.20.0
1+
FROM node:18.12

‎.github/workflows/build.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
- uses: actions/checkout@v3
1919
- uses: actions/setup-node@v3
2020
with:
21-
node-version: 16
21+
node-version: 18.12
2222
- uses: actions/cache@v3
2323
id: yarn-cache
2424
with:
@@ -41,7 +41,7 @@ jobs:
4141
- uses: actions/checkout@v3
4242
- uses: actions/setup-node@v3
4343
with:
44-
node-version: 16
44+
node-version: 18.12
4545
- uses: actions/cache@v3
4646
id: yarn-cache
4747
with:
@@ -64,7 +64,7 @@ jobs:
6464
- uses: actions/checkout@v3
6565
- uses: actions/setup-node@v3
6666
with:
67-
node-version: 16
67+
node-version: 18.12
6868
- uses: actions/cache@v3
6969
id: yarn-cache
7070
with:
@@ -90,7 +90,7 @@ jobs:
9090
- uses: actions/checkout@v3
9191
- uses: actions/setup-node@v3
9292
with:
93-
node-version: 16
93+
node-version: 18.12
9494
- uses: actions/cache@v3
9595
id: yarn-cache
9696
with:

‎.github/workflows/dev-cache.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
- uses: actions/checkout@v3
1414
- uses: actions/setup-node@v3
1515
with:
16-
node-version: 16
16+
node-version: 18.12
1717
- uses: actions/cache@v3
1818
id: yarn-cache
1919
with:

‎.github/workflows/release.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
fetch-depth: 0
3333
- uses: actions/setup-node@v3
3434
with:
35-
node-version: 16
35+
node-version: 18.12
3636
- name: 'Determine Release Type'
3737
run: |
3838
if ${{ contains(github.event.inputs.release_type, 'major') }}; then

‎.nvmrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
16.20.0
1+
18.12

‎Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM node:16.20.0
1+
FROM node:18.12
22

33
EXPOSE 3000
44

‎blockchain/TokenConfig.ts

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import type { IconProps } from 'components/Icon.types'
12
import type { ElementOf } from 'ts-essentials'
23

34
export const COIN_TAGS = ['stablecoin', 'lp-token'] as const
@@ -9,14 +10,12 @@ export interface TokenConfig {
910
digits: number
1011
maxSell?: string
1112
name: string
12-
icon: string
13-
iconCircle: string
13+
icon: IconProps['icon']
14+
iconCircle: IconProps['icon']
1415
coinpaprikaTicker?: string
1516
coinpaprikaFallbackTicker?: string
1617
tags: CoinTag[]
1718
color: string
18-
bannerIcon: string
19-
bannerGif: string
2019
token0?: string
2120
token1?: string
2221
coinbaseTicker?: string

‎blockchain/calls/proxyActions/proxyActionsResolver.test.ts

-7
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,6 @@ import { proxyActionsAdapterResolver$ } from './proxyActionsAdapterResolver'
66

77
describe('proxyActionsAdapterResolver', () => {
88
describe('crate from ilk (open new vault)', () => {
9-
it('returns a cropjoin proxy actions for CRVV1ETHSTETH-A ilk', () => {
10-
const adapter$ = proxyActionsAdapterResolver$({ ilk: 'CRVV1ETHSTETH-A' })
11-
12-
const state = getStateUnpacker(adapter$)
13-
14-
expect(state().AdapterType).toBe(ProxyActionsAdapterType.CROPJOIN)
15-
})
169
it('returns default proxy actions for other ilks', () => {
1710
const adapter$ = proxyActionsAdapterResolver$({ ilk: 'ETH-A' })
1811

‎blockchain/contracts/arbitrum.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,7 @@ export const arbitrumContracts: MainnetContractsWithOptional = {
6767
arbitrum.maker.joins,
6868
supportedIlks.filter(
6969
// these are not supported on goerli
70-
(ilk) =>
71-
!['CRVV1ETHSTETH-A', 'GUNIV3DAIUSDC1-A', 'GUNIV3DAIUSDC2-A', 'GNO-A'].includes(ilk),
70+
(ilk) => !['GUNIV3DAIUSDC1-A', 'GUNIV3DAIUSDC2-A', 'GNO-A'].includes(ilk),
7271
),
7372
),
7473
},

‎blockchain/contracts/goerli.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,7 @@ export const goerliContracts: MainnetContractsWithOptional = {
7272
goerli.maker.joins,
7373
supportedIlks.filter(
7474
// these are not supported on goerli
75-
(ilk) =>
76-
!['CRVV1ETHSTETH-A', 'GUNIV3DAIUSDC1-A', 'GUNIV3DAIUSDC2-A', 'GNO-A'].includes(ilk),
75+
(ilk) => !['GUNIV3DAIUSDC1-A', 'GUNIV3DAIUSDC2-A', 'GNO-A'].includes(ilk),
7776
),
7877
),
7978
},

‎blockchain/contracts/optimism.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,7 @@ export const optimismContracts: OptimismContracts = {
7777
optimism.maker.joins,
7878
supportedIlks.filter(
7979
// these are not supported on goerli
80-
(ilk) =>
81-
!['CRVV1ETHSTETH-A', 'GUNIV3DAIUSDC1-A', 'GUNIV3DAIUSDC2-A', 'GNO-A'].includes(ilk),
80+
(ilk) => !['GUNIV3DAIUSDC1-A', 'GUNIV3DAIUSDC2-A', 'GNO-A'].includes(ilk),
8281
),
8382
),
8483
},

‎blockchain/ens.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ import type { Observable } from 'rxjs'
44
import { switchMap } from 'rxjs/operators'
55

66
import type { Context } from './network.types'
7-
import { getNetworkRpcEndpoint, NetworkIds } from './networks'
7+
import { NetworkIds } from './networks'
8+
import { getNetworkRpcEndpoint } from './networks/get-network-rpc-endpoint'
89

910
export function resolveENSName$(context$: Observable<Context>, address: string) {
1011
return context$.pipe(

‎blockchain/network.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ import Web3 from 'web3'
2323

2424
import { every5Seconds$ } from './network.constants'
2525
import type { Context, ContextConnected, EveryBlockFunction$ } from './network.types'
26-
import { getNetworkRpcEndpoint, NetworkIds, networksById } from './networks'
26+
import { NetworkIds, networksById } from './networks'
27+
import { getNetworkRpcEndpoint } from './networks/get-network-rpc-endpoint'
2728

2829
export function createContext$(
2930
web3ContextConnected$: Observable<Web3ContextConnected | Web3ContextConnectedReadonly>,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { forkSettings } from './forks-config'
2+
import { isForkSetForNetworkId } from './is-fork-set-for-network-id'
3+
import type { NetworkIds } from './network-ids'
4+
import { networksById } from './networks-config'
5+
6+
export function getNetworkRpcEndpoint(networkId: NetworkIds) {
7+
const isForkSet = isForkSetForNetworkId(networkId)
8+
if (!networksById[networkId]) {
9+
throw new Error('Invalid contract chain id provided or not implemented yet')
10+
}
11+
if (isForkSet) {
12+
const networkName = networksById[networkId].name
13+
return forkSettings[networkName]!.url
14+
}
15+
return networksById[networkId].rpcUrl
16+
}

‎blockchain/networks/get-rpc-provider.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { ethers } from 'ethers'
2-
import { getRpcNode } from 'pages/api/rpc'
2+
import { getRpcNode } from 'helpers/getRpcNode'
33

44
import { networkSetById } from './network-helpers'
55
import type { NetworkIds } from './network-ids'
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { forkSettings } from './forks-config'
2+
import type { NetworkIds } from './network-ids'
3+
import { networksById } from './networks-config'
4+
5+
export const isForkSetForNetworkId = (networkId: NetworkIds) => {
6+
const networkName = networksById[networkId]?.name
7+
return forkSettings[networkName] !== undefined
8+
}

‎blockchain/networks/network-helpers.ts

+1-17
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { keyBy } from 'lodash'
22
import { env } from 'process'
33

44
import { forkNetworks, forkSettings } from './forks-config'
5+
import { isForkSetForNetworkId } from './is-fork-set-for-network-id'
56
import type { NetworkIds } from './network-ids'
67
import type { NetworkConfig, NetworkConfigHexId } from './networks-config'
78
import { networks, networksById } from './networks-config'
@@ -37,11 +38,6 @@ export const isTestnetNetworkHexId = (networkHexId: NetworkConfigHexId) => {
3738
.includes(networkHexId)
3839
}
3940

40-
export const isForkSetForNetworkId = (networkId: NetworkIds) => {
41-
const networkName = networksById[networkId]?.name
42-
return forkSettings[networkName] !== undefined
43-
}
44-
4541
const networksWithForksAtTheBeginning: NetworkConfig[] = [...forkNetworks, ...networks]
4642

4743
const networksSet = networksWithForksAtTheBeginning.reduce((acc, network) => {
@@ -138,18 +134,6 @@ export const filterNetworksAccordingToSavedNetwork =
138134
return isTestnetNetworkHexId(customNetworkHexId) ? network.testnet : !network.testnet
139135
}
140136

141-
export function getNetworkRpcEndpoint(networkId: NetworkIds) {
142-
const isForkSet = isForkSetForNetworkId(networkId)
143-
if (!networksById[networkId]) {
144-
throw new Error('Invalid contract chain id provided or not implemented yet')
145-
}
146-
if (isForkSet) {
147-
const networkName = networksById[networkId].name
148-
return forkSettings[networkName]!.url
149-
}
150-
return networksById[networkId].rpcUrl
151-
}
152-
153137
export function getNetworkById(networkId: NetworkIds) {
154138
const base = networkSetById[networkId]
155139
if (!base) {

‎blockchain/readOnlyEnhancedProviderProxy.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { includes } from 'lodash'
55
import type { JsonRpcResponse } from 'web3-core-helpers'
66

77
import { JsonRpcBatchProvider } from './jsonRpcBatchProvider'
8-
import { getNetworkRpcEndpoint } from './networks'
8+
import { getNetworkRpcEndpoint } from './networks/get-network-rpc-endpoint'
99

1010
function fixChainId(chainId: string | number) {
1111
return Number(chainId).valueOf()

0 commit comments

Comments
 (0)