refresh
The refresh method updates the route with the latest market data, returning a new Route instance with updated prices and paths.
Signature
async refresh(): Promise<Route>TypeScript Types
// Import for viem
import { Route } from 'symphony-sdk/viem';
import type { Route as RouteType } from 'symphony-sdk/types/viem';
// Import for ethersV5
import { Route } from 'symphony-sdk/ethersV5';
import type { Route as RouteType } from 'symphony-sdk/types/ethersV5';
// Import for ethers v6
import { Route } from 'symphony-sdk/ethers';
import type { Route as RouteType } from 'symphony-sdk/types/ethers';Returns
Returns a Promise that resolves to a new Route instance with updated market data.
Example Usage
const symphony = new Symphony();
// Get initial route
const route = await symphony.getRoute(tokenIn, tokenOut, "1.0");
// Wait some time...
// Get updated route with same tokens and amount and latest prices
const updatedRoute = await route.refresh();
// Use the updated route for swap
const { swapReceipt } = await updatedRoute.swap();TypeScript Example
import { Symphony, Route } from 'symphony-sdk/ethers';
const symphony = new Symphony();
// Get initial route with type safety
let route: Route = await symphony.getRoute(tokenIn, tokenOut, "1.0");
// Refresh the route
route = await route.refresh();
// Updated prices available
console.log(`New output amount: ${route.amountOutFormatted}`);Notes
- The method creates a new route instance with the same parameters but fresh market data
- Useful when the original route might be stale due to time passing
- The new route will have updated:
- Prices
- Optimal swap path
- Original route instance remains unchanged
Error Handling
The method will throw an error if:
- The tokens are no longer available for swap
- The Symphony API is unreachable
- The amount is invalid or exceeds available liquidity

