@latticexyz/entrykit 2.2.18-9fa07c8489f1fbf167d0db01cd9aaa645a29c8e2 → 2.2.18-c44207f620a38653497b78db0b71f5de7bc1a940
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/dist/tsup/bin/deploy.js +8 -117
- package/dist/tsup/bin/deploy.js.map +1 -1
- package/dist/tsup/exports/internal.js +1382 -2238
- package/dist/tsup/exports/internal.js.map +1 -1
- package/package.json +11 -28
- package/dist/tsup/bin/deploy.cjs +0 -132
- package/dist/tsup/bin/deploy.cjs.map +0 -1
- package/dist/tsup/bin/deploy.d.cts +0 -2
- package/dist/tsup/exports/index.cjs +0 -2
- package/dist/tsup/exports/index.cjs.map +0 -1
- package/dist/tsup/exports/index.d.cts +0 -2
- package/dist/tsup/exports/internal.cjs +0 -2287
- package/dist/tsup/exports/internal.cjs.map +0 -1
- package/dist/tsup/exports/internal.d.cts +0 -123
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@latticexyz/entrykit",
|
|
3
|
-
"version": "2.2.18-
|
|
3
|
+
"version": "2.2.18-c44207f620a38653497b78db0b71f5de7bc1a940",
|
|
4
4
|
"description": "User onboarding flows for MUD apps",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -10,26 +10,8 @@
|
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"type": "module",
|
|
12
12
|
"exports": {
|
|
13
|
-
".":
|
|
14
|
-
|
|
15
|
-
"import": "./dist/tsup/exports/index.js",
|
|
16
|
-
"types": "./dist/tsup/exports/index.d.ts"
|
|
17
|
-
},
|
|
18
|
-
"require": {
|
|
19
|
-
"require": "./dist/tsup/exports/index.cjs",
|
|
20
|
-
"types": "./dist/tsup/exports/index.d.cts"
|
|
21
|
-
}
|
|
22
|
-
},
|
|
23
|
-
"./internal": {
|
|
24
|
-
"import": {
|
|
25
|
-
"import": "./dist/tsup/exports/internal.js",
|
|
26
|
-
"types": "./dist/tsup/exports/internal.d.ts"
|
|
27
|
-
},
|
|
28
|
-
"require": {
|
|
29
|
-
"require": "./dist/tsup/exports/internal.cjs",
|
|
30
|
-
"types": "./dist/tsup/exports/internal.d.cts"
|
|
31
|
-
}
|
|
32
|
-
}
|
|
13
|
+
".": "./dist/tsup/exports/index.js",
|
|
14
|
+
"./internal": "./dist/tsup/exports/internal.js"
|
|
33
15
|
},
|
|
34
16
|
"typesVersions": {
|
|
35
17
|
"*": {
|
|
@@ -60,13 +42,13 @@
|
|
|
60
42
|
"tailwind-merge": "^1.12.0",
|
|
61
43
|
"usehooks-ts": "^3.1.0",
|
|
62
44
|
"zustand": "^4.5.2",
|
|
63
|
-
"@latticexyz/common": "2.2.18-
|
|
64
|
-
"@latticexyz/config": "2.2.18-
|
|
65
|
-
"@latticexyz/paymaster": "2.2.18-
|
|
66
|
-
"@latticexyz/protocol-parser": "2.2.18-
|
|
67
|
-
"@latticexyz/store": "2.2.18-
|
|
68
|
-
"@latticexyz/world": "2.2.18-
|
|
69
|
-
"@latticexyz/world-module-callwithsignature": "2.2.18-
|
|
45
|
+
"@latticexyz/common": "2.2.18-c44207f620a38653497b78db0b71f5de7bc1a940",
|
|
46
|
+
"@latticexyz/config": "2.2.18-c44207f620a38653497b78db0b71f5de7bc1a940",
|
|
47
|
+
"@latticexyz/paymaster": "2.2.18-c44207f620a38653497b78db0b71f5de7bc1a940",
|
|
48
|
+
"@latticexyz/protocol-parser": "2.2.18-c44207f620a38653497b78db0b71f5de7bc1a940",
|
|
49
|
+
"@latticexyz/store": "2.2.18-c44207f620a38653497b78db0b71f5de7bc1a940",
|
|
50
|
+
"@latticexyz/world": "2.2.18-c44207f620a38653497b78db0b71f5de7bc1a940",
|
|
51
|
+
"@latticexyz/world-module-callwithsignature": "2.2.18-c44207f620a38653497b78db0b71f5de7bc1a940"
|
|
70
52
|
},
|
|
71
53
|
"devDependencies": {
|
|
72
54
|
"@tanstack/react-query": "^5.56.2",
|
|
@@ -87,6 +69,7 @@
|
|
|
87
69
|
"vite": "^5.4.1",
|
|
88
70
|
"vite-plugin-dts": "^4.2.4",
|
|
89
71
|
"vite-plugin-externalize-deps": "^0.8.0",
|
|
72
|
+
"vitest": "0.34.6",
|
|
90
73
|
"wagmi": "2.12.11"
|
|
91
74
|
},
|
|
92
75
|
"peerDependencies": {
|
package/dist/tsup/bin/deploy.cjs
DELETED
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __copyProps = (to, from, except, desc) => {
|
|
9
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
-
for (let key of __getOwnPropNames(from))
|
|
11
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
12
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
13
|
-
}
|
|
14
|
-
return to;
|
|
15
|
-
};
|
|
16
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
17
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
18
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
19
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
20
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
-
mod
|
|
23
|
-
));
|
|
24
|
-
|
|
25
|
-
// src/bin/deploy.ts
|
|
26
|
-
var import_config = require("dotenv/config");
|
|
27
|
-
var import_viem = require("viem");
|
|
28
|
-
var import_accounts = require("viem/accounts");
|
|
29
|
-
var import_foundry = require("@latticexyz/common/foundry");
|
|
30
|
-
var import_internal = require("@latticexyz/common/internal");
|
|
31
|
-
var import_EntryPoint = __toESM(require("@account-abstraction/contracts/artifacts/EntryPoint.json"), 1);
|
|
32
|
-
var import_SimpleAccountFactory = __toESM(require("@account-abstraction/contracts/artifacts/SimpleAccountFactory.json"), 1);
|
|
33
|
-
var import_GenerousPaymaster = __toESM(require("@latticexyz/paymaster/out/GenerousPaymaster.sol/GenerousPaymaster.json"), 1);
|
|
34
|
-
var import_actions = require("viem/actions");
|
|
35
|
-
var import_common = require("@latticexyz/common");
|
|
36
|
-
var import_account_abstraction = require("viem/account-abstraction");
|
|
37
|
-
(async () => {
|
|
38
|
-
const privateKey = process.env.PRIVATE_KEY;
|
|
39
|
-
if (!(0, import_viem.isHex)(privateKey)) {
|
|
40
|
-
throw new Error(
|
|
41
|
-
`Missing \`PRIVATE_KEY\` environment variable. If you're using Anvil, run
|
|
42
|
-
|
|
43
|
-
echo "PRIVATE_KEY=0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80" > .env
|
|
44
|
-
|
|
45
|
-
to use a prefunded Anvil account.`
|
|
46
|
-
);
|
|
47
|
-
}
|
|
48
|
-
const account = (0, import_accounts.privateKeyToAccount)(privateKey);
|
|
49
|
-
const rpcUrl = await (0, import_foundry.getRpcUrl)();
|
|
50
|
-
const client = (0, import_viem.createClient)({ account, transport: (0, import_viem.http)(rpcUrl) });
|
|
51
|
-
const chainId = await (0, import_actions.getChainId)(client);
|
|
52
|
-
const deployerAddress = await (0, import_internal.ensureDeployer)(client);
|
|
53
|
-
const entryPointSalt = "0x90d8084deab30c2a37c45e8d47f49f2f7965183cb6990a98943ef94940681de3";
|
|
54
|
-
const entryPointAddress = (0, import_internal.getContractAddress)({
|
|
55
|
-
deployerAddress,
|
|
56
|
-
bytecode: import_EntryPoint.default.bytecode,
|
|
57
|
-
salt: entryPointSalt
|
|
58
|
-
});
|
|
59
|
-
if (entryPointAddress !== import_account_abstraction.entryPoint07Address) {
|
|
60
|
-
throw new Error(
|
|
61
|
-
`Unexpected EntryPoint v0.7 address
|
|
62
|
-
|
|
63
|
-
Expected: ${import_account_abstraction.entryPoint07Address}
|
|
64
|
-
Actual: ${entryPointAddress}`
|
|
65
|
-
);
|
|
66
|
-
}
|
|
67
|
-
await (0, import_internal.ensureContractsDeployed)({
|
|
68
|
-
client,
|
|
69
|
-
deployerAddress,
|
|
70
|
-
contracts: [
|
|
71
|
-
{
|
|
72
|
-
bytecode: import_EntryPoint.default.bytecode,
|
|
73
|
-
salt: entryPointSalt,
|
|
74
|
-
deployedBytecodeSize: (0, import_viem.size)(import_EntryPoint.default.deployedBytecode),
|
|
75
|
-
debugLabel: "EntryPoint v0.7"
|
|
76
|
-
}
|
|
77
|
-
]
|
|
78
|
-
});
|
|
79
|
-
await (0, import_internal.ensureContractsDeployed)({
|
|
80
|
-
client,
|
|
81
|
-
deployerAddress,
|
|
82
|
-
contracts: [
|
|
83
|
-
{
|
|
84
|
-
bytecode: (0, import_viem.concatHex)([
|
|
85
|
-
import_SimpleAccountFactory.default.bytecode,
|
|
86
|
-
(0, import_viem.encodeAbiParameters)((0, import_viem.parseAbiParameters)("address"), [entryPointAddress])
|
|
87
|
-
]),
|
|
88
|
-
deployedBytecodeSize: (0, import_viem.size)(import_SimpleAccountFactory.default.deployedBytecode),
|
|
89
|
-
debugLabel: "SimpleAccountFactory"
|
|
90
|
-
}
|
|
91
|
-
]
|
|
92
|
-
});
|
|
93
|
-
if (chainId === 31337) {
|
|
94
|
-
const localPaymasterBytecode = (0, import_viem.concatHex)([
|
|
95
|
-
import_GenerousPaymaster.default.bytecode.object,
|
|
96
|
-
(0, import_viem.encodeAbiParameters)((0, import_viem.parseAbiParameters)("address"), [entryPointAddress])
|
|
97
|
-
]);
|
|
98
|
-
const localPaymasterAddress = (0, import_internal.getContractAddress)({ deployerAddress, bytecode: localPaymasterBytecode });
|
|
99
|
-
await (0, import_internal.ensureContractsDeployed)({
|
|
100
|
-
client,
|
|
101
|
-
deployerAddress,
|
|
102
|
-
contracts: [
|
|
103
|
-
{
|
|
104
|
-
bytecode: localPaymasterBytecode,
|
|
105
|
-
deployedBytecodeSize: (0, import_viem.size)(import_GenerousPaymaster.default.deployedBytecode.object),
|
|
106
|
-
debugLabel: "GenerousPaymaster"
|
|
107
|
-
}
|
|
108
|
-
]
|
|
109
|
-
});
|
|
110
|
-
const tx = await (0, import_common.writeContract)(client, {
|
|
111
|
-
chain: null,
|
|
112
|
-
address: entryPointAddress,
|
|
113
|
-
abi: [
|
|
114
|
-
{
|
|
115
|
-
inputs: [{ name: "account", type: "address" }],
|
|
116
|
-
name: "depositTo",
|
|
117
|
-
outputs: [],
|
|
118
|
-
stateMutability: "payable",
|
|
119
|
-
type: "function"
|
|
120
|
-
}
|
|
121
|
-
],
|
|
122
|
-
functionName: "depositTo",
|
|
123
|
-
args: [localPaymasterAddress],
|
|
124
|
-
value: (0, import_viem.parseEther)("100")
|
|
125
|
-
});
|
|
126
|
-
await (0, import_internal.waitForTransactions)({ client, hashes: [tx] });
|
|
127
|
-
console.log("\nFunded local paymaster at:", localPaymasterAddress, "\n");
|
|
128
|
-
}
|
|
129
|
-
console.log("\nEntryKit contracts are ready!\n");
|
|
130
|
-
process.exit(0);
|
|
131
|
-
})();
|
|
132
|
-
//# sourceMappingURL=deploy.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/bin/deploy.ts"],"sourcesContent":["import \"dotenv/config\";\nimport {\n Hex,\n concatHex,\n http,\n isHex,\n parseAbiParameters,\n encodeAbiParameters,\n size,\n parseEther,\n createClient,\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 localPaymasterArtifact from \"@latticexyz/paymaster/out/GenerousPaymaster.sol/GenerousPaymaster.json\" assert { type: \"json\" };\nimport { getChainId } from \"viem/actions\";\nimport { writeContract } from \"@latticexyz/common\";\nimport { entryPoint07Address } from \"viem/account-abstraction\";\n\n// Workaround for:\n// Top-level await is currently not supported with the \"cjs\" output format\n(async () => {\n // TODO: parse env with arktype (to avoid zod dep) and throw when absent\n\n const privateKey = process.env.PRIVATE_KEY;\n if (!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 }\n const account = privateKeyToAccount(privateKey);\n const rpcUrl = await getRpcUrl();\n\n const client = createClient({ account, transport: http(rpcUrl) });\n\n const chainId = await getChainId(client);\n\n // TODO: deployer address flag/env var?\n const deployerAddress = await ensureDeployer(client);\n\n // https://github.com/eth-infinitism/account-abstraction/blob/b3bae63bd9bc0ed394dfca8668008213127adb62/hardhat.config.ts#L11\n const entryPointSalt = \"0x90d8084deab30c2a37c45e8d47f49f2f7965183cb6990a98943ef94940681de3\";\n const entryPointAddress = getContractAddress({\n deployerAddress,\n bytecode: entryPointArtifact.bytecode as Hex,\n salt: entryPointSalt,\n });\n if (entryPointAddress !== entryPoint07Address) {\n throw new Error(\n `Unexpected EntryPoint v0.7 address\\n\\n Expected: ${entryPoint07Address}\\nActual: ${entryPointAddress}`,\n );\n }\n\n // Deploy entrypoint first, because following deploys need to be able to call it.\n await 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\n await 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 });\n\n if (chainId === 31337) {\n const localPaymasterBytecode = concatHex([\n localPaymasterArtifact.bytecode.object as Hex,\n encodeAbiParameters(parseAbiParameters(\"address\"), [entryPointAddress]),\n ]);\n const localPaymasterAddress = getContractAddress({ deployerAddress, bytecode: localPaymasterBytecode });\n\n await ensureContractsDeployed({\n client,\n deployerAddress,\n contracts: [\n {\n bytecode: localPaymasterBytecode,\n deployedBytecodeSize: size(localPaymasterArtifact.deployedBytecode.object as Hex),\n debugLabel: \"GenerousPaymaster\",\n },\n ],\n });\n\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: [localPaymasterAddress],\n value: parseEther(\"100\"),\n });\n await waitForTransactions({ client, hashes: [tx] });\n console.log(\"\\nFunded local paymaster at:\", localPaymasterAddress, \"\\n\");\n }\n\n console.log(\"\\nEntryKit contracts are ready!\\n\");\n process.exit(0);\n})();\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oBAAO;AACP,kBAUO;AACP,sBAAoC;AACpC,qBAA0B;AAC1B,sBAKO;AACP,wBAA+B;AAC/B,kCAAyC;AACzC,+BAAmC;AACnC,qBAA2B;AAC3B,oBAA8B;AAC9B,iCAAoC;AA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AA,MACvC,yBAAAC,QAAuB,SAAS;AAAA,UAChC,qCAAoB,gCAAmB,SAAS,GAAG,CAAC,iBAAiB,CAAC;AAAA,IACxE,CAAC;AACD,UAAM,4BAAwB,oCAAmB,EAAE,iBAAiB,UAAU,uBAAuB,CAAC;AAEtG,cAAM,yCAAwB;AAAA,MAC5B;AAAA,MACA;AAAA,MACA,WAAW;AAAA,QACT;AAAA,UACE,UAAU;AAAA,UACV,0BAAsB,kBAAK,yBAAAA,QAAuB,iBAAiB,MAAa;AAAA,UAChF,YAAY;AAAA,QACd;AAAA,MACF;AAAA,IACF,CAAC;AAED,UAAM,KAAK,UAAM,6BAAc,QAAQ;AAAA,MACrC,OAAO;AAAA,MACP,SAAS;AAAA,MACT,KAAK;AAAA,QACH;AAAA,UACE,QAAQ,CAAC,EAAE,MAAM,WAAW,MAAM,UAAU,CAAC;AAAA,UAC7C,MAAM;AAAA,UACN,SAAS,CAAC;AAAA,UACV,iBAAiB;AAAA,UACjB,MAAM;AAAA,QACR;AAAA,MACF;AAAA,MACA,cAAc;AAAA,MACd,MAAM,CAAC,qBAAqB;AAAA,MAC5B,WAAO,wBAAW,KAAK;AAAA,IACzB,CAAC;AACD,cAAM,qCAAoB,EAAE,QAAQ,QAAQ,CAAC,EAAE,EAAE,CAAC;AAClD,YAAQ,IAAI,gCAAgC,uBAAuB,IAAI;AAAA,EACzE;AAEA,UAAQ,IAAI,mCAAmC;AAC/C,UAAQ,KAAK,CAAC;AAChB,GAAG;","names":["entryPointArtifact","simpleAccountFactoryArtifact","localPaymasterArtifact"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|