@latticexyz/entrykit 2.2.22-daa34f06d070200c1aaf0bba78ba9f2dd8662a76 → 2.2.22-db94eb24a728db6eae9842199de07c6b85983abb

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.
@@ -18,9 +18,9 @@ import {
18
18
  getContractAddress,
19
19
  waitForTransactions
20
20
  } from "@latticexyz/common/internal";
21
- import entryPointArtifact from "@account-abstraction/contracts/artifacts/EntryPoint.json" assert { type: "json" };
22
- import simpleAccountFactoryArtifact from "@account-abstraction/contracts/artifacts/SimpleAccountFactory.json" assert { type: "json" };
23
- import localPaymasterArtifact from "@latticexyz/paymaster/out/GenerousPaymaster.sol/GenerousPaymaster.json" assert { type: "json" };
21
+ import entryPointArtifact from "@account-abstraction/contracts/artifacts/EntryPoint.json" with { type: "json" };
22
+ import simpleAccountFactoryArtifact from "@account-abstraction/contracts/artifacts/SimpleAccountFactory.json" with { type: "json" };
23
+ import localPaymasterArtifact from "@latticexyz/paymaster/out/GenerousPaymaster.sol/GenerousPaymaster.json" with { type: "json" };
24
24
  import { getChainId } from "viem/actions";
25
25
  import { writeContract } from "@latticexyz/common";
26
26
  import { entryPoint07Address } from "viem/account-abstraction";
@@ -1 +1 @@
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// 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);\nconst rpcUrl = await getRpcUrl();\n\nconst client = createClient({ account, transport: http(rpcUrl) });\n\nconst chainId = await getChainId(client);\n\nconsole.log(\"Deploying to chain\", chainId, \"from\", account.address, \"via\", rpcUrl);\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});\nif (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.\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\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});\n\nif (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\nconsole.log(\"\\nEntryKit contracts are ready!\\n\");\nprocess.exit(0);\n"],"mappings":";AAAA,OAAO;AACP;AAAA,EAEE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,2BAA2B;AACpC,SAAS,iBAAiB;AAC1B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,OAAO,wBAAwB,2DAA2D,OAAO,EAAE,MAAM,OAAO;AAChH,OAAO,kCAAkC,qEAAqE,OAAO,EAAE,MAAM,OAAO;AACpI,OAAO,4BAA4B,yEAA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ACF;AACF,CAAC;AAED,IAAI,YAAY,OAAO;AACrB,QAAM,yBAAyB,UAAU;AAAA,IACvC,uBAAuB,SAAS;AAAA,IAChC,oBAAoB,mBAAmB,SAAS,GAAG,CAAC,iBAAiB,CAAC;AAAA,EACxE,CAAC;AACD,QAAM,wBAAwB,mBAAmB,EAAE,iBAAiB,UAAU,uBAAuB,CAAC;AAEtG,QAAM,wBAAwB;AAAA,IAC5B;AAAA,IACA;AAAA,IACA,WAAW;AAAA,MACT;AAAA,QACE,UAAU;AAAA,QACV,sBAAsB,KAAK,uBAAuB,iBAAiB,MAAa;AAAA,QAChF,YAAY;AAAA,MACd;AAAA,IACF;AAAA,EACF,CAAC;AAED,QAAM,KAAK,MAAM,cAAc,QAAQ;AAAA,IACrC,OAAO;AAAA,IACP,SAAS;AAAA,IACT,KAAK;AAAA,MACH;AAAA,QACE,QAAQ,CAAC,EAAE,MAAM,WAAW,MAAM,UAAU,CAAC;AAAA,QAC7C,MAAM;AAAA,QACN,SAAS,CAAC;AAAA,QACV,iBAAiB;AAAA,QACjB,MAAM;AAAA,MACR;AAAA,IACF;AAAA,IACA,cAAc;AAAA,IACd,MAAM,CAAC,qBAAqB;AAAA,IAC5B,OAAO,WAAW,KAAK;AAAA,EACzB,CAAC;AACD,QAAM,oBAAoB,EAAE,QAAQ,QAAQ,CAAC,EAAE,EAAE,CAAC;AAClD,UAAQ,IAAI,gCAAgC,uBAAuB,IAAI;AACzE;AAEA,QAAQ,IAAI,mCAAmC;AAC/C,QAAQ,KAAK,CAAC;","names":[]}
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\" with { type: \"json\" };\nimport simpleAccountFactoryArtifact from \"@account-abstraction/contracts/artifacts/SimpleAccountFactory.json\" with { type: \"json\" };\nimport localPaymasterArtifact from \"@latticexyz/paymaster/out/GenerousPaymaster.sol/GenerousPaymaster.json\" with { type: \"json\" };\nimport { getChainId } from \"viem/actions\";\nimport { writeContract } from \"@latticexyz/common\";\nimport { entryPoint07Address } from \"viem/account-abstraction\";\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);\nconst rpcUrl = await getRpcUrl();\n\nconst client = createClient({ account, transport: http(rpcUrl) });\n\nconst chainId = await getChainId(client);\n\nconsole.log(\"Deploying to chain\", chainId, \"from\", account.address, \"via\", rpcUrl);\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});\nif (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.\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\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});\n\nif (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\nconsole.log(\"\\nEntryKit contracts are ready!\\n\");\nprocess.exit(0);\n"],"mappings":";AAAA,OAAO;AACP;AAAA,EAEE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,2BAA2B;AACpC,SAAS,iBAAiB;AAC1B;AAAA,EACE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,QAClB,6BAA6B;AAAA,QAC7B,oBAAoB,mBAAmB,SAAS,GAAG,CAAC,iBAAiB,CAAC;AAAA,MACxE,CAAC;AAAA,MACD,sBAAsB,KAAK,6BAA6B,gBAAuB;AAAA,MAC/E,YAAY;AAAA,IACd;AAAA,EACF;AACF,CAAC;AAED,IAAI,YAAY,OAAO;AACrB,QAAM,yBAAyB,UAAU;AAAA,IACvC,uBAAuB,SAAS;AAAA,IAChC,oBAAoB,mBAAmB,SAAS,GAAG,CAAC,iBAAiB,CAAC;AAAA,EACxE,CAAC;AACD,QAAM,wBAAwB,mBAAmB,EAAE,iBAAiB,UAAU,uBAAuB,CAAC;AAEtG,QAAM,wBAAwB;AAAA,IAC5B;AAAA,IACA;AAAA,IACA,WAAW;AAAA,MACT;AAAA,QACE,UAAU;AAAA,QACV,sBAAsB,KAAK,uBAAuB,iBAAiB,MAAa;AAAA,QAChF,YAAY;AAAA,MACd;AAAA,IACF;AAAA,EACF,CAAC;AAED,QAAM,KAAK,MAAM,cAAc,QAAQ;AAAA,IACrC,OAAO;AAAA,IACP,SAAS;AAAA,IACT,KAAK;AAAA,MACH;AAAA,QACE,QAAQ,CAAC,EAAE,MAAM,WAAW,MAAM,UAAU,CAAC;AAAA,QAC7C,MAAM;AAAA,QACN,SAAS,CAAC;AAAA,QACV,iBAAiB;AAAA,QACjB,MAAM;AAAA,MACR;AAAA,IACF;AAAA,IACA,cAAc;AAAA,IACd,MAAM,CAAC,qBAAqB;AAAA,IAC5B,OAAO,WAAW,KAAK;AAAA,EACzB,CAAC;AACD,QAAM,oBAAoB,EAAE,QAAQ,QAAQ,CAAC,EAAE,EAAE,CAAC;AAClD,UAAQ,IAAI,gCAAgC,uBAAuB,IAAI;AACzE;AAEA,QAAQ,IAAI,mCAAmC;AAC/C,QAAQ,KAAK,CAAC;","names":[]}
@@ -4,8 +4,7 @@ import { SmartAccount } from 'viem/account-abstraction';
4
4
  import * as react_jsx_runtime from 'react/jsx-runtime';
5
5
  import { ReactNode } from 'react';
6
6
  import { UseQueryResult } from '@tanstack/react-query';
7
- import { CreateConfigParameters, Config, CreateConnectorFn } from 'wagmi';
8
- import { WalletList } from '@rainbow-me/rainbowkit';
7
+ import { CreateConfigParameters, Config } from 'wagmi';
9
8
 
10
9
  type EntryKitConfigInput = {
11
10
  /**
@@ -111,21 +110,6 @@ type CreateWagmiConfigOptions<chains extends readonly [Chain, ...Chain[]] = read
111
110
  } & Pick<CreateConfigParameters<chains, transports>, "pollingInterval">;
112
111
  declare function createWagmiConfig<const chains extends readonly [Chain, ...Chain[]], transports extends Record<chains[number]["id"], Transport>>(config: CreateWagmiConfigOptions<chains, transports>): Config<chains, transports>;
113
112
 
114
- declare function getConnectors({ wallets, ...config }: {
115
- readonly chainId: number;
116
- /**
117
- * WalletConnect project ID, obtained from your WalletConnect dashboard.
118
- */
119
- readonly walletConnectProjectId: string;
120
- readonly appName: string;
121
- } & {
122
- readonly wallets?: WalletList;
123
- }): CreateConnectorFn[];
124
-
125
- declare function getWallets(_config: {
126
- readonly chainId: number;
127
- }): WalletList;
128
-
129
113
  /**
130
114
  * @internal
131
115
  */
@@ -137,4 +121,4 @@ declare function internal_validateSigner({ client, worldAddress, userAddress, se
137
121
  signerAddress: Address$1;
138
122
  }): Promise<void>;
139
123
 
140
- export { AccountButton, type ConnectedClient, type CreateWagmiConfigOptions, type EntryKitConfig, type EntryKitConfigInput, EntryKitProvider, type SessionClient, createWagmiConfig, defineConfig, getConnectors, getWallets, internal_validateSigner, useAccountModal, useEntryKitConfig, useSessionClientReady as useSessionClient };
124
+ export { AccountButton, type ConnectedClient, type CreateWagmiConfigOptions, type EntryKitConfig, type EntryKitConfigInput, EntryKitProvider, type SessionClient, createWagmiConfig, defineConfig, internal_validateSigner, useAccountModal, useEntryKitConfig, useSessionClientReady as useSessionClient };