Skip to content

Commit

Permalink
Memoize fetching solc
Browse files Browse the repository at this point in the history
  • Loading branch information
gnidan committed Jul 7, 2024
1 parent 5bc7c56 commit 87adcf1
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/pointers/test/solc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ import { fetchSolc } from "web-solc";

import { Data } from "../src/data.js";

const solc = fetchSolc("^0.8.25");

const compile = async (input: any) => await (await solc).compile(input);

export const stopWorker = async () => (await solc).stopWorker();

/**
* Organizes the sources being compiled by their path identifier, as well
* as includes information about which contract's bytecode is desired
Expand Down Expand Up @@ -44,7 +50,6 @@ export async function compileCreateBytecode({
}
};

const { compile, stopWorker } = await fetchSolc("^0.8.25");
const output = await compile(input);
stopWorker();

Expand Down

0 comments on commit 87adcf1

Please sign in to comment.