solana-rpc-testing/configure/common_utils.ts

13 lines
303 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")
)
)
);
}