Open trajan0x opened 3 months ago
To optimize performance by awaiting the screener at the end of the screenAddress
function, follow these steps:
/packages/synapse-interface/utils/screenAddress.ts
.screenAddress
function.await fetch(url, { method: 'GET' })
call to the top of the function.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
}
/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
Minor performance optimization
I'd call at top of image then use await pattern