From ab95c9b1e9035f716f1000e21313709279c3831b Mon Sep 17 00:00:00 2001 From: Noisekit <28145325+noisekit@users.noreply.github.com> Date: Mon, 9 Sep 2024 16:04:13 +0800 Subject: [PATCH] Fix relative deps (#449) --- .../components/BorrowModal/BorrowModal.tsx | 2 +- liquidity/components/BorrowModal/package.json | 1 + .../components/ClaimModal/ClaimModal.tsx | 2 +- liquidity/components/ClaimModal/package.json | 1 + .../components/DepositModal/DepositModal.tsx | 2 +- .../components/DepositModal/package.json | 1 + .../components/RepayModal/RepayModal.tsx | 2 +- liquidity/components/RepayModal/package.json | 1 + .../UndelegateModal/UndelegateModal.tsx | 2 +- .../components/UndelegateModal/package.json | 1 + .../WithdrawModal/WithdrawModal.tsx | 2 +- .../components/WithdrawModal/package.json | 1 + liquidity/lib/calculations/calculations.ts | 2 +- liquidity/lib/calculations/package.json | 1 + liquidity/lib/constants/constants.ts | 10 + liquidity/lib/constants/package.json | 6 +- .../lib/useAccountCollateral/package.json | 1 + .../useAccountCollateral.ts | 2 +- liquidity/lib/useClearDebt/package.json | 2 + liquidity/lib/useClearDebt/useClearDebt.tsx | 4 +- .../lib/useCollateralPrices/package.json | 1 + .../useCollateralPrices.ts | 2 +- .../lib/useDepositBaseAndromeda/package.json | 2 + .../useDepositBaseAndromeda.tsx | 4 +- .../lib/useLiquidityPosition/package.json | 1 + .../useLiquidityPosition.ts | 2 +- .../lib/useLiquidityPositions/package.json | 1 + .../useLiquidityPositions.ts | 2 +- liquidity/lib/useMigrate/package.json | 2 + liquidity/lib/useMigrate/useMigrate.ts | 4 +- liquidity/lib/useMigrateUSD/package.json | 2 + liquidity/lib/useMigrateUSD/useMigrateUSD.ts | 4 +- .../lib/usePoolConfiguration/package.json | 1 + .../usePoolConfiguration.ts | 2 +- liquidity/lib/useRepay/package.json | 1 + liquidity/lib/useRepay/useRepay.tsx | 2 +- .../lib/useRepayBaseAndromeda/package.json | 2 + .../useRepayBaseAndromeda.tsx | 4 +- liquidity/lib/useTokenBalance/package.json | 1 + .../lib/useTokenBalance/useTokenBalance.ts | 2 +- liquidity/lib/useTokenPrice/package.json | 1 + liquidity/lib/useTokenPrice/useTokenPrice.ts | 2 +- .../useUndelegateBaseAndromeda/package.json | 3 + .../useUndelegateBaseAndromeda.tsx | 6 +- liquidity/lib/useVaultsData/package.json | 1 + liquidity/lib/useVaultsData/useVaultsData.ts | 2 +- .../lib/useWithdrawBaseAndromeda/package.json | 2 + .../useWithdrawBaseAndromeda.tsx | 4 +- liquidity/lib/withERC7412/package.json | 2 +- liquidity/lib/withERC7412/withERC7412.test.ts | 182 ------------------ liquidity/lib/withERC7412/withERC7412.ts | 2 +- liquidity/ui/src/components/Borrow/Borrow.tsx | 2 +- .../components/CRatioBar/CRatioChangeStat.tsx | 2 +- liquidity/ui/src/components/Claim/Claim.tsx | 2 +- .../ClosePosition/ClosePosition.tsx | 2 +- .../ClosePositionTransactions.tsx | 2 +- .../ui/src/components/Deposit/Deposit.tsx | 2 +- .../InitialDeposit/InitialDeposit.tsx | 2 +- .../src/components/Manage/CollateralStats.tsx | 2 +- .../ui/src/components/Manage/DebtStats.tsx | 2 +- .../ui/src/components/Manage/ManageStats.tsx | 2 +- .../ui/src/components/Manage/NoPosition.tsx | 2 +- .../components/MigrateUSD/MigrateUSDModal.tsx | 2 +- .../MigrateUSD/MigrateUSDTransaction.tsx | 2 +- .../src/components/MigrateUSD/StepIntro.tsx | 2 +- .../src/components/Migration/StepSummary.tsx | 2 +- .../components/Pools/PoolCards/PoolRow.tsx | 2 +- liquidity/ui/src/components/Repay/Repay.tsx | 2 +- .../ui/src/components/Stats/StatsList.tsx | 2 +- .../src/components/Undelegate/Undelegate.tsx | 2 +- .../ui/src/components/Withdraw/Withdraw.tsx | 2 +- .../src/layouts/Default/NetworkController.tsx | 2 +- liquidity/ui/src/utils/assets.ts | 2 +- liquidity/ui/src/utils/constants.ts | 9 - yarn.lock | 38 +++- 75 files changed, 137 insertions(+), 249 deletions(-) delete mode 100644 liquidity/lib/withERC7412/withERC7412.test.ts delete mode 100644 liquidity/ui/src/utils/constants.ts diff --git a/liquidity/components/BorrowModal/BorrowModal.tsx b/liquidity/components/BorrowModal/BorrowModal.tsx index 6aba8b0ad..885f69e3c 100644 --- a/liquidity/components/BorrowModal/BorrowModal.tsx +++ b/liquidity/components/BorrowModal/BorrowModal.tsx @@ -17,7 +17,7 @@ import { isBaseAndromeda } from '@snx-v3/isBaseAndromeda'; import { ArrowBackIcon } from '@chakra-ui/icons'; import { LiquidityPositionUpdated } from '../../ui/src/components/Manage/LiquidityPositionUpdated'; import { useSystemToken } from '@snx-v3/useSystemToken'; -import { ZEROWEI } from '../../ui/src/utils/constants'; +import { ZEROWEI } from '@snx-v3/constants'; export const BorrowModalUi: React.FC<{ onClose: () => void; diff --git a/liquidity/components/BorrowModal/package.json b/liquidity/components/BorrowModal/package.json index 0ebdcd04b..4369a7b9a 100644 --- a/liquidity/components/BorrowModal/package.json +++ b/liquidity/components/BorrowModal/package.json @@ -10,6 +10,7 @@ "@snx-v3/ContractError": "workspace:*", "@snx-v3/ManagePositionContext": "workspace:*", "@snx-v3/Multistep": "workspace:*", + "@snx-v3/constants": "workspace:*", "@snx-v3/isBaseAndromeda": "workspace:*", "@snx-v3/txnReducer": "workspace:*", "@snx-v3/useBlockchain": "workspace:*", diff --git a/liquidity/components/ClaimModal/ClaimModal.tsx b/liquidity/components/ClaimModal/ClaimModal.tsx index 138e0879d..46fabfc39 100644 --- a/liquidity/components/ClaimModal/ClaimModal.tsx +++ b/liquidity/components/ClaimModal/ClaimModal.tsx @@ -17,7 +17,7 @@ import { isBaseAndromeda } from '@snx-v3/isBaseAndromeda'; import { ArrowBackIcon } from '@chakra-ui/icons'; import { LiquidityPositionUpdated } from '../../ui/src/components/Manage/LiquidityPositionUpdated'; import { useSystemToken } from '@snx-v3/useSystemToken'; -import { ZEROWEI } from '../../ui/src/utils/constants'; +import { ZEROWEI } from '@snx-v3/constants'; import { LiquidityPosition } from '@snx-v3/useLiquidityPosition'; export const ClaimModalUi: React.FC<{ diff --git a/liquidity/components/ClaimModal/package.json b/liquidity/components/ClaimModal/package.json index 71bc53ad0..20e1c6103 100644 --- a/liquidity/components/ClaimModal/package.json +++ b/liquidity/components/ClaimModal/package.json @@ -10,6 +10,7 @@ "@snx-v3/ContractError": "workspace:*", "@snx-v3/ManagePositionContext": "workspace:*", "@snx-v3/Multistep": "workspace:*", + "@snx-v3/constants": "workspace:*", "@snx-v3/isBaseAndromeda": "workspace:*", "@snx-v3/txnReducer": "workspace:*", "@snx-v3/useBlockchain": "workspace:*", diff --git a/liquidity/components/DepositModal/DepositModal.tsx b/liquidity/components/DepositModal/DepositModal.tsx index 3e2172ce2..f4663b028 100644 --- a/liquidity/components/DepositModal/DepositModal.tsx +++ b/liquidity/components/DepositModal/DepositModal.tsx @@ -25,7 +25,7 @@ import type { StateFrom } from 'xstate'; import { DepositMachine, Events, ServiceNames, State } from './DepositMachine'; import { ArrowBackIcon } from '@chakra-ui/icons'; import { LiquidityPositionUpdated } from '../../ui/src/components/Manage/LiquidityPositionUpdated'; -import { ZEROWEI } from '../../ui/src/utils/constants'; +import { ZEROWEI } from '@snx-v3/constants'; import { ManagePositionContext } from '@snx-v3/ManagePositionContext'; import { LiquidityPosition } from '@snx-v3/useLiquidityPosition'; import { ChangeStat } from '../../ui/src/components'; diff --git a/liquidity/components/DepositModal/package.json b/liquidity/components/DepositModal/package.json index 51431ae8f..defbd0d70 100644 --- a/liquidity/components/DepositModal/package.json +++ b/liquidity/components/DepositModal/package.json @@ -10,6 +10,7 @@ "@snx-v3/ContractError": "workspace:*", "@snx-v3/ManagePositionContext": "workspace:*", "@snx-v3/Multistep": "workspace:*", + "@snx-v3/constants": "workspace:*", "@snx-v3/format": "workspace:*", "@snx-v3/isBaseAndromeda": "workspace:*", "@snx-v3/useApprove": "workspace:*", diff --git a/liquidity/components/RepayModal/RepayModal.tsx b/liquidity/components/RepayModal/RepayModal.tsx index 2af2a3460..11bcbec0e 100644 --- a/liquidity/components/RepayModal/RepayModal.tsx +++ b/liquidity/components/RepayModal/RepayModal.tsx @@ -25,7 +25,7 @@ import type { StateFrom } from 'xstate'; import { Events, RepayMachine, ServiceNames, State } from './RepayMachine'; import { ArrowBackIcon } from '@chakra-ui/icons'; import { LiquidityPositionUpdated } from '../../ui/src/components/Manage/LiquidityPositionUpdated'; -import { ZEROWEI } from '../../ui/src/utils/constants'; +import { ZEROWEI } from '@snx-v3/constants'; export const RepayModalUi: React.FC<{ onClose: () => void; diff --git a/liquidity/components/RepayModal/package.json b/liquidity/components/RepayModal/package.json index b21c7f7fe..730faba1d 100644 --- a/liquidity/components/RepayModal/package.json +++ b/liquidity/components/RepayModal/package.json @@ -10,6 +10,7 @@ "@snx-v3/ContractError": "workspace:*", "@snx-v3/ManagePositionContext": "workspace:*", "@snx-v3/Multistep": "workspace:*", + "@snx-v3/constants": "workspace:*", "@snx-v3/format": "workspace:*", "@snx-v3/isBaseAndromeda": "workspace:*", "@snx-v3/useApprove": "workspace:*", diff --git a/liquidity/components/UndelegateModal/UndelegateModal.tsx b/liquidity/components/UndelegateModal/UndelegateModal.tsx index 64e1aefa3..4e0965b36 100644 --- a/liquidity/components/UndelegateModal/UndelegateModal.tsx +++ b/liquidity/components/UndelegateModal/UndelegateModal.tsx @@ -20,7 +20,7 @@ import type { StateFrom } from 'xstate'; import { Events, ServiceNames, State, UndelegateMachine } from './UndelegateMachine'; import { ArrowBackIcon } from '@chakra-ui/icons'; import { LiquidityPositionUpdated } from '../../ui/src/components/Manage/LiquidityPositionUpdated'; -import { ZEROWEI } from '../../ui/src/utils/constants'; +import { ZEROWEI } from '@snx-v3/constants'; import { ChangeStat } from '../../ui/src/components'; import { currency } from '@snx-v3/format'; import { CRatioChangeStat } from '../../ui/src/components/CRatioBar/CRatioChangeStat'; diff --git a/liquidity/components/UndelegateModal/package.json b/liquidity/components/UndelegateModal/package.json index 77a300636..6f869b8a0 100644 --- a/liquidity/components/UndelegateModal/package.json +++ b/liquidity/components/UndelegateModal/package.json @@ -10,6 +10,7 @@ "@snx-v3/ContractError": "workspace:*", "@snx-v3/ManagePositionContext": "workspace:*", "@snx-v3/Multistep": "workspace:*", + "@snx-v3/constants": "workspace:*", "@snx-v3/format": "workspace:*", "@snx-v3/isBaseAndromeda": "workspace:*", "@snx-v3/useBlockchain": "workspace:*", diff --git a/liquidity/components/WithdrawModal/WithdrawModal.tsx b/liquidity/components/WithdrawModal/WithdrawModal.tsx index cd426ffbc..719fc2f14 100644 --- a/liquidity/components/WithdrawModal/WithdrawModal.tsx +++ b/liquidity/components/WithdrawModal/WithdrawModal.tsx @@ -13,7 +13,7 @@ import { ArrowBackIcon } from '@chakra-ui/icons'; import { LiquidityPositionUpdated } from '../../ui/src/components/Manage/LiquidityPositionUpdated'; import { LiquidityPosition } from '@snx-v3/useLiquidityPosition'; import { isBaseAndromeda } from '@snx-v3/isBaseAndromeda'; -import { ZEROWEI } from '../../ui/src/utils/constants'; +import { ZEROWEI } from '@snx-v3/constants'; import { useWithdrawBaseAndromeda } from '@snx-v3/useWithdrawBaseAndromeda'; import { ManagePositionContext } from '@snx-v3/ManagePositionContext'; import { useParams } from '@snx-v3/useParams'; diff --git a/liquidity/components/WithdrawModal/package.json b/liquidity/components/WithdrawModal/package.json index bb85def68..a9dc0c179 100644 --- a/liquidity/components/WithdrawModal/package.json +++ b/liquidity/components/WithdrawModal/package.json @@ -10,6 +10,7 @@ "@snx-v3/ContractError": "workspace:*", "@snx-v3/ManagePositionContext": "workspace:*", "@snx-v3/Multistep": "workspace:*", + "@snx-v3/constants": "workspace:*", "@snx-v3/isBaseAndromeda": "workspace:*", "@snx-v3/useAccountCollateral": "workspace:*", "@snx-v3/useBlockchain": "workspace:*", diff --git a/liquidity/lib/calculations/calculations.ts b/liquidity/lib/calculations/calculations.ts index 3b450206b..d2ba938cf 100644 --- a/liquidity/lib/calculations/calculations.ts +++ b/liquidity/lib/calculations/calculations.ts @@ -1,7 +1,7 @@ import type { MarketSnapshotByWeekSchema, PoolType } from '@snx-v3/usePoolData'; import { z } from 'zod'; import { wei, Wei } from '@synthetixio/wei'; -import { ZEROWEI } from '../../ui/src/utils/constants'; +import { ZEROWEI } from '@snx-v3/constants'; type MarketSnapshotByWeek = z.infer; diff --git a/liquidity/lib/calculations/package.json b/liquidity/lib/calculations/package.json index 1c92b9fad..64ed8a1b5 100644 --- a/liquidity/lib/calculations/package.json +++ b/liquidity/lib/calculations/package.json @@ -4,6 +4,7 @@ "main": "index.ts", "version": "0.0.1", "dependencies": { + "@snx-v3/constants": "workspace:*", "@snx-v3/usePoolData": "workspace:*", "@synthetixio/wei": "^2.74.4", "zod": "^3.22.4" diff --git a/liquidity/lib/constants/constants.ts b/liquidity/lib/constants/constants.ts index 8d5b28dc5..791b71400 100644 --- a/liquidity/lib/constants/constants.ts +++ b/liquidity/lib/constants/constants.ts @@ -1,3 +1,13 @@ +import { constants } from 'ethers'; +import Wei from '@synthetixio/wei'; + +export const LOCAL_STORAGE_KEYS = { + SHOW_TESTNETS: 'SHOW_TESTNETS', +}; +export const ZEROWEI = new Wei(0); +export const ONEWEI = new Wei(1); +export const MAXUINT = new Wei(constants.MaxUint256); + export const GWEI_DECIMALS = 9; export const GAS_LIMIT_MULTIPLIER = 1.5; diff --git a/liquidity/lib/constants/package.json b/liquidity/lib/constants/package.json index 2746aa015..aa30ffb4f 100644 --- a/liquidity/lib/constants/package.json +++ b/liquidity/lib/constants/package.json @@ -2,5 +2,9 @@ "name": "@snx-v3/constants", "private": true, "main": "index.ts", - "version": "0.0.0" + "version": "0.0.0", + "dependencies": { + "@synthetixio/wei": "^2.74.4", + "ethers": "^5.7.2" + } } diff --git a/liquidity/lib/useAccountCollateral/package.json b/liquidity/lib/useAccountCollateral/package.json index 22c5358c7..500ac9599 100644 --- a/liquidity/lib/useAccountCollateral/package.json +++ b/liquidity/lib/useAccountCollateral/package.json @@ -6,6 +6,7 @@ "dependencies": { "@snx-v3/tsHelpers": "workspace:*", "@snx-v3/useBlockchain": "workspace:*", + "@snx-v3/useCollateralPriceUpdates": "workspace:*", "@snx-v3/useCollateralTypes": "workspace:*", "@snx-v3/useCoreProxy": "workspace:*", "@snx-v3/useSystemToken": "workspace:*", diff --git a/liquidity/lib/useAccountCollateral/useAccountCollateral.ts b/liquidity/lib/useAccountCollateral/useAccountCollateral.ts index 56505acbb..e08b9c7d4 100644 --- a/liquidity/lib/useAccountCollateral/useAccountCollateral.ts +++ b/liquidity/lib/useAccountCollateral/useAccountCollateral.ts @@ -7,7 +7,7 @@ import { useSystemToken } from '@snx-v3/useSystemToken'; import { Wei, wei } from '@synthetixio/wei'; import { useQuery } from '@tanstack/react-query'; import { ethers } from 'ethers'; -import { useAllCollateralPriceUpdates } from '../useCollateralPriceUpdates'; +import { useAllCollateralPriceUpdates } from '@snx-v3/useCollateralPriceUpdates'; export type AccountCollateralType = { tokenAddress: string; diff --git a/liquidity/lib/useClearDebt/package.json b/liquidity/lib/useClearDebt/package.json index acd8211ef..ee1a1bb9c 100644 --- a/liquidity/lib/useClearDebt/package.json +++ b/liquidity/lib/useClearDebt/package.json @@ -9,10 +9,12 @@ "@snx-v3/txnReducer": "workspace:*", "@snx-v3/useAllCollateralPriceIds": "workspace:*", "@snx-v3/useBlockchain": "workspace:*", + "@snx-v3/useCollateralPriceUpdates": "workspace:*", "@snx-v3/useCoreProxy": "workspace:*", "@snx-v3/useGasOptions": "workspace:*", "@snx-v3/useGasPrice": "workspace:*", "@snx-v3/useGasSpeed": "workspace:*", + "@snx-v3/useSpotMarketProxy": "workspace:*", "@snx-v3/withERC7412": "workspace:*", "@synthetixio/wei": "^2.74.4", "@tanstack/react-query": "^5.8.3", diff --git a/liquidity/lib/useClearDebt/useClearDebt.tsx b/liquidity/lib/useClearDebt/useClearDebt.tsx index 1be678421..849b817e8 100644 --- a/liquidity/lib/useClearDebt/useClearDebt.tsx +++ b/liquidity/lib/useClearDebt/useClearDebt.tsx @@ -11,9 +11,9 @@ import { useGasSpeed } from '@snx-v3/useGasSpeed'; import { notNil } from '@snx-v3/tsHelpers'; import { withERC7412 } from '@snx-v3/withERC7412'; import { useAllCollateralPriceIds } from '@snx-v3/useAllCollateralPriceIds'; -import { useSpotMarketProxy } from '../useSpotMarketProxy'; +import { useSpotMarketProxy } from '@snx-v3/useSpotMarketProxy'; import { USDC_BASE_MARKET, getRepayerContract } from '@snx-v3/isBaseAndromeda'; -import { useCollateralPriceUpdates } from '../useCollateralPriceUpdates'; +import { useCollateralPriceUpdates } from '@snx-v3/useCollateralPriceUpdates'; export const DEBT_REPAYER_ABI = [ { diff --git a/liquidity/lib/useCollateralPrices/package.json b/liquidity/lib/useCollateralPrices/package.json index c155dafc0..dfb5d468b 100644 --- a/liquidity/lib/useCollateralPrices/package.json +++ b/liquidity/lib/useCollateralPrices/package.json @@ -7,6 +7,7 @@ "@snx-v3/isBaseAndromeda": "workspace:*", "@snx-v3/tsHelpers": "workspace:*", "@snx-v3/useBlockchain": "workspace:*", + "@snx-v3/useCollateralPriceUpdates": "workspace:*", "@snx-v3/useCollateralTypes": "workspace:*", "@snx-v3/useCoreProxy": "workspace:*", "@snx-v3/useGetUSDTokens": "workspace:*", diff --git a/liquidity/lib/useCollateralPrices/useCollateralPrices.ts b/liquidity/lib/useCollateralPrices/useCollateralPrices.ts index 3c5070710..c96ca1e7c 100644 --- a/liquidity/lib/useCollateralPrices/useCollateralPrices.ts +++ b/liquidity/lib/useCollateralPrices/useCollateralPrices.ts @@ -14,7 +14,7 @@ import { ZodBigNumber } from '@snx-v3/zod'; import Wei, { wei } from '@synthetixio/wei'; import { useQuery } from '@tanstack/react-query'; import { ethers } from 'ethers'; -import { useAllCollateralPriceUpdates } from '../useCollateralPriceUpdates'; +import { useAllCollateralPriceUpdates } from '@snx-v3/useCollateralPriceUpdates'; const PriceSchema = ZodBigNumber.transform((x) => wei(x)); diff --git a/liquidity/lib/useDepositBaseAndromeda/package.json b/liquidity/lib/useDepositBaseAndromeda/package.json index 230f19529..9bbab3bee 100644 --- a/liquidity/lib/useDepositBaseAndromeda/package.json +++ b/liquidity/lib/useDepositBaseAndromeda/package.json @@ -10,12 +10,14 @@ "@snx-v3/txnReducer": "workspace:*", "@snx-v3/useApprove": "workspace:*", "@snx-v3/useBlockchain": "workspace:*", + "@snx-v3/useCollateralPriceUpdates": "workspace:*", "@snx-v3/useCollateralTypes": "workspace:*", "@snx-v3/useCoreProxy": "workspace:*", "@snx-v3/useGasOptions": "workspace:*", "@snx-v3/useGasPrice": "workspace:*", "@snx-v3/useGasSpeed": "workspace:*", "@snx-v3/useGetUSDTokens": "workspace:*", + "@snx-v3/useSpotMarketProxy": "workspace:*", "@snx-v3/withERC7412": "workspace:*", "@synthetixio/wei": "^2.74.4", "@tanstack/react-query": "^5.8.3", diff --git a/liquidity/lib/useDepositBaseAndromeda/useDepositBaseAndromeda.tsx b/liquidity/lib/useDepositBaseAndromeda/useDepositBaseAndromeda.tsx index cab0823a0..b497b8840 100644 --- a/liquidity/lib/useDepositBaseAndromeda/useDepositBaseAndromeda.tsx +++ b/liquidity/lib/useDepositBaseAndromeda/useDepositBaseAndromeda.tsx @@ -10,11 +10,11 @@ import { getGasPrice } from '@snx-v3/useGasPrice'; import { useGasSpeed } from '@snx-v3/useGasSpeed'; import { withERC7412 } from '@snx-v3/withERC7412'; import { notNil } from '@snx-v3/tsHelpers'; -import { useSpotMarketProxy } from '../useSpotMarketProxy'; +import { useSpotMarketProxy } from '@snx-v3/useSpotMarketProxy'; import { parseUnits } from '@snx-v3/format'; import { getSpotMarketId } from '@snx-v3/isBaseAndromeda'; import { approveAbi } from '@snx-v3/useApprove'; -import { useCollateralPriceUpdates } from '../useCollateralPriceUpdates'; +import { useCollateralPriceUpdates } from '@snx-v3/useCollateralPriceUpdates'; import { useGetUSDTokens } from '@snx-v3/useGetUSDTokens'; import { useCollateralType } from '@snx-v3/useCollateralTypes'; diff --git a/liquidity/lib/useLiquidityPosition/package.json b/liquidity/lib/useLiquidityPosition/package.json index d36a94587..0eb706453 100644 --- a/liquidity/lib/useLiquidityPosition/package.json +++ b/liquidity/lib/useLiquidityPosition/package.json @@ -7,6 +7,7 @@ "@snx-v3/tsHelpers": "workspace:*", "@snx-v3/useAccountCollateral": "workspace:*", "@snx-v3/useBlockchain": "workspace:*", + "@snx-v3/useCollateralPriceUpdates": "workspace:*", "@snx-v3/useCollateralPrices": "workspace:*", "@snx-v3/useCollateralTypes": "workspace:*", "@snx-v3/useCoreProxy": "workspace:*", diff --git a/liquidity/lib/useLiquidityPosition/useLiquidityPosition.ts b/liquidity/lib/useLiquidityPosition/useLiquidityPosition.ts index b8746a79a..4adc2c090 100644 --- a/liquidity/lib/useLiquidityPosition/useLiquidityPosition.ts +++ b/liquidity/lib/useLiquidityPosition/useLiquidityPosition.ts @@ -11,7 +11,7 @@ import Wei, { wei } from '@synthetixio/wei'; import { useQuery } from '@tanstack/react-query'; import { ethers } from 'ethers'; import { z } from 'zod'; -import { useAllCollateralPriceUpdates } from '../useCollateralPriceUpdates'; +import { useAllCollateralPriceUpdates } from '@snx-v3/useCollateralPriceUpdates'; import { useCollateralTypes } from '@snx-v3/useCollateralTypes'; const PositionCollateralSchema = z.object({ diff --git a/liquidity/lib/useLiquidityPositions/package.json b/liquidity/lib/useLiquidityPositions/package.json index 2e92f7cf0..35b896fe5 100644 --- a/liquidity/lib/useLiquidityPositions/package.json +++ b/liquidity/lib/useLiquidityPositions/package.json @@ -7,6 +7,7 @@ "@snx-v3/calculations": "workspace:*", "@snx-v3/tsHelpers": "workspace:*", "@snx-v3/useBlockchain": "workspace:*", + "@snx-v3/useCollateralPriceUpdates": "workspace:*", "@snx-v3/useCollateralPrices": "workspace:*", "@snx-v3/useCollateralTypes": "workspace:*", "@snx-v3/useCoreProxy": "workspace:*", diff --git a/liquidity/lib/useLiquidityPositions/useLiquidityPositions.ts b/liquidity/lib/useLiquidityPositions/useLiquidityPositions.ts index 65074e551..a234f2e50 100644 --- a/liquidity/lib/useLiquidityPositions/useLiquidityPositions.ts +++ b/liquidity/lib/useLiquidityPositions/useLiquidityPositions.ts @@ -9,7 +9,7 @@ import { loadPrices } from '@snx-v3/useCollateralPrices'; import { calculateCRatio } from '@snx-v3/calculations'; import { erc7412Call } from '@snx-v3/withERC7412'; import { keyBy, stringToHash } from '@snx-v3/tsHelpers'; -import { useAllCollateralPriceUpdates } from '../useCollateralPriceUpdates'; +import { useAllCollateralPriceUpdates } from '@snx-v3/useCollateralPriceUpdates'; export type LiquidityPositionType = { id: `${string}-${string}`; diff --git a/liquidity/lib/useMigrate/package.json b/liquidity/lib/useMigrate/package.json index 8ad17525d..d80876d8c 100644 --- a/liquidity/lib/useMigrate/package.json +++ b/liquidity/lib/useMigrate/package.json @@ -4,6 +4,8 @@ "main": "index.ts", "version": "0.0.1", "dependencies": { + "@snx-v3/constants": "workspace:*", + "@snx-v3/parser": "workspace:*", "@snx-v3/useBlockchain": "workspace:*", "@snx-v3/useGasOptions": "workspace:*", "@snx-v3/useGasPrice": "workspace:*", diff --git a/liquidity/lib/useMigrate/useMigrate.ts b/liquidity/lib/useMigrate/useMigrate.ts index b0c0a9b6a..b5636a987 100644 --- a/liquidity/lib/useMigrate/useMigrate.ts +++ b/liquidity/lib/useMigrate/useMigrate.ts @@ -3,10 +3,10 @@ import { useDefaultProvider, useNetwork, useSigner } from '@snx-v3/useBlockchain import { useCallback, useMemo, useState } from 'react'; import { getGasPrice } from '@snx-v3/useGasPrice'; import { formatGasPriceForTransaction } from '@snx-v3/useGasOptions'; -import { ZEROWEI } from '../../ui/src/utils/constants'; +import { ZEROWEI } from '@snx-v3/constants'; import { wei } from '@synthetixio/wei'; import { useGasSpeed } from '@snx-v3/useGasSpeed'; -import { parseTxError } from '../parser'; +import { parseTxError } from '@snx-v3/parser'; import { useLegacyMarket } from '@snx-v3/useLegacyMarket'; export function useMigrate() { diff --git a/liquidity/lib/useMigrateUSD/package.json b/liquidity/lib/useMigrateUSD/package.json index 6235f40c3..7f58085f6 100644 --- a/liquidity/lib/useMigrateUSD/package.json +++ b/liquidity/lib/useMigrateUSD/package.json @@ -4,6 +4,8 @@ "main": "index.ts", "version": "0.0.1", "dependencies": { + "@snx-v3/constants": "workspace:*", + "@snx-v3/parser": "workspace:*", "@snx-v3/useBlockchain": "workspace:*", "@snx-v3/useGasOptions": "workspace:*", "@snx-v3/useGasPrice": "workspace:*", diff --git a/liquidity/lib/useMigrateUSD/useMigrateUSD.ts b/liquidity/lib/useMigrateUSD/useMigrateUSD.ts index 9664147ff..64a7fae17 100644 --- a/liquidity/lib/useMigrateUSD/useMigrateUSD.ts +++ b/liquidity/lib/useMigrateUSD/useMigrateUSD.ts @@ -3,10 +3,10 @@ import { useLegacyMarket } from '@snx-v3/useLegacyMarket'; import { useCallback, useState } from 'react'; import { getGasPrice } from '@snx-v3/useGasPrice'; import { formatGasPriceForTransaction } from '@snx-v3/useGasOptions'; -import { ZEROWEI } from '../../ui/src/utils/constants'; +import { ZEROWEI } from '@snx-v3/constants'; import Wei, { wei } from '@synthetixio/wei'; import { useGasSpeed } from '@snx-v3/useGasSpeed'; -import { parseTxError } from '../parser'; +import { parseTxError } from '@snx-v3/parser'; import { useQueryClient } from '@tanstack/react-query'; export function useMigrateUSD({ amount }: { amount: Wei }) { diff --git a/liquidity/lib/usePoolConfiguration/package.json b/liquidity/lib/usePoolConfiguration/package.json index a716a171b..9cbaddaa7 100644 --- a/liquidity/lib/usePoolConfiguration/package.json +++ b/liquidity/lib/usePoolConfiguration/package.json @@ -7,6 +7,7 @@ "@snx-v3/fetchPythPrices": "workspace:*", "@snx-v3/useAllCollateralPriceIds": "workspace:*", "@snx-v3/useBlockchain": "workspace:*", + "@snx-v3/useCollateralPriceUpdates": "workspace:*", "@snx-v3/useCoreProxy": "workspace:*", "@snx-v3/withERC7412": "workspace:*", "@snx-v3/zod": "workspace:*", diff --git a/liquidity/lib/usePoolConfiguration/usePoolConfiguration.ts b/liquidity/lib/usePoolConfiguration/usePoolConfiguration.ts index d86fea048..bb18d195a 100644 --- a/liquidity/lib/usePoolConfiguration/usePoolConfiguration.ts +++ b/liquidity/lib/usePoolConfiguration/usePoolConfiguration.ts @@ -7,7 +7,7 @@ import { ethers } from 'ethers'; import { erc7412Call } from '@snx-v3/withERC7412'; import { fetchPriceUpdates, priceUpdatesToPopulatedTx } from '@snx-v3/fetchPythPrices'; import { useAllCollateralPriceIds } from '@snx-v3/useAllCollateralPriceIds'; -import { useAllCollateralPriceUpdates } from '../useCollateralPriceUpdates'; +import { useAllCollateralPriceUpdates } from '@snx-v3/useCollateralPriceUpdates'; export const MarketConfigurationSchema = z.object({ id: SmallIntSchema, diff --git a/liquidity/lib/useRepay/package.json b/liquidity/lib/useRepay/package.json index d50af6818..4acda5ffe 100644 --- a/liquidity/lib/useRepay/package.json +++ b/liquidity/lib/useRepay/package.json @@ -4,6 +4,7 @@ "main": "index.ts", "version": "0.0.1", "dependencies": { + "@snx-v3/constants": "workspace:*", "@snx-v3/fetchPythPrices": "workspace:*", "@snx-v3/tsHelpers": "workspace:*", "@snx-v3/txnReducer": "workspace:*", diff --git a/liquidity/lib/useRepay/useRepay.tsx b/liquidity/lib/useRepay/useRepay.tsx index 36564a3f3..fb33a550e 100644 --- a/liquidity/lib/useRepay/useRepay.tsx +++ b/liquidity/lib/useRepay/useRepay.tsx @@ -13,7 +13,7 @@ import { notNil } from '@snx-v3/tsHelpers'; import { withERC7412 } from '@snx-v3/withERC7412'; import { useAllCollateralPriceIds } from '@snx-v3/useAllCollateralPriceIds'; import { fetchPriceUpdates, priceUpdatesToPopulatedTx } from '@snx-v3/fetchPythPrices'; -import { ZEROWEI } from '../../ui/src/utils/constants'; +import { ZEROWEI } from '@snx-v3/constants'; export const useRepay = ({ accountId, diff --git a/liquidity/lib/useRepayBaseAndromeda/package.json b/liquidity/lib/useRepayBaseAndromeda/package.json index f2c728f19..784c13ed3 100644 --- a/liquidity/lib/useRepayBaseAndromeda/package.json +++ b/liquidity/lib/useRepayBaseAndromeda/package.json @@ -10,11 +10,13 @@ "@snx-v3/txnReducer": "workspace:*", "@snx-v3/useApprove": "workspace:*", "@snx-v3/useBlockchain": "workspace:*", + "@snx-v3/useCollateralPriceUpdates": "workspace:*", "@snx-v3/useCoreProxy": "workspace:*", "@snx-v3/useGasOptions": "workspace:*", "@snx-v3/useGasPrice": "workspace:*", "@snx-v3/useGasSpeed": "workspace:*", "@snx-v3/useGetUSDTokens": "workspace:*", + "@snx-v3/useSpotMarketProxy": "workspace:*", "@snx-v3/useSystemToken": "workspace:*", "@snx-v3/withERC7412": "workspace:*", "@synthetixio/wei": "^2.74.4", diff --git a/liquidity/lib/useRepayBaseAndromeda/useRepayBaseAndromeda.tsx b/liquidity/lib/useRepayBaseAndromeda/useRepayBaseAndromeda.tsx index 98674975e..2468eb526 100644 --- a/liquidity/lib/useRepayBaseAndromeda/useRepayBaseAndromeda.tsx +++ b/liquidity/lib/useRepayBaseAndromeda/useRepayBaseAndromeda.tsx @@ -11,11 +11,11 @@ import { useGasSpeed } from '@snx-v3/useGasSpeed'; import { useSystemToken } from '@snx-v3/useSystemToken'; import { notNil } from '@snx-v3/tsHelpers'; import { withERC7412 } from '@snx-v3/withERC7412'; -import { useSpotMarketProxy } from '../useSpotMarketProxy'; +import { useSpotMarketProxy } from '@snx-v3/useSpotMarketProxy'; import { getSpotMarketId } from '@snx-v3/isBaseAndromeda'; import { parseUnits } from '@snx-v3/format'; import { approveAbi } from '@snx-v3/useApprove'; -import { useCollateralPriceUpdates } from '../useCollateralPriceUpdates'; +import { useCollateralPriceUpdates } from '@snx-v3/useCollateralPriceUpdates'; import { useGetUSDTokens } from '@snx-v3/useGetUSDTokens'; export const useRepayBaseAndromeda = ({ diff --git a/liquidity/lib/useTokenBalance/package.json b/liquidity/lib/useTokenBalance/package.json index 062d1bb85..491fd4050 100644 --- a/liquidity/lib/useTokenBalance/package.json +++ b/liquidity/lib/useTokenBalance/package.json @@ -5,6 +5,7 @@ "version": "0.0.1", "dependencies": { "@snx-v3/assertAddressType": "workspace:*", + "@snx-v3/constants": "workspace:*", "@snx-v3/useBlockchain": "workspace:*", "@snx-v3/zod": "workspace:*", "@synthetixio/wei": "^2.74.4", diff --git a/liquidity/lib/useTokenBalance/useTokenBalance.ts b/liquidity/lib/useTokenBalance/useTokenBalance.ts index 3f3b89968..965c57d21 100644 --- a/liquidity/lib/useTokenBalance/useTokenBalance.ts +++ b/liquidity/lib/useTokenBalance/useTokenBalance.ts @@ -10,7 +10,7 @@ import { } from '@snx-v3/useBlockchain'; import { ethers, providers } from 'ethers'; import { ZodBigNumber } from '@snx-v3/zod'; -import { ZEROWEI } from '../../ui/src/utils/constants'; +import { ZEROWEI } from '@snx-v3/constants'; export const BalanceSchema = ZodBigNumber.transform((x) => wei(x)); diff --git a/liquidity/lib/useTokenPrice/package.json b/liquidity/lib/useTokenPrice/package.json index 4a56302af..188077cfa 100644 --- a/liquidity/lib/useTokenPrice/package.json +++ b/liquidity/lib/useTokenPrice/package.json @@ -4,6 +4,7 @@ "main": "index.ts", "version": "0.0.2", "dependencies": { + "@snx-v3/constants": "workspace:*", "@snx-v3/useCollateralPriceUpdates": "workspace:*", "@snx-v3/useCollateralTypes": "workspace:*", "@snx-v3/useOraclePrice": "workspace:*", diff --git a/liquidity/lib/useTokenPrice/useTokenPrice.ts b/liquidity/lib/useTokenPrice/useTokenPrice.ts index 6ae5ddee4..94796315c 100644 --- a/liquidity/lib/useTokenPrice/useTokenPrice.ts +++ b/liquidity/lib/useTokenPrice/useTokenPrice.ts @@ -1,7 +1,7 @@ import { useOfflinePrices } from '@snx-v3/useCollateralPriceUpdates'; import { useCollateralTypes } from '@snx-v3/useCollateralTypes'; import { useMemo } from 'react'; -import { ZEROWEI } from '../../ui/src/utils/constants'; +import { ZEROWEI } from '@snx-v3/constants'; import { wei } from '@synthetixio/wei'; import { useOraclePrice } from '@snx-v3/useOraclePrice'; diff --git a/liquidity/lib/useUndelegateBaseAndromeda/package.json b/liquidity/lib/useUndelegateBaseAndromeda/package.json index 53fd7e0e6..02c384ee7 100644 --- a/liquidity/lib/useUndelegateBaseAndromeda/package.json +++ b/liquidity/lib/useUndelegateBaseAndromeda/package.json @@ -11,12 +11,15 @@ "@snx-v3/useAllCollateralPriceIds": "workspace:*", "@snx-v3/useApprove": "workspace:*", "@snx-v3/useBlockchain": "workspace:*", + "@snx-v3/useClearDebt": "workspace:*", + "@snx-v3/useCollateralPriceUpdates": "workspace:*", "@snx-v3/useCoreProxy": "workspace:*", "@snx-v3/useGasOptions": "workspace:*", "@snx-v3/useGasPrice": "workspace:*", "@snx-v3/useGasSpeed": "workspace:*", "@snx-v3/useGetUSDTokens": "workspace:*", "@snx-v3/useLiquidityPosition": "workspace:*", + "@snx-v3/useSpotMarketProxy": "workspace:*", "@snx-v3/withERC7412": "workspace:*", "@synthetixio/wei": "^2.74.4", "@tanstack/react-query": "^5.8.3", diff --git a/liquidity/lib/useUndelegateBaseAndromeda/useUndelegateBaseAndromeda.tsx b/liquidity/lib/useUndelegateBaseAndromeda/useUndelegateBaseAndromeda.tsx index 656714f7d..9b5646feb 100644 --- a/liquidity/lib/useUndelegateBaseAndromeda/useUndelegateBaseAndromeda.tsx +++ b/liquidity/lib/useUndelegateBaseAndromeda/useUndelegateBaseAndromeda.tsx @@ -14,10 +14,10 @@ import { LiquidityPosition } from '@snx-v3/useLiquidityPosition'; import { useApprove } from '@snx-v3/useApprove'; import { USDC_BASE_MARKET, getRepayerContract } from '@snx-v3/isBaseAndromeda'; import { parseUnits } from '@snx-v3/format'; -import { DEBT_REPAYER_ABI } from '../useClearDebt'; -import { useSpotMarketProxy } from '../useSpotMarketProxy'; +import { DEBT_REPAYER_ABI } from '@snx-v3/useClearDebt'; +import { useSpotMarketProxy } from '@snx-v3/useSpotMarketProxy'; import { notNil } from '@snx-v3/tsHelpers'; -import { useCollateralPriceUpdates } from '../useCollateralPriceUpdates'; +import { useCollateralPriceUpdates } from '@snx-v3/useCollateralPriceUpdates'; import { useGetUSDTokens } from '@snx-v3/useGetUSDTokens'; export const useUndelegateBaseAndromeda = ({ diff --git a/liquidity/lib/useVaultsData/package.json b/liquidity/lib/useVaultsData/package.json index 092358e42..b3f808c38 100644 --- a/liquidity/lib/useVaultsData/package.json +++ b/liquidity/lib/useVaultsData/package.json @@ -8,6 +8,7 @@ "@snx-v3/tsHelpers": "workspace:*", "@snx-v3/useAllCollateralPriceIds": "workspace:*", "@snx-v3/useBlockchain": "workspace:*", + "@snx-v3/useCollateralPriceUpdates": "workspace:*", "@snx-v3/useCollateralTypes": "workspace:*", "@snx-v3/useCoreProxy": "workspace:*", "@snx-v3/withERC7412": "workspace:*", diff --git a/liquidity/lib/useVaultsData/useVaultsData.ts b/liquidity/lib/useVaultsData/useVaultsData.ts index f13e570fc..a68657437 100644 --- a/liquidity/lib/useVaultsData/useVaultsData.ts +++ b/liquidity/lib/useVaultsData/useVaultsData.ts @@ -8,7 +8,7 @@ import { Network, useNetwork, useProviderForChain } from '@snx-v3/useBlockchain' import { erc7412Call } from '@snx-v3/withERC7412'; import { useAllCollateralPriceIds } from '@snx-v3/useAllCollateralPriceIds'; import { fetchPriceUpdates, priceUpdatesToPopulatedTx } from '@snx-v3/fetchPythPrices'; -import { useAllCollateralPriceUpdates } from '../useCollateralPriceUpdates'; +import { useAllCollateralPriceUpdates } from '@snx-v3/useCollateralPriceUpdates'; import { stringToHash } from '@snx-v3/tsHelpers'; const VaultCollateralSchema = z diff --git a/liquidity/lib/useWithdrawBaseAndromeda/package.json b/liquidity/lib/useWithdrawBaseAndromeda/package.json index 7adda070b..7a8a745bd 100644 --- a/liquidity/lib/useWithdrawBaseAndromeda/package.json +++ b/liquidity/lib/useWithdrawBaseAndromeda/package.json @@ -4,6 +4,7 @@ "main": "index.ts", "version": "0.0.1", "dependencies": { + "@snx-v3/constants": "workspace:*", "@snx-v3/isBaseAndromeda": "workspace:*", "@snx-v3/tsHelpers": "workspace:*", "@snx-v3/txnReducer": "workspace:*", @@ -15,6 +16,7 @@ "@snx-v3/useGasPrice": "workspace:*", "@snx-v3/useGasSpeed": "workspace:*", "@snx-v3/useGetUSDTokens": "workspace:*", + "@snx-v3/useSpotMarketProxy": "workspace:*", "@snx-v3/useUSDProxy": "workspace:*", "@snx-v3/withERC7412": "workspace:*", "@synthetixio/wei": "^2.74.4", diff --git a/liquidity/lib/useWithdrawBaseAndromeda/useWithdrawBaseAndromeda.tsx b/liquidity/lib/useWithdrawBaseAndromeda/useWithdrawBaseAndromeda.tsx index 1d2e9a37d..5bdf0725c 100644 --- a/liquidity/lib/useWithdrawBaseAndromeda/useWithdrawBaseAndromeda.tsx +++ b/liquidity/lib/useWithdrawBaseAndromeda/useWithdrawBaseAndromeda.tsx @@ -8,14 +8,14 @@ import { formatGasPriceForTransaction } from '@snx-v3/useGasOptions'; import { getGasPrice } from '@snx-v3/useGasPrice'; import { useGasSpeed } from '@snx-v3/useGasSpeed'; import { withERC7412 } from '@snx-v3/withERC7412'; -import { useSpotMarketProxy } from '../useSpotMarketProxy'; +import { useSpotMarketProxy } from '@snx-v3/useSpotMarketProxy'; import { getSpotMarketId } from '@snx-v3/isBaseAndromeda'; import { notNil } from '@snx-v3/tsHelpers'; import { useUSDProxy } from '@snx-v3/useUSDProxy'; import { Wei } from '@synthetixio/wei'; import { useCollateralPriceUpdates } from '@snx-v3/useCollateralPriceUpdates'; import { useGetUSDTokens } from '@snx-v3/useGetUSDTokens'; -import { ZEROWEI } from '../../ui/src/utils/constants'; +import { ZEROWEI } from '@snx-v3/constants'; import { AccountCollateralType } from '@snx-v3/useAccountCollateral'; export const useWithdrawBaseAndromeda = ({ diff --git a/liquidity/lib/withERC7412/package.json b/liquidity/lib/withERC7412/package.json index 3b7103005..8847fc2d0 100644 --- a/liquidity/lib/withERC7412/package.json +++ b/liquidity/lib/withERC7412/package.json @@ -7,10 +7,10 @@ "@pythnetwork/pyth-evm-js": "^1.42.0", "@snx-v3/constants": "workspace:*", "@snx-v3/contracts": "workspace:*", + "@snx-v3/parser": "workspace:*", "@snx-v3/tsHelpers": "workspace:*", "@snx-v3/useBlockchain": "workspace:*", "@snx-v3/zod": "workspace:*", - "@synthetixio/wei": "^2.74.4", "ethers": "^5.7.2", "viem": "^2.13.5", "zod": "^3.22.4" diff --git a/liquidity/lib/withERC7412/withERC7412.test.ts b/liquidity/lib/withERC7412/withERC7412.test.ts deleted file mode 100644 index 489885d0e..000000000 --- a/liquidity/lib/withERC7412/withERC7412.test.ts +++ /dev/null @@ -1,182 +0,0 @@ -import { wei } from '@synthetixio/wei'; -import { validatePosition } from '../validatePosition'; -test('handles undefined values', () => { - const result = validatePosition({ - issuanceRatioD18: undefined, - collateralAmount: undefined, - collateralValue: undefined, - debt: undefined, - collateralChange: wei(0), - debtChange: wei(0), - }); - expect(result).toEqual({ - isValid: true, - hasChanges: false, - newCRatio: wei(0), - newCollateralAmount: wei(0), - newDebt: wei(0), - maxDebt: wei(0), - }); -}); -test('handles no changes', () => { - const result = validatePosition({ - issuanceRatioD18: wei(3), - collateralAmount: wei(10), - collateralPrice: wei(2), - debt: wei(1), - collateralChange: wei(0), - debtChange: wei(0), - }); - expect(result).toEqual({ - isValid: true, - hasChanges: false, - newCRatio: wei(20), - newCollateralAmount: wei(10), - newDebt: wei(1), - maxDebt: wei('5.666666666666666666'), - }); -}); -test('handles no debt and no changes', () => { - const result = validatePosition({ - issuanceRatioD18: wei(3), - collateralAmount: wei(10), - collateralPrice: wei(2), - debt: wei(0), - collateralChange: wei(0), - debtChange: wei(0), - }); - expect(result).toEqual({ - isValid: true, - hasChanges: false, - newCRatio: wei(0), - newCollateralAmount: wei(10), - newDebt: wei(0), - maxDebt: wei('6.666666666666666666'), - }); -}); -test('handles debt increase from no debt', () => { - const result = validatePosition({ - issuanceRatioD18: wei(3), - collateralAmount: wei(10), - collateralPrice: wei(2), - debt: wei(0), - collateralChange: wei(0), - debtChange: wei(2), - }); - expect(result).toEqual({ - isValid: true, - hasChanges: true, - newCRatio: wei(10), - newCollateralAmount: wei(10), - newDebt: wei(2), - maxDebt: wei('6.666666666666666666'), - }); -}); -test('handles debt increase with existing debt', () => { - const result = validatePosition({ - issuanceRatioD18: wei(3), - collateralAmount: wei(10), - collateralPrice: wei(2), - debt: wei(1), - collateralChange: wei(0), - debtChange: wei(1), - }); - expect(result).toEqual({ - isValid: true, - hasChanges: true, - newCRatio: wei(10), - newCollateralAmount: wei(10), - newDebt: wei(2), - maxDebt: wei('5.666666666666666666'), - }); -}); -test('handles debt decrease with existing debt', () => { - const result = validatePosition({ - issuanceRatioD18: wei(3), - collateralAmount: wei(10), - collateralPrice: wei(2), - debt: wei(1), - collateralChange: wei(0), - debtChange: wei(-1), - }); - expect(result).toEqual({ - isValid: true, - hasChanges: true, - newCRatio: wei(0), - newCollateralAmount: wei(10), - newDebt: wei(0), - maxDebt: wei('5.666666666666666666'), - }); -}); -test('handles collateral deposited with no collateral', () => { - const result = validatePosition({ - issuanceRatioD18: wei(3), - collateralAmount: wei(0), - collateralPrice: wei(0), - debt: wei(0), - collateralChange: wei(10), - debtChange: wei(0), - }); - expect(result).toEqual({ - isValid: true, - hasChanges: true, - newCRatio: wei(0), - newCollateralAmount: wei(10), - newDebt: wei(0), - maxDebt: wei(0), - }); -}); -test('handles collateral deposit with existing collateral', () => { - const result = validatePosition({ - issuanceRatioD18: wei(3), - collateralAmount: wei(10), - collateralPrice: wei(0), - debt: wei(0), - collateralChange: wei(10), - debtChange: wei(0), - }); - expect(result).toEqual({ - isValid: true, - hasChanges: true, - newCRatio: wei(0), - newCollateralAmount: wei(20), - newDebt: wei(0), - maxDebt: wei(0), - }); -}); -test('handles collateral withdrawal ', () => { - const result = validatePosition({ - issuanceRatioD18: wei(3), - collateralAmount: wei(10), - collateralPrice: wei(0), - debt: wei(0), - collateralChange: wei(-10), - debtChange: wei(0), - }); - expect(result).toEqual({ - isValid: true, - hasChanges: true, - newCRatio: wei(0), - newCollateralAmount: wei(0), - newDebt: wei(0), - maxDebt: wei(0), - }); -}); -test('handles collateral withdrawal for more than we have deposited', () => { - const result = validatePosition({ - issuanceRatioD18: wei(3), - collateralAmount: wei(10), - collateralPrice: wei(0), - debt: wei(10), - collateralChange: wei(-30), - debtChange: wei(0), - }); - expect(result).toEqual({ - isValid: false, - hasChanges: true, - newCRatio: wei(0), - newCollateralAmount: wei(-20), - newDebt: wei(10), - maxDebt: wei(0), - }); -}); diff --git a/liquidity/lib/withERC7412/withERC7412.ts b/liquidity/lib/withERC7412/withERC7412.ts index e26a10f36..504f37c17 100644 --- a/liquidity/lib/withERC7412/withERC7412.ts +++ b/liquidity/lib/withERC7412/withERC7412.ts @@ -9,7 +9,7 @@ import type { Modify } from '@snx-v3/tsHelpers'; import { importCoreProxy, importMulticall3, importAllErrors } from '@snx-v3/contracts'; import { withMemoryCache } from './withMemoryCache'; import * as viem from 'viem'; -import { parseTxError } from '../parser'; +import { parseTxError } from '@snx-v3/parser'; export const ERC7412_ABI = [ 'error OracleDataRequired(address oracleContract, bytes oracleQuery)', diff --git a/liquidity/ui/src/components/Borrow/Borrow.tsx b/liquidity/ui/src/components/Borrow/Borrow.tsx index 030160dcd..23c4d4de2 100644 --- a/liquidity/ui/src/components/Borrow/Borrow.tsx +++ b/liquidity/ui/src/components/Borrow/Borrow.tsx @@ -14,7 +14,7 @@ import { useSystemToken } from '@snx-v3/useSystemToken'; import { validatePosition } from '@snx-v3/validatePosition'; import { wei } from '@synthetixio/wei'; import { useContext } from 'react'; -import { ZEROWEI } from '../../utils/constants'; +import { ZEROWEI } from '@snx-v3/constants'; export const Borrow = ({ liquidityPosition }: { liquidityPosition?: LiquidityPosition }) => { const params = useParams(); diff --git a/liquidity/ui/src/components/CRatioBar/CRatioChangeStat.tsx b/liquidity/ui/src/components/CRatioBar/CRatioChangeStat.tsx index 65e170bde..3e9494403 100644 --- a/liquidity/ui/src/components/CRatioBar/CRatioChangeStat.tsx +++ b/liquidity/ui/src/components/CRatioBar/CRatioChangeStat.tsx @@ -3,7 +3,7 @@ import { FC } from 'react'; import Wei from '@synthetixio/wei'; import { calculateCRatio } from '@snx-v3/calculations'; import { Amount } from '@snx-v3/Amount'; -import { ZEROWEI } from '../../utils/constants'; +import { ZEROWEI } from '@snx-v3/constants'; export const CRatioChangeStat: FC<{ collateralChange: Wei; diff --git a/liquidity/ui/src/components/Claim/Claim.tsx b/liquidity/ui/src/components/Claim/Claim.tsx index b8bb57847..82c0db241 100644 --- a/liquidity/ui/src/components/Claim/Claim.tsx +++ b/liquidity/ui/src/components/Claim/Claim.tsx @@ -8,7 +8,7 @@ import { LiquidityPosition } from '@snx-v3/useLiquidityPosition'; import Wei, { wei } from '@synthetixio/wei'; import { useNetwork } from '@snx-v3/useBlockchain'; import { isBaseAndromeda } from '@snx-v3/isBaseAndromeda'; -import { ZEROWEI } from '../../utils/constants'; +import { ZEROWEI } from '@snx-v3/constants'; import { useSystemToken } from '@snx-v3/useSystemToken'; import { TokenIcon } from '../TokenIcon'; import { validatePosition } from '@snx-v3/validatePosition'; diff --git a/liquidity/ui/src/components/ClosePosition/ClosePosition.tsx b/liquidity/ui/src/components/ClosePosition/ClosePosition.tsx index 17d8829d2..20baa32e5 100644 --- a/liquidity/ui/src/components/ClosePosition/ClosePosition.tsx +++ b/liquidity/ui/src/components/ClosePosition/ClosePosition.tsx @@ -13,7 +13,7 @@ import { useTokenPrice } from '@snx-v3/useTokenPrice'; import Wei from '@synthetixio/wei'; import { FC, useContext, useEffect, useState } from 'react'; import { useParams } from 'react-router-dom'; -import { ZEROWEI } from '../../utils/constants'; +import { ZEROWEI } from '@snx-v3/constants'; import { TokenIcon } from '../TokenIcon'; import { ClosePositionTransactions } from './ClosePositionTransactions'; diff --git a/liquidity/ui/src/components/ClosePosition/ClosePositionTransactions.tsx b/liquidity/ui/src/components/ClosePosition/ClosePositionTransactions.tsx index 5a3375783..1c0e77378 100644 --- a/liquidity/ui/src/components/ClosePosition/ClosePositionTransactions.tsx +++ b/liquidity/ui/src/components/ClosePosition/ClosePositionTransactions.tsx @@ -21,7 +21,7 @@ import { useUndelegate } from '@snx-v3/useUndelegate'; import { useUndelegateBaseAndromeda } from '@snx-v3/useUndelegateBaseAndromeda'; import { useQueryClient } from '@tanstack/react-query'; import { FC, ReactNode, useCallback, useContext, useEffect, useState } from 'react'; -import { ZEROWEI } from '../../utils/constants'; +import { ZEROWEI } from '@snx-v3/constants'; import { LiquidityPositionUpdated } from '../Manage/LiquidityPositionUpdated'; export const ClosePositionTransactions: FC<{ diff --git a/liquidity/ui/src/components/Deposit/Deposit.tsx b/liquidity/ui/src/components/Deposit/Deposit.tsx index c5297afe2..f7a700431 100644 --- a/liquidity/ui/src/components/Deposit/Deposit.tsx +++ b/liquidity/ui/src/components/Deposit/Deposit.tsx @@ -27,7 +27,7 @@ import { getSpotMarketId, isBaseAndromeda } from '@snx-v3/isBaseAndromeda'; import { useGetWrapperToken } from '@snx-v3/useGetUSDTokens'; import { WithdrawIncrease } from '@snx-v3/WithdrawIncrease'; import { formatNumber } from '@snx-v3/formatters'; -import { ZEROWEI } from '../../utils/constants'; +import { ZEROWEI } from '@snx-v3/constants'; import { useTokenPrice } from '@snx-v3/useTokenPrice'; import { TransactionSummary } from '../TransactionSummary/TransactionSummary'; import { currency } from '@snx-v3/format'; diff --git a/liquidity/ui/src/components/InitialDeposit/InitialDeposit.tsx b/liquidity/ui/src/components/InitialDeposit/InitialDeposit.tsx index 3d3b298c2..51bf8497f 100644 --- a/liquidity/ui/src/components/InitialDeposit/InitialDeposit.tsx +++ b/liquidity/ui/src/components/InitialDeposit/InitialDeposit.tsx @@ -31,7 +31,7 @@ import { WithdrawIncrease } from '@snx-v3/WithdrawIncrease'; import { formatNumber } from '@snx-v3/formatters'; import { ArrowBackIcon } from '@chakra-ui/icons'; import { LiquidityPosition } from '@snx-v3/useLiquidityPosition'; -import { ZEROWEI } from '../../utils/constants'; +import { ZEROWEI } from '@snx-v3/constants'; import { useTokenPrice } from '@snx-v3/useTokenPrice'; import { MigrationBanner } from '../Migration/MigrationBanner'; diff --git a/liquidity/ui/src/components/Manage/CollateralStats.tsx b/liquidity/ui/src/components/Manage/CollateralStats.tsx index 7a99fbfb6..23d3a8184 100644 --- a/liquidity/ui/src/components/Manage/CollateralStats.tsx +++ b/liquidity/ui/src/components/Manage/CollateralStats.tsx @@ -5,7 +5,7 @@ import { currency } from '@snx-v3/format'; import { LiquidityPosition } from '@snx-v3/useLiquidityPosition'; import { CollateralType } from '@snx-v3/useCollateralTypes'; import Wei from '@synthetixio/wei'; -import { ZEROWEI } from '../../utils/constants'; +import { ZEROWEI } from '@snx-v3/constants'; import { ChangeStat } from './ChangeStat'; export const CollateralStats: FC<{ diff --git a/liquidity/ui/src/components/Manage/DebtStats.tsx b/liquidity/ui/src/components/Manage/DebtStats.tsx index 788ee2c3e..ca90a6ee4 100644 --- a/liquidity/ui/src/components/Manage/DebtStats.tsx +++ b/liquidity/ui/src/components/Manage/DebtStats.tsx @@ -6,7 +6,7 @@ import { currency } from '@snx-v3/format'; import { LiquidityPosition } from '@snx-v3/useLiquidityPosition'; import { CollateralType } from '@snx-v3/useCollateralTypes'; import Wei from '@synthetixio/wei'; -import { ZEROWEI } from '../../utils/constants'; +import { ZEROWEI } from '@snx-v3/constants'; import { ChangeStat } from './ChangeStat'; import { isBaseAndromeda } from '@snx-v3/isBaseAndromeda'; import { useNetwork } from '@snx-v3/useBlockchain'; diff --git a/liquidity/ui/src/components/Manage/ManageStats.tsx b/liquidity/ui/src/components/Manage/ManageStats.tsx index 7b1db5085..92b76801c 100644 --- a/liquidity/ui/src/components/Manage/ManageStats.tsx +++ b/liquidity/ui/src/components/Manage/ManageStats.tsx @@ -14,7 +14,7 @@ import { CRatioBar } from '../CRatioBar/CRatioBar'; import { PnlStats } from './PnlStats'; import { DebtStats } from './DebtStats'; import { CollateralStats } from './CollateralStats'; -import { ZEROWEI } from '../../utils/constants'; +import { ZEROWEI } from '@snx-v3/constants'; export const ManageStatsUi: FC<{ liquidityPosition?: LiquidityPosition; diff --git a/liquidity/ui/src/components/Manage/NoPosition.tsx b/liquidity/ui/src/components/Manage/NoPosition.tsx index 00d1dfed9..504b010be 100644 --- a/liquidity/ui/src/components/Manage/NoPosition.tsx +++ b/liquidity/ui/src/components/Manage/NoPosition.tsx @@ -9,7 +9,7 @@ import { useCollateralType } from '@snx-v3/useCollateralTypes'; import { LiquidityPosition } from '@snx-v3/useLiquidityPosition'; import { useParams } from '@snx-v3/useParams'; import { FC, useContext, useState } from 'react'; -import { ZEROWEI } from '../../utils/constants'; +import { ZEROWEI } from '@snx-v3/constants'; import { CRatioBar } from '../CRatioBar/CRatioBar'; import { InitialDeposit } from '../InitialDeposit'; import { Rewards } from '../Rewards'; diff --git a/liquidity/ui/src/components/MigrateUSD/MigrateUSDModal.tsx b/liquidity/ui/src/components/MigrateUSD/MigrateUSDModal.tsx index b9f349614..d83ee80e5 100644 --- a/liquidity/ui/src/components/MigrateUSD/MigrateUSDModal.tsx +++ b/liquidity/ui/src/components/MigrateUSD/MigrateUSDModal.tsx @@ -10,7 +10,7 @@ import { } from '@chakra-ui/react'; import { FC, useCallback, useEffect, useState } from 'react'; import { StepIntro } from './StepIntro'; -import { ZEROWEI } from '../../utils/constants'; +import { ZEROWEI } from '@snx-v3/constants'; import { MigrateUSDTransaction } from './MigrateUSDTransaction'; import { Network } from '@snx-v3/useBlockchain'; import { StepSuccessFinal } from '../Migration/StepSuccessFinal'; diff --git a/liquidity/ui/src/components/MigrateUSD/MigrateUSDTransaction.tsx b/liquidity/ui/src/components/MigrateUSD/MigrateUSDTransaction.tsx index dcf80d95b..625e767ba 100644 --- a/liquidity/ui/src/components/MigrateUSD/MigrateUSDTransaction.tsx +++ b/liquidity/ui/src/components/MigrateUSD/MigrateUSDTransaction.tsx @@ -9,7 +9,7 @@ import { useV2sUSD } from '@snx-v3/useV2sUSD'; import { useLegacyMarket } from '@snx-v3/useLegacyMarket'; import { useMigrateUSD } from '@snx-v3/useMigrateUSD'; import { StepSuccess } from './StepSuccess'; -import { ZEROWEI } from '../../utils/constants'; +import { ZEROWEI } from '@snx-v3/constants'; import { useTokenBalance } from '@snx-v3/useTokenBalance'; import { useUSDProxyForChain } from '@snx-v3/useUSDProxy'; diff --git a/liquidity/ui/src/components/MigrateUSD/StepIntro.tsx b/liquidity/ui/src/components/MigrateUSD/StepIntro.tsx index 666a63417..b8f934f0f 100644 --- a/liquidity/ui/src/components/MigrateUSD/StepIntro.tsx +++ b/liquidity/ui/src/components/MigrateUSD/StepIntro.tsx @@ -13,7 +13,7 @@ import { NumberInput } from '@snx-v3/NumberInput'; import { Network } from '@snx-v3/useBlockchain'; import { useTokenBalance } from '@snx-v3/useTokenBalance'; import Wei from '@synthetixio/wei'; -import { ZEROWEI } from '../../utils/constants'; +import { ZEROWEI } from '@snx-v3/constants'; import { Amount } from '@snx-v3/Amount'; import { BorderBox } from '@snx-v3/BorderBox'; import { TokenIcon } from '../TokenIcon'; diff --git a/liquidity/ui/src/components/Migration/StepSummary.tsx b/liquidity/ui/src/components/Migration/StepSummary.tsx index de6c4aa9c..fc4806b70 100644 --- a/liquidity/ui/src/components/Migration/StepSummary.tsx +++ b/liquidity/ui/src/components/Migration/StepSummary.tsx @@ -26,7 +26,7 @@ import { formatEther } from 'ethers/lib/utils'; import { Amount } from '@snx-v3/Amount'; import { CRatioBadge } from '../CRatioBar/CRatioBadge'; import { useRates } from '@snx-v3/useRates'; -import { ZEROWEI } from '../../utils/constants'; +import { ZEROWEI } from '@snx-v3/constants'; import { useCollateralType } from '@snx-v3/useCollateralTypes'; export const StepSummary = ({ diff --git a/liquidity/ui/src/components/Pools/PoolCards/PoolRow.tsx b/liquidity/ui/src/components/Pools/PoolCards/PoolRow.tsx index 9e06d2dbf..cc652e3c2 100644 --- a/liquidity/ui/src/components/Pools/PoolCards/PoolRow.tsx +++ b/liquidity/ui/src/components/Pools/PoolCards/PoolRow.tsx @@ -19,7 +19,7 @@ import { Tooltip } from '@snx-v3/Tooltip'; import { useTokenBalanceForChain } from '@snx-v3/useTokenBalance'; import { getSpotMarketId, isBaseAndromeda } from '@snx-v3/isBaseAndromeda'; import { useGetWrapperToken } from '@snx-v3/useGetUSDTokens'; -import { ZEROWEI } from '../../../utils/constants'; +import { ZEROWEI } from '@snx-v3/constants'; import { MigrationBanner } from '../../Migration/MigrationBanner'; import { Specifics } from './Specifics'; diff --git a/liquidity/ui/src/components/Repay/Repay.tsx b/liquidity/ui/src/components/Repay/Repay.tsx index 21de134b9..4baabf5e6 100644 --- a/liquidity/ui/src/components/Repay/Repay.tsx +++ b/liquidity/ui/src/components/Repay/Repay.tsx @@ -12,7 +12,7 @@ import { useTokenPrice } from '@snx-v3/useTokenPrice'; import { wei } from '@synthetixio/wei'; import { useContext } from 'react'; import { useParams } from 'react-router-dom'; -import { ZEROWEI } from '../../utils/constants'; +import { ZEROWEI } from '@snx-v3/constants'; import { TokenIcon } from '../TokenIcon'; import { RepayAllDebt } from './'; diff --git a/liquidity/ui/src/components/Stats/StatsList.tsx b/liquidity/ui/src/components/Stats/StatsList.tsx index 9c185f0e6..836c81c30 100644 --- a/liquidity/ui/src/components/Stats/StatsList.tsx +++ b/liquidity/ui/src/components/Stats/StatsList.tsx @@ -18,7 +18,7 @@ import { useCollateralTypes } from '@snx-v3/useCollateralTypes'; import { useGetUSDTokens } from '@snx-v3/useGetUSDTokens'; import { useSystemToken } from '@snx-v3/useSystemToken'; import { Amount } from '@snx-v3/Amount'; -import { ZEROWEI } from '../../utils/constants'; +import { ZEROWEI } from '@snx-v3/constants'; import { wei } from '@synthetixio/wei'; export const StatsList = () => { diff --git a/liquidity/ui/src/components/Undelegate/Undelegate.tsx b/liquidity/ui/src/components/Undelegate/Undelegate.tsx index 197cddf37..8f2d03552 100644 --- a/liquidity/ui/src/components/Undelegate/Undelegate.tsx +++ b/liquidity/ui/src/components/Undelegate/Undelegate.tsx @@ -23,7 +23,7 @@ import { isBaseAndromeda } from '@snx-v3/isBaseAndromeda'; import { useNetwork } from '@snx-v3/useBlockchain'; import { TokenIcon } from '../TokenIcon'; import { useTokenPrice } from '@snx-v3/useTokenPrice'; -import { ZEROWEI } from '../../utils/constants'; +import { ZEROWEI } from '@snx-v3/constants'; import { CRatioChangeStat } from '../CRatioBar/CRatioChangeStat'; import { ChangeStat } from '../Manage'; import { currency } from '@snx-v3/format'; diff --git a/liquidity/ui/src/components/Withdraw/Withdraw.tsx b/liquidity/ui/src/components/Withdraw/Withdraw.tsx index 2a5b549d8..66cd4bef4 100644 --- a/liquidity/ui/src/components/Withdraw/Withdraw.tsx +++ b/liquidity/ui/src/components/Withdraw/Withdraw.tsx @@ -14,7 +14,7 @@ import { useTokenPrice } from '@snx-v3/useTokenPrice'; import { useWithdrawTimer } from '@snx-v3/useWithdrawTimer'; import { useContext, useMemo } from 'react'; import { useParams } from 'react-router-dom'; -import { ZEROWEI } from '../../utils/constants'; +import { ZEROWEI } from '@snx-v3/constants'; import { TokenIcon } from '../TokenIcon'; export const Withdraw = ({ diff --git a/liquidity/ui/src/layouts/Default/NetworkController.tsx b/liquidity/ui/src/layouts/Default/NetworkController.tsx index 35fbd7b12..a6eefc547 100644 --- a/liquidity/ui/src/layouts/Default/NetworkController.tsx +++ b/liquidity/ui/src/layouts/Default/NetworkController.tsx @@ -18,7 +18,7 @@ import { WalletIcon } from '@snx-v3/icons'; import { NetworkIcon, useNetwork, useWallet, NETWORKS } from '@snx-v3/useBlockchain'; import { prettyString } from '@snx-v3/format'; import { useLocalStorage } from '@snx-v3/useLocalStorage'; -import { LOCAL_STORAGE_KEYS } from '../../utils/constants'; +import { LOCAL_STORAGE_KEYS } from '@snx-v3/constants'; import { CopyIcon, SettingsIcon } from '@chakra-ui/icons'; import { useAccounts, useCreateAccount } from '@snx-v3/useAccounts'; import { useLocation, useNavigate, useSearchParams } from 'react-router-dom'; diff --git a/liquidity/ui/src/utils/assets.ts b/liquidity/ui/src/utils/assets.ts index e078aa7cb..8ee16664b 100644 --- a/liquidity/ui/src/utils/assets.ts +++ b/liquidity/ui/src/utils/assets.ts @@ -1,7 +1,7 @@ import { AccountCollateralType } from '@snx-v3/useAccountCollateral'; import { CollateralType } from '@snx-v3/useCollateralTypes'; import Wei, { wei } from '@synthetixio/wei'; -import { ONEWEI, ZEROWEI } from './constants'; +import { ONEWEI, ZEROWEI } from '@snx-v3/constants'; export interface Asset { collateral: AccountCollateralType; diff --git a/liquidity/ui/src/utils/constants.ts b/liquidity/ui/src/utils/constants.ts deleted file mode 100644 index ca8cb0921..000000000 --- a/liquidity/ui/src/utils/constants.ts +++ /dev/null @@ -1,9 +0,0 @@ -import Wei from '@synthetixio/wei'; -import { constants } from 'ethers'; - -export const LOCAL_STORAGE_KEYS = { - SHOW_TESTNETS: 'SHOW_TESTNETS', -}; -export const ZEROWEI = new Wei(0); -export const ONEWEI = new Wei(1); -export const MAXUINT = new Wei(constants.MaxUint256); diff --git a/yarn.lock b/yarn.lock index 414f5b707..3f3c23501 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5014,6 +5014,7 @@ __metadata: "@snx-v3/ContractError": "workspace:*" "@snx-v3/ManagePositionContext": "workspace:*" "@snx-v3/Multistep": "workspace:*" + "@snx-v3/constants": "workspace:*" "@snx-v3/isBaseAndromeda": "workspace:*" "@snx-v3/txnReducer": "workspace:*" "@snx-v3/useBlockchain": "workspace:*" @@ -5039,6 +5040,7 @@ __metadata: "@snx-v3/ContractError": "workspace:*" "@snx-v3/ManagePositionContext": "workspace:*" "@snx-v3/Multistep": "workspace:*" + "@snx-v3/constants": "workspace:*" "@snx-v3/isBaseAndromeda": "workspace:*" "@snx-v3/txnReducer": "workspace:*" "@snx-v3/useBlockchain": "workspace:*" @@ -5088,6 +5090,7 @@ __metadata: "@snx-v3/ContractError": "workspace:*" "@snx-v3/ManagePositionContext": "workspace:*" "@snx-v3/Multistep": "workspace:*" + "@snx-v3/constants": "workspace:*" "@snx-v3/format": "workspace:*" "@snx-v3/isBaseAndromeda": "workspace:*" "@snx-v3/useApprove": "workspace:*" @@ -5202,6 +5205,7 @@ __metadata: "@snx-v3/ContractError": "workspace:*" "@snx-v3/ManagePositionContext": "workspace:*" "@snx-v3/Multistep": "workspace:*" + "@snx-v3/constants": "workspace:*" "@snx-v3/format": "workspace:*" "@snx-v3/isBaseAndromeda": "workspace:*" "@snx-v3/useApprove": "workspace:*" @@ -5263,6 +5267,7 @@ __metadata: "@snx-v3/ContractError": "workspace:*" "@snx-v3/ManagePositionContext": "workspace:*" "@snx-v3/Multistep": "workspace:*" + "@snx-v3/constants": "workspace:*" "@snx-v3/format": "workspace:*" "@snx-v3/isBaseAndromeda": "workspace:*" "@snx-v3/useBlockchain": "workspace:*" @@ -5300,6 +5305,7 @@ __metadata: "@snx-v3/ContractError": "workspace:*" "@snx-v3/ManagePositionContext": "workspace:*" "@snx-v3/Multistep": "workspace:*" + "@snx-v3/constants": "workspace:*" "@snx-v3/isBaseAndromeda": "workspace:*" "@snx-v3/useAccountCollateral": "workspace:*" "@snx-v3/useBlockchain": "workspace:*" @@ -5327,6 +5333,7 @@ __metadata: version: 0.0.0-use.local resolution: "@snx-v3/calculations@workspace:liquidity/lib/calculations" dependencies: + "@snx-v3/constants": "workspace:*" "@snx-v3/usePoolData": "workspace:*" "@synthetixio/wei": "npm:^2.74.4" zod: "npm:^3.22.4" @@ -5336,6 +5343,9 @@ __metadata: "@snx-v3/constants@workspace:*, @snx-v3/constants@workspace:liquidity/lib/constants": version: 0.0.0-use.local resolution: "@snx-v3/constants@workspace:liquidity/lib/constants" + dependencies: + "@synthetixio/wei": "npm:^2.74.4" + ethers: "npm:^5.7.2" languageName: unknown linkType: soft @@ -5695,7 +5705,7 @@ __metadata: languageName: unknown linkType: soft -"@snx-v3/parser@workspace:liquidity/lib/parser": +"@snx-v3/parser@workspace:*, @snx-v3/parser@workspace:liquidity/lib/parser": version: 0.0.0-use.local resolution: "@snx-v3/parser@workspace:liquidity/lib/parser" dependencies: @@ -5721,6 +5731,7 @@ __metadata: dependencies: "@snx-v3/tsHelpers": "workspace:*" "@snx-v3/useBlockchain": "workspace:*" + "@snx-v3/useCollateralPriceUpdates": "workspace:*" "@snx-v3/useCollateralTypes": "workspace:*" "@snx-v3/useCoreProxy": "workspace:*" "@snx-v3/useSystemToken": "workspace:*" @@ -5924,10 +5935,12 @@ __metadata: "@snx-v3/txnReducer": "workspace:*" "@snx-v3/useAllCollateralPriceIds": "workspace:*" "@snx-v3/useBlockchain": "workspace:*" + "@snx-v3/useCollateralPriceUpdates": "workspace:*" "@snx-v3/useCoreProxy": "workspace:*" "@snx-v3/useGasOptions": "workspace:*" "@snx-v3/useGasPrice": "workspace:*" "@snx-v3/useGasSpeed": "workspace:*" + "@snx-v3/useSpotMarketProxy": "workspace:*" "@snx-v3/withERC7412": "workspace:*" "@synthetixio/wei": "npm:^2.74.4" "@tanstack/react-query": "npm:^5.8.3" @@ -5961,6 +5974,7 @@ __metadata: "@snx-v3/isBaseAndromeda": "workspace:*" "@snx-v3/tsHelpers": "workspace:*" "@snx-v3/useBlockchain": "workspace:*" + "@snx-v3/useCollateralPriceUpdates": "workspace:*" "@snx-v3/useCollateralTypes": "workspace:*" "@snx-v3/useCoreProxy": "workspace:*" "@snx-v3/useGetUSDTokens": "workspace:*" @@ -6044,12 +6058,14 @@ __metadata: "@snx-v3/txnReducer": "workspace:*" "@snx-v3/useApprove": "workspace:*" "@snx-v3/useBlockchain": "workspace:*" + "@snx-v3/useCollateralPriceUpdates": "workspace:*" "@snx-v3/useCollateralTypes": "workspace:*" "@snx-v3/useCoreProxy": "workspace:*" "@snx-v3/useGasOptions": "workspace:*" "@snx-v3/useGasPrice": "workspace:*" "@snx-v3/useGasSpeed": "workspace:*" "@snx-v3/useGetUSDTokens": "workspace:*" + "@snx-v3/useSpotMarketProxy": "workspace:*" "@snx-v3/withERC7412": "workspace:*" "@synthetixio/wei": "npm:^2.74.4" "@tanstack/react-query": "npm:^5.8.3" @@ -6157,6 +6173,7 @@ __metadata: "@snx-v3/tsHelpers": "workspace:*" "@snx-v3/useAccountCollateral": "workspace:*" "@snx-v3/useBlockchain": "workspace:*" + "@snx-v3/useCollateralPriceUpdates": "workspace:*" "@snx-v3/useCollateralPrices": "workspace:*" "@snx-v3/useCollateralTypes": "workspace:*" "@snx-v3/useCoreProxy": "workspace:*" @@ -6178,6 +6195,7 @@ __metadata: "@snx-v3/calculations": "workspace:*" "@snx-v3/tsHelpers": "workspace:*" "@snx-v3/useBlockchain": "workspace:*" + "@snx-v3/useCollateralPriceUpdates": "workspace:*" "@snx-v3/useCollateralPrices": "workspace:*" "@snx-v3/useCollateralTypes": "workspace:*" "@snx-v3/useCoreProxy": "workspace:*" @@ -6224,6 +6242,8 @@ __metadata: version: 0.0.0-use.local resolution: "@snx-v3/useMigrate@workspace:liquidity/lib/useMigrate" dependencies: + "@snx-v3/constants": "workspace:*" + "@snx-v3/parser": "workspace:*" "@snx-v3/useBlockchain": "workspace:*" "@snx-v3/useGasOptions": "workspace:*" "@snx-v3/useGasPrice": "workspace:*" @@ -6239,6 +6259,8 @@ __metadata: version: 0.0.0-use.local resolution: "@snx-v3/useMigrateUSD@workspace:liquidity/lib/useMigrateUSD" dependencies: + "@snx-v3/constants": "workspace:*" + "@snx-v3/parser": "workspace:*" "@snx-v3/useBlockchain": "workspace:*" "@snx-v3/useGasOptions": "workspace:*" "@snx-v3/useGasPrice": "workspace:*" @@ -6304,6 +6326,7 @@ __metadata: "@snx-v3/fetchPythPrices": "workspace:*" "@snx-v3/useAllCollateralPriceIds": "workspace:*" "@snx-v3/useBlockchain": "workspace:*" + "@snx-v3/useCollateralPriceUpdates": "workspace:*" "@snx-v3/useCoreProxy": "workspace:*" "@snx-v3/withERC7412": "workspace:*" "@snx-v3/zod": "workspace:*" @@ -6371,6 +6394,7 @@ __metadata: version: 0.0.0-use.local resolution: "@snx-v3/useRepay@workspace:liquidity/lib/useRepay" dependencies: + "@snx-v3/constants": "workspace:*" "@snx-v3/fetchPythPrices": "workspace:*" "@snx-v3/tsHelpers": "workspace:*" "@snx-v3/txnReducer": "workspace:*" @@ -6399,11 +6423,13 @@ __metadata: "@snx-v3/txnReducer": "workspace:*" "@snx-v3/useApprove": "workspace:*" "@snx-v3/useBlockchain": "workspace:*" + "@snx-v3/useCollateralPriceUpdates": "workspace:*" "@snx-v3/useCoreProxy": "workspace:*" "@snx-v3/useGasOptions": "workspace:*" "@snx-v3/useGasPrice": "workspace:*" "@snx-v3/useGasSpeed": "workspace:*" "@snx-v3/useGetUSDTokens": "workspace:*" + "@snx-v3/useSpotMarketProxy": "workspace:*" "@snx-v3/useSystemToken": "workspace:*" "@snx-v3/withERC7412": "workspace:*" "@synthetixio/wei": "npm:^2.74.4" @@ -6485,6 +6511,7 @@ __metadata: resolution: "@snx-v3/useTokenBalance@workspace:liquidity/lib/useTokenBalance" dependencies: "@snx-v3/assertAddressType": "workspace:*" + "@snx-v3/constants": "workspace:*" "@snx-v3/useBlockchain": "workspace:*" "@snx-v3/zod": "workspace:*" "@synthetixio/wei": "npm:^2.74.4" @@ -6509,6 +6536,7 @@ __metadata: version: 0.0.0-use.local resolution: "@snx-v3/useTokenPrice@workspace:liquidity/lib/useTokenPrice" dependencies: + "@snx-v3/constants": "workspace:*" "@snx-v3/useCollateralPriceUpdates": "workspace:*" "@snx-v3/useCollateralTypes": "workspace:*" "@snx-v3/useOraclePrice": "workspace:*" @@ -6581,12 +6609,15 @@ __metadata: "@snx-v3/useAllCollateralPriceIds": "workspace:*" "@snx-v3/useApprove": "workspace:*" "@snx-v3/useBlockchain": "workspace:*" + "@snx-v3/useClearDebt": "workspace:*" + "@snx-v3/useCollateralPriceUpdates": "workspace:*" "@snx-v3/useCoreProxy": "workspace:*" "@snx-v3/useGasOptions": "workspace:*" "@snx-v3/useGasPrice": "workspace:*" "@snx-v3/useGasSpeed": "workspace:*" "@snx-v3/useGetUSDTokens": "workspace:*" "@snx-v3/useLiquidityPosition": "workspace:*" + "@snx-v3/useSpotMarketProxy": "workspace:*" "@snx-v3/withERC7412": "workspace:*" "@synthetixio/wei": "npm:^2.74.4" "@tanstack/react-query": "npm:^5.8.3" @@ -6640,6 +6671,7 @@ __metadata: "@snx-v3/tsHelpers": "workspace:*" "@snx-v3/useAllCollateralPriceIds": "workspace:*" "@snx-v3/useBlockchain": "workspace:*" + "@snx-v3/useCollateralPriceUpdates": "workspace:*" "@snx-v3/useCollateralTypes": "workspace:*" "@snx-v3/useCoreProxy": "workspace:*" "@snx-v3/withERC7412": "workspace:*" @@ -6676,6 +6708,7 @@ __metadata: version: 0.0.0-use.local resolution: "@snx-v3/useWithdrawBaseAndromeda@workspace:liquidity/lib/useWithdrawBaseAndromeda" dependencies: + "@snx-v3/constants": "workspace:*" "@snx-v3/isBaseAndromeda": "workspace:*" "@snx-v3/tsHelpers": "workspace:*" "@snx-v3/txnReducer": "workspace:*" @@ -6687,6 +6720,7 @@ __metadata: "@snx-v3/useGasPrice": "workspace:*" "@snx-v3/useGasSpeed": "workspace:*" "@snx-v3/useGetUSDTokens": "workspace:*" + "@snx-v3/useSpotMarketProxy": "workspace:*" "@snx-v3/useUSDProxy": "workspace:*" "@snx-v3/withERC7412": "workspace:*" "@synthetixio/wei": "npm:^2.74.4" @@ -6737,10 +6771,10 @@ __metadata: "@pythnetwork/pyth-evm-js": "npm:^1.42.0" "@snx-v3/constants": "workspace:*" "@snx-v3/contracts": "workspace:*" + "@snx-v3/parser": "workspace:*" "@snx-v3/tsHelpers": "workspace:*" "@snx-v3/useBlockchain": "workspace:*" "@snx-v3/zod": "workspace:*" - "@synthetixio/wei": "npm:^2.74.4" ethers: "npm:^5.7.2" viem: "npm:^2.13.5" zod: "npm:^3.22.4"