diff --git a/src/components/contextual/pages/pool/PoolTransactionsCard/BoostedPoolActivities/Activities.vue b/src/components/contextual/pages/pool/PoolTransactionsCard/BoostedPoolActivities/Activities.vue deleted file mode 100644 index 01dcf8e1fa..0000000000 --- a/src/components/contextual/pages/pool/PoolTransactionsCard/BoostedPoolActivities/Activities.vue +++ /dev/null @@ -1,74 +0,0 @@ - - - - - diff --git a/src/components/contextual/pages/pool/PoolTransactionsCard/InvestmentTransactions/InvestmentTransactions.vue b/src/components/contextual/pages/pool/PoolTransactionsCard/InvestmentTransactions/InvestmentTransactions.vue index 35eefc3b4c..b0ece32208 100644 --- a/src/components/contextual/pages/pool/PoolTransactionsCard/InvestmentTransactions/InvestmentTransactions.vue +++ b/src/components/contextual/pages/pool/PoolTransactionsCard/InvestmentTransactions/InvestmentTransactions.vue @@ -5,7 +5,7 @@ import { useI18n } from 'vue-i18n'; import { usePoolHelpers } from '@/composables/usePoolHelpers'; import { Pool } from '@/services/pool/types'; -import BoostedActivities from '../BoostedPoolActivities/Activities.vue'; +// import BoostedActivities from '../BoostedPoolActivities/Activities.vue'; import Activities from '../PoolActivities/Activities.vue'; import { PoolTransactionsTab } from '../types'; import useWeb3 from '@/services/web3/useWeb3'; @@ -98,36 +98,19 @@ const title = computed((): string => { - - - + - - - - - - - - + diff --git a/src/components/contextual/pages/pools/StakedPoolsTable.vue b/src/components/contextual/pages/pools/StakedPoolsTable.vue deleted file mode 100644 index f299d76369..0000000000 --- a/src/components/contextual/pages/pools/StakedPoolsTable.vue +++ /dev/null @@ -1,229 +0,0 @@ - - - - - - - {{ $t('staking.stakedPools') }} - - - - - - - - - - - - - - - - - - diff --git a/src/components/contextual/pages/pools/UnstakedPoolsTable.vue b/src/components/contextual/pages/pools/UnstakedPoolsTable.vue deleted file mode 100644 index 0086f35699..0000000000 --- a/src/components/contextual/pages/pools/UnstakedPoolsTable.vue +++ /dev/null @@ -1,104 +0,0 @@ - - - - - - - {{ $t('staking.unstakedPools') }} - - - - - - diff --git a/src/components/contextual/pages/vebal/MyVeBAL/MyVeBAL.vue b/src/components/contextual/pages/vebal/MyVeBAL/MyVeBAL.vue index cd77428492..e18943df20 100644 --- a/src/components/contextual/pages/vebal/MyVeBAL/MyVeBAL.vue +++ b/src/components/contextual/pages/vebal/MyVeBAL/MyVeBAL.vue @@ -21,9 +21,7 @@ const { * COMPUTED */ -const isLoading = computed( - () => isLoadingLockPool.value || isLoadingLockInfo.value -); +const isLoading = computed(() => isLoadingLockPool || isLoadingLockInfo.value); diff --git a/src/components/contextual/pages/vebal/MyVebalInfo.vue b/src/components/contextual/pages/vebal/MyVebalInfo.vue index 1cb4f9db7e..15bfd9e074 100644 --- a/src/components/contextual/pages/vebal/MyVebalInfo.vue +++ b/src/components/contextual/pages/vebal/MyVebalInfo.vue @@ -58,7 +58,7 @@ const isLoadingData = computed(() => { isLoadingLockBoard.value || isLoading.value || isLoadingLockInfo.value || - isLoadingLockPool.value || + isLoadingLockPool || isLoadingVebalBalance.value ); }); diff --git a/src/components/forms/lock_actions/LockForm/LockForm.vue b/src/components/forms/lock_actions/LockForm/LockForm.vue index cbc940d4a5..2573b04489 100644 --- a/src/components/forms/lock_actions/LockForm/LockForm.vue +++ b/src/components/forms/lock_actions/LockForm/LockForm.vue @@ -2,11 +2,9 @@ import { computed } from 'vue'; import Col3Layout from '@/components/layouts/Col3Layout.vue'; -import usePoolQuery from '@/composables/queries/usePoolQuery'; import useVeBalLockInfoQuery from '@/composables/queries/useVeBalLockInfoQuery'; import useBreakpoints from '@/composables/useBreakpoints'; import { useTokens } from '@/providers/tokens.provider'; -import useVeBal from '@/composables/useVeBAL'; import { Pool } from '@/services/pool/types'; import useWeb3 from '@/services/web3/useWeb3'; @@ -14,31 +12,30 @@ import HowToLock from './components/HowToLock.vue'; import LockableTokens from './components/LockableTokens.vue'; import MyVeBAL from './components/MyVeBAL.vue'; import VeBalForm from './components/VeBalForm/VeBalForm.vue'; +import { staticLockPool } from '@/composables/useLock'; /** * COMPOSABLES */ const { getToken } = useTokens(); const { isWalletReady } = useWeb3(); -const { lockablePoolId } = useVeBal(); +// const { lockablePoolId } = useVeBal(); const { isDesktop, isMobile } = useBreakpoints(); /** * QUERIES */ -const lockablePoolQuery = usePoolQuery(lockablePoolId.value as string); +// const lockablePoolQuery = usePoolQuery(lockablePoolId.value as string); const veBalLockInfoQuery = useVeBalLockInfoQuery(); /** * COMPUTED */ -const lockablePoolLoading = computed(() => lockablePoolQuery.isLoading.value); +const lockablePoolLoading = computed(() => false); const veBalQueryLoading = computed(() => veBalLockInfoQuery.isLoading.value); -const lockablePool = computed( - () => lockablePoolQuery.data.value -); +const lockablePool = computed(() => staticLockPool); const lockablePoolTokenInfo = computed(() => lockablePool.value != null ? getToken(lockablePool.value.address) : null diff --git a/src/components/forms/lock_actions/UnlockForm/UnlockForm.vue b/src/components/forms/lock_actions/UnlockForm/UnlockForm.vue index 2a4d9d3b08..b59ff48229 100644 --- a/src/components/forms/lock_actions/UnlockForm/UnlockForm.vue +++ b/src/components/forms/lock_actions/UnlockForm/UnlockForm.vue @@ -2,39 +2,36 @@ import { computed } from 'vue'; import Col3Layout from '@/components/layouts/Col3Layout.vue'; -import usePoolQuery from '@/composables/queries/usePoolQuery'; import useVeBalLockInfoQuery from '@/composables/queries/useVeBalLockInfoQuery'; import { useTokens } from '@/providers/tokens.provider'; -import useVeBal from '@/composables/useVeBAL'; import { Pool } from '@/services/pool/types'; import useWeb3 from '@/services/web3/useWeb3'; import MyVeBAL from '../LockForm/components/MyVeBAL.vue'; import VeBalUnlockForm from './components/VeBalUnlockForm/VeBalUnlockForm.vue'; +import { staticLockPool } from '@/composables/useLock'; /** * COMPOSABLES */ const { getToken } = useTokens(); const { isWalletReady } = useWeb3(); -const { lockablePoolId } = useVeBal(); +// const { lockablePoolId } = useVeBal(); /** * QUERIES */ -const lockablePoolQuery = usePoolQuery(lockablePoolId.value as string); +// const lockablePoolQuery = usePoolQuery(lockablePoolId.value as string); const veBalLockInfoQuery = useVeBalLockInfoQuery(); /** * COMPUTED */ -const lockablePoolLoading = computed(() => lockablePoolQuery.isLoading.value); +const lockablePoolLoading = computed(() => false); const veBalQueryLoading = computed(() => veBalLockInfoQuery.isLoading.value); -const lockablePool = computed( - () => lockablePoolQuery.data.value -); +const lockablePool = computed(() => staticLockPool); const lockablePoolTokenInfo = computed(() => lockablePool.value != null ? getToken(lockablePool.value.address) : null diff --git a/src/components/heros/PortfolioPageHero.vue b/src/components/heros/PortfolioPageHero.vue deleted file mode 100644 index 39bac42941..0000000000 --- a/src/components/heros/PortfolioPageHero.vue +++ /dev/null @@ -1,167 +0,0 @@ - - - - - - - - - - {{ totalInvestedLabel }} - - - - - - {{ l2VeBalBalances?.[networkId] }} - {{ $t('veBAL.hero.tokens.veBAL') }} - - {{ totalLockedValue }} {{ $t('veBAL.hero.tokens.veBAL') }} - {{ $t('inclXInVeBal', [totalVeBalLabel]) }} - - - - - - - - - - - - {{ fNum('0', FNumFormats.fiat) }} - - - - - - - - - diff --git a/src/composables/queries/useUserPoolSharesQuery.spec.ts b/src/composables/queries/useUserPoolSharesQuery.spec.ts deleted file mode 100644 index 19eb5eebd7..0000000000 --- a/src/composables/queries/useUserPoolSharesQuery.spec.ts +++ /dev/null @@ -1,17 +0,0 @@ -import useUserPoolSharesQuery from '@/composables/queries/useUserPoolSharesQuery'; -import { initDependenciesWithDefaultMocks } from '@/dependencies/default-mocks'; -import { mountComposable, waitForQueryData } from '@tests/mount-helpers'; -import { defaultPoolBalance } from '@tests/msw/graphql-handlers'; - -initDependenciesWithDefaultMocks(); - -test.skip('Returns pool shares for the current user', async () => { - const { result } = mountComposable(() => useUserPoolSharesQuery()); - - const data = await waitForQueryData(result); - - expect(data).toEqual({ - '0xe053685f16968a350c8dea6420281a41f72ce3aa00020000000000000000006b': - defaultPoolBalance, - }); -}); diff --git a/src/composables/useLock.ts b/src/composables/useLock.ts index 688d4e178e..1b18c65b42 100644 --- a/src/composables/useLock.ts +++ b/src/composables/useLock.ts @@ -1,49 +1,138 @@ -import { Pool } from '@/services/pool/types'; +import { Pool, PoolType } from '@/services/pool/types'; import { TokenInfo } from '@/types/TokenList'; import { useTokens } from '@/providers/tokens.provider'; import { useUserData } from '@/providers/user-data.provider'; -import usePoolQuery from './queries/usePoolQuery'; import { fiatValueOf } from './usePoolHelpers'; -import useVeBal, { isVeBalSupported } from './useVeBAL'; import { bnum } from '@/lib/utils'; +export const staticLockPool: Pool = { + id: '0x5c6ee304399dbdb9c8ef030ab642b10820db8f56000200000000000000000014', + name: 'Balancer 80 BAL 20 WETH', + address: '0x5c6ee304399dbdb9c8ef030ab642b10820db8f56', + chainId: 1, + poolType: PoolType.Weighted, + poolTypeVersion: 1, + swapFee: '0.005', + swapEnabled: true, + protocolYieldFeeCache: '0.5', + protocolSwapFeeCache: '0.5', + owner: '0xba1ba1ba1ba1ba1ba1ba1ba1ba1ba1ba1ba1ba1b', + factory: '0xa5bf2ddf098bb0ef6d120c98217dd6b141c74ee0', + symbol: 'B-80BAL-20WETH', + tokens: [ + { + address: '0xba100000625a3754423978a60c9317c58a424e3d', + balance: '19385573.977733216984154245', + decimals: 18, + isExemptFromYieldProtocolFee: false, + priceRate: '1', + symbol: 'BAL', + token: { + pool: null, + latestUSDPrice: '3.020051763151765590907891699486145', + }, + weight: '0.8', + }, + { + address: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', + balance: '3708.004332746461130832', + decimals: 18, + isExemptFromYieldProtocolFee: false, + priceRate: '1', + symbol: 'WETH', + token: { + pool: null, + latestUSDPrice: '2544.423752510128812336112279381925', + }, + weight: '0.2', + }, + ], + tokensList: [ + '0xba100000625a3754423978a60c9317c58a424e3d', + '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', + ], + tokenAddresses: [ + '0xba100000625a3754423978a60c9317c58a424e3d', + '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', + ], + totalLiquidity: '67980171.169812751723110183', + totalShares: '6792743.266911456277523322', + totalSwapFee: '6173259.879907230383616330051651873', + totalSwapVolume: '1398500114.898508628102297818442082', + priceRateProviders: [], + createTime: 1620153071, + totalWeight: '1', + lowerTarget: '0', + upperTarget: '0', + isInRecoveryMode: false, + isPaused: false, + isNew: false, + onchain: { + tokens: { + '0xba100000625a3754423978a60c9317c58a424e3d': { + decimals: 18, + balance: '19385573.977733216984154245', + weight: 0.8, + symbol: 'BAL', + name: 'Balancer', + logoURI: + 'https://raw.githubusercontent.com/balancer/tokenlists/main/src/assets/images/tokens/0xba100000625a3754423978a60c9317c58a424e3d.png', + }, + '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2': { + decimals: 18, + balance: '3708.004332746461130832', + weight: 0.2, + symbol: 'WETH', + name: 'Wrapped Ether', + logoURI: + 'https://raw.githubusercontent.com/balancer/tokenlists/main/src/assets/images/tokens/0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2.png', + }, + }, + amp: '0', + swapEnabled: true, + totalSupply: '6792743.266911456277523322', + decimals: 18, + swapFee: '0.005', + }, + feesSnapshot: '866.901337693887527854586071982', + volumeSnapshot: '333819.702829775009564326720188', +}; + interface Options { enabled?: boolean; } +// eslint-disable-next-line @typescript-eslint/no-unused-vars export function useLock({ enabled = true }: Options = {}) { /** * COMPOSABLES */ - const { lockablePoolId } = useVeBal(); + // const { lockablePoolId } = useVeBal(); const { getToken, balanceFor } = useTokens(); /** * QUERIES */ - const shouldFetchLockPool = computed( - (): boolean => isVeBalSupported.value && enabled - ); - const lockPoolQuery = usePoolQuery( - lockablePoolId.value as string, - shouldFetchLockPool - ); + // const shouldFetchLockPool = computed( + // (): boolean => isVeBalSupported.value && enabled + // ); + // const lockPoolQuery = usePoolQuery( + // lockablePoolId.value as string, + // shouldFetchLockPool + // ); const { lockQuery } = useUserData(); /** * COMPUTED */ - const isLoadingLockPool = computed( - (): boolean => lockPoolQuery.isLoading.value - ); + const isLoadingLockPool = false; const isLoadingLockInfo = computed((): boolean => lockQuery.isLoading.value); - const isLoadingLock = computed( - (): boolean => isLoadingLockPool.value || isLoadingLockInfo.value - ); + const isLoadingLock = computed((): boolean => isLoadingLockInfo.value); - const lockPool = computed(() => lockPoolQuery.data.value); + const lockPool = computed(() => staticLockPool); + console.log('lockPool', lockPool.value); const lockPoolToken = computed((): TokenInfo | null => lockPool.value != null ? getToken(lockPool.value.address) : null diff --git a/src/constants/exploits.ts b/src/constants/exploits.ts index 03593a6815..e0b45c1271 100644 --- a/src/constants/exploits.ts +++ b/src/constants/exploits.ts @@ -8,7 +8,7 @@ export type Exploits = Record< } >; -export const WALLET_SCREEN_ENDPOINT = 'https://api.balancer.fi/check-wallet'; +export const WALLET_SCREEN_ENDPOINT = 'https://xxx.balancer.fi/check-wallet'; export const ACTIVE_EXPLOITS: Exploits = { sorbet_finance: { diff --git a/src/lib/config/arbitrum/index.ts b/src/lib/config/arbitrum/index.ts index 5e0316cfd9..3f03e25ec0 100644 --- a/src/lib/config/arbitrum/index.ts +++ b/src/lib/config/arbitrum/index.ts @@ -27,7 +27,7 @@ const config: Config = { explorer: 'https://arbiscan.io', explorerName: 'Arbiscan', subgraph: `https://gateway-arbitrum.network.thegraph.com/api/${keys.graph}/subgraphs/id/98cQDy6tufTJtshDCuhh9z2kWXsQWBHVh2bqnLHsGAeS`, - balancerApi: 'https://api.balancer.fi', + balancerApi: 'https://xxx.balancer.fi', poolsUrlV2: '', subgraphs: { main: [ diff --git a/src/lib/config/avalanche/index.ts b/src/lib/config/avalanche/index.ts index 3cdd76a0cb..423fbc8331 100644 --- a/src/lib/config/avalanche/index.ts +++ b/src/lib/config/avalanche/index.ts @@ -27,7 +27,7 @@ const config: Config = { explorer: 'https://snowtrace.io', explorerName: 'Snowtrace', subgraph: `https://gateway-arbitrum.network.thegraph.com/api/${keys.graph}/subgraphs/id/7asfmtQA1KYu6CP7YVm5kv4bGxVyfAHEiptt2HMFgkHu`, - balancerApi: 'https://api.balancer.fi', + balancerApi: 'https://xxx.balancer.fi', poolsUrlV2: '', subgraphs: { main: [ diff --git a/src/lib/config/base/index.ts b/src/lib/config/base/index.ts index 4b8879f34c..869b30a8fa 100644 --- a/src/lib/config/base/index.ts +++ b/src/lib/config/base/index.ts @@ -27,7 +27,7 @@ const config: Config = { explorer: 'https://basescan.org', explorerName: 'BaseScan', subgraph: `https://gateway.thegraph.com/api/${keys.graph}/subgraphs/id/E7XyutxXVLrp8njmjF16Hh38PCJuHm12RRyMt5ma4ctX`, - balancerApi: 'https://api.balancer.fi', + balancerApi: 'https://xxx.balancer.fi', poolsUrlV2: '', subgraphs: { main: [ diff --git a/src/lib/config/fraxtal/index.ts b/src/lib/config/fraxtal/index.ts index 4b2d38dd69..d79f6e4514 100644 --- a/src/lib/config/fraxtal/index.ts +++ b/src/lib/config/fraxtal/index.ts @@ -27,7 +27,7 @@ const config: Config = { explorerName: 'The Fraxtal Explorer', subgraph: 'https://api.goldsky.com/api/public/project_clwhu1vopoigi01wmbn514m1z/subgraphs/balancer-fraxtal-v2/latest/gn', - balancerApi: 'https://api.balancer.fi', + balancerApi: 'https://xxx.balancer.fi', poolsUrlV2: '', subgraphs: { main: [ diff --git a/src/lib/config/gnosis-chain/index.ts b/src/lib/config/gnosis-chain/index.ts index 63ad50ed95..d289a20b7a 100644 --- a/src/lib/config/gnosis-chain/index.ts +++ b/src/lib/config/gnosis-chain/index.ts @@ -27,7 +27,7 @@ const config: Config = { publicRpc: 'https://rpc.gnosis.gateway.fm', explorer: 'https://gnosisscan.io', explorerName: 'Gnosisscan', - balancerApi: 'https://api.balancer.fi', + balancerApi: 'https://xxx.balancer.fi', subgraph: `https://gateway-arbitrum.network.thegraph.com/api/${keys.graph}/subgraphs/id/EJezH1Cp31QkKPaBDerhVPRWsKVZLrDfzjrLqpmv6cGg`, poolsUrlV2: '', subgraphs: { diff --git a/src/lib/config/mainnet/index.ts b/src/lib/config/mainnet/index.ts index 4c2cb56165..070d56e905 100644 --- a/src/lib/config/mainnet/index.ts +++ b/src/lib/config/mainnet/index.ts @@ -25,7 +25,7 @@ const config: Config = { explorer: 'https://etherscan.io', explorerName: 'Etherscan', subgraph: `https://gateway-arbitrum.network.thegraph.com/api/${keys.graph}/subgraphs/id/C4ayEZP2yTXRAB8vSaTrgN4m9anTe9Mdm2ViyiAuV9TV`, - balancerApi: 'https://api.balancer.fi', + balancerApi: 'https://xxx.balancer.fi', poolsUrlV2: 'https://storageapi.fleek.co/johngrantuk-team-bucket/poolsV2.json', subgraphs: { diff --git a/src/lib/config/mainnet/keys.ts b/src/lib/config/mainnet/keys.ts index 1385da2c5d..e941fd0583 100644 --- a/src/lib/config/mainnet/keys.ts +++ b/src/lib/config/mainnet/keys.ts @@ -3,7 +3,7 @@ import { Keys } from '../types'; const keys: Keys = { infura: 'daaa68ec242643719749dd1caba2fc66', alchemy: '', - graph: 'a84caa9e5c322a2faec24ad89ccb9d28', + graph: '91429265f2a0b1852cd6665ce5fa6a3e', balancerApi: 'da2-7a3ukmnw7bexndpx5x522uafui', }; diff --git a/src/lib/config/mode/index.ts b/src/lib/config/mode/index.ts index c181db31a0..3750e822c4 100644 --- a/src/lib/config/mode/index.ts +++ b/src/lib/config/mode/index.ts @@ -27,7 +27,7 @@ const config: Config = { explorerName: 'The Mode Explorer', subgraph: 'https://api.studio.thegraph.com/query/75376/balancer-mode-v2/version/latest', - balancerApi: 'https://api.balancer.fi', + balancerApi: 'https://xxx.balancer.fi', poolsUrlV2: '', subgraphs: { main: [ diff --git a/src/lib/config/optimism/index.ts b/src/lib/config/optimism/index.ts index a9d213fc88..6da2067666 100644 --- a/src/lib/config/optimism/index.ts +++ b/src/lib/config/optimism/index.ts @@ -27,7 +27,7 @@ const config: Config = { explorer: 'https://optimistic.etherscan.io/', explorerName: 'The Optimism Explorer', subgraph: `https://gateway-arbitrum.network.thegraph.com/api/${keys.graph}/subgraphs/id/FsmdxmvBJLGjUQPxKMRtcWKzuCNpomKuMTbSbtRtggZ7`, - balancerApi: 'https://api.balancer.fi', + balancerApi: 'https://xxx.balancer.fi', poolsUrlV2: '', subgraphs: { main: [ diff --git a/src/lib/config/polygon/index.ts b/src/lib/config/polygon/index.ts index 07b3cc6c43..7699a60737 100644 --- a/src/lib/config/polygon/index.ts +++ b/src/lib/config/polygon/index.ts @@ -27,7 +27,7 @@ const config: Config = { explorer: 'https://polygonscan.com', explorerName: 'Polygonscan', subgraph: `https://gateway-arbitrum.network.thegraph.com/api/${keys.graph}/subgraphs/id/H9oPAbXnobBRq1cB3HDmbZ1E8MWQyJYQjT1QDJMrdbNp`, - balancerApi: 'https://api.balancer.fi', + balancerApi: 'https://xxx.balancer.fi', poolsUrlV2: '', subgraphs: { main: [ diff --git a/src/lib/config/zkevm/index.ts b/src/lib/config/zkevm/index.ts index 8b2f8051a9..88ebe8b085 100644 --- a/src/lib/config/zkevm/index.ts +++ b/src/lib/config/zkevm/index.ts @@ -28,7 +28,7 @@ const config: Config = { explorerName: 'Polygonscan', subgraph: 'https://api.studio.thegraph.com/query/24660/balancer-polygon-zk-v2/version/latest', - balancerApi: 'https://api.balancer.fi', + balancerApi: 'https://xxx.balancer.fi', poolsUrlV2: '', subgraphs: { main: [ diff --git a/src/pages/portfolio.vue b/src/pages/portfolio.vue deleted file mode 100644 index 03c6e98de3..0000000000 --- a/src/pages/portfolio.vue +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - - - - - - {{ $t('myLiquidityInBalancerPools') }} - - - - - - - - - - - diff --git a/src/plugins/router/index.ts b/src/plugins/router/index.ts index dac9d0de3b..1d18aad1a1 100644 --- a/src/plugins/router/index.ts +++ b/src/plugins/router/index.ts @@ -28,7 +28,7 @@ const FaucetPage = () => import('@/pages/faucet.vue'); const BalancesPage = () => import('@/pages/balances.vue'); const ClaimSubmissionsPage = () => import('@/pages/claim-submissions.vue'); -const PortfolioPage = () => import('@/pages/portfolio.vue'); +// const PortfolioPage = () => import('@/pages/portfolio.vue'); const RecoveryExitPage = () => import('@/pages/recovery-exit/recovery-exit.vue'); @@ -146,11 +146,11 @@ const routes: RouteRecordRaw[] = [ name: 'legacy-claim', component: LegacyClaimPage, }, - { - path: '/:networkSlug/portfolio', - name: 'portfolio', - component: PortfolioPage, - }, + // { + // path: '/:networkSlug/portfolio', + // name: 'portfolio', + // component: PortfolioPage, + // }, { path: '/:networkSlug/balances', name: 'balances', diff --git a/src/providers/local/user-pools.provider.ts b/src/providers/local/user-pools.provider.ts index 18a5a02fbe..5da5cfc260 100644 --- a/src/providers/local/user-pools.provider.ts +++ b/src/providers/local/user-pools.provider.ts @@ -1,115 +1,24 @@ import { InjectionKey } from 'vue'; import { UserStakingResponse } from '@/providers/local/user-staking.provider'; -import { useUserData } from '@/providers/user-data.provider'; -import { Pool, PoolType, allLinearTypes } from '@/services/pool/types'; -import { bnSum } from '@/lib/utils'; import symbolKeys from '@/constants/symbol.keys'; import { safeInject } from '../inject'; -import { useLock } from '@/composables/useLock'; -import usePoolsQuery from '@/composables/queries/usePoolsQuery'; -import { fiatValueOf } from '@/composables/usePoolHelpers'; -import { isQueryLoading } from '@/composables/queries/useQueryHelpers'; -import { isVeBalSupported } from '@/composables/useVeBAL'; -import { useTokens } from '../tokens.provider'; -import { POOLS } from '@/constants/pools'; - /** * Provides user pools data. Primarily for the portfolio page. */ export const provider = (userStaking: UserStakingResponse) => { - const { - stakedPools, - totalStakedValue, - refetchStakedPools, - isLoading: isStakedDataLoading, - } = userStaking; - - // Access user data fetched on wallet connection/change. - const { userPoolSharesQuery, lockQuery } = useUserData(); - const { data: userPoolShares, refetch: refetchUserPoolShares } = - userPoolSharesQuery; - - const { totalLockedValue } = useLock(); - const { injectTokens } = useTokens(); - - // Array of pool IDs that the user hasn't staked. - const unstakedPoolIds = computed((): string[] => - Object.keys(userPoolShares.value || {}) - ); - - // Only fetch unstaked pools if the user has pool shares. - const isPoolsQueryEnabled = computed( - (): boolean => unstakedPoolIds.value.length > 0 - ); - - // Fetch pools that the user hasn't staked. - const filterOptions = computed(() => ({ - poolIds: unstakedPoolIds.value, - pageSize: 999, - poolTypes: [...POOLS.IncludedPoolTypes, ...allLinearTypes] as PoolType[], - })); - const unstakedPoolsQuery = usePoolsQuery(filterOptions, { - enabled: isPoolsQueryEnabled, - }); - const { data: _unstakedPools } = unstakedPoolsQuery; - - // Helper property to drill down to first page of results. - const unstakedPools = computed( - (): Pool[] => _unstakedPools.value?.pages[0].pools || [] - ); - - // Combine staked and unstaked pools. - const userPools = computed((): Pool[] => [ - ...unstakedPools.value, - ...stakedPools.value, - ]); - - // Total fiat value of unstaked positions. - const totalUnstakedValue = computed((): string => { - return Object.keys(userPoolShares.value || {}) - .reduce((acc, poolId) => { - const pool = userPools.value.find(pool => pool.id === poolId); - if (!pool) return acc; - const bpt = userPoolShares?.value?.[poolId] || '0'; - return acc + Number(fiatValueOf(pool, bpt)); - }, 0) - .toString(); - }); - - // Total portfolio fiat value, including staked, unstaked, and locked positions. - const totalFiatValue = computed((): string => - bnSum([ - totalUnstakedValue.value, - totalStakedValue.value, - totalLockedValue.value, - ]).toString() - ); - - const isLoading = computed( - (): boolean => - isStakedDataLoading.value || - isQueryLoading(userPoolSharesQuery) || - isQueryLoading(unstakedPoolsQuery) || - (isVeBalSupported.value && isQueryLoading(lockQuery)) - ); + const { stakedPools, refetchStakedPools } = userStaking; // Trigger refetch of queries for staked and unstaked pools. async function refetchAllUserPools() { - await Promise.all([refetchUserPoolShares(), refetchStakedPools()]); + await Promise.all([refetchStakedPools()]); } - // Whenever new pools show up in the user pools array, inject their tokens so - // that we can add the user's balance to the token registry. - watch(userPools, newUserPools => { - injectTokens(newUserPools.map(pool => pool.address)); - }); - return { stakedPools, - unstakedPools, - userPoolShares, - totalFiatValue, - isLoading, + // unstakedPools, + // userPoolShares, + // totalFiatValue, + // isLoading, refetchAllUserPools, }; }; diff --git a/src/providers/user-data.provider.ts b/src/providers/user-data.provider.ts index 606b35c957..8288b37b31 100644 --- a/src/providers/user-data.provider.ts +++ b/src/providers/user-data.provider.ts @@ -6,7 +6,6 @@ import useStakedSharesQuery from '@/composables/queries/useStakedSharesQuery'; import useUserBoostsQuery from '@/composables/queries/useUserBoostsQuery'; import useUserGaugeSharesQuery from '@/composables/queries/useUserGaugeSharesQuery'; -import useUserPoolSharesQuery from '@/composables/queries/useUserPoolSharesQuery'; import useVeBalLockInfoQuery from '@/composables/queries/useVeBalLockInfoQuery'; import symbolKeys from '@/constants/symbol.keys'; import { InjectionKey, provide } from 'vue'; @@ -17,7 +16,7 @@ export const userDataProvider = () => { * COMPOSABLES */ // Fetch all user's pool shares. - const userPoolSharesQuery = useUserPoolSharesQuery(); + // const userPoolSharesQuery = useUserPoolSharesQuery(); // Fetches all user's gaugeShares. const userGaugeSharesQuery = useUserGaugeSharesQuery(); @@ -32,7 +31,7 @@ export const userDataProvider = () => { const lockQuery = useVeBalLockInfoQuery(); return { - userPoolSharesQuery, + // userPoolSharesQuery, userGaugeSharesQuery, stakedSharesQuery, userBoostsQuery, diff --git a/tests/msw/rest-handlers.ts b/tests/msw/rest-handlers.ts index c7fda08c28..6d7c31beec 100644 --- a/tests/msw/rest-handlers.ts +++ b/tests/msw/rest-handlers.ts @@ -71,7 +71,7 @@ export const restHandlers = [ } ), - rest.get('https://api.balancer.fi/check-wallet', (req, res, ctx) => { + rest.get('https://xxx.balancer.fi/check-wallet', (req, res, ctx) => { const query = req.url.searchParams; const address = query.get('address'); if (address === SANCTIONED_ADDRESS)