@latticexyz/common 2.2.19-900ac35deebfa260bafb1697d15e95eef855cd69 → 2.2.20-306707570ec5fd27877d674502aa381d7fd89662
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/foundry.d.ts +1 -26
- package/dist/foundry.js +0 -39
- package/dist/foundry.js.map +1 -1
- package/package.json +2 -2
package/dist/foundry.d.ts
CHANGED
|
@@ -40,30 +40,5 @@ declare function getOutDirectory(profile?: string): Promise<string>;
|
|
|
40
40
|
* @returns The rpc url
|
|
41
41
|
*/
|
|
42
42
|
declare function getRpcUrl(profile?: string): Promise<string>;
|
|
43
|
-
/**
|
|
44
|
-
* Execute a forge command
|
|
45
|
-
* @param args The arguments to pass to forge
|
|
46
|
-
* @param options { profile?: The foundry profile to use; silent?: If true, nothing will be logged to the console }
|
|
47
|
-
*/
|
|
48
|
-
declare function forge(args: string[], options?: {
|
|
49
|
-
profile?: string;
|
|
50
|
-
silent?: boolean;
|
|
51
|
-
env?: NodeJS.ProcessEnv;
|
|
52
|
-
cwd?: string;
|
|
53
|
-
}): Promise<void>;
|
|
54
|
-
/**
|
|
55
|
-
* Execute a cast command
|
|
56
|
-
* @param args The arguments to pass to cast
|
|
57
|
-
* @returns Stdout of the command
|
|
58
|
-
*/
|
|
59
|
-
declare function cast(args: string[], options?: {
|
|
60
|
-
profile?: string;
|
|
61
|
-
}): Promise<string>;
|
|
62
|
-
/**
|
|
63
|
-
* Start an anvil chain
|
|
64
|
-
* @param args The arguments to pass to anvil
|
|
65
|
-
* @returns Stdout of the command
|
|
66
|
-
*/
|
|
67
|
-
declare function anvil(args: string[]): Promise<string>;
|
|
68
43
|
|
|
69
|
-
export { type ForgeConfig,
|
|
44
|
+
export { type ForgeConfig, getForgeConfig, getOutDirectory, getRpcUrl, getScriptDirectory, getSrcDirectory, getTestDirectory };
|
package/dist/foundry.js
CHANGED
|
@@ -22,46 +22,7 @@ async function getOutDirectory(profile) {
|
|
|
22
22
|
async function getRpcUrl(profile) {
|
|
23
23
|
return process.env.FOUNDRY_ETH_RPC_URL || process.env.RPC_HTTP_URL || process.env.RPC_URL || (await getForgeConfig(profile)).eth_rpc_url || "http://127.0.0.1:8545";
|
|
24
24
|
}
|
|
25
|
-
async function forge(args, options) {
|
|
26
|
-
const execOptions = {
|
|
27
|
-
env: { FOUNDRY_PROFILE: options?.profile, ...options?.env },
|
|
28
|
-
stdout: "inherit",
|
|
29
|
-
stderr: "pipe",
|
|
30
|
-
cwd: options?.cwd
|
|
31
|
-
};
|
|
32
|
-
await (options?.silent ? execa("forge", args, execOptions) : execLog("forge", args, execOptions));
|
|
33
|
-
}
|
|
34
|
-
async function cast(args, options) {
|
|
35
|
-
return execLog("cast", args, {
|
|
36
|
-
env: { FOUNDRY_PROFILE: options?.profile }
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
async function anvil(args) {
|
|
40
|
-
return execLog("anvil", args);
|
|
41
|
-
}
|
|
42
|
-
async function execLog(command, args, options) {
|
|
43
|
-
const commandString = `${command} ${args.join(" ")}`;
|
|
44
|
-
try {
|
|
45
|
-
console.log(`running "${commandString}"`);
|
|
46
|
-
const { stdout } = await execa(command, args, {
|
|
47
|
-
...options,
|
|
48
|
-
stdout: "pipe",
|
|
49
|
-
stderr: "pipe",
|
|
50
|
-
lines: false,
|
|
51
|
-
encoding: "utf8"
|
|
52
|
-
});
|
|
53
|
-
return stdout;
|
|
54
|
-
} catch (error) {
|
|
55
|
-
let errorMessage = error?.stderr || error?.message || "";
|
|
56
|
-
errorMessage += `
|
|
57
|
-
Error running "${commandString}"`;
|
|
58
|
-
throw new Error(errorMessage);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
25
|
export {
|
|
62
|
-
anvil,
|
|
63
|
-
cast,
|
|
64
|
-
forge,
|
|
65
26
|
getForgeConfig,
|
|
66
27
|
getOutDirectory,
|
|
67
28
|
getRpcUrl,
|
package/dist/foundry.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/foundry/index.ts"],"sourcesContent":["import { execa
|
|
1
|
+
{"version":3,"sources":["../src/foundry/index.ts"],"sourcesContent":["import { execa } from \"execa\";\n\nexport interface ForgeConfig {\n // project\n src: string;\n test: string;\n script: string;\n out: string;\n libs: string[];\n cache: boolean;\n cache_path: string;\n eth_rpc_url: string | null;\n\n // compiler\n remappings: string[];\n\n // all unspecified keys (this interface is far from comprehensive)\n [key: string]: unknown;\n}\n\n/**\n * Get forge config as a parsed json object.\n */\nexport async function getForgeConfig(profile?: string): Promise<ForgeConfig> {\n const { stdout } = await execa(\"forge\", [\"config\", \"--json\"], {\n stdio: [\"inherit\", \"pipe\", \"pipe\"],\n env: { FOUNDRY_PROFILE: profile },\n });\n\n return JSON.parse(stdout) as ForgeConfig;\n}\n\n/**\n * Get the value of \"src\" from forge config.\n * The path to the contract sources relative to the root of the project.\n */\nexport async function getSrcDirectory(profile?: string): Promise<string> {\n return (await getForgeConfig(profile)).src;\n}\n\n/**\n * Get the value of \"script\" from forge config.\n * The path to the contract sources relative to the root of the project.\n */\nexport async function getScriptDirectory(profile?: string): Promise<string> {\n return (await getForgeConfig(profile)).script;\n}\n\n/**\n * Get the value of \"test\" from forge config.\n * The path to the test contract sources relative to the root of the project.\n */\nexport async function getTestDirectory(profile?: string): Promise<string> {\n return (await getForgeConfig(profile)).test;\n}\n\n/**\n * Get the value of \"out\" from forge config.\n * The path to put contract artifacts in, relative to the root of the project.\n */\nexport async function getOutDirectory(profile?: string): Promise<string> {\n return (await getForgeConfig(profile)).out;\n}\n\n/**\n * Get the value of \"eth_rpc_url\" from forge config, default to \"http://127.0.0.1:8545\"\n * @param profile The foundry profile to use\n * @returns The rpc url\n */\nexport async function getRpcUrl(profile?: string): Promise<string> {\n return (\n process.env.FOUNDRY_ETH_RPC_URL ||\n process.env.RPC_HTTP_URL ||\n process.env.RPC_URL ||\n (await getForgeConfig(profile)).eth_rpc_url ||\n \"http://127.0.0.1:8545\"\n );\n}\n"],"mappings":";AAAA,SAAS,aAAa;AAuBtB,eAAsB,eAAe,SAAwC;AAC3E,QAAM,EAAE,OAAO,IAAI,MAAM,MAAM,SAAS,CAAC,UAAU,QAAQ,GAAG;AAAA,IAC5D,OAAO,CAAC,WAAW,QAAQ,MAAM;AAAA,IACjC,KAAK,EAAE,iBAAiB,QAAQ;AAAA,EAClC,CAAC;AAED,SAAO,KAAK,MAAM,MAAM;AAC1B;AAMA,eAAsB,gBAAgB,SAAmC;AACvE,UAAQ,MAAM,eAAe,OAAO,GAAG;AACzC;AAMA,eAAsB,mBAAmB,SAAmC;AAC1E,UAAQ,MAAM,eAAe,OAAO,GAAG;AACzC;AAMA,eAAsB,iBAAiB,SAAmC;AACxE,UAAQ,MAAM,eAAe,OAAO,GAAG;AACzC;AAMA,eAAsB,gBAAgB,SAAmC;AACvE,UAAQ,MAAM,eAAe,OAAO,GAAG;AACzC;AAOA,eAAsB,UAAU,SAAmC;AACjE,SACE,QAAQ,IAAI,uBACZ,QAAQ,IAAI,gBACZ,QAAQ,IAAI,YACX,MAAM,eAAe,OAAO,GAAG,eAChC;AAEJ;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@latticexyz/common",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.20-306707570ec5fd27877d674502aa381d7fd89662",
|
|
4
4
|
"description": "Common low level logic shared between packages",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
"p-retry": "^5.1.2",
|
|
70
70
|
"prettier": "3.2.5",
|
|
71
71
|
"prettier-plugin-solidity": "1.3.1",
|
|
72
|
-
"@latticexyz/schema-type": "2.2.
|
|
72
|
+
"@latticexyz/schema-type": "2.2.20-306707570ec5fd27877d674502aa381d7fd89662"
|
|
73
73
|
},
|
|
74
74
|
"devDependencies": {
|
|
75
75
|
"@types/debug": "^4.1.7",
|