Configuration
To start using the SDK, you need to import and initialize the ParabolServer
class:
import { ParabolServer } from "@parabolfi/server";
const parabolServer = new ParabolServer({
apiKey: "YOUR_API_KEY",
});
Configuration Options
The ParabolServer
constructor accepts an options object with the following properties:
apiKey
(required): Your Parabol API key.env
(optional): The Parabol environment to use. Defaults toPARABOL_ENV.Production
.logger
(optional): A custom logger function.
The ParabolServer
instance can directly read the PARABOL_API_KEY
environment variable to configure itself. If you are using Next.js, make sure
NOT to prefix it with NEXT_PUBLIC_
.
If you have PARABOL_API_KEY
environment variable set, you can omit the apiKey
option.
const parabolServer = new ParabolServer();
Parabol Environments
The ParabolServer
constructor also accepts an env
option that can be used to specify the Parabol environment.
Parabol has two environments:
PARABOL_ENV.Production
PARABOL_ENV.Testnet
The default environment is PARABOL_ENV.Production
.
If you are working on testnet, you should set the env
option to
PARABOL_ENV.Testnet
. You can find the supported testnet chains in the smart
contracts page Smart Contracts.
You have to use the ParabolServer
instance in the server-side code. You can
wrap your own logic with server-actions for Next.js, API route handlers, or
other server-side environments.