📜 Get DEX Name
Dex Name
A utility function implement to get the DEX (Decentralise Exchange) name and we will need to import some functions from@saros-finance/dlmm-sdk which are:
getDexName.tsx
TypeScript
import {
LiquidityBookServices,
MODE,
} from "@saros - finance / dlmm - sdk";Configurations
After importing the related function now we need to initialize our Liquidity book service using mainnet or devnet mode.
getDexName.tsx
TypeScript
const liquidityBookServices = new LiquidityBookServices({
mode: MODE.MAINNET,
});Usage
getDexName.tsx
TypeScript
const getDexName = async () => {
try {
const dexName = await liquidityBookService.getDexName();
return dexName;
} catch (error) {
if (error instanceof Error) {
console.error(error.message);
}
}
}