Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into feat_sentry_releas…
Browse files Browse the repository at this point in the history
…e_yml
  • Loading branch information
gomesalexandre committed May 6, 2024
2 parents 201a25e + 898f274 commit 4ea5b52
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 32 deletions.
7 changes: 6 additions & 1 deletion src/components/StakingVaults/hooks/useFetchOpportunities.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,8 @@ export const Deposit: React.FC<DepositProps> = ({
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,
Expand All @@ -211,7 +213,15 @@ export const Deposit: React.FC<DepositProps> = ({
})()
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,
Expand Down
88 changes: 58 additions & 30 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions src/state/apis/zapper/zapperApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit 4ea5b52

Please sign in to comment.