@latticexyz/entrykit 2.2.17-ffefc8f000769d5ca625dd19290007a853a21788 → 2.2.17

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@latticexyz/entrykit",
3
- "version": "2.2.17-ffefc8f000769d5ca625dd19290007a853a21788",
3
+ "version": "2.2.17",
4
4
  "description": "User onboarding flows for MUD apps",
5
5
  "repository": {
6
6
  "type": "git",
@@ -24,7 +24,7 @@
24
24
  }
25
25
  },
26
26
  "bin": {
27
- "deploy-local-prereqs": "./bin/deploy-local-prereqs.js"
27
+ "entrykit-deploy": "./bin/deploy.js"
28
28
  },
29
29
  "files": [
30
30
  "dist"
@@ -42,13 +42,13 @@
42
42
  "tailwind-merge": "^1.12.0",
43
43
  "usehooks-ts": "^3.1.0",
44
44
  "zustand": "^4.5.2",
45
- "@latticexyz/common": "2.2.17-ffefc8f000769d5ca625dd19290007a853a21788",
46
- "@latticexyz/config": "2.2.17-ffefc8f000769d5ca625dd19290007a853a21788",
47
- "@latticexyz/paymaster": "2.2.17-ffefc8f000769d5ca625dd19290007a853a21788",
48
- "@latticexyz/protocol-parser": "2.2.17-ffefc8f000769d5ca625dd19290007a853a21788",
49
- "@latticexyz/store": "2.2.17-ffefc8f000769d5ca625dd19290007a853a21788",
50
- "@latticexyz/world": "2.2.17-ffefc8f000769d5ca625dd19290007a853a21788",
51
- "@latticexyz/world-module-callwithsignature": "2.2.17-ffefc8f000769d5ca625dd19290007a853a21788"
45
+ "@latticexyz/common": "2.2.17",
46
+ "@latticexyz/config": "2.2.17",
47
+ "@latticexyz/paymaster": "2.2.17",
48
+ "@latticexyz/protocol-parser": "2.2.17",
49
+ "@latticexyz/store": "2.2.17",
50
+ "@latticexyz/world": "2.2.17",
51
+ "@latticexyz/world-module-callwithsignature": "2.2.17"
52
52
  },
53
53
  "devDependencies": {
54
54
  "@tanstack/react-query": "^5.56.2",
@@ -88,6 +88,7 @@
88
88
  "clean": "pnpm run clean:js",
89
89
  "clean:js": "shx rm -rf dist",
90
90
  "data:relay-chains": "tsx src/scripts/get-relay-chains.ts",
91
+ "deploy": "tsx src/bin/deploy.ts",
91
92
  "dev": "tsup --watch",
92
93
  "playground": "mprocs",
93
94
  "playground:deploy": "mprocs --config mprocs.deploy.yaml",
@@ -1,16 +0,0 @@
1
- import"dotenv/config";import{concatHex as c,createWalletClient as A,http as x,isHex as g,parseAbiParameters as d,encodeAbiParameters as i,size as s,parseEther as h}from"viem";import{privateKeyToAccount as v}from"viem/accounts";import{getRpcUrl as w}from"@latticexyz/common/foundry";import{ensureContractsDeployed as p,ensureDeployer as E,getContractAddress as y,waitForTransactions as H}from"@latticexyz/common/internal";import r from"@account-abstraction/contracts/artifacts/EntryPoint.json"assert{type:"json"};import n from"@account-abstraction/contracts/artifacts/SimpleAccountFactory.json"assert{type:"json"};import l from"@latticexyz/paymaster/out/GenerousPaymaster.sol/GenerousPaymaster.json"assert{type:"json"};import{getChainId as P}from"viem/actions";import{writeContract as B}from"@latticexyz/common";var m=process.env.PRIVATE_KEY;if(!g(m))throw new Error(`Missing \`PRIVATE_KEY\` environment variable. If you're using Anvil, run
2
-
3
- echo "PRIVATE_KEY=0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80" > .env
4
-
5
- to use a prefunded Anvil account.`);var T=v(m),C=await w(),e=A({transport:x(C),account:T}),I=await P(e),o=await E(e),b="0x90d8084deab30c2a37c45e8d47f49f2f7965183cb6990a98943ef94940681de3",t=y({deployerAddress:o,bytecode:r.bytecode,salt:b});await p({client:e,deployerAddress:o,contracts:[{bytecode:r.bytecode,salt:b,deployedBytecodeSize:s(r.deployedBytecode),debugLabel:"EntryPoint v0.7"}]});var f=c([l.bytecode.object,i(d("address"),[t])]),a=y({deployerAddress:o,bytecode:f});await p({client:e,deployerAddress:o,contracts:[{bytecode:c([n.bytecode,i(d("address"),[t])]),deployedBytecodeSize:s(n.deployedBytecode),debugLabel:"SimpleAccountFactory"},{bytecode:f,deployedBytecodeSize:s(l.deployedBytecode.object),debugLabel:"GenerousPaymaster"}]});console.log(`
6
- Contracts deployed!
7
- `);if(I===31337){let u=await B(e,{chain:null,address:t,abi:[{inputs:[{name:"account",type:"address"}],name:"depositTo",outputs:[],stateMutability:"payable",type:"function"}],functionName:"depositTo",args:[a],value:h("100")});await H({client:e,hashes:[u]}),console.log(`
8
- Funded paymaster at:`,a,`
9
- `)}else console.log(`
10
- Be sure to fund the paymaster by making a deposit in the entrypoint contract. For example:
11
-
12
- cast send ${t} "depositTo(address)" ${a} --value 1ether
13
- `);console.log(`
14
- EntryKit prerequisites complete!
15
- `);process.exit(0);
16
- //# sourceMappingURL=deploy-local-prereqs.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/bin/deploy-local-prereqs.ts"],"sourcesContent":["import \"dotenv/config\";\nimport {\n Hex,\n concatHex,\n createWalletClient,\n http,\n isHex,\n parseAbiParameters,\n encodeAbiParameters,\n size,\n parseEther,\n} from \"viem\";\nimport { privateKeyToAccount } from \"viem/accounts\";\nimport { getRpcUrl } from \"@latticexyz/common/foundry\";\nimport {\n ensureContractsDeployed,\n ensureDeployer,\n getContractAddress,\n waitForTransactions,\n} from \"@latticexyz/common/internal\";\nimport entryPointArtifact from \"@account-abstraction/contracts/artifacts/EntryPoint.json\" assert { type: \"json\" };\nimport simpleAccountFactoryArtifact from \"@account-abstraction/contracts/artifacts/SimpleAccountFactory.json\" assert { type: \"json\" };\nimport paymasterArtifact from \"@latticexyz/paymaster/out/GenerousPaymaster.sol/GenerousPaymaster.json\" assert { type: \"json\" };\nimport { getChainId } from \"viem/actions\";\nimport { writeContract } from \"@latticexyz/common\";\n\n// TODO: parse env with arktype (to avoid zod dep) and throw when absent\n\nconst privateKey = process.env.PRIVATE_KEY;\nif (!isHex(privateKey)) {\n // TODO: detect anvil and automatically put this env var where it needs to go?\n throw new Error(\n `Missing \\`PRIVATE_KEY\\` environment variable. If you're using Anvil, run\n\n echo \"PRIVATE_KEY=0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80\" > .env\n\nto use a prefunded Anvil account.`,\n );\n}\nconst account = privateKeyToAccount(privateKey);\n\n// TODO: rpc url flag/env var?\n// TODO: foundry profile flag/env var?\nconst rpc = await getRpcUrl();\n\nconst client = createWalletClient({\n transport: http(rpc),\n account,\n});\n\nconst chainId = await getChainId(client);\n\n// TODO: deployer address flag/env var?\nconst deployerAddress = await ensureDeployer(client);\n\n// https://github.com/eth-infinitism/account-abstraction/blob/b3bae63bd9bc0ed394dfca8668008213127adb62/hardhat.config.ts#L11\nconst entryPointSalt = \"0x90d8084deab30c2a37c45e8d47f49f2f7965183cb6990a98943ef94940681de3\";\nconst entryPointAddress = getContractAddress({\n deployerAddress,\n bytecode: entryPointArtifact.bytecode as Hex,\n salt: entryPointSalt,\n});\n// TODO: assert that this matches Viem's entryPoint07Address\n\n// Deploy entrypoint first, because following deploys need to be able to call it.\nawait ensureContractsDeployed({\n client,\n deployerAddress,\n contracts: [\n {\n bytecode: entryPointArtifact.bytecode as Hex,\n salt: entryPointSalt,\n deployedBytecodeSize: size(entryPointArtifact.deployedBytecode as Hex),\n debugLabel: \"EntryPoint v0.7\",\n },\n ],\n});\n\nconst paymasterBytecode = concatHex([\n paymasterArtifact.bytecode.object as Hex,\n encodeAbiParameters(parseAbiParameters(\"address\"), [entryPointAddress]),\n]);\nconst paymasterAddress = getContractAddress({ deployerAddress, bytecode: paymasterBytecode });\n\nawait ensureContractsDeployed({\n client,\n deployerAddress,\n contracts: [\n {\n bytecode: concatHex([\n simpleAccountFactoryArtifact.bytecode as Hex,\n encodeAbiParameters(parseAbiParameters(\"address\"), [entryPointAddress]),\n ]),\n deployedBytecodeSize: size(simpleAccountFactoryArtifact.deployedBytecode as Hex),\n debugLabel: \"SimpleAccountFactory\",\n },\n {\n bytecode: paymasterBytecode,\n deployedBytecodeSize: size(paymasterArtifact.deployedBytecode.object as Hex),\n debugLabel: \"GenerousPaymaster\",\n },\n ],\n});\n\nconsole.log(\"\\nContracts deployed!\\n\");\n\nif (chainId === 31337) {\n const tx = await writeContract(client, {\n chain: null,\n address: entryPointAddress,\n abi: [\n {\n inputs: [{ name: \"account\", type: \"address\" }],\n name: \"depositTo\",\n outputs: [],\n stateMutability: \"payable\",\n type: \"function\",\n },\n ],\n functionName: \"depositTo\",\n args: [paymasterAddress],\n value: parseEther(\"100\"),\n });\n await waitForTransactions({ client, hashes: [tx] });\n console.log(\"\\nFunded paymaster at:\", paymasterAddress, \"\\n\");\n} else {\n console.log(`\nBe sure to fund the paymaster by making a deposit in the entrypoint contract. For example:\n\n cast send ${entryPointAddress} \"depositTo(address)\" ${paymasterAddress} --value 1ether\n`);\n}\n\nconsole.log(\"\\nEntryKit prerequisites complete!\\n\");\nprocess.exit(0);\n"],"mappings":"AAAA,MAAO,gBACP,OAEE,aAAAA,EACA,sBAAAC,EACA,QAAAC,EACA,SAAAC,EACA,sBAAAC,EACA,uBAAAC,EACA,QAAAC,EACA,cAAAC,MACK,OACP,OAAS,uBAAAC,MAA2B,gBACpC,OAAS,aAAAC,MAAiB,6BAC1B,OACE,2BAAAC,EACA,kBAAAC,EACA,sBAAAC,EACA,uBAAAC,MACK,8BACP,OAAOC,MAAwB,0DAA2D,MAAO,CAAE,KAAM,MAAO,EAChH,OAAOC,MAAkC,oEAAqE,MAAO,CAAE,KAAM,MAAO,EACpI,OAAOC,MAAuB,wEAAyE,MAAO,CAAE,KAAM,MAAO,EAC7H,OAAS,cAAAC,MAAkB,eAC3B,OAAS,iBAAAC,MAAqB,qBAI9B,IAAMC,EAAa,QAAQ,IAAI,YAC/B,GAAI,CAAChB,EAAMgB,CAAU,EAEnB,MAAM,IAAI,MACR;AAAA;AAAA;AAAA;AAAA,kCAKF,EAEF,IAAMC,EAAUZ,EAAoBW,CAAU,EAIxCE,EAAM,MAAMZ,EAAU,EAEtBa,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,CACzB,CAAC,EACD,MAAMM,EAAoB,CAAE,OAAAS,EAAQ,OAAQ,CAACO,CAAE,CAAE,CAAC,EAClD,QAAQ,IAAI;AAAA,sBAA0BD,EAAkB;AAAA,CAAI,CAC9D,MACE,QAAQ,IAAI;AAAA;AAAA;AAAA,cAGAF,CAAiB,yBAAyBE,CAAgB;AAAA,CACvE,EAGD,QAAQ,IAAI;AAAA;AAAA,CAAsC,EAClD,QAAQ,KAAK,CAAC","names":["concatHex","createWalletClient","http","isHex","parseAbiParameters","encodeAbiParameters","size","parseEther","privateKeyToAccount","getRpcUrl","ensureContractsDeployed","ensureDeployer","getContractAddress","waitForTransactions","entryPointArtifact","simpleAccountFactoryArtifact","paymasterArtifact","getChainId","writeContract","privateKey","account","rpc","client","chainId","deployerAddress","entryPointSalt","entryPointAddress","paymasterBytecode","paymasterAddress","tx"]}