Skip to content

Commit

Permalink
Merge 7635532 into 5052439
Browse files Browse the repository at this point in the history
  • Loading branch information
abtestingalpha authored Sep 19, 2024
2 parents 5052439 + 7635532 commit fd48bd1
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 15 deletions.
16 changes: 10 additions & 6 deletions packages/synapse-interface/contexts/UserProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,16 @@ export const UserProvider = ({ children }) => {

useAccountEffect({
onConnect() {
segmentAnalyticsEvent(`[Wallet Analytics] connects`, {
walletId: connector?.id,
chainId: chain?.id,
query,
pathname,
})
segmentAnalyticsEvent(
`[Wallet Analytics] connects`,
{
walletId: connector?.id,
chainId: chain?.id,
query,
pathname,
},
true
)
},
onDisconnect() {
segmentAnalyticsEvent('[Wallet Analytics] disconnect', {})
Expand Down
20 changes: 11 additions & 9 deletions packages/synapse-interface/utils/screenAddress.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,18 @@ const createRiskDetectedEvent = (address: Address | string) => {
})
}

const dispatchRiskDetectedEvent = (address: Address | string) => {
const event = createRiskDetectedEvent(address)
GlobalEventEmitter.dispatchEvent(event)
}

export const screenAddress = async (
address: Address | string
): Promise<boolean> => {
const url = `https://screener.omnirpc.io/fe/address/${address}`

if (isBlacklisted(address)) {
const event = createRiskDetectedEvent(address)

GlobalEventEmitter.dispatchEvent(event)
dispatchRiskDetectedEvent(address)
return true
}

Expand All @@ -29,14 +32,13 @@ export const screenAddress = async (
const { risk } = await response.json()

if (risk) {
const event = createRiskDetectedEvent(address)

GlobalEventEmitter.dispatchEvent(event)
dispatchRiskDetectedEvent(address)
return true
} else {
return false
}
return false
} catch (error) {
console.error('Error:', error)
return false
dispatchRiskDetectedEvent(address)
return true
}
}

0 comments on commit fd48bd1

Please sign in to comment.