@latticexyz/cli 2.2.3-main-854645260c41eaa89cdadad30bf8e70d5d2fd109 → 2.2.3

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 Zn(p)}})(),h=Yn({transport:Gn(i,{batch:e.rpcBatch?{batchSize:100,wait:1e3}:void 0}),account:b});console.log("Deploying from",h.account.address);let{reset:A}=await Bo(h),T=Date.now(),g=await wo({config:t,deployerAddress:e.deployerAddress,salt:o,worldAddress:e.worldAddress,client:h,tables:u,systems:c,libraries:l,modules:d,artifacts:f});(e.worldAddress==null||e.alwaysRunPostDeploy)&&await To(t.deploy.postDeployScript,g.address,i,r,e.forgeScriptOptions,!!e.kms),await A(),console.log(F.green("Deployment completed in",(Date.now()-T)/1e3,"seconds"));let C={worldAddress:g.address,blockNumber:Number(g.deployBlock)};if(e.saveDeployment){let p=await rs(h),y=me.join(t.deploy.deploysDirectory,p.toString());Jn(y,{recursive:!0}),Ce(me.join(y,"latest.json"),JSON.stringify(C,null,2)),Ce(me.join(y,Date.now()+".json"),JSON.stringify(C,null,2));let v=[1337,31337],q=Kn(t.deploy.worldsFile)?JSON.parse(qn(t.deploy.worldsFile,"utf-8")):{};q[p]={address:C.worldAddress,blockNumber:v.includes(p)?void 0:C.blockNumber},Ce(t.deploy.worldsFile,JSON.stringify(q,null,2)),console.log(F.bgGreen(F.whiteBright(`
26
26
  Deployment result (written to ${t.deploy.worldsFile} and ${y}):
27
- `)))}return console.log(C),g}var as={command:"deploy",describe:"Deploy MUD contracts",builder(e){return e.options(P)},async handler(e){try{await z(e)}catch(o){Y(o),process.exit(1)}process.exit(0)}},Io=as;import is from"node:path";import{loadConfig as ds,resolveConfigPath as ls}from"@latticexyz/config/node";import{worldgen as cs}from"@latticexyz/world/node";var ms={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 ps(e),process.exit(0)}};async function ps(e){let o=await ls(e.configPath),r=await ds(o),n=is.dirname(o);await cs({rootDir:n,config:r,clean:e.clean})}var Oo=ms;import J from"chalk";import{readFileSync as bs,writeFileSync as hs}from"fs";import Se from"path";import{MUDError as L}from"@latticexyz/common/errors";var Ho={name:"@latticexyz/cli",version:"2.2.2",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 ws}from"glob";import{ZodError as ys,z as Ro}from"zod";var us=Ro.object({MUD_PACKAGES:Ro.string().transform(e=>JSON.parse(e))});function gs(){try{return us.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/query":{"localPath":"packages/query"},"@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 ys){let{...o}=e.format();console.error(`
27
+ `)))}return console.log(C),g}var as={command:"deploy",describe:"Deploy MUD contracts",builder(e){return e.options(P)},async handler(e){try{await z(e)}catch(o){Y(o),process.exit(1)}process.exit(0)}},Io=as;import is from"node:path";import{loadConfig as ds,resolveConfigPath as ls}from"@latticexyz/config/node";import{worldgen as cs}from"@latticexyz/world/node";var ms={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 ps(e),process.exit(0)}};async function ps(e){let o=await ls(e.configPath),r=await ds(o),n=is.dirname(o);await cs({rootDir:n,config:r,clean:e.clean})}var Oo=ms;import J from"chalk";import{readFileSync as bs,writeFileSync as hs}from"fs";import Se from"path";import{MUDError as L}from"@latticexyz/common/errors";var Ho={name:"@latticexyz/cli",version:"2.2.3",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 ws}from"glob";import{ZodError as ys,z as Ro}from"zod";var us=Ro.object({MUD_PACKAGES:Ro.string().transform(e=>JSON.parse(e))});function gs(){try{return us.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 ys){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
  `))}}),ra(na)).subscribe()}},No=aa;import{getCreate2Address as Vo,sliceHex as da,zeroHash as la}from"viem";import{forge as ia}from"@latticexyz/common/foundry";async function H(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 ia(o,{cwd:e.cwd})}import ca from"p-queue";import{MUDError as ma}from"@latticexyz/common/errors";import{getStorageAt as pa}from"viem/actions";import{execa as De}from"execa";var fa="0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc";async function Uo({client:e,rpc:o,systems:r,modules:n,worldAddress:t,deployerAddress:s,verifier:a,verifierUrl:i}){let c=s??await Z(e);if(!c)throw new ma("No deployer address provided or found.");let l=await pa(e,{address:t,slot:fa}),f=l&&l!==la,d=new ca({concurrency:4});if(r.map(({name:u,bytecode:b})=>d.add(()=>H({name:u,rpc:o,verifier:a,verifierUrl:i,address:Vo({from:c,bytecode:b,salt:x})}).catch(h=>{console.error(`Error verifying system contract ${u}:`,h)}))),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(([u,{bytecode:b}])=>d.add(()=>H({cwd:"node_modules/@latticexyz/world",name:u,rpc:o,verifier:a,verifierUrl:i,address:Vo({from:c,bytecode:b,salt:x})}).catch(h=>{console.error(`Error verifying world factory contract ${u}:`,h)}))),n.map(({name:u,prepareDeploy:b})=>{let{address:h}=b(c,[]);return d.add(()=>H({cwd:"node_modules/@latticexyz/world-modules",name:u,rpc:o,verifier:a,verifierUrl:i,address:h}).catch(A=>{console.error(`Error verifying module contract ${u}:`,A)}))}),f){let u=da(l,-20);d.add(()=>H({cwd:"node_modules/@latticexyz/world",name:"WorldProxy",rpc:o,verifier:a,verifierUrl:i,address:t}).catch(b=>{console.error("Error verifying WorldProxy contract:",b)})),d.add(()=>H({cwd:"node_modules/@latticexyz/world",name:"World",rpc:o,verifier:a,verifierUrl:i,address:u}).catch(b=>{console.error("Error verifying World contract:",b)}))}else d.add(()=>H({cwd:"node_modules/@latticexyz/world",name:"World",rpc:o,verifier:a,verifierUrl:i,address:t}).catch(u=>{console.error("Error verifying World contract:",u)}));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 ya,resolveConfigPath as ua}from"@latticexyz/config/node";import{resolveSystems as ga}from"@latticexyz/world/node";import{getOutDirectory as ba,getRpcUrl as ha}from"@latticexyz/common/foundry";import{createWalletClient as wa,http as xa}from"viem";import _o from"chalk";import Ca from"node:path";var Aa={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."}},va={command:"verify",describe:"Verify contracts",builder(e){return e.options(Aa)},async handler(e){let o=e.profile??process.env.FOUNDRY_PROFILE,r=await ua(e.configPath),n=Ca.dirname(r),t=await ya(r),s=await ba(o),a=e.rpc??await ha(o);console.log(_o.bgBlue(_o.whiteBright(`
40
40
  Verifying MUD contracts${o?" with profile "+o:""} to RPC ${a}
41
41
  `)));let i=wa({transport:xa(a,{batch:e.rpcBatch?{batchSize:100,wait:1e3}:void 0})}),l=(await ga({rootDir:n,config:t})).map(d=>{let u=E(`${d.name}.sol`,d.name,s);return{name:d.name,bytecode:u.bytecode}}),f=await ce(t,s);await Uo({client:i,rpc:a,systems:l,modules:f,deployerAddress:e.deployerAddress,worldAddress:e.worldAddress,verifier:e.verifier,verifierUrl:e.verifierUrl})}},Ko=va;var su=[Te,Io,ke,Sa,Pe,Me,Oo,$o,Eo,Lo,No,Da,Ko];export{su as commands};
42
- //# sourceMappingURL=commands-XKAEQV2S.js.map
42
+ //# sourceMappingURL=commands-EPQI3HHU.js.map