SDKs@solio/coreContractsFactorygetRouter

getRouter()

function getRouter(client, props): Promise<`0x${string}`>

Fetches the route address from the factory contract.

Parameters

ParameterTypeDescription
clientReadClientReadClient The read client to use.
propsFactoryGetRoutePropsFactoryGetRouteProps The properties for the function.
type FactoryGetRouteProps: {
  address: Address;
};

Returns

Promise<`0x${string}`>

A promise that resolves to the route address.

Example

// for reading the router address
import { factory } from '@solio/core';
import { createClient, http } from 'viem';
import { sepolia } from 'viem/chains';
const readClient = createClient({
 chain: sepolia,
 transport: http(),
});
const routeAddress = await getRouter(readClient, {
 address: '0x...' // factory contract address
});
console.log(routeAddress);