diff --git a/src/components/StakingVaults/hooks/useFetchOpportunities.tsx b/src/components/StakingVaults/hooks/useFetchOpportunities.tsx index 70f9433aca4..5bcd20b1685 100644 --- a/src/components/StakingVaults/hooks/useFetchOpportunities.tsx +++ b/src/components/StakingVaults/hooks/useFetchOpportunities.tsx @@ -23,7 +23,12 @@ export const useFetchOpportunities = () => { const portfolioAccounts = useSelector(selectPortfolioAccounts) const DynamicLpAssets = useFeatureFlag('DynamicLpAssets') - const { isLoading: isZapperAppsBalancesOutputLoading } = useGetZapperAppsBalancesOutputQuery() + const { isLoading: isZapperAppsBalancesOutputLoading } = useGetZapperAppsBalancesOutputQuery( + undefined, + { + skip: !requestedAccountIds.length, + }, + ) const { isLoading: isZapperUniV2PoolAssetIdsLoading } = useGetZapperUniV2PoolAssetIdsQuery( undefined, { skip: !DynamicLpAssets }, diff --git a/src/features/defi/providers/thorchain-savers/components/ThorchainSaversManager/Deposit/components/Deposit.tsx b/src/features/defi/providers/thorchain-savers/components/ThorchainSaversManager/Deposit/components/Deposit.tsx index 73fa9674c1b..337eda2f6ac 100644 --- a/src/features/defi/providers/thorchain-savers/components/ThorchainSaversManager/Deposit/components/Deposit.tsx +++ b/src/features/defi/providers/thorchain-savers/components/ThorchainSaversManager/Deposit/components/Deposit.tsx @@ -194,6 +194,8 @@ export const Deposit: React.FC = ({ const isApprovalRequired = await (async () => { // Router contract address is only set in case we're depositting a token, not a native asset if (!inboundAddress) return false + // Do not try to get allowance for native assets, including non-EVM ones. + if (!isTokenDeposit) return false const allowanceOnChainCryptoBaseUnit = await getErc20Allowance({ address: fromAssetId(assetId).assetReference, @@ -211,7 +213,15 @@ export const Deposit: React.FC = ({ })() setIsApprovalRequired(isApprovalRequired) })() - }, [accountId, asset.chainId, asset.precision, assetId, inputValues, inboundAddress]) + }, [ + accountId, + asset.chainId, + asset.precision, + assetId, + inputValues, + inboundAddress, + isTokenDeposit, + ]) // TODO(gomes): this will work for UTXO but is invalid for tokens since they use diff. denoms // the current workaround is to not do fee deduction for non-UTXO chains, diff --git a/src/index.tsx b/src/index.tsx index c9b1ef0c1ea..8ac0ed30299 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -12,36 +12,64 @@ import { reportWebVitals } from 'lib/reportWebVitals' import * as serviceWorkerRegistration from './serviceWorkerRegistration' -Sentry.init({ - ...(window.location.hostname === 'localhost' - ? {} - : { dsn: getConfig().REACT_APP_SENTRY_DSN_URL }), - attachStacktrace: true, - denyUrls: ['alchemy.com'], - integrations: [ - // Sentry.browserTracingIntegration(), - // Sentry.replayIntegration(), - Sentry.httpClientIntegration({ - failedRequestStatusCodes: [ - [400, 428], - // i.e no 429s - [430, 599], - ], - }), - Sentry.browserApiErrorsIntegration(), - Sentry.breadcrumbsIntegration(), - Sentry.globalHandlersIntegration(), - Sentry.httpContextIntegration(), - ], - beforeSend(event) { - // https://github.com/getsentry/sentry-javascript/issues/8353 / https://forum.sentry.io/t/turn-off-event-grouping/10916/3 - event.fingerprint = [(Math.random() * 1000000).toString()] - return event - }, - enableTracing: true, - // Set 'tracePropagationTargets' to control for which URLs distributed tracing should be enabled - tracePropagationTargets: ['localhost'], -}) +// Remove this condition to test sentry locally +if (window.location.hostname !== 'localhost') { + const VALID_ENVS = [ + 'localhost', + 'develop', + 'release', + 'app', + 'private', + 'yeet', + 'beard', + 'juice', + 'wood', + 'gome', + ] as const + + const environment = (() => { + if (window.location.hostname.includes('app')) return 'production' + + if (VALID_ENVS.some(env => window.location.hostname.includes(env))) + return window.location.hostname.split('.')[0] + })() + Sentry.init({ + environment, + dsn: getConfig().REACT_APP_SENTRY_DSN_URL, + attachStacktrace: true, + integrations: [ + // Sentry.browserTracingIntegration(), + // Sentry.replayIntegration(), + Sentry.httpClientIntegration({ + failedRequestStatusCodes: [ + [400, 428], + // i.e no 429s + [430, 599], + ], + + failedRequestTargets: [/^(?!.*\.?(alchemy|snapshot)\.(com|org)).*$/], + }), + Sentry.browserApiErrorsIntegration(), + Sentry.breadcrumbsIntegration(), + Sentry.globalHandlersIntegration(), + Sentry.httpContextIntegration(), + ], + beforeSend(event, hint) { + // Drop closed ws errors to avoid spew + if ( + (hint.originalException as Error | undefined)?.message === + 'failed to reconnect, connection closed' + ) + return null + // https://github.com/getsentry/sentry-javascript/issues/8353 / https://forum.sentry.io/t/turn-off-event-grouping/10916/3 + event.fingerprint = [(Math.random() * 1000000).toString()] + return event + }, + enableTracing: true, + // Set 'tracePropagationTargets' to control for which URLs distributed tracing should be enabled + tracePropagationTargets: ['localhost'], + }) +} const rootElement = document.getElementById('root')! const root = createRoot(rootElement) diff --git a/src/state/apis/zapper/zapperApi.ts b/src/state/apis/zapper/zapperApi.ts index 68a9a774ac2..8125e4a9f30 100644 --- a/src/state/apis/zapper/zapperApi.ts +++ b/src/state/apis/zapper/zapperApi.ts @@ -330,6 +330,8 @@ export const zapper = createApi({ const accountIds = selectWalletAccountIds(state) + if (!accountIds.length) throw new Error('Not ready') + const assets = selectAssets(state) const evmNetworks = evmChainIds.map(chainIdToZapperNetwork).filter(isSome)