ThreatDetector is used to detect Phishing and Scam websites using ChainPatrol’s APIs.
A ThreatDetector allows you to easily build out community safety features
in your dApp or wallet. It is a smart wrapper around ChainPatrol’s APIs that allows you to
check if a website is a scam or not. It comes with a variety of storage adapters, so you can
easily cache the results of your checks and avoid making unnecessary API calls.
Copy
Ask AI
import { ThreatDetector, Storage } from "@chainpatrol/sdk";// Create a new detector instanceconst detector = new ThreatDetector({ mode: "cloud", // 'cloud' | 'local' (default: 'cloud') // Optional: Specify a custom API key (only available for 'cloud' mode) apiKey: "YOUR_API_KEY", // Optional: Configure a proxy server (only available for 'cloud' mode) proxyUrl: "https://proxy.acme.com", // Optional: Specify a custom storage adapter storage: Storage.extension(), // storage: Storage.browser(), // storage: Storage.memory(), // Optional: Specify a custom redirect URL redirectUrl: "https://app.chainpatrol.io/warning",});