# fanbase-aggregate-erc20-swap-widget

React widget for ERC20 token swaps with wallet connection, quote fetching, and swap execution.

## Documentation

- Full docs and integration reference:
  https://fanbase-io.gitbook.io/docs/reference/swap-widget-sdk/aggregate-swap-widget

## Installation

```bash
npm install fanbase-aggregate-erc20-swap-widget
```

## Quick Start

```tsx
import AggregationCryptoExchangeWidget from "fanbase-aggregate-erc20-swap-widget";

export default function App() {
  return (
    <AggregationCryptoExchangeWidget
      appId="YOUR_APP_ID"
      chainId={10}
    />
  );
}
```

Styles are bundled and injected by the package.

## Props

- `appId: string`
  Required public app identifier used for backend access verification.
- `chainId: number | string`
  Required target EVM chain ID used by the widget API calls.
- `buyToken?: string`
  Optional fixed output token address. When set, output token selection is limited.

## Access Model

- Widget access is denied when `appId` is missing or invalid.
- Free vs paid behavior is enforced by backend verification, not frontend flags.

## Notes

- Use numeric `chainId` when possible (example: `chainId={10}`).
- In production, your domain must be allowed for your integration keys/providers.

## Peer Dependencies

- `react` `^18.2.0`
- `react-dom` `^18.2.0`
