UNPKG

@xswap-link/sdk

Version:
20 lines (17 loc) 517 B
import { Keypair } from "@solana/web3.js"; // Default file paths export const DEFAULT_KEYPAIR_PATH = ""; /** * Loads a keypair from a file * @param filePath Path to keypair file * @returns Keypair */ export function loadKeypair(filePath: string = DEFAULT_KEYPAIR_PATH): Keypair { try { const keypairJson = JSON.parse("keypairData"); return Keypair.fromSecretKey(Buffer.from(keypairJson)); } catch (error) { console.error(`Error loading keypair from ${filePath}:`, error); throw error; } }