UNPKG

lotus-sdk

Version:

Central repository for several classes of tools for integrating with, and building for, the Lotusia ecosystem

28 lines (27 loc) 1.01 kB
import { RNKC_MIN_DATA_LENGTH, RNKC_MIN_FEE_RATE } from '../utils/constants.js'; const isBrowser = typeof window !== 'undefined' && typeof window.document !== 'undefined'; let parsed = {}; if (!isBrowser && typeof process !== 'undefined' && process.versions?.node) { try { const { createRequire } = await import('node:module'); const require = createRequire(import.meta.url); const dotenv = require('dotenv'); parsed = dotenv.config({ path: '.env' }).parsed || {}; } catch { } } export const RPC = { user: parsed.NODE_RPC_USER, password: parsed.NODE_RPC_PASS, address: parsed.NODE_RPC_HOST, port: parsed.NODE_RPC_PORT, }; export const RNKC = { minFeeRate: Number(parsed.RNKC_MIN_FEE_RATE) || RNKC_MIN_FEE_RATE, minDataLength: Number(parsed.RNKC_MIN_DATA_LENGTH) || RNKC_MIN_DATA_LENGTH, }; export const P2P = { maxConnections: Number(parsed?.P2P_MAX_CONNECTIONS) || 50, minConnections: Number(parsed?.P2P_MIN_CONNECTIONS) || 10, };