solana-rpc-testing/configure/common_utils.ts

14 lines
353 B
TypeScript

import { Keypair } from "@solana/web3.js";
import * as fs from 'fs';
export function getKeypairFromFile(filePath: String): Keypair {
return Keypair.fromSecretKey(
Uint8Array.from(
JSON.parse(
process.env.KEYPAIR ||
fs.readFileSync(filePath.toString(), 'utf-8'),
),
),
)
}