UNPKG

@moonwell-fi/moonwell-sdk

Version:

TypeScript Interface for Moonwell

37 lines (34 loc) 1.04 kB
import { http, fallback } from "viem"; import { avalanche } from "viem/chains"; import { type Environment, createEnvironmentConfig, } from "../../types/config.js"; import { tokens } from "./tokens.js"; const createEnvironment = ( rpcUrls?: string[], indexerUrl?: string, governanceIndexerUrl?: string, ): Environment<typeof tokens, {}, {}, {}, {}> => createEnvironmentConfig({ key: "avalanche", name: "Avalanche", chain: { ...avalanche, rpcUrls: { default: { http: rpcUrls || avalanche.rpcUrls.default.http }, }, }, transport: rpcUrls ? fallback(rpcUrls.map((url) => http(url))) : http(avalanche.rpcUrls.default.http[0]), indexerUrl: indexerUrl || "https://ponder.moonwell.fi", governanceIndexerUrl: governanceIndexerUrl || "https://ponder.moonwell.fi", tokens, markets: {}, vaults: {}, morphoMarkets: {}, contracts: {}, custom: {}, }) as Environment<typeof tokens, {}, {}, {}, {}>; export { avalanche, createEnvironment, tokens };