getConfig
The getConfig
method returns the current configuration of the Symphony instance.
Signature
getConfig(): SymphonyConfig
Returns
Returns a SymphonyConfig
object containing:
apiUrl
: Symphony API URLtimeout
: Request timeout in millisecondschainId
: Chain ID for the networkchainName
: Name of the chainrpcUrl
: RPC URL for the networknativeAddress
: Address used to refer to the native tokenwrappedNativeAddress
: Address of the wrapped native tokenslippage
: Default slippage percentage for swapspublicClient / provider
: Public client instance (viem) or provider (ethers)tokens
: Map of token addresses to token information
Example
const symphony = new Symphony();
const config = symphony.getConfig();
console.log(config);
// Example output:
{
apiUrl: "https://route-api-url.com",
timeout: 10000,
chainId: 1329,
chainName: "sei",
rpcUrl: "https://sei-rpc.publicnode.com",
nativeAddress: "0x0",
wrappedNativeAddress: "0xe30fedd158a2e3b13e9badaeabafc5516e95e8c7",
slippage: "0.5",
// ... other configuration options
}
Accessing Specific Configuration
const symphony = new Symphony();
const route = await symphony.getRoute(tokenIn, tokenOut, "1.0");
// Get the current slippage setting
const slippage = route.getConfig().slippage;
console.log(`Current slippage: ${slippage}%`);
For modifying the configuration, see setConfig
.