diff --git a/apps/main/next.config.js b/apps/main/next.config.js index 156c0c4e25..628be3349e 100644 --- a/apps/main/next.config.js +++ b/apps/main/next.config.js @@ -1,5 +1,6 @@ /** @type {import('next').NextConfig} */ const nextConfiguration = { + // reactStrictMode: false, // uncomment to disable React's Strict Mode when testing page load compiler: { styledComponents: true }, diff --git a/apps/main/package.json b/apps/main/package.json index 65b02e4e6e..649970610e 100644 --- a/apps/main/package.json +++ b/apps/main/package.json @@ -18,7 +18,7 @@ "analyze": "ANALYZE=true next build" }, "dependencies": { - "@curvefi/api": "2.66.30", + "@curvefi/api": "^2.67.1", "@curvefi/llamalend-api": "^1.0.21", "@ethersproject/abi": "^5.8.0", "@hookform/error-message": "^2.0.1", diff --git a/apps/main/src/app/.well-known/walletconnect.txt/route.ts b/apps/main/src/app/.well-known/walletconnect.txt/route.ts index 74feaf8eb0..ffa55e99ac 100644 --- a/apps/main/src/app/.well-known/walletconnect.txt/route.ts +++ b/apps/main/src/app/.well-known/walletconnect.txt/route.ts @@ -2,8 +2,8 @@ import { headers } from 'next/headers' const WALLET_CONNECT_ACCOUNT = `c3fe8dd8-93df-44af-803f-83798aa1d440` -// for curve-dapp-git-fix-wallet-connect-curvefi.vercel.app, other domains can be added the dashboard -const VERCEL_DOMAIN_VERIFICATION = 'a88005b9d67c9ec31773975c8bd861ef2583b1c3112dbc919b809efb79b003a8' +// for curve-dapp-git-chore-curve-js-curvefi.vercel.app, other domains can be added the dashboard +const VERCEL_DOMAIN_VERIFICATION = 'bfc9255d32decb58f8e2c39e798017ff0d28a7200471a67ff1000d08e1d8a045' // for curve.fi and staging.curve.fi const CURVE_FI_DOMAIN_VERIFICATION = '3d76b3cd8cd754f34ac1c18ff25dc23ee9b80fc7f75800041335263b11f20b19' // for curve.finance and staging.curve.finance diff --git a/apps/main/src/app/api/dex/[network]/route.ts b/apps/main/src/app/api/dex/[network]/route.ts index 77d90b9a71..b584435412 100644 --- a/apps/main/src/app/api/dex/[network]/route.ts +++ b/apps/main/src/app/api/dex/[network]/route.ts @@ -1,8 +1,8 @@ -import cloneDeep from 'lodash/cloneDeep' import { getAllNetworks } from '@/app/dex/[network]/pools.util' import { refreshDataInBackground } from '@/background' import { getPools } from '@/dex/lib/pools' import { CurveApi, NetworkConfig, PoolDataMapper, type ValueMapperCached } from '@/dex/types/main.types' +import { createCurve } from '@curvefi/api' import type { DexServerSideNetworkCache } from '../types' const DexServerSideCache: Record = {} @@ -39,7 +39,7 @@ const getVolumeCache = async (network: NetworkConfig, pools: PoolDataMapper) => * Unfortunately we cannot use an API as the pool names are generated in CurveJS */ const getServerSideCache = async (network: NetworkConfig) => { - const curveJS = cloneDeep((await import('@curvefi/api')).default) as CurveApi + const curveJS = createCurve() as CurveApi await curveJS.init('NoRPC', 'NoRPC', { chainId: network.chainId }) await Promise.all([ curveJS.factory.fetchPools(), diff --git a/apps/main/src/dao/lib/curvejs.ts b/apps/main/src/dao/lib/curvejs.ts index 0cbd668d6b..4112f88814 100644 --- a/apps/main/src/dao/lib/curvejs.ts +++ b/apps/main/src/dao/lib/curvejs.ts @@ -1,8 +1,8 @@ import type { Eip1193Provider } from 'ethers' -import cloneDeep from 'lodash/cloneDeep' import type { FormType as LockFormType } from '@/dao/components/PageVeCrv/types' import { CurveApi, ChainId, Provider, EstimatedGas, UsdRatesMapper, ClaimButtonsKey } from '@/dao/types/dao.types' import { getErrorMessage } from '@/dao/utils' +import { createCurve } from '@curvefi/api' import type { DateValue } from '@internationalized/date' import PromisePool from '@supercharge/promise-pool/dist' import { log } from '@ui-kit/lib' @@ -11,7 +11,7 @@ import { waitForTransaction, waitForTransactions } from '@ui-kit/lib/ethers' export const helpers = { initCurveJs: async (chainId: ChainId, provider?: Eip1193Provider) => { - const curveApi = cloneDeep((await import('@curvefi/api')).default) as CurveApi + const curveApi = createCurve() as CurveApi if (provider) { await curveApi.init('Web3', { network: { chainId }, externalProvider: provider }, { chainId }) } else { diff --git a/apps/main/src/dex/store/createPoolsSlice.ts b/apps/main/src/dex/store/createPoolsSlice.ts index 97ba03d839..fb5a292aa0 100644 --- a/apps/main/src/dex/store/createPoolsSlice.ts +++ b/apps/main/src/dex/store/createPoolsSlice.ts @@ -1,7 +1,6 @@ import produce from 'immer' import type { UTCTimestamp } from 'lightweight-charts' import chunk from 'lodash/chunk' -import cloneDeep from 'lodash/cloneDeep' import countBy from 'lodash/countBy' import groupBy from 'lodash/groupBy' import isNaN from 'lodash/isNaN' @@ -483,11 +482,13 @@ const createPoolsSlice = (set: SetState, get: GetState): PoolsSlic const tokens = curvejsApi.pool.poolTokens(poolData.pool, isWrapped) const tokenAddresses = curvejsApi.pool.poolTokenAddresses(poolData.pool, isWrapped) - const cPoolData = cloneDeep(poolData) - cPoolData.isWrapped = isWrapped - cPoolData.tokens = tokens - cPoolData.tokensCountBy = countBy(tokens) - cPoolData.tokenAddresses = tokenAddresses + const cPoolData = { + ...poolData, + isWrapped, + tokens, + tokensCountBy: countBy(tokens), + tokenAddresses, + } set( produce((state) => { diff --git a/apps/main/src/dex/utils/utilsCurvejs.ts b/apps/main/src/dex/utils/utilsCurvejs.ts index 9cfb26992b..0554aa6249 100644 --- a/apps/main/src/dex/utils/utilsCurvejs.ts +++ b/apps/main/src/dex/utils/utilsCurvejs.ts @@ -1,10 +1,10 @@ import type { Eip1193Provider } from 'ethers' -import cloneDeep from 'lodash/cloneDeep' import { CurveApi, ChainId, RewardsApy } from '@/dex/types/main.types' +import { createCurve } from '@curvefi/api' import { FORMAT_OPTIONS, formatNumber } from '@ui/utils' export async function initCurveJs(chainId: ChainId, provider?: Eip1193Provider) { - const curveApi = cloneDeep((await import('@curvefi/api')).default) as CurveApi + const curveApi = createCurve() as CurveApi if (provider) { await curveApi.init('Web3', { network: { chainId }, externalProvider: provider }, { chainId }) } else { diff --git a/yarn.lock b/yarn.lock index 1d900287e7..be598c6597 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1709,19 +1709,19 @@ __metadata: languageName: node linkType: hard -"@curvefi/api@npm:2.66.30": - version: 2.66.30 - resolution: "@curvefi/api@npm:2.66.30" +"@curvefi/api@npm:^2.67.1": + version: 2.67.1 + resolution: "@curvefi/api@npm:2.67.1" dependencies: - "@curvefi/ethcall": "npm:^6.0.13" + "@curvefi/ethcall": "npm:^6.0.14" bignumber.js: "npm:^9.3.0" ethers: "npm:^6.14.1" memoizee: "npm:^0.4.17" - checksum: 10c0/bad98fb876986308b2505d13d7658352e8333628fb9de502f609f3cf41565ca5a9813a62d4eeb164fa0cf4a55f1f9d7551864da3f2bb87599ea9d22f801bc8ab + checksum: 10c0/f09069183b71566ff975d68f882b5c43ba34f850e63784f3aeb0495c935e9a954f9a5684ba7e5820f4230e383159a7589015e69e1f397a550275022822ddd6f2 languageName: node linkType: hard -"@curvefi/ethcall@npm:6.0.13, @curvefi/ethcall@npm:^6.0.13": +"@curvefi/ethcall@npm:6.0.13": version: 6.0.13 resolution: "@curvefi/ethcall@npm:6.0.13" dependencies: @@ -1733,6 +1733,18 @@ __metadata: languageName: node linkType: hard +"@curvefi/ethcall@npm:^6.0.14": + version: 6.0.14 + resolution: "@curvefi/ethcall@npm:6.0.14" + dependencies: + "@types/node": "npm:^22.12.0" + abi-coder: "npm:^5.0.0" + peerDependencies: + ethers: ^6.0.0 + checksum: 10c0/a29ca908e4c2c769607374d73c1d926f1b17696901e82352d5834cfcbaa8b5d5a6df4c7925996fd0decba3324bc0fce348d4bf56dec688215f9d67b8aafdf898 + languageName: node + linkType: hard + "@curvefi/llamalend-api@npm:^1.0.21": version: 1.0.21 resolution: "@curvefi/llamalend-api@npm:1.0.21" @@ -14987,7 +14999,7 @@ __metadata: version: 0.0.0-use.local resolution: "main@workspace:apps/main" dependencies: - "@curvefi/api": "npm:2.66.30" + "@curvefi/api": "npm:^2.67.1" "@curvefi/llamalend-api": "npm:^1.0.21" "@ethersproject/abi": "npm:^5.8.0" "@hookform/error-message": "npm:^2.0.1"