SDKs@solio/coreContractsRoutergetFactory

getFactory()

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

Fetches the factory address from the router contract.

Parameters

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

Returns

Promise<`0x${string}`>

A promise that resolves to the factory address.

Example

router.ts
import { router } from '@solio/core';
import { createClient, http } from 'viem';
import { sepolia } from 'viem/chains';
const readClient = createClient({
 chain: sepolia,
 transport: http(),
})
const factoryAddress = await router.read.getFactory(readClient, {
 address: '0x...' // router contract address
});
console.log(factoryAddress);