Skip to content

Commit

Permalink
Merge branch 'main' into add-new-test-helpers
Browse files Browse the repository at this point in the history
  • Loading branch information
mikemaccana authored Jun 5, 2024
2 parents 66217ae + ee5dbf2 commit 10d8127
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ import {
} from "@solana/web3.js";
import base58 from "bs58";
import BigNumber from "bn.js";
import path from "path";
import { readFile, appendFile } from "fs/promises";
import assert from "node:assert/strict";
import { randomBytes } from "crypto";

Expand Down Expand Up @@ -126,6 +124,7 @@ export const getExplorerLink = (
};

export const getKeypairFromFile = async (filepath?: string) => {
const path = await import("path");
// Work out correct file name
if (!filepath) {
filepath = DEFAULT_FILEPATH;
Expand All @@ -140,6 +139,7 @@ export const getKeypairFromFile = async (filepath?: string) => {
// Get contents of file
let fileContents: string;
try {
const { readFile } = await import("fs/promises");
const fileContentsBuffer = await readFile(filepath);
fileContents = fileContentsBuffer.toString();
} catch (error) {
Expand Down Expand Up @@ -196,6 +196,7 @@ export const addKeypairToEnvFile = async (
variableName: string,
envFileName?: string,
) => {
const { appendFile } = await import("fs/promises");
if (!envFileName) {
envFileName = ".env";
}
Expand Down

0 comments on commit 10d8127

Please sign in to comment.