For the complete documentation index, see llms.txt. This page is also available as Markdown.

Configuration

The YieldFi SDK can be configured with various options to customize its behavior. This guide covers all available configuration options.

Basic Configuration

The minimum required configuration is the gatewayUrl:

import { YieldFiSDK } from "yieldfi-sdk";

const sdk = await YieldFiSDK.create({
  gatewayUrl: "https://gw.yield.fi",
});

Configuration Options

gatewayUrl (Required)

The base URL of the YieldFi gateway service.

const sdk = await YieldFiSDK.create({
  gatewayUrl: "https://gw.yield.fi", // Production
  // gatewayUrl: "https://gw-staging.yield.fi", // Staging
});

partnerId (Optional)

Partner identifier for tracking and analytics. Used for partner transaction attribution.

timeout (Optional)

Request timeout in milliseconds. Default: 60000 (60 seconds).

retryAttempts (Optional)

Number of retry attempts for failed requests. Default: 3.

retryDelay (Optional)

Delay between retry attempts in milliseconds. Default: 1000 (1 second).

debug (Optional)

Enable debug logging. Default: false.

environment (Optional)

Environment identifier. Options: 'development', 'production', or 'test'. Default: 'production'.

Complete Configuration Example

Here's an example with all configuration options:

Environment-Based Configuration

A common pattern is to configure the SDK based on your environment:

Using the Factory Function

Alternatively, you can use the factory function:

Configuration Schema

The SDK uses Zod for configuration validation. Invalid configurations will throw a ConfigurationError:

Next Steps

  • Authentication Guide - Learn about authentication flows

  • API Reference - Explore available APIs

Last updated