📜 Get Farm List
Farm List
To fetch the Farm list all we need from the @saros-finance/sdk is :
FarmList.tsx
TypeScript
import sarosSdk from "@saros - finance / sdk";SarosFarmService
We need to utilize the SarosFarmService that we got from the sarosSdk member we just imported
FarmList.tsx
TypeScript
//using @saros-finance SarosFarm Services then we
const { SarosFarmService } = sarosSdk;Usage
FarmList.tsx
TypeScript
//Query all farms on Saros
const handleFetchFarmList = async () => {
try {
const farmResponse = await SarosFarmService.getListPool({
page: 1,
size: 2,
});
return farmResponse;
} catch (error) {
if (error instanceOf Error) console.error(error)
return []
}
};