> ## Documentation Index
> Fetch the complete documentation index at: https://chainpatrol.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Overview

> Use our JavaScript SDK to interact with ChainPatrol's APIs

**Phishing** and **scam URLs** are a huge problem online.
To make it easier for wallet and dApp builders to protect their users
from these threats, we've built a JavaScript SDK that you can use to
interact with our threat detection APIs.

```js theme={null}
import { ThreatDetector } from "@chainpatrol/sdk";

const detector = new ThreatDetector({
  mode: "cloud",
  apiKey: "YOUR_API_KEY",
});

const result = await detector.url("https://scam-site.com");
```

## Installation

<Tabs>
  <Tab title="npm">
    ```bash theme={null}
    npm install --save @chainpatrol/sdk
    ```
  </Tab>

  <Tab title="yarn">
    ```bash theme={null}
    yarn add @chainpatrol/sdk
    ```
  </Tab>

  <Tab title="pnpm">
    ```bash theme={null}
    pnpm add @chainpatrol/sdk
    ```
  </Tab>
</Tabs>

## Features

<CardGroup cols={2}>
  <Card title="TypeScript support" icon={typescriptIcon}>
    Written in TypeScript with full type definitions
  </Card>

  <Card title="Cross-platform" icon="diagram-venn">
    Works in all modern browsers, Node.js, and browser extensions
  </Card>

  <Card title="Lightweight" icon="feather">
    Minimal dependencies
  </Card>

  <Card title="Built for scale" icon="chart-mixed">
    Designed with caching and rate-limiting built-in
  </Card>
</CardGroup>

## Exports

| Name                                      | Description                                                           |
| :---------------------------------------- | :-------------------------------------------------------------------- |
| [ThreatDetector](./threat-detector)       | A simple interface for detecting phishing URLs                        |
| [Storage](./storage)                      | Storage cache implementation for ThreatDetector                       |
| [Relay](./relay)                          | A message relay for sharing events between browser extension contexts |
| [ChainPatrolClient](./chainpatrol-client) | Used to create a client that connects to the ChainPatrol API          |

export const typescriptIcon = <svg viewBox="0 0 128 128" fill="none" xmlns="http://www.w3.org/2000/svg" class="h-6 w-6 text-primary dark:text-primary-light">

<path fill-rule="evenodd" clip-rule="evenodd" d="M6 0H122C125.314 0 128 2.68629 128 6V122C128 125.314 125.314 128 122 128H6C2.68629 128 0 125.314 0 122V6C0 2.68629 2.68629 0 6 0ZM74.2622 113.494V99.468C76.7968 101.601 79.5498 103.201 82.5213 104.267C85.4929 105.334 88.4935 105.867 91.5234 105.867C93.3005 105.867 94.8518 105.706 96.1773 105.385C97.5029 105.064 98.6099 104.618 99.4985 104.048C100.387 103.478 101.05 102.806 101.487 102.032C101.924 101.258 102.142 100.418 102.142 99.5118C102.142 98.2845 101.793 97.1888 101.093 96.2245C100.394 95.2603 99.4402 94.3691 98.2312 93.5509C97.0222 92.7327 95.5874 91.9438 93.9268 91.1841C92.2663 90.4244 90.4746 89.65 88.5518 88.8611C83.6575 86.8157 80.0087 84.3174 77.6052 81.3661C75.2017 78.4149 74 74.8501 74 70.6716C74 67.3989 74.6555 64.5865 75.9665 62.2343C77.2774 59.8821 79.0618 57.9463 81.3196 56.4268C83.5774 54.9074 86.1921 53.7897 89.1636 53.0738C92.1352 52.3579 95.2815 52 98.6026 52C101.866 52 104.757 52.1972 107.277 52.5917C109.797 52.9862 112.12 53.5925 114.247 54.4107V67.5158C113.198 66.7853 112.055 66.1425 110.817 65.5873C109.578 65.0321 108.304 64.5719 106.993 64.2067C105.682 63.8414 104.378 63.5711 103.082 63.3958C101.785 63.2205 100.555 63.1328 99.3892 63.1328C97.7869 63.1328 96.3303 63.2862 95.0193 63.5931C93.7083 63.8999 92.6013 64.3309 91.6982 64.886C90.7951 65.4412 90.0959 66.106 89.6006 66.8803C89.1053 67.6546 88.8577 68.5239 88.8577 69.4882C88.8577 70.5401 89.1345 71.4825 89.688 72.3152C90.2415 73.148 91.0281 73.9369 92.0478 74.6821C93.0674 75.4272 94.3055 76.1577 95.7622 76.8736C97.2188 77.5895 98.8648 78.3273 100.7 79.087C103.206 80.1389 105.456 81.2566 107.452 82.44C109.447 83.6234 111.159 84.9602 112.586 86.4504C114.014 87.9407 115.106 89.6427 115.864 91.5566C116.621 93.4706 117 95.6986 117 98.2407C117 101.747 116.337 104.691 115.012 107.072C113.686 109.454 111.887 111.382 109.615 112.858C107.342 114.334 104.699 115.393 101.683 116.036C98.6682 116.679 95.4855 117 92.1352 117C88.6975 117 85.4274 116.708 82.3247 116.123C79.222 115.539 76.5346 114.662 74.2622 113.494ZM69 64.5544H50.7026V116H36.2079V64.5544H18V53H69V64.5544Z" fill="currentColor" />
</svg>;
