@latticexyz/cli 2.2.9-main-2f2e63adbc90288d11e4a15d755167f9c97cbf74 → 2.2.9

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 ss(p)}})(),w=ts({transport:rs(i,{batch:e.rpcBatch?{batchSize:100,wait:1e3}:void 0}),account:b});console.log("Deploying from",w.account.address);let v=await jo(w),T=Date.now(),g=await So({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 Oo(n.deploy.postDeployScript,g.address,i,r,e.forgeScriptOptions,!!e.kms),await v?.reset(),console.log(z.green("Deployment completed in",(Date.now()-T)/1e3,"seconds"));let A={worldAddress:g.address,blockNumber:Number(g.deployBlock)};if(e.saveDeployment){let p=await cs(w),h=me.join(n.deploy.deploysDirectory,p.toString());es(h,{recursive:!0}),xe(me.join(h,"latest.json"),JSON.stringify(A,null,2)),xe(me.join(h,Date.now()+".json"),JSON.stringify(A,null,2));let k=[1337,31337],u=Xn(n.deploy.worldsFile)?JSON.parse(os(n.deploy.worldsFile,"utf-8")):{};u[p]={address:A.worldAddress,blockNumber:k.includes(p)?void 0:A.blockNumber},xe(n.deploy.worldsFile,JSON.stringify(u,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 fs={command:"deploy",describe:"Deploy MUD contracts",builder(e){return e.options(M)},async handler(e){try{await N(e)}catch(o){G(o),process.exit(1)}process.exit(0)}},$o=fs;import ys from"node:path";import{loadConfig as us,resolveConfigPath as gs}from"@latticexyz/config/node";import{worldgen as bs}from"@latticexyz/world/node";var hs={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 ws(e),process.exit(0)}};async function ws(e){let o=await gs(e.configPath),r=await us(o),t=ys.dirname(o);await bs({rootDir:t,config:r,clean:e.clean})}var Eo=hs;import Y from"chalk";import{readFileSync as Ss,writeFileSync as Ds}from"fs";import ve from"path";import{MUDError as V}from"@latticexyz/common/errors";var Fo={name:"@latticexyz/cli",version:"2.2.8",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/block-logs-stream":"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 Ts}from"glob";import{ZodError as Cs,z as Lo}from"zod";var As=Lo.object({MUD_PACKAGES:Lo.string().transform(e=>JSON.parse(e))});function vs(){try{return As.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/stash":{"localPath":"packages/stash"},"@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 Cs){let{...o}=e.format();console.error(`
27
+ `)))}return console.log(A),g}var fs={command:"deploy",describe:"Deploy MUD contracts",builder(e){return e.options(M)},async handler(e){try{await N(e)}catch(o){G(o),process.exit(1)}process.exit(0)}},$o=fs;import ys from"node:path";import{loadConfig as us,resolveConfigPath as gs}from"@latticexyz/config/node";import{worldgen as bs}from"@latticexyz/world/node";var hs={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 ws(e),process.exit(0)}};async function ws(e){let o=await gs(e.configPath),r=await us(o),t=ys.dirname(o);await bs({rootDir:t,config:r,clean:e.clean})}var Eo=hs;import Y from"chalk";import{readFileSync as Ss,writeFileSync as Ds}from"fs";import ve from"path";import{MUDError as V}from"@latticexyz/common/errors";var Fo={name:"@latticexyz/cli",version:"2.2.9",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/block-logs-stream":"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 Ts}from"glob";import{ZodError as Cs,z as Lo}from"zod";var As=Lo.object({MUD_PACKAGES:Lo.string().transform(e=>JSON.parse(e))});function vs(){try{return As.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/stash":{"localPath":"packages/stash"},"@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 Cs){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
  `))}}),ca(ma)).subscribe()}},Jo=fa;import{getCreate2Address as qo,sliceHex as ua,zeroHash as ga}from"viem";import{forge as ya}from"@latticexyz/common/foundry";async function j(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 ya(o,{cwd:e.cwd})}import ba from"p-queue";import{MUDError as ha}from"@latticexyz/common/errors";import{getStorageAt as wa}from"viem/actions";import{execa as Se}from"execa";var xa="0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc";async function Yo({client:e,rpc:o,systems:r,modules:t,worldAddress:n,deployerAddress:s,verifier:a,verifierUrl:i}){let c=s??await X(e);if(!c)throw new ha("No deployer address provided or found.");let l=await wa(e,{address:n,slot:xa}),f=l&&l!==ga,d=new ba({concurrency:4});if(r.map(({name:y,bytecode:b})=>d.add(()=>j({name:y,rpc:o,verifier:a,verifierUrl:i,address:qo({from:c,bytecode:b,salt:x})}).catch(w=>{console.error(`Error verifying system contract ${y}:`,w)}))),a==="sourcify")if(await Se("npm",["install"],{cwd:"node_modules/@latticexyz/store"}),await Se("npm",["install"],{cwd:"node_modules/@latticexyz/world"}),await Se("npm",["install"],{cwd:"node_modules/@latticexyz/world-modules"}),Object.entries(f?te(c):oe(c)).map(([y,{bytecode:b}])=>d.add(()=>j({cwd:"node_modules/@latticexyz/world",name:y,rpc:o,verifier:a,verifierUrl:i,address:qo({from:c,bytecode:b,salt:x})}).catch(w=>{console.error(`Error verifying world factory contract ${y}:`,w)}))),t.map(({name:y,prepareDeploy:b})=>{let{address:w}=b(c);return d.add(()=>j({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=ua(l,-20);d.add(()=>j({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(()=>j({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(()=>j({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 Ca,resolveConfigPath as Aa}from"@latticexyz/config/node";import{resolveSystems as va}from"@latticexyz/world/node";import{getOutDirectory as Sa,getRpcUrl as Da}from"@latticexyz/common/foundry";import{createWalletClient as Ta,http as ka}from"viem";import Go from"chalk";import Pa from"node:path";var Ma={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."}},Ba={command:"verify",describe:"Verify contracts",builder(e){return e.options(Ma)},async handler(e){let o=e.profile??process.env.FOUNDRY_PROFILE,r=await Aa(e.configPath),t=Pa.dirname(r),n=await Ca(r),s=await Sa(o),a=e.rpc??await Da(o);console.log(Go.bgBlue(Go.whiteBright(`
40
40
  Verifying MUD contracts${o?" with profile "+o:""} to RPC ${a}
41
41
  `)));let i=Ta({transport:ka(a,{batch:e.rpcBatch?{batchSize:100,wait:1e3}:void 0})}),l=(await va({rootDir:t,config:n})).map(d=>{let y=L(`${d.name}.sol`,d.name,s);return{name:d.name,bytecode:y.bytecode}}),f=await ce(n,s);await Yo({client:i,rpc:a,systems:l,modules:f,deployerAddress:e.deployerAddress,worldAddress:e.worldAddress,verifier:e.verifier,verifierUrl:e.verifierUrl})}},Qo=Ba;var pu=[Te,$o,ke,Oa,Pe,Me,Eo,No,Vo,Ko,Jo,Wa,Qo];export{pu as commands};
42
- //# sourceMappingURL=commands-PPUS4N74.js.map
42
+ //# sourceMappingURL=commands-2NKMUUKE.js.map