Skip to content

chore: sync dependencies #518

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Dec 30, 2024
6 changes: 3 additions & 3 deletions apps/dao/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,20 @@
"@hookform/resolvers": "^3.9.0",
"@lingui/react": "^4.6.0",
"@supercharge/promise-pool": "^2.3.2",
"bignumber.js": "^9.0.1",
"bignumber.js": "^9.1.2",
"curve-common": "*",
"curve-lib": "*",
"curve-ui-kit": "*",
"dayjs": "^1.11.7",
"ethers": "^6.9.0",
"ethers": "^6.13.4",
"focus-visible": "5.2.0",
"fuse.js": "^6.6.2",
"immer": "^9.0.12",
"intersection-observer": "^0.12.0",
"lightweight-charts": "4.1.2",
"lodash": "4.17.21",
"make-plural": "^7.1.0",
"memoizee": "^0.4.15",
"memoizee": "^0.4.17",
"next": "^13.5.6",
"next-images": "^1.8.5",
"react": "*",
Expand Down
6 changes: 3 additions & 3 deletions apps/lend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,21 @@
"@lingui/detect-locale": "^4.6.0",
"@lingui/react": "^4.6.0",
"@supercharge/promise-pool": "^2.3.2",
"bignumber.js": "^9.0.1",
"bignumber.js": "^9.1.2",
"cross-fetch": "^3.1.5",
"curve-common": "*",
"curve-lib": "*",
"curve-ui-kit": "*",
"dayjs": "^1.11.7",
"ethers": "^6.11.0",
"ethers": "^6.13.4",
"external-rewards": "*",
"focus-visible": "5.2.0",
"fuse.js": "^6.6.2",
"immer": "^9.0.12",
"intersection-observer": "^0.12.0",
"lodash": "4.17.21",
"make-plural": "^7.1.0",
"memoizee": "^0.4.15",
"memoizee": "^0.4.17",
"next": "^13.5.6",
"next-images": "^1.8.5",
"numbro": "^2.4.0",
Expand Down
6 changes: 3 additions & 3 deletions apps/loan/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,20 @@
"@lingui/detect-locale": "^4.6.0",
"@lingui/react": "^4.6.0",
"@supercharge/promise-pool": "^2.3.2",
"bignumber.js": "^9.0.1",
"bignumber.js": "^9.1.2",
"cross-fetch": "^3.1.5",
"curve-common": "*",
"curve-lib": "*",
"curve-ui-kit": "*",
"dayjs": "^1.11.7",
"ethers": "^5",
"ethers": "^6.13.4",
"focus-visible": "5.2.0",
"fuse.js": "^6.6.2",
"immer": "^9.0.12",
"intersection-observer": "^0.12.0",
"lodash": "4.17.21",
"make-plural": "^7.1.0",
"memoizee": "^0.4.15",
"memoizee": "^0.4.17",
"next": "^13.5.6",
"next-images": "^1.8.5",
"numbro": "^2.4.0",
Expand Down
4 changes: 2 additions & 2 deletions apps/loan/src/hooks/usePageOnMount.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ function usePageOnMount(params: Params, location: Location, navigate: NavigateFu
setStorageValue('APP_CACHE', { walletName: walletState.label, timestamp: Date.now().toString() })
const walletChainId = getWalletChainId(walletState)
if (walletChainId && walletChainId !== parsedParams.rChainId) {
const success = await setChain({ chainId: ethers.utils.hexValue(parsedParams.rChainId) })
const success = await setChain({ chainId: ethers.toQuantity(parsedParams.rChainId) })
if (success) {
updateConnectState('loading', CONNECT_STAGE.CONNECT_API, [parsedParams.rChainId, true])
} else {
Expand Down Expand Up @@ -166,7 +166,7 @@ function usePageOnMount(params: Params, location: Location, navigate: NavigateFu
const [currChainId, newChainId] = options
if (wallet) {
try {
const success = await setChain({ chainId: ethers.utils.hexValue(newChainId) })
const success = await setChain({ chainId: ethers.toQuantity(newChainId) })
if (!success) throw new Error('reject network switch')
updateConnectState('loading', CONNECT_STAGE.CONNECT_API, [newChainId, true])
} catch (error) {
Expand Down
7 changes: 3 additions & 4 deletions apps/loan/src/lib/apiCrvusd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ import type { FormValues as SwapFormValues } from '@/components/PageLoanManage/L
import type { LiqRange, Provider, MaxRecvLeverage } from '@/store/types'
import type { MaxRecvLeverage as MaxRecvLeverageForm } from '@/components/PageLoanCreate/types'
import type { FormDetailInfo as FormDetailInfoDeleverage } from '@/components/PageLoanManage/LoanDeleverage/types'

import { ethers } from 'ethers'
import { BrowserProvider } from 'ethers'
import PromisePool from '@supercharge/promise-pool'

import { fulfilledValue, getErrorMessage, log } from '@/utils/helpers'
Expand Down Expand Up @@ -94,10 +93,10 @@ const helpers = {
}
},
waitForTransaction: async (hash: string, provider: Provider) =>
(provider as ethers.providers.Web3Provider).waitForTransaction(hash),
(provider as BrowserProvider).waitForTransaction(hash),
waitForTransactions: async (hashes: string[], provider: Provider) => {
const { results, errors } = await PromisePool.for(hashes).process(
async (hash) => await (provider as ethers.providers.Web3Provider).waitForTransaction(hash),
async (hash) => await (provider as BrowserProvider).waitForTransaction(hash),
)
if (Array.isArray(errors) && errors.length > 0) {
throw errors
Expand Down
4 changes: 2 additions & 2 deletions apps/loan/src/store/createAppSlice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import type { Locale } from '@/lib/i18n'

import produce from 'immer'

import { ethers, Contract } from 'ethers'
import { ethers, Contract, ContractRunner } from 'ethers'
import { Interface } from '@ethersproject/abi'
import { httpFetcher, log } from '@/utils/helpers'
import { setStorageValue } from '@/utils/storage'
Expand Down Expand Up @@ -39,7 +39,7 @@ type SliceState = {

// prettier-ignore
export interface AppSlice extends SliceState {
getContract(jsonModuleName: string, contractAddress: string, provider: Provider): Promise<ethers.Contract | null>
getContract(jsonModuleName: string, contractAddress: string, provider: ContractRunner): Promise<ethers.Contract | null>
fetchCrvUSDTotalSupply(api: Curve): Promise<void>
fetchDailyVolume(): Promise<void>
setAppCache<T>(key: AppCacheKeys, value: T): void
Expand Down
43 changes: 24 additions & 19 deletions apps/loan/src/store/createGasSlice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { GetState, SetState } from 'zustand'
import type { State } from '@/store/useStore'
import type { GasInfo } from '@/store/types'

import { ethers } from 'ethers'
import { JsonRpcProvider } from 'ethers'
import cloneDeep from 'lodash/cloneDeep'

import { gweiToWai } from '@/shared/curve-lib'
Expand Down Expand Up @@ -118,38 +118,43 @@ function parseEthereumGasInfo(gasInfo, chainId: ChainId) {
}
}

// @ts-ignore
async function parseGasInfoFromRpcUrl(rpcUrl) {
const provider = new ethers.providers.JsonRpcProvider(rpcUrl)
async function parseGasInfoFromRpcUrl(rpcUrl: string) {
if (rpcUrl) {
const provider = new JsonRpcProvider(rpcUrl)

if (provider) {
const gasInfo = await provider.getFeeData()
const { gasPrice, maxPriorityFeePerGas, maxFeePerGas } = gasInfo

if (gasPrice) {
const base = gasPrice.toNumber()
const base = toNumber(gasPrice)

if (maxPriorityFeePerGas && maxFeePerGas) {
return {
gasInfo: {
base,
priority: [maxPriorityFeePerGas.toNumber()],
max: [maxFeePerGas.toNumber()],
basePlusPriority: [gasPrice.add(maxPriorityFeePerGas).toNumber()],
},
label: ['fast'],
}
} else {
return {
gasInfo: {
base,
priority: [0],
max: [0],
basePlusPriority: [gasPrice.add(gweiToWai(25)).toNumber()],
priority: [toNumber(maxPriorityFeePerGas)],
max: [toNumber(maxFeePerGas)],
basePlusPriority: [toNumber(gasPrice + maxPriorityFeePerGas)],
},
label: ['fast'],
}
}
return {
gasInfo: {
base,
priority: [0],
max: [0],
basePlusPriority: [toNumber(gasPrice) + gweiToWai(25)],
},
label: ['fast'],
}
}
}
}

const toNumber = (value: bigint) => {
if (value <= Number.MAX_SAFE_INTEGER && value >= Number.MIN_SAFE_INTEGER) {
return Number(value)
}
throw new Error(`Value: "${value}" is out of bounds to be a Number`)
}
8 changes: 4 additions & 4 deletions apps/loan/src/store/createPegKeepersSlice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ const createPegKeepersSlice = (set: SetState<State>, get: GetState<State>): PegK
debtCeilingContract ? debtCeilingContract['debt_ceiling'](pegKeeperAddress) : () => '',
])
results[pegKeeperAddress] = {
debt: ethers.utils.formatUnits(debt, 'ether'),
estCallerProfit: ethers.utils.formatUnits(estCallerProfit, 'ether'),
debtCeiling: ethers.utils.formatUnits(debtCeiling, 'ether'),
debt: ethers.formatEther(debt),
estCallerProfit: ethers.formatEther(estCallerProfit),
debtCeiling: ethers.formatEther(debtCeiling),
}
})

Expand All @@ -95,7 +95,7 @@ const createPegKeepersSlice = (set: SetState<State>, get: GetState<State>): PegK
const estCallerProfit = await contract.estimate_caller_profit()
sliceState.setStateByActiveKey('detailsMapper', pegKeeperAddress, {
...detailsMapper[pegKeeperAddress],
estCallerProfit: ethers.utils.formatUnits(estCallerProfit, 'ether'),
estCallerProfit: ethers.formatEther(estCallerProfit),
})
} catch (error) {
console.error(error)
Expand Down
4 changes: 2 additions & 2 deletions apps/loan/src/store/createScrvUsdSlice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,8 @@ async function _fetchSavingsYield(provider?: Provider | null): Promise<PricesYie
provider.getBlock('latest'),
])
return {
last_updated: new Date(block.timestamp).toISOString(),
last_updated_block: block.number,
last_updated: new Date(block?.timestamp ?? 0).toISOString(),
last_updated_block: block?.number ?? 0,
proj_apr: supply > 0 ? (unlock_amount * 1e-12 * YEAR) / supply : 0,
supply: supply / 1e18,
}
Expand Down
8 changes: 3 additions & 5 deletions apps/loan/src/store/createWalletSlice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ import type { State } from '@/store/useStore'
import type { CustomNotification, NotificationType } from '@web3-onboard/core/dist/types'
import type { Provider } from '@/store/types'
import type { OnboardAPI, UpdateNotification } from '@web3-onboard/core'

import cloneDeep from 'lodash/cloneDeep'
import { ethers } from 'ethers'
import { BrowserProvider } from 'ethers'

type StateKey = keyof typeof DEFAULT_STATE

Expand Down Expand Up @@ -116,11 +115,10 @@ const createWalletSlice = (set: SetState<State>, get: GetState<State>): WalletSl
export default createWalletSlice

export function getProvider(wallet: Wallet) {
return new ethers.providers.Web3Provider(wallet.provider)
return new BrowserProvider(wallet.provider)
}

export function getWalletChainId(wallet: Wallet | undefined | null) {
if (!wallet) return null
const chainId = (wallet as Wallet).chains[0].id
return ethers.BigNumber.from(chainId).toNumber()
return +(wallet as Wallet).chains[0].id
}
4 changes: 2 additions & 2 deletions apps/loan/src/store/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ethers } from 'ethers'
import { BrowserProvider } from 'ethers'

/* createAppSlice */

Expand Down Expand Up @@ -52,7 +52,7 @@ export type LiqRangeSliderIdx = LiqRange & { sliderIdx: number }
export type LiqRangesMapper = { [n: string]: LiqRangeSliderIdx }

/* createWalletSlice */
export type Provider = ethers.providers.Web3Provider
export type Provider = BrowserProvider

export type PricesYieldDataResponse = PricesYieldData

Expand Down
3 changes: 2 additions & 1 deletion apps/loan/src/types/global.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { BrowserProvider } from 'ethers'
import type { INetworkName } from '@curvefi/stablecoin-api/lib/interfaces'
import type { LlammaTemplate } from '@curvefi/stablecoin-api/lib/llammas'
import type { Locale } from '@/lib/i18n'
Expand Down Expand Up @@ -31,7 +32,7 @@ declare global {
type Curve = typeof stablecoinApi & { chainId: ChainId }
type LendApi = typeof lendingApi & { chainId: ChainId }
type NetworkEnum = INetworkName
type Provider = ethers.providers.web3Provider
type Provider = BrowserProvider

type RFormType = 'loan' | 'deleverage' | 'collateral' | 'leverage' | ''
type RouterParams = {
Expand Down
6 changes: 3 additions & 3 deletions apps/main/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@
"@hookform/resolvers": "^3.9.0",
"@lingui/react": "^4.6.0",
"@supercharge/promise-pool": "^2.3.2",
"bignumber.js": "^9.0.1",
"bignumber.js": "^9.1.2",
"cross-fetch": "^3.1.5",
"curve-common": "*",
"curve-lib": "*",
"curve-ui-kit": "*",
"dayjs": "^1.11.7",
"ethers": "^6.11.0",
"ethers": "^6.13.4",
"external-rewards": "*",
"focus-visible": "5.2.0",
"fuse.js": "^6.6.2",
Expand All @@ -44,7 +44,7 @@
"lightweight-charts": "4.1.2",
"lodash": "4.17.21",
"make-plural": "^7.1.0",
"memoizee": "^0.4.15",
"memoizee": "^0.4.17",
"next": "^13.5.6",
"next-images": "^1.8.5",
"numbro": "^2.4.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/curve-common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"@web3-onboard/trezor": "^2.4.6",
"@web3-onboard/trust": "^2.1.2",
"@web3-onboard/walletconnect": "^2.6.1",
"ethers": "^6.11.0"
"ethers": "^6.13.4"
},
"devDependencies": {
"@babel/core": "^7.25.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/curve-lib/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"@tanstack/react-query": "^5.59.0",
"@tanstack/react-query-devtools": "^5.59.0",
"@tanstack/react-query-persist-client": "^5.59.0",
"ethers": "^6.11.0",
"ethers": "^6.13.4",
"react": "^18.2.0",
"type-fest": "^4.26.1"
},
Expand Down
4 changes: 2 additions & 2 deletions packages/ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
"dependencies": {
"@carbon/icons-react": "11.17.0",
"@lingui/detect-locale": "^4.6.0",
"bignumber.js": "^9.0.1",
"ethers": "^6.11.0",
"bignumber.js": "^9.1.2",
"ethers": "^6.13.4",
"lodash": "4.17.21",
"react-aria": "3.22.0",
"react-stately": "3.18.0"
Expand Down
2 changes: 1 addition & 1 deletion tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"chai-bigint": "^0.2.0",
"cypress": "^13.9.0",
"dotenv-flow": "^4.1.0",
"ethers": "^6.11.0",
"ethers": "^6.13.4",
"hardhat": "^2.22.10",
"tsconfig": "*",
"wait-on": "^8.0.1"
Expand Down
Loading
Loading