setConfig
The setConfig method allows you to update the configuration of the Symphony instance. You can update one or more configuration options at a time.
Signature
setConfig(options: Partial<SymphonyConfig>): voidTypeScript Types
// Import for viem
import type { SymphonyConfig } from 'symphony-sdk/types/viem';
 
// Import for ethersV5
import type { SymphonyConfig } from 'symphony-sdk/types/ethersV5';
 
// Import for ethers v6
import type { SymphonyConfig } from 'symphony-sdk/types/ethers';
 
interface SymphonyConfig {
  apiUrl?: string;
  timeout?: number;
  chainId?: number;
  chainName?: string;
  rpcUrl?: string;
  nativeAddress?: Address;
  wrappedNativeAddress?: Address;
  slippage?: string;
  additionalTokens?: TokenList;
  overrideDefaultTokens?: boolean;
  feeParams?: FeeParams;
  publicClient?: any;        // viem PublicClient
  provider?: any;            // ethers Provider
  tokens?: TokenList;
}Parameters
- options: Partial configuration object containing the values to update- Only the properties you want to change need to be included
- See Configuration for all available options
 
Example
Basic Usage
const symphony = new Symphony();
const route = await symphony.getRoute(tokenIn, tokenOut, "1.0");
 
// Update single configuration option
route.setConfig({
  slippage: "1.0" // Set slippage to 1%
});
 
// Update multiple configuration options
route.setConfig({
  rpcUrl: "https://my-custom-rpc.com",
  timeout: 15000,
  nativeAddress: "0x1"
});Notes
- The configuration is updated immediately and affects all subsequent operations
- Invalid configuration values will be ignored and a warning will be logged
- Some configuration changes (like changing the network) may require reinitializing certain components
- Highly suggest setting your configuration while creating Symphony object.

