Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Screener can be awaited at the end of the Seen #2965

Open
trajan0x opened this issue Jul 30, 2024 · 1 comment
Open

Screener can be awaited at the end of the Seen #2965

trajan0x opened this issue Jul 30, 2024 · 1 comment

Comments

@trajan0x
Copy link
Contributor

Minor performance optimization

image

I'd call at top of image then use await pattern

Copy link

greptile-apps bot commented Jul 30, 2024

To optimize performance by awaiting the screener at the end of the screenAddress function, follow these steps:

  1. Open /packages/synapse-interface/utils/screenAddress.ts.
  2. Locate the screenAddress function.
  3. Move the await fetch(url, { method: 'GET' }) call to the top of the function.
  4. Use the await pattern to handle the response and risk detection.
export const screenAddress = async (
  address: Address | string
): Promise<boolean> => {
  const url = `https://screener.omnirpc.io/fe/address/${address}`

  const response = await fetch(url, { method: 'GET' })
  const { risk } = await response.json()

  if (isBlacklisted(address) || risk) {
    const event = createRiskDetectedEvent(address)
    GlobalEventEmitter.dispatchEvent(event)
    return true
  }

  return false
}

References

/agents/contracts/test/attestationharness/generate.go
/contrib/screener-api/docs
/.github/workflows/scan.yml
/agents/contracts/test/snapshotharness/generate.go
/packages/solidity-devops/src/SynapseScript.sol
/core/go.mod
/contrib/screener-api/config/doc.go
/packages/solidity-devops/src/SynapseScript06.sol
/contrib/screener-api/docs/swagger.yaml
/charts/screener/Chart.yaml
/contrib/screener-api/README.md
/contrib/screener-api/docs/swagger.json
/services/rfq/README.md
/contrib/screener-api
/.github/stale.yml
/.yarn/releases/yarn-1.22.19.cjs
/.github/PULL_REQUEST_TEMPLATE.md
/services/scribe/go.mod
/packages/synapse-interface/utils/screenAddress.ts
/packages/synapse-interface/patch.ts
/contrib/screener-api/go.mod
/.github/actions/add-label/action.yml
/contrib/screener-api/screener
/services/scribe/metadata/metadata.go
/packages/synapse-interface/components/ui/SearchResults.tsx

About Greptile

This response provides a starting point for your research, not a precise solution.

Help us improve! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

Ask Greptile · Edit Issue Bot Settings

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant