@zodiaceco/sdk 2.1.3 → 2.2.0

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/cli.mjs CHANGED
@@ -3,16 +3,109 @@ import { n as resolveZodiacDir, t as ApiClient } from "./api-kKgzHQlu.mjs";
3
3
  import { a as walkContracts, i as readAbi, n as chainIdFor, o as writeAbi, r as abiFilePath } from "./networks-B0H4Uoyh.mjs";
4
4
  import { a as resolveAbisDir, i as loadConfig, o as findProjectRoot, r as ensureConfigStub } from "./config-D0FqysME.mjs";
5
5
  import fs, { existsSync, readFileSync, writeFileSync } from "node:fs";
6
- import path, { basename, join, resolve } from "node:path";
6
+ import path, { basename, dirname, join, resolve } from "node:path";
7
7
  import { getAddress } from "ethers";
8
8
  import { Command } from "commander";
9
9
  import { config } from "dotenv";
10
+ import { fileURLToPath } from "node:url";
10
11
  import { createHash, randomBytes } from "node:crypto";
11
12
  import { createServer } from "node:http";
12
13
  import open from "open";
13
14
  import { join as join$1 } from "path";
14
15
  import { ModuleKind, Project, ScriptTarget, VariableDeclarationKind } from "ts-morph";
15
16
  import { mkdirSync, writeFileSync as writeFileSync$1 } from "fs";
17
+ //#region src/cli/checkForUpdate.ts
18
+ const PACKAGE = "@zodiaceco/sdk";
19
+ const REGISTRY_URL = `https://registry.npmjs.org/${PACKAGE}/latest`;
20
+ const TIMEOUT_MS = 2e3;
21
+ /**
22
+ * Whether a newer release of this package is out, as the notice to print — or
23
+ * `null`, which is also the answer to every failure. The check is a courtesy
24
+ * on the way out of a command, so nothing here may throw or block for long,
25
+ * and a run without a terminal to read the notice skips it entirely.
26
+ */
27
+ const checkForUpdate = async ({ cwd = process.cwd(), env = process.env } = {}) => {
28
+ if (env.CI) return null;
29
+ try {
30
+ const current = ownVersion();
31
+ const latest = await fetchLatestVersion();
32
+ if (latest == null || !isNewer(latest, current)) return null;
33
+ return [`A newer version of ${PACKAGE} is available (${current} → ${latest}). Update with:`, ` ${updateCommand(detectPackageManager(cwd, env))}`].join("\n");
34
+ } catch {
35
+ return null;
36
+ }
37
+ };
38
+ /**
39
+ * The version of the package this module runs from. Walks up to the
40
+ * `package.json` that names it, which holds from `src/` and from `dist/`
41
+ * alike — and finds this package, not the caller's, when the CLI runs
42
+ * inside another project.
43
+ */
44
+ const ownVersion = () => {
45
+ let dir = dirname(fileURLToPath(import.meta.url));
46
+ while (true) {
47
+ const manifest = join(dir, "package.json");
48
+ if (existsSync(manifest)) {
49
+ const { name, version } = JSON.parse(readFileSync(manifest, "utf-8"));
50
+ if (name === PACKAGE && typeof version === "string") return version;
51
+ }
52
+ const parent = dirname(dir);
53
+ if (parent === dir) throw new Error(`Could not find the package.json of ${PACKAGE}`);
54
+ dir = parent;
55
+ }
56
+ };
57
+ const fetchLatestVersion = async () => {
58
+ const response = await fetch(REGISTRY_URL, { signal: AbortSignal.timeout(TIMEOUT_MS) });
59
+ if (!response.ok) return null;
60
+ const { version } = await response.json();
61
+ return typeof version === "string" ? version : null;
62
+ };
63
+ const isNewer = (latest, current) => {
64
+ const a = parseVersion(latest);
65
+ const b = parseVersion(current);
66
+ if (a == null || b == null) return false;
67
+ for (let i = 0; i < 3; i++) if (a[i] !== b[i]) return a[i] > b[i];
68
+ return false;
69
+ };
70
+ const parseVersion = (version) => {
71
+ const match = /^(\d+)\.(\d+)\.(\d+)/.exec(version);
72
+ if (match == null) return null;
73
+ return [
74
+ Number(match[1]),
75
+ Number(match[2]),
76
+ Number(match[3])
77
+ ];
78
+ };
79
+ /**
80
+ * The package manager an update should go through: whichever one launched
81
+ * this process, or failing that, whichever one's lockfile the project
82
+ * carries. `npm` when neither says anything.
83
+ */
84
+ const detectPackageManager = (cwd, env) => {
85
+ const agent = env.npm_config_user_agent;
86
+ if (agent != null) {
87
+ const fromAgent = PACKAGE_MANAGERS.find((packageManager) => agent.startsWith(`${packageManager}/`));
88
+ if (fromAgent != null) return fromAgent;
89
+ }
90
+ const root = findProjectRoot(cwd);
91
+ const fromLockfile = LOCKFILES.find(([lockfile]) => existsSync(join(root, lockfile)));
92
+ return fromLockfile == null ? "npm" : fromLockfile[1];
93
+ };
94
+ const PACKAGE_MANAGERS = [
95
+ "pnpm",
96
+ "yarn",
97
+ "bun",
98
+ "npm"
99
+ ];
100
+ const LOCKFILES = [
101
+ ["bun.lock", "bun"],
102
+ ["bun.lockb", "bun"],
103
+ ["pnpm-lock.yaml", "pnpm"],
104
+ ["yarn.lock", "yarn"],
105
+ ["package-lock.json", "npm"]
106
+ ];
107
+ const updateCommand = (packageManager) => packageManager === "npm" ? `npm install ${PACKAGE}@latest` : `${packageManager} add ${PACKAGE}@latest`;
108
+ //#endregion
16
109
  //#region src/cli/commands/init.ts
17
110
  const DEFAULT_APP_URL = "https://app.zodiac.eco";
18
111
  const CALLBACK_TIMEOUT_MS = 300 * 1e3;
@@ -610,7 +703,15 @@ const loadConfigOrInit = (configPath) => loadConfig(configPath, {
610
703
  });
611
704
  const run = async (argv = process.argv) => {
612
705
  const program = new Command();
613
- program.name("zodiac").description("Zodiac SDK CLI – pull org data and contract ABIs").version("1.0.0").option("-c, --config <path>", "path to the config file", "zodiac.config.ts");
706
+ program.name("zodiac").description("Zodiac SDK CLI – pull org data and contract ABIs").version(ownVersion()).option("-c, --config <path>", "path to the config file", "zodiac.config.ts");
707
+ let updateNotice = Promise.resolve(null);
708
+ program.hook("preAction", () => {
709
+ updateNotice = checkForUpdate();
710
+ });
711
+ program.hook("postAction", async () => {
712
+ const notice = await updateNotice;
713
+ if (notice != null) console.warn(`\n${notice}`);
714
+ });
614
715
  program.command("pull").description("Fetch Zodiac org data and contract ABIs, generating typed SDK functions. Authorizes this directory automatically on first run.").action(async (_opts, cmd) => {
615
716
  const config = await loadConfigOrInit(cmd.optsWithGlobals().config);
616
717
  await Promise.all([pullOrg(config), pullContracts(config)]);
package/dist/cli.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.mjs","names":["join","loadDotenv"],"sources":["../src/cli/commands/init.ts","../src/cli/commands/pullOrg.ts","../src/allow/fetch.ts","../src/allow/codegen.ts","../src/cli/commands/pullContracts.ts","../src/cli/run.ts","../src/cli/index.ts"],"sourcesContent":["import { createHash, randomBytes } from 'node:crypto'\nimport {\n createServer,\n type IncomingMessage,\n type ServerResponse,\n} from 'node:http'\nimport { existsSync, readFileSync, writeFileSync } from 'node:fs'\nimport { basename, join, resolve } from 'node:path'\nimport open from 'open'\nimport { ensureConfigStub } from '../config'\nimport { findProjectRoot } from '../projectRoot'\n\nconst DEFAULT_APP_URL = 'https://app.zodiac.eco'\nconst CALLBACK_TIMEOUT_MS = 5 * 60 * 1000 // 5 minutes\n\ntype InitOptions = {\n rootDir?: string\n /** Override the Zodiac app base URL (defaults to ZODIAC_APP_URL env or app.zodiac.eco). */\n appUrl?: string\n}\n\nexport const init = async (options: InitOptions = {}): Promise<string> => {\n const rootDir = options.rootDir ?? findProjectRoot()\n const appUrl = (\n options.appUrl ??\n process.env.ZODIAC_APP_URL ??\n DEFAULT_APP_URL\n ).replace(/\\/$/, '')\n\n const label = basename(resolve(rootDir)) || 'zodiac-cli'\n\n // PKCE: keep `code_verifier` private to this process. Send only the\n // SHA-256 hash (`code_challenge`) over the wire.\n const codeVerifier = randomBytes(32).toString('base64url')\n const codeChallenge = createHash('sha256')\n .update(codeVerifier)\n .digest('base64url')\n\n // `state` binds the redirect we receive on the loopback to this CLI\n // invocation, defending against a stray local process trying to inject\n // an auth code into our callback.\n const state = randomBytes(32).toString('base64url')\n\n const { port, waitForCode, close } = await startCallbackServer({\n expectedState: state,\n appUrl,\n })\n\n const callbackUrl = `http://127.0.0.1:${port}/callback`\n const authUrl = new URL('/cli-auth', appUrl)\n authUrl.searchParams.set('callback', callbackUrl)\n authUrl.searchParams.set('state', state)\n authUrl.searchParams.set('code_challenge', codeChallenge)\n authUrl.searchParams.set('label', label)\n\n console.log(\n `Opening ${authUrl} in your browser. Approve the request to receive an API key.`\n )\n await open(authUrl.toString())\n\n let code: string\n try {\n code = await waitForCode(CALLBACK_TIMEOUT_MS)\n } finally {\n await close()\n }\n\n const apiKey = await exchangeCodeForKey(appUrl, code, codeVerifier)\n\n const envPath = join(rootDir, '.env')\n const apiUrl = `${appUrl}/api/v1`\n writeEnv(envPath, { ZODIAC_API_KEY: apiKey, ZODIAC_API_URL: apiUrl })\n\n // So a same-run `pull` targets the org we just authorized, not the default.\n process.env.ZODIAC_API_KEY = apiKey\n process.env.ZODIAC_API_URL = apiUrl\n\n console.log(`✅ API key written to ${envPath}`)\n\n const configPath = join(rootDir, 'zodiac.config.ts')\n if (ensureConfigStub(configPath)) {\n console.log(`✅ Created ${configPath}`)\n }\n\n return apiKey\n}\n\nconst exchangeCodeForKey = async (\n appUrl: string,\n code: string,\n codeVerifier: string\n): Promise<string> => {\n const response = await fetch(`${appUrl}/cli-auth/exchange`, {\n method: 'POST',\n headers: { 'content-type': 'application/json' },\n body: JSON.stringify({ code, code_verifier: codeVerifier }),\n })\n\n if (!response.ok) {\n let detail = ''\n try {\n const body = (await response.json()) as { error?: string }\n detail = body.error ? `: ${body.error}` : ''\n } catch {\n // ignore — fall through to a generic message\n }\n throw new Error(\n `Failed to exchange auth code (${response.status})${detail}`\n )\n }\n\n const { key } = (await response.json()) as { key: unknown }\n if (typeof key !== 'string' || !key.startsWith('zodiac_')) {\n throw new Error(\n 'Exchange endpoint returned an unexpected response (missing or malformed key)'\n )\n }\n return key\n}\n\ntype StartServerOptions = {\n expectedState: string\n appUrl: string\n}\n\ntype StartServerResult = {\n port: number\n waitForCode: (timeoutMs: number) => Promise<string>\n close: () => Promise<void>\n}\n\nconst startCallbackServer = async ({\n expectedState,\n appUrl,\n}: StartServerOptions): Promise<StartServerResult> => {\n let resolveCode: (code: string) => void = () => {}\n let rejectCode: (err: Error) => void = () => {}\n const codePromise = new Promise<string>((res, rej) => {\n resolveCode = res\n rejectCode = rej\n })\n\n const handler = (req: IncomingMessage, res: ServerResponse) => {\n if (req.method !== 'GET' || !req.url?.startsWith('/callback')) {\n res.statusCode = 404\n res.end()\n return\n }\n\n const url = new URL(req.url, `http://127.0.0.1`)\n const code = url.searchParams.get('code')\n const state = url.searchParams.get('state')\n\n if (state !== expectedState) {\n // A stray request — could be a stale browser tab, a malicious\n // local process, etc. Silently 403 and keep waiting for the right\n // one. Don't reject the CLI promise.\n respondHtml(\n res,\n 403,\n renderHtml(\n 'Mismatched state',\n `<p>This callback didn't match the running <code>zodiac init</code> session. You can close this tab.</p>`\n )\n )\n return\n }\n\n if (typeof code !== 'string' || code.length === 0) {\n respondHtml(\n res,\n 400,\n renderHtml(\n 'Missing code',\n `<p>The callback URL didn't include an auth <code>code</code>. Please re-run <code>zodiac init</code>.</p>`\n )\n )\n return\n }\n\n respondHtml(\n res,\n 200,\n renderHtml(\n 'Authorized',\n `<p>Your CLI now has its API key. You can close this tab and return to your terminal.</p>\n <p><a href=\"${escapeHtml(appUrl)}\">Back to Zodiac</a></p>`\n )\n )\n resolveCode(code)\n }\n\n const server = createServer(handler)\n await new Promise<void>((res) => server.listen(0, '127.0.0.1', res))\n const address = server.address()\n if (address == null || typeof address === 'string') {\n throw new Error('Failed to bind loopback callback server')\n }\n const port = address.port\n\n const close = (): Promise<void> =>\n new Promise<void>((resolve) => {\n server.close(() => resolve())\n })\n\n const waitForCode = (timeoutMs: number) =>\n Promise.race<string>([\n codePromise,\n new Promise<string>((_, rej) =>\n setTimeout(() => {\n rejectCode(new Error(`Timed out waiting for CLI auth callback`))\n rej(new Error(`Timed out waiting for CLI auth callback`))\n }, timeoutMs)\n ),\n ])\n\n return { port, waitForCode, close }\n}\n\nconst respondHtml = (res: ServerResponse, status: number, body: string) => {\n // Force the connection to close after the response so the browser\n // doesn't keep waiting on a keep-alive socket once the CLI exits.\n // Resolve only after 'finish' (response handed to the OS) so the\n // bytes can flush before the process tears down.\n res.setHeader('Connection', 'close')\n res.setHeader('content-type', 'text/html; charset=utf-8')\n res.statusCode = status\n res.end(body)\n}\n\nconst renderHtml = (title: string, bodyHtml: string) => `<!doctype html>\n<html lang=\"en\">\n <head>\n <meta charset=\"utf-8\" />\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n <title>${escapeHtml(title)} — Zodiac CLI</title>\n <style>\n body { font: 16px/1.5 -apple-system, BlinkMacSystemFont, \"Segoe UI\", sans-serif; max-width: 32rem; margin: 4rem auto; padding: 0 1rem; color: #1f2937; }\n h1 { font-weight: 300; font-size: 1.75rem; margin-bottom: 1rem; }\n code { background: #f3f4f6; padding: 0.125rem 0.375rem; border-radius: 0.25rem; }\n a { color: #1d4ed8; }\n </style>\n </head>\n <body>\n <h1>${escapeHtml(title)}</h1>\n ${bodyHtml}\n </body>\n</html>\n`\n\nconst escapeHtml = (value: string) =>\n value\n .replace(/&/g, '&amp;')\n .replace(/</g, '&lt;')\n .replace(/>/g, '&gt;')\n .replace(/\"/g, '&quot;')\n .replace(/'/g, '&#39;')\n\nconst writeEnv = (envPath: string, vars: Record<string, string>): void => {\n let contents = existsSync(envPath) ? readFileSync(envPath, 'utf8') : ''\n\n for (const [key, value] of Object.entries(vars)) {\n contents = upsertEnvLine(contents, key, value)\n }\n\n writeFileSync(envPath, contents, 'utf8')\n}\n\nconst upsertEnvLine = (\n contents: string,\n key: string,\n value: string\n): string => {\n const line = `${key}=${value}`\n const lines = contents.split(/\\r?\\n/)\n const idx = lines.findIndex((l) => new RegExp(`^\\\\s*${key}\\\\s*=`).test(l))\n\n if (idx >= 0) {\n lines[idx] = line\n return lines.join('\\n')\n }\n\n return contents.length === 0 || contents.endsWith('\\n')\n ? `${contents}${line}\\n`\n : `${contents}\\n${line}\\n`\n}\n","import type {\n Address,\n ChainId,\n ResolveConstellationPayload,\n} from '@zodiaceco/api-types'\nimport type { ResolvedConfig } from '../config'\nimport { ApiClient } from '../../api'\nimport { getAddress } from 'ethers'\nimport {\n ModuleKind,\n Project,\n ScriptTarget,\n VariableDeclarationKind,\n} from 'ts-morph'\nimport { mkdirSync, writeFileSync } from 'fs'\nimport { join } from 'path'\nimport { resolveZodiacDir } from '../../paths'\n\nconst toLiteral = (value: unknown, indent = 0): string => {\n const pad = ' '.repeat(indent)\n const childPad = ' '.repeat(indent + 1)\n\n if (value === null) return 'null'\n if (typeof value === 'bigint') return `${value}n`\n if (typeof value === 'string') return JSON.stringify(value)\n if (typeof value === 'number' || typeof value === 'boolean')\n return String(value)\n if (Array.isArray(value)) {\n if (value.length === 0) return '[]'\n return `[\\n${value.map((v) => `${childPad}${toLiteral(v, indent + 1)}`).join(',\\n')},\\n${pad}]`\n }\n if (typeof value === 'object') {\n const entries = Object.entries(value as Record<string, unknown>)\n if (entries.length === 0) return '{}'\n const props = entries.map(\n ([k, v]) =>\n `${childPad}${isBareKey(k) ? k : JSON.stringify(k)}: ${toLiteral(v, indent + 1)}`\n )\n return `{\\n${props.join(',\\n')},\\n${pad}}`\n }\n return String(value)\n}\n\ntype NodeType = 'SAFE' | 'ROLES' | 'DELAY'\n\n/**\n * An account written as the specification node that names it and declares\n * nothing else.\n *\n * The `ref` is required of every node and has to be distinct, but nothing\n * reads it back — the result comes aligned with the request.\n *\n * Spelled out per type rather than passed through: `/accounts` answers with\n * the same three names as an enum, whose members are types of their own, and\n * a node is only a node once it says which of the three it is.\n */\nconst asNodeReference = (\n {\n type,\n chain,\n address,\n }: { type: string; chain: ChainId; address: Lowercase<Address> },\n index: number\n): ResolveConstellationPayload['specification'][number] => {\n const node = { ref: `account_${index}`, chain, address }\n\n switch (asNodeType(type)) {\n case 'SAFE':\n return { ...node, type: 'SAFE' }\n case 'ROLES':\n return { ...node, type: 'ROLES' }\n case 'DELAY':\n return { ...node, type: 'DELAY' }\n }\n}\n\nconst asNodeType = (type: string): NodeType => {\n if (type === 'SAFE' || type === 'ROLES' || type === 'DELAY') {\n return type\n }\n\n throw new Error(`Cannot describe an account of type \"${type}\"`)\n}\n\n/**\n * Whether a key can be written without quotes. Chain ids are grouping keys in\n * the generated data, and an unquoted number keys the `as const` type by chain\n * id — quoted, it would key by a string the callers never hold.\n */\nconst isBareKey = (key: string): boolean =>\n /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(key) || /^\\d+$/.test(key)\n\nexport const pullOrg = async (config: ResolvedConfig) => {\n const client = new ApiClient({\n apiKey: config.apiKey,\n })\n\n const [users, workspaceAccounts] = await Promise.all([\n client.listUsers(),\n client.listAccounts(),\n ])\n\n // The generated accounts carry their onchain state so a node reads as the\n // account it names and completes in an editor. Only what a constellation\n // declares is ever pushed back, so this is for reading, not a declaration.\n //\n // Each account is named by its address and nothing else. `/resolve`\n // resolves a node it has no address for against the setup safe of whoever\n // holds the API key — which describes the account *that* caller would\n // deploy, not the one being asked about — and it merges declarations over\n // what it reads. Sending an address and no declarations leaves it nothing\n // to derive and nothing to merge, so the answer is the account itself, the\n // same for every key.\n //\n // Asking about every listed account is safe for the same reason: `/accounts`\n // admits one only once it has been seen to hold code, so every address here\n // is one that can be read from chain.\n const allAccounts = workspaceAccounts.flatMap((ws) => ws.accounts)\n const resolved = new Map<\n string,\n Awaited<ReturnType<typeof client.resolveConstellation>>['result'][number]\n >()\n\n if (allAccounts.length > 0) {\n const { result } = await client.resolveConstellation(\n workspaceAccounts[0].workspaceId, // any workspace works for the resolve route\n {\n specification: allAccounts.map(asNodeReference),\n }\n )\n\n // Aligned with the request, entry for entry.\n allAccounts.forEach((account, index) => {\n resolved.set(account.id, result[index])\n })\n }\n\n // Group accounts by type and then by chain into separate bracket-access\n // namespaces: `safes[chain]`, `rolesMods[chain]`, `delays[chain]`. This way\n // `eth.safe[...]` IntelliSense only suggests SAFE labels deployed on the\n // constellation's own chain, and the label-collision suffix only kicks in\n // where a label is genuinely ambiguous — same type, same chain.\n type AccountsByChain = Record<number, Record<string, unknown>>\n\n const accountsRecord: Record<string, unknown> = {}\n for (const ws of workspaceAccounts) {\n const safes: AccountsByChain = {}\n const rolesMods: AccountsByChain = {}\n const delays: AccountsByChain = {}\n\n const bucketsByType = {\n SAFE: safes,\n ROLES: rolesMods,\n DELAY: delays,\n } as const\n\n const isNodeType = (type: string): type is NodeType =>\n type === 'SAFE' || type === 'ROLES' || type === 'DELAY'\n\n // Accounts we only know by address — Safe owners, external role\n // members, route targets — carry no label. They can't key a\n // label-addressed namespace, so they stay out of the codegen.\n // Vault entries always carry one.\n\n // Count labels per namespace so we only suffix collisions a constellation\n // could actually run into. Two safes named `Treasury` on different chains\n // never compete for a key, because a constellation only ever sees one of\n // those chains.\n const namespaceKey = (type: NodeType, chain: number) => `${type}:${chain}`\n const labelCounts = new Map<string, Map<string, number>>()\n\n for (const account of ws.accounts) {\n const { label } = account\n if (label == null || !isNodeType(account.type)) continue\n const key = namespaceKey(account.type, account.chain)\n let counts = labelCounts.get(key)\n if (!counts) {\n counts = new Map()\n labelCounts.set(key, counts)\n }\n counts.set(label, (counts.get(label) ?? 0) + 1)\n }\n\n for (const account of ws.accounts) {\n const { label } = account\n if (label == null || !isNodeType(account.type)) continue\n const onChain = resolved.get(account.id)\n const counts = labelCounts.get(namespaceKey(account.type, account.chain))\n const key =\n (counts?.get(label) ?? 0) > 1\n ? `${label} (${getAddress(account.address)})`\n : label\n const byChain = bucketsByType[account.type]\n const byLabel = (byChain[account.chain] ??= {})\n byLabel[key] = {\n id: account.id,\n label,\n address: account.address,\n chain: account.chain,\n vault: account.vault,\n ...(onChain?.type === 'SAFE' && {\n threshold: onChain.threshold,\n owners: [...onChain.owners],\n modules: [...onChain.modules],\n }),\n }\n }\n\n accountsRecord[ws.workspaceName] = {\n workspaceId: ws.workspaceId,\n workspaceName: ws.workspaceName,\n safes,\n rolesMods,\n delays,\n }\n }\n\n const nameCount = new Map<string, number>()\n for (const user of users) {\n nameCount.set(user.fullName, (nameCount.get(user.fullName) ?? 0) + 1)\n }\n\n const usersRecord: Record<string, unknown> = {}\n for (const user of users) {\n const handle =\n nameCount.get(user.fullName)! > 1\n ? `${user.fullName} (${user.id})`\n : user.fullName\n usersRecord[handle] = {\n id: user.id,\n fullName: user.fullName,\n personalSafes: user.personalSafes,\n }\n }\n\n const outDir = resolveZodiacDir(config.rootDir)\n\n mkdirSync(outDir, { recursive: true })\n\n // Pin CJS so `require()` works regardless of the parent package.json's type\n writeFileSync(\n join(outDir, 'package.json'),\n JSON.stringify(\n {\n type: 'commonjs',\n main: 'index.js',\n types: 'index.d.ts',\n },\n null,\n 2\n )\n )\n\n // Use ts-morph to generate TS, then emit JS + d.ts\n const project = new Project({\n compilerOptions: {\n declaration: true,\n module: ModuleKind.CommonJS,\n target: ScriptTarget.ESNext,\n outDir,\n },\n useInMemoryFileSystem: true,\n })\n\n const sourceFile = project.createSourceFile('index.ts', '')\n\n sourceFile.addVariableStatement({\n isExported: true,\n declarationKind: VariableDeclarationKind.Const,\n declarations: [\n {\n name: 'users',\n initializer: `${toLiteral(usersRecord)} as const`,\n },\n ],\n })\n\n sourceFile.addVariableStatement({\n isExported: true,\n declarationKind: VariableDeclarationKind.Const,\n declarations: [\n {\n name: 'accounts',\n initializer: `${toLiteral(accountsRecord)} as const`,\n },\n ],\n })\n\n const emitResult = sourceFile.getEmitOutput()\n for (const outputFile of emitResult.getOutputFiles()) {\n const filePath = outputFile.getFilePath()\n const fileName = filePath.includes('.d.ts') ? 'index.d.ts' : 'index.js'\n let contents = outputFile.getText()\n // Augment the SDK's global `ZodiacGeneratedCodegen` interface so\n // `constellation()`'s default type parameter picks up these literal\n // shapes automatically.\n if (fileName === 'index.d.ts') {\n contents += `\ndeclare global {\n interface ZodiacGeneratedCodegen {\n users: typeof users;\n accounts: typeof accounts;\n }\n}\n`\n }\n writeFileSync(join(outDir, fileName), contents)\n }\n}\n","import { chainIdFor, type ChainPrefix } from './networks'\n\nexport type AbiFragment = Record<string, any>\nexport type Abi = AbiFragment[]\n\ntype Implementation = { abi?: unknown }\ntype Account = Implementation & {\n proxy?: unknown\n implementation?: Implementation\n}\n\n// Returns null on any failure so callers can fall back to a manual ABI file.\nexport async function fetchAbi(\n chainId: number,\n address: `0x${string}`\n): Promise<Abi | null> {\n const url = `https://api.abi.pub/v1/chains/${chainId}/accounts/${address}`\n let account: Account\n try {\n const resp = await fetch(url)\n if (!resp.ok) return null\n account = (await resp.json()) as Account\n } catch {\n return null\n }\n if (account == null || typeof account !== 'object') return null\n\n // For a proxy the endpoint reports the proxy under `proxy` and the contract\n // that actually holds the functions under `implementation`. Permissions are\n // written against the implementation ABI.\n const abi = account.proxy ? account.implementation?.abi : account.abi\n if (!Array.isArray(abi) || abi.length === 0) return null\n return abi as Abi\n}\n\nexport const fetchAbiForPrefix = (\n prefix: ChainPrefix,\n address: `0x${string}`\n) => fetchAbi(chainIdFor(prefix), address)\n","import fs from 'node:fs'\nimport path from 'node:path'\nimport { walkContracts, readAbi, type ContractNode } from './abi'\nimport type { Abi, AbiFragment } from './fetch'\n\n// Emits named tuple elements per ABI input — this is the reason we don't rely\n// on viem/abitype, which produces unnamed tuples (microsoft/TypeScript#44939).\nexport function generateAllowTypes(\n abisDir: string,\n contractsConfig: Record<string, any>\n): string {\n type Tree = Map<string, Tree | { node: ContractNode; abi: Abi }>\n\n const root: Tree = new Map()\n for (const node of walkContracts(contractsConfig)) {\n const abi = readAbi(abisDir, node)\n if (!abi) continue\n insertIntoTree(root, [node.chain, ...node.segments], { node, abi })\n }\n\n const out: string[] = []\n out.push('// AUTO-GENERATED by `zodiac pull-contracts`. Do not edit.')\n out.push('/* eslint-disable */')\n out.push('')\n out.push(\n `import type { Scoping, Options, EVERYTHING, FunctionPermission, TargetPermission } from \"@zodiaceco/sdk/allow\";`\n )\n out.push('')\n out.push('declare global {')\n out.push(' interface AllowKit ' + renderTree(root, ' '))\n out.push('}')\n out.push('')\n out.push('export {};')\n out.push('')\n return out.join('\\n')\n}\n\nfunction insertIntoTree(\n tree: Map<string, any>,\n segments: string[],\n leaf: { node: ContractNode; abi: Abi }\n): void {\n const [first, ...rest] = segments\n if (!first) throw new Error('empty segments')\n if (rest.length === 0) {\n tree.set(first, leaf)\n return\n }\n let child = tree.get(first)\n if (!child || child.node) {\n child = new Map()\n tree.set(first, child)\n }\n insertIntoTree(child, rest, leaf)\n}\n\nfunction renderTree(tree: Map<string, any>, indent: string): string {\n const lines: string[] = ['{']\n for (const [key, value] of tree) {\n const safeKey = renderPropKey(key)\n if (value instanceof Map) {\n lines.push(`${indent} ${safeKey}: ${renderTree(value, indent + ' ')};`)\n } else {\n const { node, abi } = value as { node: ContractNode; abi: Abi }\n lines.push(\n `${indent} ${safeKey}: ${renderContractType(node, abi, indent + ' ')};`\n )\n }\n }\n lines.push(`${indent}}`)\n return lines.join('\\n')\n}\n\nfunction renderPropKey(name: string): string {\n return /^[A-Za-z_$][A-Za-z0-9_$]*$/.test(name) ? name : JSON.stringify(name)\n}\n\nfunction renderContractType(\n node: ContractNode,\n abi: Abi,\n indent: string\n): string {\n const members: string[] = []\n members.push(\n `${indent} [EVERYTHING]: (options?: Options) => TargetPermission;`\n )\n\n // Members mirror what the runtime proxy can resolve, which is whatever\n // `Interface.getFunction` accepts. A name it would find ambiguous is not a\n // member there — the proxy returns undefined for it — so an overloaded name\n // is emitted once per full signature and never bare. Declaring the bare name\n // anyway is what used to make `allow.eth.susds.deposit(…)` type-check and\n // then fail at runtime.\n for (const overloads of groupByName(abi).values()) {\n const overloaded = overloads.length > 1\n for (const fragment of overloads) {\n const key = overloaded\n ? signatureFor(fragment)\n : (fragment.name as string)\n members.push(renderFunctionSignature(fragment, key, indent + ' '))\n }\n }\n return ['{', ...members, `${indent}}`].join('\\n')\n}\n\n/**\n * Permissionable fragments grouped by function name, in ABI order. Two\n * fragments that render the same signature are the same function listed twice,\n * so they collapse — emitting the key twice would not compile.\n */\nfunction groupByName(abi: Abi): Map<string, AbiFragment[]> {\n const byName = new Map<string, AbiFragment[]>()\n for (const fragment of abi) {\n if (fragment.type !== 'function') continue\n if (\n fragment.stateMutability === 'view' ||\n fragment.stateMutability === 'pure'\n ) {\n continue\n }\n const name = fragment.name as string\n if (!name) continue\n const overloads = byName.get(name) ?? []\n if (overloads.some((f) => signatureFor(f) === signatureFor(fragment))) {\n continue\n }\n byName.set(name, [...overloads, fragment])\n }\n return byName\n}\n\n/** The canonical `name(type,…)` form, which is how `Interface.getFunction`\n * addresses one overload of a name. */\nfunction signatureFor(fragment: AbiFragment): string {\n const inputs = (fragment.inputs as AbiFragment[]) ?? []\n return `${fragment.name}(${inputs.map(canonicalTypeFor).join(',')})`\n}\n\nfunction canonicalTypeFor(fragment: AbiFragment): string {\n const type = fragment.type as string\n\n const arrayMatch = /^(.*)\\[(\\d*)\\]$/.exec(type)\n if (arrayMatch) {\n const inner: AbiFragment = { ...fragment, type: arrayMatch[1] }\n return `${canonicalTypeFor(inner)}[${arrayMatch[2]}]`\n }\n\n if (type === 'tuple') {\n const components = (fragment.components as AbiFragment[]) ?? []\n return `(${components.map(canonicalTypeFor).join(',')})`\n }\n\n return type\n}\n\nfunction renderFunctionSignature(\n fragment: AbiFragment,\n key: string,\n indent: string\n): string {\n const name = renderPropKey(key)\n const params: string[] = []\n for (const input of (fragment.inputs as AbiFragment[]) ?? []) {\n const paramName = sanitizeParamName(\n input.name || `arg${params.length}`,\n params.length\n )\n params.push(`${paramName}?: Scoping<${tsTypeFor(input)}>`)\n }\n params.push(`options?: Options`)\n return `${indent}${name}: (${params.join(', ')}) => FunctionPermission;`\n}\n\nfunction sanitizeParamName(name: string, index: number): string {\n const cleaned = name.replace(/[^A-Za-z0-9_$]/g, '_')\n if (!cleaned || /^[0-9]/.test(cleaned)) return `arg${index}`\n // Named tuple element labels can't collide with TS reserved words.\n const reserved = new Set([\n 'function',\n 'class',\n 'new',\n 'number',\n 'string',\n 'object',\n 'boolean',\n 'symbol',\n 'default',\n 'return',\n 'this',\n 'void',\n 'delete',\n 'in',\n 'of',\n 'for',\n 'while',\n 'switch',\n 'case',\n 'if',\n 'else',\n 'null',\n 'true',\n 'false',\n 'undefined',\n 'any',\n 'never',\n 'unknown',\n ])\n return reserved.has(cleaned) ? `_${cleaned}` : cleaned\n}\n\nfunction tsTypeFor(fragment: AbiFragment): string {\n const type = fragment.type as string\n\n const arrayMatch = /^(.*)\\[(\\d*)\\]$/.exec(type)\n if (arrayMatch) {\n const inner: AbiFragment = { ...fragment, type: arrayMatch[1] }\n return `readonly (${tsTypeFor(inner)})[]`\n }\n\n if (type === 'tuple') {\n const components = (fragment.components as AbiFragment[]) ?? []\n if (components.length === 0) return 'Record<string, unknown>'\n const fields = components.map((c, i) => {\n const key = sanitizeParamName(c.name || `f${i}`, i)\n return `${renderPropKey(key)}: ${tsTypeFor(c)}`\n })\n return `{ ${fields.join('; ')} }`\n }\n\n if (type === 'address') return '`0x${string}`'\n if (type === 'bool') return 'boolean'\n if (type === 'string') return 'string'\n if (type === 'bytes') return 'import(\"ethers\").BytesLike'\n if (/^bytes\\d+$/.test(type)) return '`0x${string}`'\n if (/^u?int\\d*$/.test(type)) return 'import(\"ethers\").BigNumberish'\n return 'unknown'\n}\n\nexport function writeGenerated(outFile: string, source: string): void {\n fs.mkdirSync(path.dirname(outFile), { recursive: true })\n fs.writeFileSync(outFile, source, 'utf8')\n}\n","import fs from 'node:fs'\nimport path from 'node:path'\nimport type { ResolvedConfig } from '../config'\nimport { resolveAbisDir } from '../config'\nimport { resolveZodiacDir } from '../../paths'\nimport { abiFilePath, walkContracts, writeAbi } from '../../allow/abi'\nimport { fetchAbi } from '../../allow/fetch'\nimport { chainIdFor } from '../../allow/networks'\nimport { generateAllowTypes, writeGenerated } from '../../allow/codegen'\n\ntype Status = 'ok' | 'fetched' | 'missing'\n\nexport const pullContracts = async (config: ResolvedConfig) => {\n if (!config.contracts || Object.keys(config.contracts).length === 0) {\n console.log('No contracts defined in config, skipping.')\n return\n }\n\n const abisDir = resolveAbisDir(config)\n const generatedFile = path.join(\n resolveZodiacDir(config.rootDir),\n 'allow.d.ts'\n )\n\n let missing = 0\n let fetched = 0\n let existing = 0\n\n for (const node of walkContracts(config.contracts)) {\n const file = abiFilePath(abisDir, node)\n\n if (fs.existsSync(file)) {\n existing++\n report(node.chain, node.segments, node.address, 'ok', file)\n continue\n }\n\n let chainId: number\n try {\n chainId = chainIdFor(node.chain)\n } catch (error) {\n missing++\n report(\n node.chain,\n node.segments,\n node.address,\n 'missing',\n file,\n (error as Error).message\n )\n continue\n }\n\n const abi = await fetchAbi(chainId, node.address)\n if (!abi) {\n missing++\n report(\n node.chain,\n node.segments,\n node.address,\n 'missing',\n file,\n `api.abi.pub returned no ABI for chain ${chainId}`\n )\n continue\n }\n writeAbi(abisDir, node, abi)\n fetched++\n report(node.chain, node.segments, node.address, 'fetched', file)\n }\n\n console.log('')\n console.log(\n `Contracts summary: ${existing} existing, ${fetched} fetched, ${missing} missing.`\n )\n if (missing > 0) {\n console.log('')\n console.log('Missing ABIs must be provided manually. Paste the contract')\n console.log(\n 'ABI JSON at the paths listed above and re-run `zodiac pull-contracts`.'\n )\n }\n\n const source = generateAllowTypes(abisDir, config.contracts)\n writeGenerated(generatedFile, source)\n console.log('')\n console.log(`Wrote typings to ${path.relative(process.cwd(), generatedFile)}`)\n\n if (missing > 0) process.exit(1)\n}\n\nfunction report(\n chain: string,\n segments: string[],\n address: string,\n status: Status,\n file: string,\n reason?: string\n) {\n const label = `${chain}.${segments.join('.')}`.padEnd(40, ' ')\n const tag = {\n ok: ' cached ',\n fetched: ' fetched ',\n missing: ' MISSING ',\n }[status]\n const suffix = reason ? ` — ${reason}` : ''\n console.log(`${tag} ${label} ${address}${suffix}`)\n if (status === 'missing') {\n console.log(` → paste ABI at ${file}`)\n }\n}\n","import { Command } from 'commander'\nimport { config as loadDotenv } from 'dotenv'\nimport { init } from './commands/init'\nimport { loadConfig } from './config'\nimport { pullOrg } from './commands/pullOrg'\nimport { pullContracts } from './commands/pullContracts'\n\n// Load `.env` from the current working directory before reading any env vars.\nloadDotenv({ quiet: true })\n\nconst loadConfigOrInit = (configPath: string) =>\n loadConfig(configPath, {\n createIfMissing: true,\n onMissingKey: async (rootDir) => {\n console.log(\n 'No ZODIAC_API_KEY found. Starting authorization to mint one for this directory…'\n )\n return init({ rootDir })\n },\n })\n\nexport const run = async (argv: string[] = process.argv) => {\n const program = new Command()\n\n program\n .name('zodiac')\n .description('Zodiac SDK CLI – pull org data and contract ABIs')\n .version('1.0.0')\n .option(\n '-c, --config <path>',\n 'path to the config file',\n 'zodiac.config.ts'\n )\n\n program\n .command('pull')\n .description(\n 'Fetch Zodiac org data and contract ABIs, generating typed SDK functions. Authorizes this directory automatically on first run.'\n )\n .action(async (_opts, cmd) => {\n const config = await loadConfigOrInit(cmd.optsWithGlobals().config)\n await Promise.all([pullOrg(config), pullContracts(config)])\n })\n\n program\n .command('pull-org')\n .description('Fetch Zodiac users and accounts, generate TypeScript types')\n .action(async (_opts, cmd) => {\n const config = await loadConfigOrInit(cmd.optsWithGlobals().config)\n await pullOrg(config)\n })\n\n program\n .command('pull-contracts')\n .description('Fetch contract ABIs, generate typed permissions kit')\n .action(async (_opts, cmd) => {\n const config = await loadConfigOrInit(cmd.optsWithGlobals().config)\n await pullContracts(config)\n })\n\n program\n .command('init')\n .description(\n 'Re-authorize this directory / mint a new API key (run automatically by `pull` on first use).'\n )\n .option(\n '--app-url <url>',\n 'Override the Zodiac app URL (defaults to ZODIAC_APP_URL or app.zodiac.eco)'\n )\n .action(async (opts) => {\n await init({ appUrl: opts.appUrl })\n })\n\n await program.parseAsync(argv)\n}\n","#!/usr/bin/env node\nimport { run } from './run'\n\nrun().then(\n () => {\n process.exit(0)\n },\n (error: unknown) => {\n if (error) console.error(error)\n process.exit(1)\n }\n)\n"],"mappings":";;;;;;;;;;;;;;;;AAYA,MAAM,kBAAkB;AACxB,MAAM,sBAAsB,MAAS;AAQrC,MAAa,OAAO,OAAO,UAAuB,EAAE,KAAsB;CACxE,MAAM,UAAU,QAAQ,WAAW,iBAAiB;CACpD,MAAM,UACJ,QAAQ,UACR,QAAQ,IAAI,kBACZ,iBACA,QAAQ,OAAO,GAAG;CAEpB,MAAM,QAAQ,SAAS,QAAQ,QAAQ,CAAC,IAAI;CAI5C,MAAM,eAAe,YAAY,GAAG,CAAC,SAAS,YAAY;CAC1D,M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AC1D,MAAM,UAAU,IAAI,SAAS;AAE7B,SACG,KAAK,SAAS,CACd,YAAY,mDAAmD,CAC/D,QAAQ,QAAQ,CAChB,OACC,uBACA,2BACA,mBACD;AAEH,SACG,QAAQ,OAAO,CACf,YACC,iIACD,CACA,OAAO,OAAO,OAAO,QAAQ;EAC5B,MAAM,SAAS,MAAM,iBAAiB,IAAI,iBAAiB,CAAC,OAAO;AACnE,QAAM,QAAQ,IAAI,CAAC,QAAQ,OAAO,EAAE,cAAc,OAAO,CAAC,CAAC;GAC3D;AAEJ,SACG,QAAQ,WAAW,CACnB,YAAY,6DAA6D,CACzE,OAAO,OAAO,OAAO,QAAQ;AAE5B,QAAM,QADS,MAAM,iBAAiB,IAAI,iBAAiB,CAAC,OAAO,CAC9C;GACrB;AAEJ,SACG,QAAQ,iBAAiB,CACzB,YAAY,sDAAsD,CAClE,OAAO,OAAO,OAAO,QAAQ;AAE5B,QAAM,cADS,MAAM,iBAAiB,IAAI,iBAAiB,CAAC,OAAO,CACxC;GAC3B;AAEJ,SACG,QAAQ,OAAO,CACf,YACC,+FACD,CACA,OACC,mBACA,6EACD,CACA,OAAO,OAAO,SAAS;AACtB,QAAM,KAAK,EAAE,QAAQ,KAAK,QAAQ,CAAC;GACnC;AAEJ,OAAM,QAAQ,WAAW,KAAK;;;;ACtEhC,KAAK,CAAC,WACE;AACJ,SAAQ,KAAK,EAAE;IAEhB,UAAmB;AAClB,KAAI,MAAO,SAAQ,MAAM,MAAM;AAC/B,SAAQ,KAAK,EAAE;EAElB"}
1
+ {"version":3,"file":"cli.mjs","names":["join","loadDotenv"],"sources":["../src/cli/checkForUpdate.ts","../src/cli/commands/init.ts","../src/cli/commands/pullOrg.ts","../src/allow/fetch.ts","../src/allow/codegen.ts","../src/cli/commands/pullContracts.ts","../src/cli/run.ts","../src/cli/index.ts"],"sourcesContent":["import { existsSync, readFileSync } from 'node:fs'\nimport { dirname, join } from 'node:path'\nimport { fileURLToPath } from 'node:url'\nimport { findProjectRoot } from './projectRoot'\n\nconst PACKAGE = '@zodiaceco/sdk'\nconst REGISTRY_URL = `https://registry.npmjs.org/${PACKAGE}/latest`\nconst TIMEOUT_MS = 2_000\n\ntype Env = Record<string, string | undefined>\n\ntype CheckForUpdateOptions = {\n cwd?: string\n env?: Env\n}\n\n/**\n * Whether a newer release of this package is out, as the notice to print — or\n * `null`, which is also the answer to every failure. The check is a courtesy\n * on the way out of a command, so nothing here may throw or block for long,\n * and a run without a terminal to read the notice skips it entirely.\n */\nexport const checkForUpdate = async ({\n cwd = process.cwd(),\n env = process.env,\n}: CheckForUpdateOptions = {}): Promise<string | null> => {\n if (env.CI) {\n return null\n }\n\n try {\n const current = ownVersion()\n const latest = await fetchLatestVersion()\n\n if (latest == null || !isNewer(latest, current)) {\n return null\n }\n\n return [\n `A newer version of ${PACKAGE} is available (${current} → ${latest}). Update with:`,\n ` ${updateCommand(detectPackageManager(cwd, env))}`,\n ].join('\\n')\n } catch {\n return null\n }\n}\n\n/**\n * The version of the package this module runs from. Walks up to the\n * `package.json` that names it, which holds from `src/` and from `dist/`\n * alike — and finds this package, not the caller's, when the CLI runs\n * inside another project.\n */\nexport const ownVersion = (): string => {\n let dir = dirname(fileURLToPath(import.meta.url))\n\n while (true) {\n const manifest = join(dir, 'package.json')\n\n if (existsSync(manifest)) {\n const { name, version } = JSON.parse(readFileSync(manifest, 'utf-8'))\n\n if (name === PACKAGE && typeof version === 'string') {\n return version\n }\n }\n\n const parent = dirname(dir)\n if (parent === dir) {\n throw new Error(`Could not find the package.json of ${PACKAGE}`)\n }\n dir = parent\n }\n}\n\nconst fetchLatestVersion = async (): Promise<string | null> => {\n const response = await fetch(REGISTRY_URL, {\n signal: AbortSignal.timeout(TIMEOUT_MS),\n })\n\n if (!response.ok) {\n return null\n }\n\n const { version } = (await response.json()) as { version?: unknown }\n\n return typeof version === 'string' ? version : null\n}\n\nconst isNewer = (latest: string, current: string): boolean => {\n const a = parseVersion(latest)\n const b = parseVersion(current)\n\n if (a == null || b == null) {\n return false\n }\n\n for (let i = 0; i < 3; i++) {\n if (a[i] !== b[i]) {\n return a[i] > b[i]\n }\n }\n\n return false\n}\n\nconst parseVersion = (version: string): [number, number, number] | null => {\n const match = /^(\\d+)\\.(\\d+)\\.(\\d+)/.exec(version)\n\n if (match == null) {\n return null\n }\n\n return [Number(match[1]), Number(match[2]), Number(match[3])]\n}\n\ntype PackageManager = 'npm' | 'pnpm' | 'yarn' | 'bun'\n\n/**\n * The package manager an update should go through: whichever one launched\n * this process, or failing that, whichever one's lockfile the project\n * carries. `npm` when neither says anything.\n */\nconst detectPackageManager = (cwd: string, env: Env): PackageManager => {\n const agent = env.npm_config_user_agent\n\n if (agent != null) {\n const fromAgent = PACKAGE_MANAGERS.find((packageManager) =>\n agent.startsWith(`${packageManager}/`)\n )\n\n if (fromAgent != null) {\n return fromAgent\n }\n }\n\n const root = findProjectRoot(cwd)\n const fromLockfile = LOCKFILES.find(([lockfile]) =>\n existsSync(join(root, lockfile))\n )\n\n return fromLockfile == null ? 'npm' : fromLockfile[1]\n}\n\nconst PACKAGE_MANAGERS = ['pnpm', 'yarn', 'bun', 'npm'] as const\n\nconst LOCKFILES: [string, PackageManager][] = [\n ['bun.lock', 'bun'],\n ['bun.lockb', 'bun'],\n ['pnpm-lock.yaml', 'pnpm'],\n ['yarn.lock', 'yarn'],\n ['package-lock.json', 'npm'],\n]\n\nconst updateCommand = (packageManager: PackageManager): string =>\n packageManager === 'npm'\n ? `npm install ${PACKAGE}@latest`\n : `${packageManager} add ${PACKAGE}@latest`\n","import { createHash, randomBytes } from 'node:crypto'\nimport {\n createServer,\n type IncomingMessage,\n type ServerResponse,\n} from 'node:http'\nimport { existsSync, readFileSync, writeFileSync } from 'node:fs'\nimport { basename, join, resolve } from 'node:path'\nimport open from 'open'\nimport { ensureConfigStub } from '../config'\nimport { findProjectRoot } from '../projectRoot'\n\nconst DEFAULT_APP_URL = 'https://app.zodiac.eco'\nconst CALLBACK_TIMEOUT_MS = 5 * 60 * 1000 // 5 minutes\n\ntype InitOptions = {\n rootDir?: string\n /** Override the Zodiac app base URL (defaults to ZODIAC_APP_URL env or app.zodiac.eco). */\n appUrl?: string\n}\n\nexport const init = async (options: InitOptions = {}): Promise<string> => {\n const rootDir = options.rootDir ?? findProjectRoot()\n const appUrl = (\n options.appUrl ??\n process.env.ZODIAC_APP_URL ??\n DEFAULT_APP_URL\n ).replace(/\\/$/, '')\n\n const label = basename(resolve(rootDir)) || 'zodiac-cli'\n\n // PKCE: keep `code_verifier` private to this process. Send only the\n // SHA-256 hash (`code_challenge`) over the wire.\n const codeVerifier = randomBytes(32).toString('base64url')\n const codeChallenge = createHash('sha256')\n .update(codeVerifier)\n .digest('base64url')\n\n // `state` binds the redirect we receive on the loopback to this CLI\n // invocation, defending against a stray local process trying to inject\n // an auth code into our callback.\n const state = randomBytes(32).toString('base64url')\n\n const { port, waitForCode, close } = await startCallbackServer({\n expectedState: state,\n appUrl,\n })\n\n const callbackUrl = `http://127.0.0.1:${port}/callback`\n const authUrl = new URL('/cli-auth', appUrl)\n authUrl.searchParams.set('callback', callbackUrl)\n authUrl.searchParams.set('state', state)\n authUrl.searchParams.set('code_challenge', codeChallenge)\n authUrl.searchParams.set('label', label)\n\n console.log(\n `Opening ${authUrl} in your browser. Approve the request to receive an API key.`\n )\n await open(authUrl.toString())\n\n let code: string\n try {\n code = await waitForCode(CALLBACK_TIMEOUT_MS)\n } finally {\n await close()\n }\n\n const apiKey = await exchangeCodeForKey(appUrl, code, codeVerifier)\n\n const envPath = join(rootDir, '.env')\n const apiUrl = `${appUrl}/api/v1`\n writeEnv(envPath, { ZODIAC_API_KEY: apiKey, ZODIAC_API_URL: apiUrl })\n\n // So a same-run `pull` targets the org we just authorized, not the default.\n process.env.ZODIAC_API_KEY = apiKey\n process.env.ZODIAC_API_URL = apiUrl\n\n console.log(`✅ API key written to ${envPath}`)\n\n const configPath = join(rootDir, 'zodiac.config.ts')\n if (ensureConfigStub(configPath)) {\n console.log(`✅ Created ${configPath}`)\n }\n\n return apiKey\n}\n\nconst exchangeCodeForKey = async (\n appUrl: string,\n code: string,\n codeVerifier: string\n): Promise<string> => {\n const response = await fetch(`${appUrl}/cli-auth/exchange`, {\n method: 'POST',\n headers: { 'content-type': 'application/json' },\n body: JSON.stringify({ code, code_verifier: codeVerifier }),\n })\n\n if (!response.ok) {\n let detail = ''\n try {\n const body = (await response.json()) as { error?: string }\n detail = body.error ? `: ${body.error}` : ''\n } catch {\n // ignore — fall through to a generic message\n }\n throw new Error(\n `Failed to exchange auth code (${response.status})${detail}`\n )\n }\n\n const { key } = (await response.json()) as { key: unknown }\n if (typeof key !== 'string' || !key.startsWith('zodiac_')) {\n throw new Error(\n 'Exchange endpoint returned an unexpected response (missing or malformed key)'\n )\n }\n return key\n}\n\ntype StartServerOptions = {\n expectedState: string\n appUrl: string\n}\n\ntype StartServerResult = {\n port: number\n waitForCode: (timeoutMs: number) => Promise<string>\n close: () => Promise<void>\n}\n\nconst startCallbackServer = async ({\n expectedState,\n appUrl,\n}: StartServerOptions): Promise<StartServerResult> => {\n let resolveCode: (code: string) => void = () => {}\n let rejectCode: (err: Error) => void = () => {}\n const codePromise = new Promise<string>((res, rej) => {\n resolveCode = res\n rejectCode = rej\n })\n\n const handler = (req: IncomingMessage, res: ServerResponse) => {\n if (req.method !== 'GET' || !req.url?.startsWith('/callback')) {\n res.statusCode = 404\n res.end()\n return\n }\n\n const url = new URL(req.url, `http://127.0.0.1`)\n const code = url.searchParams.get('code')\n const state = url.searchParams.get('state')\n\n if (state !== expectedState) {\n // A stray request — could be a stale browser tab, a malicious\n // local process, etc. Silently 403 and keep waiting for the right\n // one. Don't reject the CLI promise.\n respondHtml(\n res,\n 403,\n renderHtml(\n 'Mismatched state',\n `<p>This callback didn't match the running <code>zodiac init</code> session. You can close this tab.</p>`\n )\n )\n return\n }\n\n if (typeof code !== 'string' || code.length === 0) {\n respondHtml(\n res,\n 400,\n renderHtml(\n 'Missing code',\n `<p>The callback URL didn't include an auth <code>code</code>. Please re-run <code>zodiac init</code>.</p>`\n )\n )\n return\n }\n\n respondHtml(\n res,\n 200,\n renderHtml(\n 'Authorized',\n `<p>Your CLI now has its API key. You can close this tab and return to your terminal.</p>\n <p><a href=\"${escapeHtml(appUrl)}\">Back to Zodiac</a></p>`\n )\n )\n resolveCode(code)\n }\n\n const server = createServer(handler)\n await new Promise<void>((res) => server.listen(0, '127.0.0.1', res))\n const address = server.address()\n if (address == null || typeof address === 'string') {\n throw new Error('Failed to bind loopback callback server')\n }\n const port = address.port\n\n const close = (): Promise<void> =>\n new Promise<void>((resolve) => {\n server.close(() => resolve())\n })\n\n const waitForCode = (timeoutMs: number) =>\n Promise.race<string>([\n codePromise,\n new Promise<string>((_, rej) =>\n setTimeout(() => {\n rejectCode(new Error(`Timed out waiting for CLI auth callback`))\n rej(new Error(`Timed out waiting for CLI auth callback`))\n }, timeoutMs)\n ),\n ])\n\n return { port, waitForCode, close }\n}\n\nconst respondHtml = (res: ServerResponse, status: number, body: string) => {\n // Force the connection to close after the response so the browser\n // doesn't keep waiting on a keep-alive socket once the CLI exits.\n // Resolve only after 'finish' (response handed to the OS) so the\n // bytes can flush before the process tears down.\n res.setHeader('Connection', 'close')\n res.setHeader('content-type', 'text/html; charset=utf-8')\n res.statusCode = status\n res.end(body)\n}\n\nconst renderHtml = (title: string, bodyHtml: string) => `<!doctype html>\n<html lang=\"en\">\n <head>\n <meta charset=\"utf-8\" />\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n <title>${escapeHtml(title)} — Zodiac CLI</title>\n <style>\n body { font: 16px/1.5 -apple-system, BlinkMacSystemFont, \"Segoe UI\", sans-serif; max-width: 32rem; margin: 4rem auto; padding: 0 1rem; color: #1f2937; }\n h1 { font-weight: 300; font-size: 1.75rem; margin-bottom: 1rem; }\n code { background: #f3f4f6; padding: 0.125rem 0.375rem; border-radius: 0.25rem; }\n a { color: #1d4ed8; }\n </style>\n </head>\n <body>\n <h1>${escapeHtml(title)}</h1>\n ${bodyHtml}\n </body>\n</html>\n`\n\nconst escapeHtml = (value: string) =>\n value\n .replace(/&/g, '&amp;')\n .replace(/</g, '&lt;')\n .replace(/>/g, '&gt;')\n .replace(/\"/g, '&quot;')\n .replace(/'/g, '&#39;')\n\nconst writeEnv = (envPath: string, vars: Record<string, string>): void => {\n let contents = existsSync(envPath) ? readFileSync(envPath, 'utf8') : ''\n\n for (const [key, value] of Object.entries(vars)) {\n contents = upsertEnvLine(contents, key, value)\n }\n\n writeFileSync(envPath, contents, 'utf8')\n}\n\nconst upsertEnvLine = (\n contents: string,\n key: string,\n value: string\n): string => {\n const line = `${key}=${value}`\n const lines = contents.split(/\\r?\\n/)\n const idx = lines.findIndex((l) => new RegExp(`^\\\\s*${key}\\\\s*=`).test(l))\n\n if (idx >= 0) {\n lines[idx] = line\n return lines.join('\\n')\n }\n\n return contents.length === 0 || contents.endsWith('\\n')\n ? `${contents}${line}\\n`\n : `${contents}\\n${line}\\n`\n}\n","import type {\n Address,\n ChainId,\n ResolveConstellationPayload,\n} from '@zodiaceco/api-types'\nimport type { ResolvedConfig } from '../config'\nimport { ApiClient } from '../../api'\nimport { getAddress } from 'ethers'\nimport {\n ModuleKind,\n Project,\n ScriptTarget,\n VariableDeclarationKind,\n} from 'ts-morph'\nimport { mkdirSync, writeFileSync } from 'fs'\nimport { join } from 'path'\nimport { resolveZodiacDir } from '../../paths'\n\nconst toLiteral = (value: unknown, indent = 0): string => {\n const pad = ' '.repeat(indent)\n const childPad = ' '.repeat(indent + 1)\n\n if (value === null) return 'null'\n if (typeof value === 'bigint') return `${value}n`\n if (typeof value === 'string') return JSON.stringify(value)\n if (typeof value === 'number' || typeof value === 'boolean')\n return String(value)\n if (Array.isArray(value)) {\n if (value.length === 0) return '[]'\n return `[\\n${value.map((v) => `${childPad}${toLiteral(v, indent + 1)}`).join(',\\n')},\\n${pad}]`\n }\n if (typeof value === 'object') {\n const entries = Object.entries(value as Record<string, unknown>)\n if (entries.length === 0) return '{}'\n const props = entries.map(\n ([k, v]) =>\n `${childPad}${isBareKey(k) ? k : JSON.stringify(k)}: ${toLiteral(v, indent + 1)}`\n )\n return `{\\n${props.join(',\\n')},\\n${pad}}`\n }\n return String(value)\n}\n\ntype NodeType = 'SAFE' | 'ROLES' | 'DELAY'\n\n/**\n * An account written as the specification node that names it and declares\n * nothing else.\n *\n * The `ref` is required of every node and has to be distinct, but nothing\n * reads it back — the result comes aligned with the request.\n *\n * Spelled out per type rather than passed through: `/accounts` answers with\n * the same three names as an enum, whose members are types of their own, and\n * a node is only a node once it says which of the three it is.\n */\nconst asNodeReference = (\n {\n type,\n chain,\n address,\n }: { type: string; chain: ChainId; address: Lowercase<Address> },\n index: number\n): ResolveConstellationPayload['specification'][number] => {\n const node = { ref: `account_${index}`, chain, address }\n\n switch (asNodeType(type)) {\n case 'SAFE':\n return { ...node, type: 'SAFE' }\n case 'ROLES':\n return { ...node, type: 'ROLES' }\n case 'DELAY':\n return { ...node, type: 'DELAY' }\n }\n}\n\nconst asNodeType = (type: string): NodeType => {\n if (type === 'SAFE' || type === 'ROLES' || type === 'DELAY') {\n return type\n }\n\n throw new Error(`Cannot describe an account of type \"${type}\"`)\n}\n\n/**\n * Whether a key can be written without quotes. Chain ids are grouping keys in\n * the generated data, and an unquoted number keys the `as const` type by chain\n * id — quoted, it would key by a string the callers never hold.\n */\nconst isBareKey = (key: string): boolean =>\n /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(key) || /^\\d+$/.test(key)\n\nexport const pullOrg = async (config: ResolvedConfig) => {\n const client = new ApiClient({\n apiKey: config.apiKey,\n })\n\n const [users, workspaceAccounts] = await Promise.all([\n client.listUsers(),\n client.listAccounts(),\n ])\n\n // The generated accounts carry their onchain state so a node reads as the\n // account it names and completes in an editor. Only what a constellation\n // declares is ever pushed back, so this is for reading, not a declaration.\n //\n // Each account is named by its address and nothing else. `/resolve`\n // resolves a node it has no address for against the setup safe of whoever\n // holds the API key — which describes the account *that* caller would\n // deploy, not the one being asked about — and it merges declarations over\n // what it reads. Sending an address and no declarations leaves it nothing\n // to derive and nothing to merge, so the answer is the account itself, the\n // same for every key.\n //\n // Asking about every listed account is safe for the same reason: `/accounts`\n // admits one only once it has been seen to hold code, so every address here\n // is one that can be read from chain.\n const allAccounts = workspaceAccounts.flatMap((ws) => ws.accounts)\n const resolved = new Map<\n string,\n Awaited<ReturnType<typeof client.resolveConstellation>>['result'][number]\n >()\n\n if (allAccounts.length > 0) {\n const { result } = await client.resolveConstellation(\n workspaceAccounts[0].workspaceId, // any workspace works for the resolve route\n {\n specification: allAccounts.map(asNodeReference),\n }\n )\n\n // Aligned with the request, entry for entry.\n allAccounts.forEach((account, index) => {\n resolved.set(account.id, result[index])\n })\n }\n\n // Group accounts by type and then by chain into separate bracket-access\n // namespaces: `safes[chain]`, `rolesMods[chain]`, `delays[chain]`. This way\n // `eth.safe[...]` IntelliSense only suggests SAFE labels deployed on the\n // constellation's own chain, and the label-collision suffix only kicks in\n // where a label is genuinely ambiguous — same type, same chain.\n type AccountsByChain = Record<number, Record<string, unknown>>\n\n const accountsRecord: Record<string, unknown> = {}\n for (const ws of workspaceAccounts) {\n const safes: AccountsByChain = {}\n const rolesMods: AccountsByChain = {}\n const delays: AccountsByChain = {}\n\n const bucketsByType = {\n SAFE: safes,\n ROLES: rolesMods,\n DELAY: delays,\n } as const\n\n const isNodeType = (type: string): type is NodeType =>\n type === 'SAFE' || type === 'ROLES' || type === 'DELAY'\n\n // Accounts we only know by address — Safe owners, external role\n // members, route targets — carry no label. They can't key a\n // label-addressed namespace, so they stay out of the codegen.\n // Vault entries always carry one.\n\n // Count labels per namespace so we only suffix collisions a constellation\n // could actually run into. Two safes named `Treasury` on different chains\n // never compete for a key, because a constellation only ever sees one of\n // those chains.\n const namespaceKey = (type: NodeType, chain: number) => `${type}:${chain}`\n const labelCounts = new Map<string, Map<string, number>>()\n\n for (const account of ws.accounts) {\n const { label } = account\n if (label == null || !isNodeType(account.type)) continue\n const key = namespaceKey(account.type, account.chain)\n let counts = labelCounts.get(key)\n if (!counts) {\n counts = new Map()\n labelCounts.set(key, counts)\n }\n counts.set(label, (counts.get(label) ?? 0) + 1)\n }\n\n for (const account of ws.accounts) {\n const { label } = account\n if (label == null || !isNodeType(account.type)) continue\n const onChain = resolved.get(account.id)\n const counts = labelCounts.get(namespaceKey(account.type, account.chain))\n const key =\n (counts?.get(label) ?? 0) > 1\n ? `${label} (${getAddress(account.address)})`\n : label\n const byChain = bucketsByType[account.type]\n const byLabel = (byChain[account.chain] ??= {})\n byLabel[key] = {\n id: account.id,\n label,\n address: account.address,\n chain: account.chain,\n vault: account.vault,\n ...(onChain?.type === 'SAFE' && {\n threshold: onChain.threshold,\n owners: [...onChain.owners],\n modules: [...onChain.modules],\n }),\n }\n }\n\n accountsRecord[ws.workspaceName] = {\n workspaceId: ws.workspaceId,\n workspaceName: ws.workspaceName,\n safes,\n rolesMods,\n delays,\n }\n }\n\n const nameCount = new Map<string, number>()\n for (const user of users) {\n nameCount.set(user.fullName, (nameCount.get(user.fullName) ?? 0) + 1)\n }\n\n const usersRecord: Record<string, unknown> = {}\n for (const user of users) {\n const handle =\n nameCount.get(user.fullName)! > 1\n ? `${user.fullName} (${user.id})`\n : user.fullName\n usersRecord[handle] = {\n id: user.id,\n fullName: user.fullName,\n personalSafes: user.personalSafes,\n }\n }\n\n const outDir = resolveZodiacDir(config.rootDir)\n\n mkdirSync(outDir, { recursive: true })\n\n // Pin CJS so `require()` works regardless of the parent package.json's type\n writeFileSync(\n join(outDir, 'package.json'),\n JSON.stringify(\n {\n type: 'commonjs',\n main: 'index.js',\n types: 'index.d.ts',\n },\n null,\n 2\n )\n )\n\n // Use ts-morph to generate TS, then emit JS + d.ts\n const project = new Project({\n compilerOptions: {\n declaration: true,\n module: ModuleKind.CommonJS,\n target: ScriptTarget.ESNext,\n outDir,\n },\n useInMemoryFileSystem: true,\n })\n\n const sourceFile = project.createSourceFile('index.ts', '')\n\n sourceFile.addVariableStatement({\n isExported: true,\n declarationKind: VariableDeclarationKind.Const,\n declarations: [\n {\n name: 'users',\n initializer: `${toLiteral(usersRecord)} as const`,\n },\n ],\n })\n\n sourceFile.addVariableStatement({\n isExported: true,\n declarationKind: VariableDeclarationKind.Const,\n declarations: [\n {\n name: 'accounts',\n initializer: `${toLiteral(accountsRecord)} as const`,\n },\n ],\n })\n\n const emitResult = sourceFile.getEmitOutput()\n for (const outputFile of emitResult.getOutputFiles()) {\n const filePath = outputFile.getFilePath()\n const fileName = filePath.includes('.d.ts') ? 'index.d.ts' : 'index.js'\n let contents = outputFile.getText()\n // Augment the SDK's global `ZodiacGeneratedCodegen` interface so\n // `constellation()`'s default type parameter picks up these literal\n // shapes automatically.\n if (fileName === 'index.d.ts') {\n contents += `\ndeclare global {\n interface ZodiacGeneratedCodegen {\n users: typeof users;\n accounts: typeof accounts;\n }\n}\n`\n }\n writeFileSync(join(outDir, fileName), contents)\n }\n}\n","import { chainIdFor, type ChainPrefix } from './networks'\n\nexport type AbiFragment = Record<string, any>\nexport type Abi = AbiFragment[]\n\ntype Implementation = { abi?: unknown }\ntype Account = Implementation & {\n proxy?: unknown\n implementation?: Implementation\n}\n\n// Returns null on any failure so callers can fall back to a manual ABI file.\nexport async function fetchAbi(\n chainId: number,\n address: `0x${string}`\n): Promise<Abi | null> {\n const url = `https://api.abi.pub/v1/chains/${chainId}/accounts/${address}`\n let account: Account\n try {\n const resp = await fetch(url)\n if (!resp.ok) return null\n account = (await resp.json()) as Account\n } catch {\n return null\n }\n if (account == null || typeof account !== 'object') return null\n\n // For a proxy the endpoint reports the proxy under `proxy` and the contract\n // that actually holds the functions under `implementation`. Permissions are\n // written against the implementation ABI.\n const abi = account.proxy ? account.implementation?.abi : account.abi\n if (!Array.isArray(abi) || abi.length === 0) return null\n return abi as Abi\n}\n\nexport const fetchAbiForPrefix = (\n prefix: ChainPrefix,\n address: `0x${string}`\n) => fetchAbi(chainIdFor(prefix), address)\n","import fs from 'node:fs'\nimport path from 'node:path'\nimport { walkContracts, readAbi, type ContractNode } from './abi'\nimport type { Abi, AbiFragment } from './fetch'\n\n// Emits named tuple elements per ABI input — this is the reason we don't rely\n// on viem/abitype, which produces unnamed tuples (microsoft/TypeScript#44939).\nexport function generateAllowTypes(\n abisDir: string,\n contractsConfig: Record<string, any>\n): string {\n type Tree = Map<string, Tree | { node: ContractNode; abi: Abi }>\n\n const root: Tree = new Map()\n for (const node of walkContracts(contractsConfig)) {\n const abi = readAbi(abisDir, node)\n if (!abi) continue\n insertIntoTree(root, [node.chain, ...node.segments], { node, abi })\n }\n\n const out: string[] = []\n out.push('// AUTO-GENERATED by `zodiac pull-contracts`. Do not edit.')\n out.push('/* eslint-disable */')\n out.push('')\n out.push(\n `import type { Scoping, Options, EVERYTHING, FunctionPermission, TargetPermission } from \"@zodiaceco/sdk/allow\";`\n )\n out.push('')\n out.push('declare global {')\n out.push(' interface AllowKit ' + renderTree(root, ' '))\n out.push('}')\n out.push('')\n out.push('export {};')\n out.push('')\n return out.join('\\n')\n}\n\nfunction insertIntoTree(\n tree: Map<string, any>,\n segments: string[],\n leaf: { node: ContractNode; abi: Abi }\n): void {\n const [first, ...rest] = segments\n if (!first) throw new Error('empty segments')\n if (rest.length === 0) {\n tree.set(first, leaf)\n return\n }\n let child = tree.get(first)\n if (!child || child.node) {\n child = new Map()\n tree.set(first, child)\n }\n insertIntoTree(child, rest, leaf)\n}\n\nfunction renderTree(tree: Map<string, any>, indent: string): string {\n const lines: string[] = ['{']\n for (const [key, value] of tree) {\n const safeKey = renderPropKey(key)\n if (value instanceof Map) {\n lines.push(`${indent} ${safeKey}: ${renderTree(value, indent + ' ')};`)\n } else {\n const { node, abi } = value as { node: ContractNode; abi: Abi }\n lines.push(\n `${indent} ${safeKey}: ${renderContractType(node, abi, indent + ' ')};`\n )\n }\n }\n lines.push(`${indent}}`)\n return lines.join('\\n')\n}\n\nfunction renderPropKey(name: string): string {\n return /^[A-Za-z_$][A-Za-z0-9_$]*$/.test(name) ? name : JSON.stringify(name)\n}\n\nfunction renderContractType(\n node: ContractNode,\n abi: Abi,\n indent: string\n): string {\n const members: string[] = []\n members.push(\n `${indent} [EVERYTHING]: (options?: Options) => TargetPermission;`\n )\n\n // Members mirror what the runtime proxy can resolve, which is whatever\n // `Interface.getFunction` accepts. A name it would find ambiguous is not a\n // member there — the proxy returns undefined for it — so an overloaded name\n // is emitted once per full signature and never bare. Declaring the bare name\n // anyway is what used to make `allow.eth.susds.deposit(…)` type-check and\n // then fail at runtime.\n for (const overloads of groupByName(abi).values()) {\n const overloaded = overloads.length > 1\n for (const fragment of overloads) {\n const key = overloaded\n ? signatureFor(fragment)\n : (fragment.name as string)\n members.push(renderFunctionSignature(fragment, key, indent + ' '))\n }\n }\n return ['{', ...members, `${indent}}`].join('\\n')\n}\n\n/**\n * Permissionable fragments grouped by function name, in ABI order. Two\n * fragments that render the same signature are the same function listed twice,\n * so they collapse — emitting the key twice would not compile.\n */\nfunction groupByName(abi: Abi): Map<string, AbiFragment[]> {\n const byName = new Map<string, AbiFragment[]>()\n for (const fragment of abi) {\n if (fragment.type !== 'function') continue\n if (\n fragment.stateMutability === 'view' ||\n fragment.stateMutability === 'pure'\n ) {\n continue\n }\n const name = fragment.name as string\n if (!name) continue\n const overloads = byName.get(name) ?? []\n if (overloads.some((f) => signatureFor(f) === signatureFor(fragment))) {\n continue\n }\n byName.set(name, [...overloads, fragment])\n }\n return byName\n}\n\n/** The canonical `name(type,…)` form, which is how `Interface.getFunction`\n * addresses one overload of a name. */\nfunction signatureFor(fragment: AbiFragment): string {\n const inputs = (fragment.inputs as AbiFragment[]) ?? []\n return `${fragment.name}(${inputs.map(canonicalTypeFor).join(',')})`\n}\n\nfunction canonicalTypeFor(fragment: AbiFragment): string {\n const type = fragment.type as string\n\n const arrayMatch = /^(.*)\\[(\\d*)\\]$/.exec(type)\n if (arrayMatch) {\n const inner: AbiFragment = { ...fragment, type: arrayMatch[1] }\n return `${canonicalTypeFor(inner)}[${arrayMatch[2]}]`\n }\n\n if (type === 'tuple') {\n const components = (fragment.components as AbiFragment[]) ?? []\n return `(${components.map(canonicalTypeFor).join(',')})`\n }\n\n return type\n}\n\nfunction renderFunctionSignature(\n fragment: AbiFragment,\n key: string,\n indent: string\n): string {\n const name = renderPropKey(key)\n const params: string[] = []\n for (const input of (fragment.inputs as AbiFragment[]) ?? []) {\n const paramName = sanitizeParamName(\n input.name || `arg${params.length}`,\n params.length\n )\n params.push(`${paramName}?: Scoping<${tsTypeFor(input)}>`)\n }\n params.push(`options?: Options`)\n return `${indent}${name}: (${params.join(', ')}) => FunctionPermission;`\n}\n\nfunction sanitizeParamName(name: string, index: number): string {\n const cleaned = name.replace(/[^A-Za-z0-9_$]/g, '_')\n if (!cleaned || /^[0-9]/.test(cleaned)) return `arg${index}`\n // Named tuple element labels can't collide with TS reserved words.\n const reserved = new Set([\n 'function',\n 'class',\n 'new',\n 'number',\n 'string',\n 'object',\n 'boolean',\n 'symbol',\n 'default',\n 'return',\n 'this',\n 'void',\n 'delete',\n 'in',\n 'of',\n 'for',\n 'while',\n 'switch',\n 'case',\n 'if',\n 'else',\n 'null',\n 'true',\n 'false',\n 'undefined',\n 'any',\n 'never',\n 'unknown',\n ])\n return reserved.has(cleaned) ? `_${cleaned}` : cleaned\n}\n\nfunction tsTypeFor(fragment: AbiFragment): string {\n const type = fragment.type as string\n\n const arrayMatch = /^(.*)\\[(\\d*)\\]$/.exec(type)\n if (arrayMatch) {\n const inner: AbiFragment = { ...fragment, type: arrayMatch[1] }\n return `readonly (${tsTypeFor(inner)})[]`\n }\n\n if (type === 'tuple') {\n const components = (fragment.components as AbiFragment[]) ?? []\n if (components.length === 0) return 'Record<string, unknown>'\n const fields = components.map((c, i) => {\n const key = sanitizeParamName(c.name || `f${i}`, i)\n return `${renderPropKey(key)}: ${tsTypeFor(c)}`\n })\n return `{ ${fields.join('; ')} }`\n }\n\n if (type === 'address') return '`0x${string}`'\n if (type === 'bool') return 'boolean'\n if (type === 'string') return 'string'\n if (type === 'bytes') return 'import(\"ethers\").BytesLike'\n if (/^bytes\\d+$/.test(type)) return '`0x${string}`'\n if (/^u?int\\d*$/.test(type)) return 'import(\"ethers\").BigNumberish'\n return 'unknown'\n}\n\nexport function writeGenerated(outFile: string, source: string): void {\n fs.mkdirSync(path.dirname(outFile), { recursive: true })\n fs.writeFileSync(outFile, source, 'utf8')\n}\n","import fs from 'node:fs'\nimport path from 'node:path'\nimport type { ResolvedConfig } from '../config'\nimport { resolveAbisDir } from '../config'\nimport { resolveZodiacDir } from '../../paths'\nimport { abiFilePath, walkContracts, writeAbi } from '../../allow/abi'\nimport { fetchAbi } from '../../allow/fetch'\nimport { chainIdFor } from '../../allow/networks'\nimport { generateAllowTypes, writeGenerated } from '../../allow/codegen'\n\ntype Status = 'ok' | 'fetched' | 'missing'\n\nexport const pullContracts = async (config: ResolvedConfig) => {\n if (!config.contracts || Object.keys(config.contracts).length === 0) {\n console.log('No contracts defined in config, skipping.')\n return\n }\n\n const abisDir = resolveAbisDir(config)\n const generatedFile = path.join(\n resolveZodiacDir(config.rootDir),\n 'allow.d.ts'\n )\n\n let missing = 0\n let fetched = 0\n let existing = 0\n\n for (const node of walkContracts(config.contracts)) {\n const file = abiFilePath(abisDir, node)\n\n if (fs.existsSync(file)) {\n existing++\n report(node.chain, node.segments, node.address, 'ok', file)\n continue\n }\n\n let chainId: number\n try {\n chainId = chainIdFor(node.chain)\n } catch (error) {\n missing++\n report(\n node.chain,\n node.segments,\n node.address,\n 'missing',\n file,\n (error as Error).message\n )\n continue\n }\n\n const abi = await fetchAbi(chainId, node.address)\n if (!abi) {\n missing++\n report(\n node.chain,\n node.segments,\n node.address,\n 'missing',\n file,\n `api.abi.pub returned no ABI for chain ${chainId}`\n )\n continue\n }\n writeAbi(abisDir, node, abi)\n fetched++\n report(node.chain, node.segments, node.address, 'fetched', file)\n }\n\n console.log('')\n console.log(\n `Contracts summary: ${existing} existing, ${fetched} fetched, ${missing} missing.`\n )\n if (missing > 0) {\n console.log('')\n console.log('Missing ABIs must be provided manually. Paste the contract')\n console.log(\n 'ABI JSON at the paths listed above and re-run `zodiac pull-contracts`.'\n )\n }\n\n const source = generateAllowTypes(abisDir, config.contracts)\n writeGenerated(generatedFile, source)\n console.log('')\n console.log(`Wrote typings to ${path.relative(process.cwd(), generatedFile)}`)\n\n if (missing > 0) process.exit(1)\n}\n\nfunction report(\n chain: string,\n segments: string[],\n address: string,\n status: Status,\n file: string,\n reason?: string\n) {\n const label = `${chain}.${segments.join('.')}`.padEnd(40, ' ')\n const tag = {\n ok: ' cached ',\n fetched: ' fetched ',\n missing: ' MISSING ',\n }[status]\n const suffix = reason ? ` — ${reason}` : ''\n console.log(`${tag} ${label} ${address}${suffix}`)\n if (status === 'missing') {\n console.log(` → paste ABI at ${file}`)\n }\n}\n","import { Command } from 'commander'\nimport { config as loadDotenv } from 'dotenv'\nimport { checkForUpdate, ownVersion } from './checkForUpdate'\nimport { init } from './commands/init'\nimport { loadConfig } from './config'\nimport { pullOrg } from './commands/pullOrg'\nimport { pullContracts } from './commands/pullContracts'\n\n// Load `.env` from the current working directory before reading any env vars.\nloadDotenv({ quiet: true })\n\nconst loadConfigOrInit = (configPath: string) =>\n loadConfig(configPath, {\n createIfMissing: true,\n onMissingKey: async (rootDir) => {\n console.log(\n 'No ZODIAC_API_KEY found. Starting authorization to mint one for this directory…'\n )\n return init({ rootDir })\n },\n })\n\nexport const run = async (argv: string[] = process.argv) => {\n const program = new Command()\n\n program\n .name('zodiac')\n .description('Zodiac SDK CLI – pull org data and contract ABIs')\n .version(ownVersion())\n .option(\n '-c, --config <path>',\n 'path to the config file',\n 'zodiac.config.ts'\n )\n\n // Started before the command so the registry round trip rides along with\n // the command's own work, printed after it so the notice is the last thing\n // on screen — and not at all when the command fails, where it would only\n // distract from the error. On stderr, so piped output stays clean.\n let updateNotice: Promise<string | null> = Promise.resolve(null)\n\n program.hook('preAction', () => {\n updateNotice = checkForUpdate()\n })\n\n program.hook('postAction', async () => {\n const notice = await updateNotice\n\n if (notice != null) {\n console.warn(`\\n${notice}`)\n }\n })\n\n program\n .command('pull')\n .description(\n 'Fetch Zodiac org data and contract ABIs, generating typed SDK functions. Authorizes this directory automatically on first run.'\n )\n .action(async (_opts, cmd) => {\n const config = await loadConfigOrInit(cmd.optsWithGlobals().config)\n await Promise.all([pullOrg(config), pullContracts(config)])\n })\n\n program\n .command('pull-org')\n .description('Fetch Zodiac users and accounts, generate TypeScript types')\n .action(async (_opts, cmd) => {\n const config = await loadConfigOrInit(cmd.optsWithGlobals().config)\n await pullOrg(config)\n })\n\n program\n .command('pull-contracts')\n .description('Fetch contract ABIs, generate typed permissions kit')\n .action(async (_opts, cmd) => {\n const config = await loadConfigOrInit(cmd.optsWithGlobals().config)\n await pullContracts(config)\n })\n\n program\n .command('init')\n .description(\n 'Re-authorize this directory / mint a new API key (run automatically by `pull` on first use).'\n )\n .option(\n '--app-url <url>',\n 'Override the Zodiac app URL (defaults to ZODIAC_APP_URL or app.zodiac.eco)'\n )\n .action(async (opts) => {\n await init({ appUrl: opts.appUrl })\n })\n\n await program.parseAsync(argv)\n}\n","#!/usr/bin/env node\nimport { run } from './run'\n\nrun().then(\n () => {\n process.exit(0)\n },\n (error: unknown) => {\n if (error) console.error(error)\n process.exit(1)\n }\n)\n"],"mappings":";;;;;;;;;;;;;;;;;AAKA,MAAM,UAAU;AAChB,MAAM,eAAe,8BAA8B,QAAQ;AAC3D,MAAM,aAAa;;;;;;;AAenB,MAAa,iBAAiB,OAAO,EACnC,MAAM,QAAQ,KAAK,EACnB,MAAM,QAAQ,QACW,EAAE,KAA6B;AACxD,KAAI,IAAI,GACN,QAAO;AAGT,KAAI;EACF,MAAM,UAAU,YAAY;EAC5B,MAAM,SAAS,MAAM,oBAAoB;AAEzC,MAAI,UAAU,QAAQ,CAAC,QAAQ,QAAQ,QAAQ,CAC7C,QAAO;AAGT,SAAO,CACL,sBAAsB,QAAQ,iBAAiB,QAAQ,KAAK,OAAO,kBACnE,KAAK,cAAc,q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IACD,CACA,OAAO,OAAO,OAAO,QAAQ;EAC5B,MAAM,SAAS,MAAM,iBAAiB,IAAI,iBAAiB,CAAC,OAAO;AACnE,QAAM,QAAQ,IAAI,CAAC,QAAQ,OAAO,EAAE,cAAc,OAAO,CAAC,CAAC;GAC3D;AAEJ,SACG,QAAQ,WAAW,CACnB,YAAY,6DAA6D,CACzE,OAAO,OAAO,OAAO,QAAQ;AAE5B,QAAM,QADS,MAAM,iBAAiB,IAAI,iBAAiB,CAAC,OAAO,CAC9C;GACrB;AAEJ,SACG,QAAQ,iBAAiB,CACzB,YAAY,sDAAsD,CAClE,OAAO,OAAO,OAAO,QAAQ;AAE5B,QAAM,cADS,MAAM,iBAAiB,IAAI,iBAAiB,CAAC,OAAO,CACxC;GAC3B;AAEJ,SACG,QAAQ,OAAO,CACf,YACC,+FACD,CACA,OACC,mBACA,6EACD,CACA,OAAO,OAAO,SAAS;AACtB,QAAM,KAAK,EAAE,QAAQ,KAAK,QAAQ,CAAC;GACnC;AAEJ,OAAM,QAAQ,WAAW,KAAK;;;;ACzFhC,KAAK,CAAC,WACE;AACJ,SAAQ,KAAK,EAAE;IAEhB,UAAmB;AAClB,KAAI,MAAO,SAAQ,MAAM,MAAM;AAC/B,SAAQ,KAAK,EAAE;EAElB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zodiaceco/sdk",
3
- "version": "2.1.3",
3
+ "version": "2.2.0",
4
4
  "author": "Zodiac Labs GmbH",
5
5
  "license": "LGPL-3.0-only",
6
6
  "homepage": "https://github.com/gnosisguild/zodiac-sdk",