diff --git a/.changeset/seven-ants-change.md b/.changeset/seven-ants-change.md new file mode 100644 index 00000000..35b29578 --- /dev/null +++ b/.changeset/seven-ants-change.md @@ -0,0 +1,5 @@ +--- +"@permissionless/wagmi": patch +--- + +First release with smartAccount connector diff --git a/.github/actions/install-dependencies/action.yml b/.github/actions/install-dependencies/action.yml index 388715b1..d1b61d04 100644 --- a/.github/actions/install-dependencies/action.yml +++ b/.github/actions/install-dependencies/action.yml @@ -6,6 +6,8 @@ runs: steps: - name: Set up Bun uses: oven-sh/setup-bun@v1 + with: + bun-version: 1.0.25 - name: Set up foundry uses: foundry-rs/foundry-toolchain@v1 diff --git a/.github/workflows/canary.yml b/.github/workflows/canary.yml index c8bfca4d..8ecbaf59 100644 --- a/.github/workflows/canary.yml +++ b/.github/workflows/canary.yml @@ -22,17 +22,28 @@ jobs: with: registry-url: 'https://registry.npmjs.org' - - name: Set version + - name: Set permissionless version run: | jq --arg prop "workspaces" 'del(.[$prop])' package.json > package.tmp.json && rm package.json && cp package.tmp.json package.json && rm package.tmp.json cd packages/permissionless npm --no-git-tag-version version 0.0.0 npm --no-git-tag-version version $(npm pkg get version | sed 's/"//g')-$(git branch --show-current | tr -cs '[:alnum:]-' '-' | tr '[:upper:]' '[:lower:]' | sed 's/-$//').$(date +'%Y%m%dT%H%M%S') + - name: Set permissionless/wagmi version + run: | + cd packages/wagmi + npm --no-git-tag-version version 0.0.0 + npm --no-git-tag-version version $(npm pkg get version | sed 's/"//g')-$(git branch --show-current | tr -cs '[:alnum:]-' '-' | tr '[:upper:]' '[:lower:]' | sed 's/-$//').$(date +'%Y%m%dT%H%M%S') + - name: Build run: bun run build - - name: Publish to npm + - name: Publish permissionless to npm run: cd packages/permissionless && npm publish --tag $(git branch --show-current | tr -cs '[:alnum:]-' '-' | tr '[:upper:]' '[:lower:]' | sed 's/-$//') env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} \ No newline at end of file + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + + - name: Publish permissionless/wagmi to npm + run: cd packages/wagmi && npm publish --tag $(git branch --show-current | tr -cs '[:alnum:]-' '-' | tr '[:upper:]' '[:lower:]' | sed 's/-$//') + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_ORG_PERMISSIONLESS_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/prune-tags.yml b/.github/workflows/prune-tags.yml index b71495c7..a662147f 100644 --- a/.github/workflows/prune-tags.yml +++ b/.github/workflows/prune-tags.yml @@ -21,16 +21,16 @@ jobs: with: registry-url: 'https://registry.npmjs.org' - - name: Prune tags + - name: Prune permissionless tags run: | PACKAGE_NAME=$(jq -r '.name' package.json) - + npm view $PACKAGE_NAME dist-tags --json | jq -r 'to_entries | .[] | select(.key != "latest") | select(.key != "main") | select(.key != "next") | .key' | xargs -I % npm dist-tag rm $PACKAGE_NAME % working-directory: packages/permissionless env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - - name: Deprecate canary versions + - name: Deprecate permissionless canary versions working-directory: packages/permissionless run: | PACKAGE_NAME=$(jq -r '.name' package.json) @@ -42,7 +42,42 @@ jobs: VERSION=$(echo $line | jq -r '.key') TIME=$(echo $line | jq -r '.value') PUBLISH_DATE=$(date --date=$TIME +%s) + + if [ $PUBLISH_DATE -lt $FOUR_DAYS_AGO ]; then + continue # skip versions older than 4 days to reduce the number of npm deprecate calls + fi + + if [ $PUBLISH_DATE -lt $TWO_DAYS_AGO ]; then + echo "Deprecate $PACKAGE_NAME@$VERSION" + npm deprecate $PACKAGE_NAME@$VERSION "This canary version is deprecated because it is older than 2 days." || true + echo "Deprecated $PACKAGE_NAME@$VERSION" + fi + done + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + + - name: Prune @permissionless/wagmi tags + run: | + PACKAGE_NAME=$(jq -r '.name' package.json) + npm view $PACKAGE_NAME dist-tags --json | jq -r 'to_entries | .[] | select(.key != "latest") | select(.key != "main") | select(.key != "next") | .key' | xargs -I % npm dist-tag rm $PACKAGE_NAME % + working-directory: packages/wagmi + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + + - name: Deprecate @permissionless/wagmi canary versions + working-directory: packages/wagmi + run: | + PACKAGE_NAME=$(jq -r '.name' package.json) + TWO_DAYS_AGO=$(date --date='2 days ago' +%s) + FOUR_DAYS_AGO=$(date --date='4 days ago' +%s) + + npm view $PACKAGE_NAME time --json | jq -c 'to_entries | .[] | select(.key | test("^0.0.0-.+$"))' \ + | while read line; do + VERSION=$(echo $line | jq -r '.key') + TIME=$(echo $line | jq -r '.value') + PUBLISH_DATE=$(date --date=$TIME +%s) + if [ $PUBLISH_DATE -lt $FOUR_DAYS_AGO ]; then continue # skip versions older than 4 days to reduce the number of npm deprecate calls fi diff --git a/bun.lockb b/bun.lockb index a94ba283..374eb57a 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/package.json b/package.json index 33d8e61d..6ca88541 100644 --- a/package.json +++ b/package.json @@ -22,11 +22,15 @@ "keywords": [], "license": "MIT", "scripts": { - "build": "bun run clean && bun run build:cjs && bun run build:esm && bun run build:types", - "build:cjs": "tsc --project ./tsconfig.cjs.json && tsc-alias -p ./tsconfig.cjs.json && printf '{\"type\":\"commonjs\"}' > ./packages/permissionless/_cjs/package.json", - "build:esm": "tsc --project ./tsconfig.esm.json && tsc-alias -p ./tsconfig.esm.json && printf '{\"type\": \"module\",\"sideEffects\":false}' > ./packages/permissionless/_esm/package.json", - "build:types": "tsc --project ./tsconfig.types.json && tsc-alias -p ./tsconfig.types.json", - "clean": "rimraf ./packages/permissionless/_esm ./packages/permissionless/_cjs ./packages/permissionless/_types", + "build": "bun run build:permissionless && bun run build:wagmi", + "build:permissionless": "bun run clean:permissionless && bun run build:cjs && bun run build:esm && bun run build:types", + "build:wagmi": "bun run clean:wagmi && bun run build:wagmi:cjs && bun run build:wagmi:esm && bun run build:wagmi:types", + "build:cjs": "tsc --project ./tsconfig/tsconfig.permissionless.cjs.json && tsc-alias -p ./tsconfig/tsconfig.permissionless.cjs.json && printf '{\"type\":\"commonjs\"}' > ./packages/permissionless/_cjs/package.json", + "build:esm": "tsc --project ./tsconfig/tsconfig.permissionless.esm.json && tsc-alias -p ./tsconfig/tsconfig.permissionless.esm.json && printf '{\"type\": \"module\",\"sideEffects\":false}' > ./packages/permissionless/_esm/package.json", + "build:types": "tsc --project ./tsconfig/tsconfig.permissionless.types.json && tsc-alias -p ./tsconfig/tsconfig.permissionless.types.json", + "clean": "bun run clean:permissionless && bun run clean:wagmi", + "clean:permissionless": "rimraf ./packages/permissionless/_esm ./packages/permissionless/_cjs ./packages/permissionless/_types", + "clean:wagmi": "rimraf ./packages/wagmi/_esm ./packages/wagmi/_cjs ./packages/wagmi/_types", "changeset": "changeset", "changeset:release": "bun run build && changeset publish", "changeset:version": "changeset version && bun install --lockfile-only", @@ -35,7 +39,10 @@ "lint:fix": "bun run lint --apply", "test": "vitest dev -c ./packages/permissionless-test/vitest.config.ts", "test:ci": "CI=true vitest -c ./packages/permissionless-test/vitest.config.ts --coverage", - "run:demo": "bun run --cwd packages/wagmi-demo dev" + "run:demo": "bun run --cwd packages/wagmi-demo dev", + "build:wagmi:cjs": "tsc --project ./tsconfig/tsconfig.wagmi.cjs.json && tsc-alias -p ./tsconfig/tsconfig.wagmi.cjs.json && printf '{\"type\":\"commonjs\"}' > ./packages/wagmi/_cjs/package.json", + "build:wagmi:esm": "tsc --project ./tsconfig/tsconfig.wagmi.esm.json && tsc-alias -p ./tsconfig/tsconfig.wagmi.esm.json && printf '{\"type\": \"module\",\"sideEffects\":false}' > ./packages/wagmi/_esm/package.json", + "build:wagmi:types": "tsc --project ./tsconfig/tsconfig.wagmi.types.json && tsc-alias -p ./tsconfig/tsconfig.wagmi.types.json" }, "simple-git-hooks": { "pre-commit": "bun run format && bun run lint:fix" diff --git a/packages/permissionless-test/package.json b/packages/permissionless-test/package.json index 50813a41..aac544b5 100644 --- a/packages/permissionless-test/package.json +++ b/packages/permissionless-test/package.json @@ -15,7 +15,7 @@ "dotenv": "^16.3.1", "execa": "^8.0.1", "get-port": "^7.0.0", - "permissionless": "workspace:*", + "permissionless": "workspace:packages/permissionless", "viem": "^2.0.0" } } diff --git a/packages/permissionless/utils/errors/getBundlerError.ts b/packages/permissionless/utils/errors/getBundlerError.ts index 54f0b249..85045899 100644 --- a/packages/permissionless/utils/errors/getBundlerError.ts +++ b/packages/permissionless/utils/errors/getBundlerError.ts @@ -82,7 +82,7 @@ export function getBundlerError( return new ExecutionRevertedError({ cause: err, message: executionRevertedError.details - }) as any + }) as ExecutionRevertedErrorType } // TODO: Add validation Errors @@ -97,7 +97,7 @@ export function getBundlerError( sender: args.userOperation.sender, docsPath: "https://docs.pimlico.io/bundler/reference/entrypoint-errors/aa10" - }) as any + }) as SenderAlreadyDeployedErrorType } if (InitCodeRevertedError.message.test(message)) { @@ -105,7 +105,7 @@ export function getBundlerError( cause: err, docsPath: "https://docs.pimlico.io/bundler/reference/entrypoint-errors/aa13" - }) as any + }) as InitCodeRevertedErrorType } if (SenderAddressMismatchError.message.test(message)) { @@ -114,7 +114,7 @@ export function getBundlerError( sender: args.userOperation.sender, docsPath: "https://docs.pimlico.io/bundler/reference/entrypoint-errors/aa14" - }) as any + }) as SenderAddressMismatchErrorType } if (InitCodeDidNotDeploySenderError.message.test(message)) { @@ -123,7 +123,7 @@ export function getBundlerError( sender: args.userOperation.sender, docsPath: "https://docs.pimlico.io/bundler/reference/entrypoint-errors/aa15" - }) as any + }) as InitCodeDidNotDeploySenderErrorType } if (SenderNotDeployedError.message.test(message)) { @@ -132,7 +132,7 @@ export function getBundlerError( sender: args.userOperation.sender, docsPath: "https://docs.pimlico.io/bundler/reference/entrypoint-errors/aa20" - }) as any + }) as SenderNotDeployedErrorType } if (SmartAccountInsufficientFundsError.message.test(message)) { @@ -141,7 +141,7 @@ export function getBundlerError( sender: args.userOperation.sender, docsPath: "https://docs.pimlico.io/bundler/reference/entrypoint-errors/aa21" - }) as any + }) as SmartAccountInsufficientFundsErrorType } if (SmartAccountSignatureValidityPeriodError.message.test(message)) { @@ -149,7 +149,7 @@ export function getBundlerError( cause: err, docsPath: "https://docs.pimlico.io/bundler/reference/entrypoint-errors/aa22" - }) as any + }) as SmartAccountSignatureValidityPeriodErrorType } if (SmartAccountValidationRevertedError.message.test(message)) { @@ -158,7 +158,7 @@ export function getBundlerError( sender: args.userOperation.sender, docsPath: "https://docs.pimlico.io/bundler/reference/entrypoint-errors/aa23" - }) as any + }) as SmartAccountValidationRevertedErrorType } if (InvalidSmartAccountNonceError.message.test(message)) { @@ -168,7 +168,7 @@ export function getBundlerError( nonce: args.userOperation.nonce, docsPath: "https://docs.pimlico.io/bundler/reference/entrypoint-errors/aa25" - }) as any + }) as InvalidSmartAccountNonceErrorType } if (PaymasterNotDeployedError.message.test(message)) { @@ -177,7 +177,7 @@ export function getBundlerError( paymasterAndData: args.userOperation.paymasterAndData, docsPath: "https://docs.pimlico.io/bundler/reference/entrypoint-errors/aa30" - }) as any + }) as PaymasterNotDeployedErrorType } if (PaymasterDepositTooLowError.message.test(message)) { @@ -186,7 +186,7 @@ export function getBundlerError( paymasterAndData: args.userOperation.paymasterAndData, docsPath: "https://docs.pimlico.io/bundler/reference/entrypoint-errors/aa31" - }) as any + }) as PaymasterDepositTooLowErrorType } if (PaymasterValidityPeriodError.message.test(message)) { @@ -195,7 +195,7 @@ export function getBundlerError( paymasterAndData: args.userOperation.paymasterAndData, docsPath: "https://docs.pimlico.io/bundler/reference/entrypoint-errors/aa32" - }) as any + }) as PaymasterValidityPeriodErrorType } if (PaymasterValidationRevertedError.message.test(message)) { @@ -204,7 +204,7 @@ export function getBundlerError( paymasterAndData: args.userOperation.paymasterAndData, docsPath: "https://docs.pimlico.io/bundler/reference/entrypoint-errors/aa33" - }) as any + }) as PaymasterValidationRevertedErrorType } if (PaymasterDataRejectedError.message.test(message)) { @@ -213,8 +213,8 @@ export function getBundlerError( paymasterAndData: args.userOperation.paymasterAndData, docsPath: "https://docs.pimlico.io/bundler/reference/entrypoint-errors/aa34" - }) as any + }) as PaymasterDataRejectedErrorType } - return new UnknownNodeError({ cause: err }) as any + return new UnknownNodeError({ cause: err }) as UnknownNodeErrorType } diff --git a/packages/permissionless/utils/getAction.ts b/packages/permissionless/utils/getAction.ts index 3abc03ac..66ac9a74 100644 --- a/packages/permissionless/utils/getAction.ts +++ b/packages/permissionless/utils/getAction.ts @@ -1,5 +1,6 @@ import type { Client } from "viem" +// biome-ignore lint/suspicious/noExplicitAny: it's a generic function, so it's hard to type export function getAction( client: Client, // biome-ignore lint/suspicious/noExplicitAny: it's a recursive function, so it's hard to type diff --git a/packages/wagmi-demo/.env.example b/packages/wagmi-demo/.env.example new file mode 100644 index 00000000..d0a1b84b --- /dev/null +++ b/packages/wagmi-demo/.env.example @@ -0,0 +1,2 @@ +RPC_URL= +PAYMASTER_URL= \ No newline at end of file diff --git a/packages/wagmi-demo/index.html b/packages/wagmi-demo/index.html new file mode 100644 index 00000000..f519ce85 --- /dev/null +++ b/packages/wagmi-demo/index.html @@ -0,0 +1,12 @@ + + + + + + Create Wagmi + + +
+ + + diff --git a/packages/wagmi-demo/package.json b/packages/wagmi-demo/package.json new file mode 100644 index 00000000..8e7c058c --- /dev/null +++ b/packages/wagmi-demo/package.json @@ -0,0 +1,27 @@ +{ + "name": "@permissionless/wagmi-demo", + "private": true, + "author": "Pimlico", + "homepage": "https://docs.pimlico.io/permissionless/wagmi", + "repository": "github:pimlicolabs/permissionless.js", + "type": "module", + "scripts": { + "dev": "vite", + "build": "tsc && vite build", + "lint": "biome check .", + "preview": "vite preview" + }, + "dependencies": { + "wagmi": "^0.0.0-canary-20240123224806", + "viem": "^2.0.0", + "@tanstack/react-query": "5.0.5", + "react": "^18.2.0", + "permissionless": "workspace:packages/permissionless", + "vite": "^4.4.9", + "@types/react": "^18.2.22", + "@types/react-dom": "^18.2.7", + "react-dom": "^18.2.0", + "@permissionless/wagmi": "workspace:packages/wagmi", + "@vitejs/plugin-react": "^4.1.0" + } +} diff --git a/packages/wagmi-demo/src/App.tsx b/packages/wagmi-demo/src/App.tsx new file mode 100644 index 00000000..37b78c87 --- /dev/null +++ b/packages/wagmi-demo/src/App.tsx @@ -0,0 +1,133 @@ +import { smartAccount } from "@permissionless/wagmi" +import { + createSmartAccountClient, + walletClientToCustomSigner +} from "permissionless" +import { signerToSafeSmartAccount } from "permissionless/accounts" +import { createPimlicoPaymasterClient } from "permissionless/clients/pimlico" +import React from "react" +import { http, zeroAddress } from "viem" +import { + useAccount, + useConfig, + useConnect, + useDisconnect, + useSendTransaction +} from "wagmi" +import { getPublicClient, getWalletClient } from "wagmi/actions" + +function App() { + const account = useAccount() + const { connectors, connect, status, error } = useConnect() + const { disconnect } = useDisconnect() + const config = useConfig() + + const connectSmartAccount = async () => { + const client = getPublicClient(config) + const walletClient = await getWalletClient(config) + + const pimlicoClient = createPimlicoPaymasterClient({ + transport: http(import.meta.env.PAYMASTER_URL) + }) + + if (!walletClient) return + + const smartAccountClient = createSmartAccountClient({ + account: await signerToSafeSmartAccount(client, { + safeVersion: "1.4.1", + entryPoint: import.meta.env.ENTRY_POINT, + signer: walletClientToCustomSigner(walletClient) + }), + transport: http(import.meta.env.BUNDLER_URL), + sponsorUserOperation: pimlicoClient.sponsorUserOperation + }) + + const connector = smartAccount({ + smartAccountClient: smartAccountClient + }) + + connect({ connector }) + } + + const { + data: hash, + sendTransaction, + error: sendTransactionError, + isPending + } = useSendTransaction() + + const sendTransactionOnButtonPress = () => { + sendTransaction({ + to: zeroAddress, + value: 0n, + data: "0x" + }) + } + + console.log("error: ", sendTransactionError) + + return ( + <> +
+

Account

+ +
+ status: {account.status} +
+ addresses: {JSON.stringify(account.addresses)} +
+ chainId: {account.chainId} +
+ + {account.status === "connected" && ( + <> + + + + + {isPending && ( +
+ Executing transaction... +
+
+ )} + {hash &&
hash: {hash}
} + + )} +
+ +
+

Connect

+ + {connectors.map((connector) => ( + + ))} +
{status}
+
{error?.message}
+
+ + ) +} + +export default App diff --git a/packages/wagmi-demo/src/index.css b/packages/wagmi-demo/src/index.css new file mode 100644 index 00000000..d620caf8 --- /dev/null +++ b/packages/wagmi-demo/src/index.css @@ -0,0 +1,35 @@ +:root { + background-color: #181818; + color: rgba(255, 255, 255, 0.87); + color-scheme: light dark; + font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif; + font-synthesis: none; + font-weight: 400; + line-height: 1.5; + text-rendering: optimizeLegibility; + + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + -webkit-text-size-adjust: 100%; +} + +@media (prefers-color-scheme: light) { + :root { + background-color: #f8f8f8; + color: #181818; + } +} + +.loader { + border: 2.5px solid #f3f3f3; /* Light grey */ + border-top: 2.5px solid #3498db; /* Blue */ + border-radius: 50%; + width: 20px; + height: 20px; + animation: spin 0.8s linear infinite; +} + +@keyframes spin { + 0% { transform: rotate(0deg); } + 100% { transform: rotate(360deg); } +} diff --git a/packages/wagmi-demo/src/main.tsx b/packages/wagmi-demo/src/main.tsx new file mode 100644 index 00000000..13a2ba78 --- /dev/null +++ b/packages/wagmi-demo/src/main.tsx @@ -0,0 +1,35 @@ +import { Buffer } from "buffer" +import { QueryClient, QueryClientProvider } from "@tanstack/react-query" +import React from "react" +import ReactDOM from "react-dom/client" +import { http, WagmiProvider, createConfig } from "wagmi" +import App from "./App.tsx" + +import { sepolia } from "viem/chains" +import "./index.css" + +globalThis.Buffer = Buffer + +const queryClient = new QueryClient() + +const root = document.getElementById("root") + +if (!root) throw new Error("No root element found") + +const config = createConfig({ + chains: [sepolia], + connectors: [], + transports: { + [sepolia.id]: http(import.meta.env.RPC_URL) + } +}) + +ReactDOM.createRoot(root).render( + + + + + + + +) diff --git a/packages/wagmi-demo/src/vite-env.d.ts b/packages/wagmi-demo/src/vite-env.d.ts new file mode 100644 index 00000000..11f02fe2 --- /dev/null +++ b/packages/wagmi-demo/src/vite-env.d.ts @@ -0,0 +1 @@ +/// diff --git a/packages/wagmi/connectors/smartAccount.ts b/packages/wagmi/connectors/smartAccount.ts new file mode 100644 index 00000000..75cba706 --- /dev/null +++ b/packages/wagmi/connectors/smartAccount.ts @@ -0,0 +1,72 @@ +import { type SmartAccountClient, chainId } from "permissionless" +import { type SmartAccount } from "permissionless/accounts" +import type { Chain, Transport } from "viem" +import { createConnector } from "wagmi" + +export function smartAccount< + transport extends Transport = Transport, + chain extends Chain | undefined = Chain | undefined, + account extends SmartAccount = SmartAccount +>({ + smartAccountClient, + id = smartAccountClient.uid, + name = smartAccountClient.name, + type = "smart-account" +}: { + smartAccountClient: SmartAccountClient & { + estimateGas?: () => undefined | bigint + } + id?: string + name?: string + type?: string +}) { + // Don't remove this, it is needed because wagmi has an opinion on always estimating gas: + // https://github.com/wevm/wagmi/blob/main/packages/core/src/actions/sendTransaction.ts#L77 + smartAccountClient.estimateGas = () => { + return undefined + } + + return createConnector((config) => ({ + id, + name, + type, + // async setup() {}, + async connect({ chainId } = {}) { + if (chainId && chainId !== (await this.getChainId())) { + throw new Error(`Invalid chainId ${chainId} requested`) + } + + return { + accounts: [smartAccountClient.account.address], + chainId: await this.getChainId() + } + }, + async disconnect() {}, + async getAccounts() { + return [smartAccountClient.account.address] + }, + getChainId() { + return chainId(smartAccountClient) + }, + async getProvider() {}, + async isAuthorized() { + return !!smartAccountClient.account.address + }, + onAccountsChanged() { + // Not relevant + }, + onChainChanged() { + // Not relevant because smart accounts only exist on single chain. + }, + onDisconnect() { + config.emitter.emit("disconnect") + }, + async getClient({ chainId: requestedChainId }: { chainId: number }) { + const chainId = await this.getChainId() + if (requestedChainId !== chainId) { + throw new Error(`Invalid chainId ${chainId} requested`) + } + return smartAccountClient + } + })) +} diff --git a/packages/wagmi/index.ts b/packages/wagmi/index.ts new file mode 100644 index 00000000..4fbb7855 --- /dev/null +++ b/packages/wagmi/index.ts @@ -0,0 +1,3 @@ +import { smartAccount } from "./connectors/smartAccount" + +export { smartAccount } diff --git a/packages/wagmi/package.json b/packages/wagmi/package.json new file mode 100644 index 00000000..ab51a204 --- /dev/null +++ b/packages/wagmi/package.json @@ -0,0 +1,34 @@ +{ + "name": "@permissionless/wagmi", + "version": "0.0.1", + "author": "Pimlico", + "homepage": "https://docs.pimlico.io/permissionless/wagmi", + "repository": "github:pimlicolabs/permissionless.js", + "main": "./_cjs/index.js", + "module": "./_esm/index.js", + "types": "./_types/index.d.ts", + "typings": "./_types/index.d.ts", + "type": "module", + "sideEffects": false, + "description": "A utility library for working with ERC-4337", + "keywords": [ + "ethereum", + "erc-4337", + "eip-4337", + "paymaster", + "bundler" + ], + "license": "MIT", + "exports": { + ".": { + "types": "./_types/index.d.ts", + "import": "./_esm/index.js", + "default": "./_cjs/index.js" + } + }, + "peerDependencies": { + "wagmi": "^0.0.0-canary-20240123224806", + "viem": "^2.0.0", + "permissionless": "^0.0.30" + } +} diff --git a/tsconfig.base.json b/tsconfig/tsconfig.base.json similarity index 100% rename from tsconfig.base.json rename to tsconfig/tsconfig.base.json diff --git a/tsconfig.cjs.json b/tsconfig/tsconfig.permissionless.cjs.json similarity index 85% rename from tsconfig.cjs.json rename to tsconfig/tsconfig.permissionless.cjs.json index 0d7d74ec..e857c712 100644 --- a/tsconfig.cjs.json +++ b/tsconfig/tsconfig.permissionless.cjs.json @@ -3,7 +3,7 @@ "extends": "./tsconfig.permissionless.json", "compilerOptions": { "module": "commonjs", - "outDir": "./packages/permissionless/_cjs", + "outDir": "../packages/permissionless/_cjs", "removeComments": true, "verbatimModuleSyntax": false } diff --git a/tsconfig.esm.json b/tsconfig/tsconfig.permissionless.esm.json similarity index 81% rename from tsconfig.esm.json rename to tsconfig/tsconfig.permissionless.esm.json index 18f25497..dbd9eea6 100644 --- a/tsconfig.esm.json +++ b/tsconfig/tsconfig.permissionless.esm.json @@ -3,6 +3,6 @@ "extends": "./tsconfig.permissionless.json", "compilerOptions": { "module": "es2015", - "outDir": "./packages/permissionless/_esm", + "outDir": "../packages/permissionless/_esm", } } diff --git a/tsconfig.permissionless.json b/tsconfig/tsconfig.permissionless.json similarity index 56% rename from tsconfig.permissionless.json rename to tsconfig/tsconfig.permissionless.json index 70281b67..632d24f9 100644 --- a/tsconfig.permissionless.json +++ b/tsconfig/tsconfig.permissionless.json @@ -2,16 +2,16 @@ // This file is used to compile the for cjs and esm (see package.json build scripts). It should exclude all test files. "extends": "./tsconfig.base.json", "include": [ - "packages/permissionless" + "../packages/permissionless" ], "exclude": [ - "packages/permissionless/**/*.test.ts", - "packages/permissionless/**/*.test-d.ts", - "packages/permissionless/**/*.bench.ts" + "../packages/permissionless/**/*.test.ts", + "../packages/permissionless/**/*.test-d.ts", + "../packages/permissionless/**/*.bench.ts" ], "compilerOptions": { "moduleResolution": "node", "sourceMap": true, - "rootDir": "./packages/permissionless" + "rootDir": "../packages/permissionless" } } diff --git a/tsconfig.types.json b/tsconfig/tsconfig.permissionless.types.json similarity index 74% rename from tsconfig.types.json rename to tsconfig/tsconfig.permissionless.types.json index 99ffed26..b75d3afa 100644 --- a/tsconfig.types.json +++ b/tsconfig/tsconfig.permissionless.types.json @@ -3,8 +3,8 @@ "extends": "./tsconfig.permissionless.json", "compilerOptions": { "module": "esnext", - "outDir": "./packages/permissionless/_esm", - "declarationDir": "./packages/permissionless/_types", + "outDir": "../packages/permissionless/_esm", + "declarationDir": "../packages/permissionless/_types", "emitDeclarationOnly": true, "declaration": true, "declarationMap": true, diff --git a/tsconfig/tsconfig.wagmi.cjs.json b/tsconfig/tsconfig.wagmi.cjs.json new file mode 100644 index 00000000..aa4d42d1 --- /dev/null +++ b/tsconfig/tsconfig.wagmi.cjs.json @@ -0,0 +1,10 @@ +{ + // This file is used to compile the for cjs and esm (see package.json build scripts). It should exclude all test files. + "extends": "./tsconfig.wagmi.json", + "compilerOptions": { + "module": "commonjs", + "outDir": "../packages/wagmi/_cjs", + "removeComments": true, + "verbatimModuleSyntax": false + } +} diff --git a/tsconfig/tsconfig.wagmi.esm.json b/tsconfig/tsconfig.wagmi.esm.json new file mode 100644 index 00000000..dc5cef38 --- /dev/null +++ b/tsconfig/tsconfig.wagmi.esm.json @@ -0,0 +1,8 @@ +{ + // This file is used to compile the for cjs and esm (see package.json build scripts). It should exclude all test files. + "extends": "./tsconfig.wagmi.json", + "compilerOptions": { + "module": "es2015", + "outDir": "../packages/wagmi/_esm", + } +} diff --git a/tsconfig.wagmi.json b/tsconfig/tsconfig.wagmi.json similarity index 63% rename from tsconfig.wagmi.json rename to tsconfig/tsconfig.wagmi.json index 62908454..4770e5a4 100644 --- a/tsconfig.wagmi.json +++ b/tsconfig/tsconfig.wagmi.json @@ -2,17 +2,17 @@ // This file is used to compile the for cjs and esm (see package.json build scripts). It should exclude all test files. "extends": "./tsconfig.base.json", "include": [ - "packages/wagmi" + "../packages/wagmi" ], "exclude": [ - "packages/wagmi/**/*.test.ts", - "packages/wagmi/**/*.test-d.ts", - "packages/wagmi/**/*.bench.ts" + "../packages/wagmi/**/*.test.ts", + "../packages/wagmi/**/*.test-d.ts", + "../packages/wagmi/**/*.bench.ts" ], "compilerOptions": { "moduleResolution": "node", "sourceMap": true, - "rootDir": "./packages/wagmi" + "rootDir": "../packages/wagmi" }, "jsx": "react-jsx", } diff --git a/tsconfig/tsconfig.wagmi.types.json b/tsconfig/tsconfig.wagmi.types.json new file mode 100644 index 00000000..07f9f42c --- /dev/null +++ b/tsconfig/tsconfig.wagmi.types.json @@ -0,0 +1,12 @@ +{ + // This file is used to compile the for cjs and esm (see package.json build scripts). It should exclude all test files. + "extends": "./tsconfig.wagmi.json", + "compilerOptions": { + "module": "esnext", + "outDir": "../packages/wagmi/_esm", + "declarationDir": "../packages/wagmi/_types", + "emitDeclarationOnly": true, + "declaration": true, + "declarationMap": true, + } +}