Skip to content

Symphony Class

The Symphony class is the main entry point for interacting with the Symphony SDK. It provides methods for configuring, route finding, wallet integration and tokens.

Constructor

new Symphony(params?: {
  walletClient?: WalletClient; // viem
  signer?: Signer; // ethers/ethersV5
  options?: SymphonyConfig;
})

TypeScript Types

// Import for viem
import { Symphony } from 'symphony-sdk/viem';
import type { WalletClient } from 'viem';
import type { SymphonyConfig } from 'symphony-sdk/types/viem';
 
// Import for ethersV5
import { Symphony } from 'symphony-sdk/ethersV5';
import type { Signer } from 'ethers';
import type { SymphonyConfig } from 'symphony-sdk/types/ethersV5';
 
// Import for ethers v6
import { Symphony } from 'symphony-sdk/ethers';
import type { Signer } from 'ethers';
import type { SymphonyConfig } from 'symphony-sdk/types/ethers';

Parameters

  • walletClient/signer: The wallet client for signing transactions. Optional when initializing Symphony object and can be later provided using connect.
    • For viem: A viem WalletClient instance
    • For ethers/ethersV5: An ethers Signer instance
  • options (optional): Configuration options for Symphony.

Example

Viem
import { Symphony } from 'symphony-sdk/viem';
const symphony = new Symphony({
  options: {
    nativeAddress: "0x12345",
    rpcUrl: "https://my-rpc-url.com",
    slippage: "1" // 1%
  }
});