@latticexyz/cli 2.2.4 → 2.2.5

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.
@@ -24,7 +24,7 @@ Resolved config:
24
24
  Run 'echo "PRIVATE_KEY=0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80" > .env'
25
25
  in your contracts directory to use the default anvil private key.`);return ts(p)}})(),w=Xn({transport:es(i,{batch:e.rpcBatch?{batchSize:100,wait:1e3}:void 0}),account:b});console.log("Deploying from",w.account.address);let{reset:v}=await Io(w),k=Date.now(),g=await xo({config:n,deployerAddress:e.deployerAddress,salt:o,worldAddress:e.worldAddress,client:w,tables:y,systems:c,libraries:l,modules:d,artifacts:f});(e.worldAddress==null||e.alwaysRunPostDeploy)&&await ko(n.deploy.postDeployScript,g.address,i,t,e.forgeScriptOptions,!!e.kms),await v(),console.log(z.green("Deployment completed in",(Date.now()-k)/1e3,"seconds"));let A={worldAddress:g.address,blockNumber:Number(g.deployBlock)};if(e.saveDeployment){let p=await is(w),h=me.join(n.deploy.deploysDirectory,p.toString());Qn(h,{recursive:!0}),Ce(me.join(h,"latest.json"),JSON.stringify(A,null,2)),Ce(me.join(h,Date.now()+".json"),JSON.stringify(A,null,2));let u=[1337,31337],S=Gn(n.deploy.worldsFile)?JSON.parse(Zn(n.deploy.worldsFile,"utf-8")):{};S[p]={address:A.worldAddress,blockNumber:u.includes(p)?void 0:A.blockNumber},Ce(n.deploy.worldsFile,JSON.stringify(S,null,2)),console.log(z.bgGreen(z.whiteBright(`
26
26
  Deployment result (written to ${n.deploy.worldsFile} and ${h}):
27
- `)))}return console.log(A),g}var cs={command:"deploy",describe:"Deploy MUD contracts",builder(e){return e.options(M)},async handler(e){try{await L(e)}catch(o){Y(o),process.exit(1)}process.exit(0)}},Oo=cs;import ms from"node:path";import{loadConfig as ps,resolveConfigPath as fs}from"@latticexyz/config/node";import{worldgen as ys}from"@latticexyz/world/node";var us={command:"worldgen",describe:"Autogenerate interfaces for Systems and World based on existing contracts and the config file",builder(e){return e.options({configPath:{type:"string",desc:"Path to the MUD config file"},clean:{type:"boolean",desc:"Clear the worldgen directory before generating new interfaces (defaults to true)",default:!0}})},async handler(e){await gs(e),process.exit(0)}};async function gs(e){let o=await fs(e.configPath),t=await ps(o),r=ms.dirname(o);await ys({rootDir:r,config:t,clean:e.clean})}var Ho=us;import q from"chalk";import{readFileSync as Cs,writeFileSync as As}from"fs";import Se from"path";import{MUDError as N}from"@latticexyz/common/errors";var Ro={name:"@latticexyz/cli",version:"2.2.4",description:"Command line interface for mud",repository:{type:"git",url:"https://github.com/latticexyz/mud.git",directory:"packages/cli"},license:"MIT",type:"module",exports:{".":"./dist/index.js"},typesVersions:{"*":{index:["./dist/index.d.ts"]}},bin:{mud:"./bin/mud.js"},files:["bin","dist"],scripts:{build:"pnpm run build:js && pnpm run build:test-tables","build:js":"tsup && chmod +x ./dist/mud.js","build:test-tables":"tsx ./scripts/generate-test-tables.ts",clean:"pnpm run clean:js && pnpm run clean:test-tables","clean:js":"shx rm -rf dist","clean:test-tables":"shx rm -rf src/**/codegen",dev:"tsup --watch",lint:"eslint . --ext .ts",test:"tsc --noEmit && forge test","test:ci":"pnpm run test"},dependencies:{"@ark/util":"catalog:","@aws-sdk/client-kms":"^3.556.0","@latticexyz/abi-ts":"workspace:*","@latticexyz/common":"workspace:*","@latticexyz/config":"workspace:*","@latticexyz/gas-report":"workspace:*","@latticexyz/protocol-parser":"workspace:*","@latticexyz/schema-type":"workspace:*","@latticexyz/store":"workspace:*","@latticexyz/utils":"workspace:*","@latticexyz/world":"workspace:*","@latticexyz/world-module-metadata":"workspace:*",abitype:"catalog:","asn1.js":"^5.4.1",chalk:"^5.0.1",chokidar:"^3.5.3",debug:"^4.3.4",dotenv:"^16.0.3",execa:"^7.0.0","find-up":"^6.3.0",glob:"^10.4.2",openurl:"^1.1.1","p-queue":"^7.4.1","p-retry":"^5.1.2",path:"^0.12.7",rxjs:"7.5.5","throttle-debounce":"^5.0.0",toposort:"^2.0.2",typescript:"5.4.2",viem:"catalog:",yargs:"^17.7.1",zod:"3.23.8","zod-validation-error":"^1.3.0"},devDependencies:{"@types/debug":"^4.1.7","@types/ejs":"^3.1.1","@types/node":"^18.15.11","@types/openurl":"^1.0.0","@types/throttle-debounce":"^5.0.0","@types/toposort":"^2.0.6","@types/yargs":"^17.0.10","ds-test":"https://github.com/dapphub/ds-test.git#e282159d5170298eb2455a6c05280ab5a73a4ef0","forge-std":"https://github.com/foundry-rs/forge-std.git#74cfb77e308dd188d2f58864aaf44963ae6b88b1",tsup:"^6.7.0",tsx:"^3.12.6",vitest:"0.34.6"}};import{globSync as vs}from"glob";import{ZodError as hs,z as jo}from"zod";var ws=jo.object({MUD_PACKAGES:jo.string().transform(e=>JSON.parse(e))});function xs(){try{return ws.parse({MUD_PACKAGES:'{"@latticexyz/abi-ts":{"localPath":"packages/abi-ts"},"@latticexyz/block-logs-stream":{"localPath":"packages/block-logs-stream"},"@latticexyz/cli":{"localPath":"packages/cli"},"@latticexyz/common":{"localPath":"packages/common"},"@latticexyz/config":{"localPath":"packages/config"},"create-mud":{"localPath":"packages/create-mud"},"@latticexyz/dev-tools":{"localPath":"packages/dev-tools"},"@latticexyz/explorer":{"localPath":"packages/explorer"},"@latticexyz/faucet":{"localPath":"packages/faucet"},"@latticexyz/gas-report":{"localPath":"packages/gas-report"},"@latticexyz/protocol-parser":{"localPath":"packages/protocol-parser"},"@latticexyz/react":{"localPath":"packages/react"},"@latticexyz/recs":{"localPath":"packages/recs"},"@latticexyz/schema-type":{"localPath":"packages/schema-type"},"solhint-config-mud":{"localPath":"packages/solhint-config-mud"},"solhint-plugin-mud":{"localPath":"packages/solhint-plugin-mud"},"@latticexyz/store-indexer":{"localPath":"packages/store-indexer"},"@latticexyz/store-sync":{"localPath":"packages/store-sync"},"@latticexyz/store":{"localPath":"packages/store"},"@latticexyz/utils":{"localPath":"packages/utils"},"@latticexyz/world-module-metadata":{"localPath":"packages/world-module-metadata"},"@latticexyz/world-modules":{"localPath":"packages/world-modules"},"@latticexyz/world":{"localPath":"packages/world"}}'})}catch(e){if(e instanceof hs){let{...o}=e.format();console.error(`
27
+ `)))}return console.log(A),g}var cs={command:"deploy",describe:"Deploy MUD contracts",builder(e){return e.options(M)},async handler(e){try{await L(e)}catch(o){Y(o),process.exit(1)}process.exit(0)}},Oo=cs;import ms from"node:path";import{loadConfig as ps,resolveConfigPath as fs}from"@latticexyz/config/node";import{worldgen as ys}from"@latticexyz/world/node";var us={command:"worldgen",describe:"Autogenerate interfaces for Systems and World based on existing contracts and the config file",builder(e){return e.options({configPath:{type:"string",desc:"Path to the MUD config file"},clean:{type:"boolean",desc:"Clear the worldgen directory before generating new interfaces (defaults to true)",default:!0}})},async handler(e){await gs(e),process.exit(0)}};async function gs(e){let o=await fs(e.configPath),t=await ps(o),r=ms.dirname(o);await ys({rootDir:r,config:t,clean:e.clean})}var Ho=us;import q from"chalk";import{readFileSync as Cs,writeFileSync as As}from"fs";import Se from"path";import{MUDError as N}from"@latticexyz/common/errors";var Ro={name:"@latticexyz/cli",version:"2.2.5",description:"Command line interface for mud",repository:{type:"git",url:"https://github.com/latticexyz/mud.git",directory:"packages/cli"},license:"MIT",type:"module",exports:{".":"./dist/index.js"},typesVersions:{"*":{index:["./dist/index.d.ts"]}},bin:{mud:"./bin/mud.js"},files:["bin","dist"],scripts:{build:"pnpm run build:js && pnpm run build:test-tables","build:js":"tsup && chmod +x ./dist/mud.js","build:test-tables":"tsx ./scripts/generate-test-tables.ts",clean:"pnpm run clean:js && pnpm run clean:test-tables","clean:js":"shx rm -rf dist","clean:test-tables":"shx rm -rf src/**/codegen",dev:"tsup --watch",lint:"eslint . --ext .ts",test:"tsc --noEmit && forge test","test:ci":"pnpm run test"},dependencies:{"@ark/util":"catalog:","@aws-sdk/client-kms":"^3.556.0","@latticexyz/abi-ts":"workspace:*","@latticexyz/common":"workspace:*","@latticexyz/config":"workspace:*","@latticexyz/gas-report":"workspace:*","@latticexyz/protocol-parser":"workspace:*","@latticexyz/schema-type":"workspace:*","@latticexyz/store":"workspace:*","@latticexyz/utils":"workspace:*","@latticexyz/world":"workspace:*","@latticexyz/world-module-metadata":"workspace:*",abitype:"catalog:","asn1.js":"^5.4.1",chalk:"^5.0.1",chokidar:"^3.5.3",debug:"^4.3.4",dotenv:"^16.0.3",execa:"^7.0.0","find-up":"^6.3.0",glob:"^10.4.2",openurl:"^1.1.1","p-queue":"^7.4.1","p-retry":"^5.1.2",path:"^0.12.7",rxjs:"7.5.5","throttle-debounce":"^5.0.0",toposort:"^2.0.2",typescript:"5.4.2",viem:"catalog:",yargs:"^17.7.1",zod:"3.23.8","zod-validation-error":"^1.3.0"},devDependencies:{"@types/debug":"^4.1.7","@types/ejs":"^3.1.1","@types/node":"^18.15.11","@types/openurl":"^1.0.0","@types/throttle-debounce":"^5.0.0","@types/toposort":"^2.0.6","@types/yargs":"^17.0.10","ds-test":"https://github.com/dapphub/ds-test.git#e282159d5170298eb2455a6c05280ab5a73a4ef0","forge-std":"https://github.com/foundry-rs/forge-std.git#74cfb77e308dd188d2f58864aaf44963ae6b88b1",tsup:"^6.7.0",tsx:"^3.12.6",vitest:"0.34.6"}};import{globSync as vs}from"glob";import{ZodError as hs,z as jo}from"zod";var ws=jo.object({MUD_PACKAGES:jo.string().transform(e=>JSON.parse(e))});function xs(){try{return ws.parse({MUD_PACKAGES:'{"@latticexyz/abi-ts":{"localPath":"packages/abi-ts"},"@latticexyz/block-logs-stream":{"localPath":"packages/block-logs-stream"},"@latticexyz/cli":{"localPath":"packages/cli"},"@latticexyz/common":{"localPath":"packages/common"},"@latticexyz/config":{"localPath":"packages/config"},"create-mud":{"localPath":"packages/create-mud"},"@latticexyz/dev-tools":{"localPath":"packages/dev-tools"},"@latticexyz/explorer":{"localPath":"packages/explorer"},"@latticexyz/faucet":{"localPath":"packages/faucet"},"@latticexyz/gas-report":{"localPath":"packages/gas-report"},"@latticexyz/protocol-parser":{"localPath":"packages/protocol-parser"},"@latticexyz/react":{"localPath":"packages/react"},"@latticexyz/recs":{"localPath":"packages/recs"},"@latticexyz/schema-type":{"localPath":"packages/schema-type"},"solhint-config-mud":{"localPath":"packages/solhint-config-mud"},"solhint-plugin-mud":{"localPath":"packages/solhint-plugin-mud"},"@latticexyz/store-indexer":{"localPath":"packages/store-indexer"},"@latticexyz/store-sync":{"localPath":"packages/store-sync"},"@latticexyz/store":{"localPath":"packages/store"},"@latticexyz/utils":{"localPath":"packages/utils"},"@latticexyz/world-module-metadata":{"localPath":"packages/world-module-metadata"},"@latticexyz/world-modules":{"localPath":"packages/world-modules"},"@latticexyz/world":{"localPath":"packages/world"}}'})}catch(e){if(e instanceof hs){let{...o}=e.format();console.error(`
28
28
  Missing or invalid environment variables:
29
29
 
30
30
  ${Object.keys(o).join(`
@@ -39,4 +39,4 @@ Waiting for file changes\u2026
39
39
  `))}}),ia(da)).subscribe()}},Vo=ca;import{getCreate2Address as Uo,sliceHex as pa,zeroHash as fa}from"viem";import{forge as ma}from"@latticexyz/common/foundry";async function R(e){let o=["verify-contract",e.address,e.name,"--rpc-url",e.rpc];e.verifier&&o.push("--verifier",e.verifier),e.verifierUrl&&o.push("--verifier-url",e.verifierUrl),await ma(o,{cwd:e.cwd})}import ya from"p-queue";import{MUDError as ua}from"@latticexyz/common/errors";import{getStorageAt as ga}from"viem/actions";import{execa as De}from"execa";var ba="0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc";async function _o({client:e,rpc:o,systems:t,modules:r,worldAddress:n,deployerAddress:s,verifier:a,verifierUrl:i}){let c=s??await Z(e);if(!c)throw new ua("No deployer address provided or found.");let l=await ga(e,{address:n,slot:ba}),f=l&&l!==fa,d=new ya({concurrency:4});if(t.map(({name:y,bytecode:b})=>d.add(()=>R({name:y,rpc:o,verifier:a,verifierUrl:i,address:Uo({from:c,bytecode:b,salt:C})}).catch(w=>{console.error(`Error verifying system contract ${y}:`,w)}))),a==="sourcify")if(await De("npm",["install"],{cwd:"node_modules/@latticexyz/store"}),await De("npm",["install"],{cwd:"node_modules/@latticexyz/world"}),await De("npm",["install"],{cwd:"node_modules/@latticexyz/world-modules"}),Object.entries(f?oe(c):ee(c)).map(([y,{bytecode:b}])=>d.add(()=>R({cwd:"node_modules/@latticexyz/world",name:y,rpc:o,verifier:a,verifierUrl:i,address:Uo({from:c,bytecode:b,salt:C})}).catch(w=>{console.error(`Error verifying world factory contract ${y}:`,w)}))),r.map(({name:y,prepareDeploy:b})=>{let{address:w}=b(c,[]);return d.add(()=>R({cwd:"node_modules/@latticexyz/world-modules",name:y,rpc:o,verifier:a,verifierUrl:i,address:w}).catch(v=>{console.error(`Error verifying module contract ${y}:`,v)}))}),f){let y=pa(l,-20);d.add(()=>R({cwd:"node_modules/@latticexyz/world",name:"WorldProxy",rpc:o,verifier:a,verifierUrl:i,address:n}).catch(b=>{console.error("Error verifying WorldProxy contract:",b)})),d.add(()=>R({cwd:"node_modules/@latticexyz/world",name:"World",rpc:o,verifier:a,verifierUrl:i,address:y}).catch(b=>{console.error("Error verifying World contract:",b)}))}else d.add(()=>R({cwd:"node_modules/@latticexyz/world",name:"World",rpc:o,verifier:a,verifierUrl:i,address:n}).catch(y=>{console.error("Error verifying World contract:",y)}));else console.log(""),console.log(`Note: MUD is currently unable to verify store, world, and world-modules contracts with ${a}. We are planning to expand support in a future version.`),console.log("")}import{loadConfig as ha,resolveConfigPath as wa}from"@latticexyz/config/node";import{resolveSystems as xa}from"@latticexyz/world/node";import{getOutDirectory as Ca,getRpcUrl as Aa}from"@latticexyz/common/foundry";import{createWalletClient as va,http as Sa}from"viem";import Ko from"chalk";import Da from"node:path";var Ta={deployerAddress:{type:"string",desc:"Deploy using an existing deterministic deployer (https://github.com/Arachnid/deterministic-deployment-proxy)"},worldAddress:{type:"string",required:!0,desc:"Verify an existing World at the given address"},configPath:{type:"string",desc:"Path to the MUD config file"},profile:{type:"string",desc:"The foundry profile to use"},rpc:{type:"string",desc:"The RPC URL to use. Defaults to the RPC url from the local foundry.toml"},rpcBatch:{type:"boolean",desc:"Enable batch processing of RPC requests in viem client (defaults to batch size of 100 and wait of 1s)"},verifier:{type:"string",desc:"The verifier to use. Defaults to blockscout",default:"blockscout"},verifierUrl:{type:"string",desc:"The verification provider."}},ka={command:"verify",describe:"Verify contracts",builder(e){return e.options(Ta)},async handler(e){let o=e.profile??process.env.FOUNDRY_PROFILE,t=await wa(e.configPath),r=Da.dirname(t),n=await ha(t),s=await Ca(o),a=e.rpc??await Aa(o);console.log(Ko.bgBlue(Ko.whiteBright(`
40
40
  Verifying MUD contracts${o?" with profile "+o:""} to RPC ${a}
41
41
  `)));let i=va({transport:Sa(a,{batch:e.rpcBatch?{batchSize:100,wait:1e3}:void 0})}),l=(await xa({rootDir:r,config:n})).map(d=>{let y=F(`${d.name}.sol`,d.name,s);return{name:d.name,bytecode:y.bytecode}}),f=await ce(n,s);await _o({client:i,rpc:a,systems:l,modules:f,deployerAddress:e.deployerAddress,worldAddress:e.worldAddress,verifier:e.verifier,verifierUrl:e.verifierUrl})}},Jo=ka;var cu=[ke,Oo,Pe,Pa,Me,We,Ho,Eo,Fo,No,Vo,Ma,Jo];export{cu as commands};
42
- //# sourceMappingURL=commands-OIS3QW7V.js.map
42
+ //# sourceMappingURL=commands-XCW4Y2DB.js.map