Skip to content

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>): void

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();
 
// Update single configuration option
symphony.setConfig({
  slippage: "1.0" // Set slippage to 1%
});
 
// Update multiple configuration options
symphony.setConfig({
  rpcUrl: "https://my-custom-rpc.com",
  timeout: 15000,
  nativeAddress: "0x1"
});

Modifying Slippage

// Set a custom slippage for all swaps
symphony.setConfig({
  slippage: "2.5" // 2.5% slippage
});
 
// Later, verify the change
console.log(symphony.getConfig().slippage); // "2.5"

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.