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();
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.