Skip to content

Commit 7385948

Browse files
authored
feat(entrykit): deploy prereqs to any chain (#3529)
1 parent 9321a5c commit 7385948

22 files changed

Lines changed: 92 additions & 65 deletions

File tree

.changeset/large-moles-rule.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
"@latticexyz/entrykit": patch
3+
---
4+
5+
Renamed `deploy-local-prereqs` bin to `entrykit-deploy`, which now accepts an RPC URL so that you can deploy the EntryKit prerequisites to your chain of choice.
6+
7+
```
8+
RPC_URL=http://rpc.garnetchain.com pnpm entrykit-deploy
9+
```
10+
11+
This bin supports specifying the RPC URL via `RPC_URL`, `RPC_HTTP_URL`, `FOUNDRY_ETH_RPC_URL` environment variables or `FOUNDRY_PROFILE` if using `eth_rpc_url` in `foundry.toml`.

.changeset/neat-taxis-behave.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"@latticexyz/cli": patch
3+
---
4+
5+
Added an empty line to the end of `.json` output files for consistency.
6+
Removed some unnecessary defaults to allow them to pass through via environment variables.

.changeset/tiny-moles-rule.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@latticexyz/common": patch
3+
---
4+
5+
Updated Rhodolite chain config with new contract addresses.

packages/cli/src/build.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,7 @@ type BuildOptions = {
1515
config: WorldConfig;
1616
};
1717

18-
export async function build({
19-
rootDir,
20-
config,
21-
foundryProfile = process.env.FOUNDRY_PROFILE,
22-
}: BuildOptions): Promise<void> {
18+
export async function build({ rootDir, config, foundryProfile }: BuildOptions): Promise<void> {
2319
await Promise.all([tablegen({ rootDir, config }), worldgen({ rootDir, config })]);
2420
await forge(["build"], { profile: foundryProfile });
2521
await buildSystemsManifest({ rootDir, config });

packages/cli/src/commands/pull.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ const commandModule: CommandModule<Options, Options> = {
3939
},
4040

4141
async handler(opts) {
42-
const profile = opts.profile ?? process.env.FOUNDRY_PROFILE;
42+
const profile = opts.profile;
4343
const rpc = opts.rpc ?? (await getRpcUrl(profile));
4444
const client = createClient({
4545
transport: http(rpc, {

packages/cli/src/commands/trace.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ const commandModule: CommandModule<Options, Options> = {
5757
const configPath = await resolveConfigPath(args.configPath);
5858
const rootDir = path.dirname(configPath);
5959

60-
const profile = args.profile ?? process.env.FOUNDRY_PROFILE;
60+
const profile = args.profile;
6161
const rpc = args.rpc ?? (await getRpcUrl(profile));
6262

6363
const config = (await loadConfig(configPath)) as WorldConfig;

packages/cli/src/commands/verify.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ const commandModule: CommandModule<Options, Options> = {
4141
},
4242

4343
async handler(opts) {
44-
const profile = opts.profile ?? process.env.FOUNDRY_PROFILE;
44+
const profile = opts.profile;
4545

4646
const configPath = await resolveConfigPath(opts.configPath);
4747
const rootDir = path.dirname(configPath);

packages/cli/src/runDeploy.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ export type DeployOptions = InferredOptionTypes<typeof deployOptions>;
6666
export async function runDeploy(opts: DeployOptions): Promise<WorldDeploy> {
6767
const salt = opts.salt != null ? (isHex(opts.salt) ? opts.salt : stringToHex(opts.salt)) : undefined;
6868

69-
const profile = opts.profile ?? process.env.FOUNDRY_PROFILE;
69+
const profile = opts.profile;
7070

7171
const configPath = await resolveConfigPath(opts.configPath);
7272
const config = (await loadConfig(configPath)) as WorldConfig;
@@ -197,8 +197,8 @@ export async function runDeploy(opts: DeployOptions): Promise<WorldDeploy> {
197197
if (opts.saveDeployment) {
198198
const deploysDir = path.join(config.deploy.deploysDirectory, chainId.toString());
199199
mkdirSync(deploysDir, { recursive: true });
200-
writeFileSync(path.join(deploysDir, "latest.json"), JSON.stringify(deploymentInfo, null, 2));
201-
writeFileSync(path.join(deploysDir, Date.now() + ".json"), JSON.stringify(deploymentInfo, null, 2));
200+
writeFileSync(path.join(deploysDir, "latest.json"), JSON.stringify(deploymentInfo, null, 2) + "\n");
201+
writeFileSync(path.join(deploysDir, Date.now() + ".json"), JSON.stringify(deploymentInfo, null, 2) + "\n");
202202

203203
const localChains = [1337, 31337];
204204
const deploys = existsSync(config.deploy.worldsFile)
@@ -210,7 +210,7 @@ export async function runDeploy(opts: DeployOptions): Promise<WorldDeploy> {
210210
// a consistent address but different block number, we'll ignore the block number.
211211
blockNumber: localChains.includes(chainId) ? undefined : deploymentInfo.blockNumber,
212212
};
213-
writeFileSync(config.deploy.worldsFile, JSON.stringify(deploys, null, 2));
213+
writeFileSync(config.deploy.worldsFile, JSON.stringify(deploys, null, 2) + "\n");
214214

215215
console.log(
216216
chalk.bgGreen(

packages/common/src/chains/rhodolite.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { chainConfig } from "viem/op-stack";
22
import { MUDChain } from "./types";
33
import { Chain } from "viem";
44

5-
const sourceId = 17001;
5+
const sourceId = 17000;
66

77
const defaultRpcUrls = {
88
http: ["https://rpc.rhodolitechain.com"],
@@ -24,9 +24,13 @@ export const rhodolite = {
2424
},
2525
contracts: {
2626
...chainConfig.contracts,
27+
l1StandardBridge: {
28+
[sourceId]: {
29+
address: "0x6487446e0B9FAEa90F6a9772A6448cFa780E30F9",
30+
},
31+
},
2732
quarryPaymaster: {
28-
address: "0x61f22c3827d90c390e0e2aaf220971524ac0a68d",
29-
blockCreated: 11262,
33+
address: "0x7ca1b85aca23fccf2fbac14c02b5e8a6432639b9",
3034
},
3135
},
3236
blockExplorers: {

packages/common/src/foundry/index.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,13 @@ export async function getOutDirectory(profile?: string): Promise<string> {
6868
* @returns The rpc url
6969
*/
7070
export async function getRpcUrl(profile?: string): Promise<string> {
71-
return (await getForgeConfig(profile)).eth_rpc_url || "http://127.0.0.1:8545";
71+
return (
72+
process.env.FOUNDRY_ETH_RPC_URL ||
73+
process.env.RPC_HTTP_URL ||
74+
process.env.RPC_URL ||
75+
(await getForgeConfig(profile)).eth_rpc_url ||
76+
"http://127.0.0.1:8545"
77+
);
7278
}
7379

7480
/**

0 commit comments

Comments
 (0)