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:
Initialize the client
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.
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.