Navigator is a Typescript client for instantiating various of kinds of DeFi protocols. You can use it as a standalone dependency in your own project or together with Dappio Gateway.
import { PublicKey, Connection } from "@solana/web3.js";
import { raydium, orca, tulip, friktion } from "@dappio/navigator";
const connection = new Connection("https://api.mainnet-beta.solana.com", {
commitment: "confirmed",
});
// Fetch all Raydium pools
const raydiumPools = await raydium.infos.getAllPools(connection);
// Fetch all Orca pools
const orcaPools = await orca.infos.getAllPools(connection);
// Fetch Raydium pool (RAY-USDC)
const poolId = new PublicKey("6UmmUiYoBjSrhakAobJw8BvkmJtDVxaeBtbt7rxWo1mg");
const raydiumPool = await raydium.infos.getPool(connection, poolId);
// Fetch all Raydium farms
const raydiumFarms = await raydium.infos.getAllFarms(connection);
// Fetch all Orca farms
const orcaFarms = await orca.infos.getAllFarms(connection);
// Fetch Raydium farm (RAY-USDC)
const farmId = new PublicKey("CHYrUBX2RKX8iBg7gYTkccoGNBzP44LdaazMHCLcdEgS");
const raydiumFarm = await raydium.infos.getFarm(connection, farmId);
// Fetch all Tulip vaults
const tulipVaults = await tulip.infos.getAllVaults(connection);
// Fetch all Friktion vaults
const friktionVaults = await friktion.infos.getAllVaults(connection);
// Fetch all Marinade vaults
const marinadeVaults = await marinade.infos.getAllVaults(connection);
// Fetch all Lido vaults
const lidoVaults = await lido.infos.getAllVaults(connection);
Check here to see all the supported protocols
Run all tests:
$ yarn run test
Or specifically run test for one specific protocol:
$ yarn run testRaydium