UNPKG

@skeet-framework/solana-utils

Version:

Skeet Framework Plugin - Solana Utils

14 lines (12 loc) 360 B
import { Connection } from '@solana/web3.js' export const getCurrentEpoch = async (endpoint: string) => { try { const connection = new Connection(endpoint) const currentEpoch = await connection .getEpochInfo() .then((info) => info.epoch) return currentEpoch } catch (error) { throw new Error(`getCurrentEpoch: ${error}`) } }