> ## Documentation Index
> Fetch the complete documentation index at: https://blackswan-23965643.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Configure the BlackSwan JavaScript Client and Contracts

> Initialize BlackSwanClient with your network and RPC URL. Supports Polygon Amoy and Ethereum Sepolia testnets. Access contract addresses as named exports.

After installing the SDK, you configure a `BlackSwanClient` instance by passing your target network and RPC endpoint. The client handles all contract interactions and data formatting, so you can focus on building your application.

## Constructor parameters

Pass a configuration object to `BlackSwanClient` with the following properties:

| Parameter | Type   | Required | Description                             |
| --------- | ------ | -------- | --------------------------------------- |
| network   | string | Yes      | Target network: `"amoy"` or `"sepolia"` |
| rpcUrl    | string | Yes      | Your RPC endpoint URL                   |

## Initialize the client

```ts theme={null}
import { BlackSwanClient } from "blackswan-sdk";

// Polygon Amoy (recommended for testing)
const client = new BlackSwanClient({
  network: "amoy",
  rpcUrl: process.env.NEXT_PUBLIC_RPC_URL
});

// Ethereum Sepolia
const client = new BlackSwanClient({
  network: "sepolia",
  rpcUrl: process.env.NEXT_PUBLIC_RPC_URL
});
```

## Contract addresses

BlackSwan contract addresses are available as named exports from `blackswan-sdk`. Import the constants for your target network instead of hardcoding addresses in your application.

```ts theme={null}
import { AMOY_CONTRACTS, SEPOLIA_CONTRACTS } from "blackswan-sdk";

// Amoy
AMOY_CONTRACTS.P2PLENDING    // 0x7E04C0a283d372537E547086D37642776199C1DC
AMOY_CONTRACTS.BLACKSWANSBT  // 0x6665e5E15Ee295d9de05C6D57c629F33653687D7

// Sepolia
SEPOLIA_CONTRACTS.P2PLENDING   // 0x20D2E08E283FF4052B2B02A3475dda1B320cD26f
SEPOLIA_CONTRACTS.BLACKSWANSBT // 0xf8D2F43227Ea25a7fD0B34E1b74FF6FF2722879F
```

<Tip>
  Store your RPC URL in an environment variable (e.g. `NEXT_PUBLIC_RPC_URL` for
  Next.js, or `RPC_URL` for Node.js) rather than committing it directly in
  source code. This keeps your credentials out of version control and makes it
  easy to swap providers without touching your application logic.
</Tip>
