@kashdao/cli 0.1.1 → 0.2.1

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.
Files changed (93) hide show
  1. package/CHANGELOG.md +96 -0
  2. package/README.md +78 -27
  3. package/dist/{account-CVJZ3HVT.js → account-QHPOIZ6I.js} +9 -9
  4. package/dist/{auth-V5WVZBCO.js → auth-TE7BCN5Q.js} +12 -12
  5. package/dist/{auth-V5WVZBCO.js.map → auth-TE7BCN5Q.js.map} +1 -1
  6. package/dist/{chunk-MQUJG224.js → chunk-2HFKULGG.js} +2 -2
  7. package/dist/{chunk-BVFDUI73.js → chunk-2SR77BYA.js} +10 -9
  8. package/dist/chunk-2SR77BYA.js.map +1 -0
  9. package/dist/chunk-6QSTFU4R.js +9 -0
  10. package/dist/{chunk-KAM6KOFD.js.map → chunk-6QSTFU4R.js.map} +1 -1
  11. package/dist/{chunk-R4NGUZKN.js → chunk-6UU43MF5.js} +5 -3
  12. package/dist/chunk-6UU43MF5.js.map +1 -0
  13. package/dist/{chunk-A3IH5HUV.js → chunk-AROIP4EQ.js} +3 -3
  14. package/dist/chunk-AROIP4EQ.js.map +1 -0
  15. package/dist/{chunk-QALDZHTX.js → chunk-H2QGFDZP.js} +9 -11
  16. package/dist/chunk-H2QGFDZP.js.map +1 -0
  17. package/dist/{chunk-L4AFV2HK.js → chunk-IOLKGV45.js} +3 -3
  18. package/dist/chunk-IOLKGV45.js.map +1 -0
  19. package/dist/{chunk-KADB3OKE.js → chunk-VFBQVUL4.js} +2 -2
  20. package/dist/{chunk-X2VM6VKM.js → chunk-WL7XUYPH.js} +19 -20
  21. package/dist/chunk-WL7XUYPH.js.map +1 -0
  22. package/dist/{chunk-N26VGVGB.js → chunk-ZSMI63N3.js} +109 -37
  23. package/dist/chunk-ZSMI63N3.js.map +1 -0
  24. package/dist/client-REDY6K7J.js +14 -0
  25. package/dist/{completion-PK74S3EZ.js → completion-MXTJYK3D.js} +4 -4
  26. package/dist/{config-T5U6E6KU.js → config-TIJXUJ5N.js} +32 -23
  27. package/dist/config-TIJXUJ5N.js.map +1 -0
  28. package/dist/{config-store-UTFDUCKW.js → config-store-INJY4DDT.js} +6 -4
  29. package/dist/{docs-VA7CJ2ZF.js → docs-M5RZAQ6P.js} +5 -5
  30. package/dist/{eoa-RL3NLN3H.js → eoa-N55DYIN3.js} +18 -16
  31. package/dist/eoa-N55DYIN3.js.map +1 -0
  32. package/dist/{errors-2NNXRNES.js → errors-SMR7X5DU.js} +2 -2
  33. package/dist/{explain-3SPMWDYX.js → explain-HIDEZVLV.js} +31 -8
  34. package/dist/explain-HIDEZVLV.js.map +1 -0
  35. package/dist/{global-options-WFQ6CEFK.js → global-options-YONBFB7N.js} +4 -4
  36. package/dist/{health-2KD6XUTJ.js → health-LSJKP3NH.js} +9 -9
  37. package/dist/index.js +31 -28
  38. package/dist/index.js.map +1 -1
  39. package/dist/{markets-H6EK2XDE.js → markets-AGL6Q2ES.js} +23 -12
  40. package/dist/markets-AGL6Q2ES.js.map +1 -0
  41. package/dist/{output-FGTXXZEQ.js → output-M4NFSWGW.js} +4 -4
  42. package/dist/{portfolio-R63D5QB2.js → portfolio-RBRVUEYP.js} +11 -11
  43. package/dist/{portfolio-R63D5QB2.js.map → portfolio-RBRVUEYP.js.map} +1 -1
  44. package/dist/{protocol-ZB6R25IM.js → protocol-WYQAKN6N.js} +18 -16
  45. package/dist/protocol-WYQAKN6N.js.map +1 -0
  46. package/dist/{quote-OF6BTAPQ.js → quote-6CNHU36A.js} +10 -10
  47. package/dist/redeem-JESSTZ46.js +108 -0
  48. package/dist/redeem-JESSTZ46.js.map +1 -0
  49. package/dist/{schema-3HQN4RFL.js → schema-6EXADLRW.js} +12 -8
  50. package/dist/{schema-3HQN4RFL.js.map → schema-6EXADLRW.js.map} +1 -1
  51. package/dist/{setup-IIPQXLPL.js → setup-H46GTSVW.js} +8 -8
  52. package/dist/{trace-WMO3KDHS.js → trace-VDBWWTYL.js} +10 -10
  53. package/dist/{trade-YBCI6XD2.js → trade-FTSY23QG.js} +10 -10
  54. package/dist/trade-FTSY23QG.js.map +1 -0
  55. package/dist/{version-WB2ACHMU.js → version-JTLF3464.js} +7 -7
  56. package/dist/{version-check-PRAVPFC6.js → version-check-7JGBY6FZ.js} +4 -4
  57. package/dist/{webhooks-DVS55O4T.js → webhooks-JEWNX5HZ.js} +10 -10
  58. package/dist/{webhooks-DVS55O4T.js.map → webhooks-JEWNX5HZ.js.map} +1 -1
  59. package/dist/{with-retry-2MD2CNK2.js → with-retry-DYSHNLG7.js} +12 -6
  60. package/dist/with-retry-DYSHNLG7.js.map +1 -0
  61. package/package.json +5 -5
  62. package/dist/chunk-A3IH5HUV.js.map +0 -1
  63. package/dist/chunk-BVFDUI73.js.map +0 -1
  64. package/dist/chunk-KAM6KOFD.js +0 -9
  65. package/dist/chunk-L4AFV2HK.js.map +0 -1
  66. package/dist/chunk-N26VGVGB.js.map +0 -1
  67. package/dist/chunk-QALDZHTX.js.map +0 -1
  68. package/dist/chunk-R4NGUZKN.js.map +0 -1
  69. package/dist/chunk-X2VM6VKM.js.map +0 -1
  70. package/dist/client-75FVHGOH.js +0 -14
  71. package/dist/config-T5U6E6KU.js.map +0 -1
  72. package/dist/eoa-RL3NLN3H.js.map +0 -1
  73. package/dist/explain-3SPMWDYX.js.map +0 -1
  74. package/dist/markets-H6EK2XDE.js.map +0 -1
  75. package/dist/protocol-ZB6R25IM.js.map +0 -1
  76. package/dist/trade-YBCI6XD2.js.map +0 -1
  77. package/dist/with-retry-2MD2CNK2.js.map +0 -1
  78. /package/dist/{account-CVJZ3HVT.js.map → account-QHPOIZ6I.js.map} +0 -0
  79. /package/dist/{chunk-MQUJG224.js.map → chunk-2HFKULGG.js.map} +0 -0
  80. /package/dist/{chunk-KADB3OKE.js.map → chunk-VFBQVUL4.js.map} +0 -0
  81. /package/dist/{client-75FVHGOH.js.map → client-REDY6K7J.js.map} +0 -0
  82. /package/dist/{completion-PK74S3EZ.js.map → completion-MXTJYK3D.js.map} +0 -0
  83. /package/dist/{config-store-UTFDUCKW.js.map → config-store-INJY4DDT.js.map} +0 -0
  84. /package/dist/{docs-VA7CJ2ZF.js.map → docs-M5RZAQ6P.js.map} +0 -0
  85. /package/dist/{errors-2NNXRNES.js.map → errors-SMR7X5DU.js.map} +0 -0
  86. /package/dist/{global-options-WFQ6CEFK.js.map → global-options-YONBFB7N.js.map} +0 -0
  87. /package/dist/{health-2KD6XUTJ.js.map → health-LSJKP3NH.js.map} +0 -0
  88. /package/dist/{output-FGTXXZEQ.js.map → output-M4NFSWGW.js.map} +0 -0
  89. /package/dist/{quote-OF6BTAPQ.js.map → quote-6CNHU36A.js.map} +0 -0
  90. /package/dist/{setup-IIPQXLPL.js.map → setup-H46GTSVW.js.map} +0 -0
  91. /package/dist/{trace-WMO3KDHS.js.map → trace-VDBWWTYL.js.map} +0 -0
  92. /package/dist/{version-WB2ACHMU.js.map → version-JTLF3464.js.map} +0 -0
  93. /package/dist/{version-check-PRAVPFC6.js.map → version-check-7JGBY6FZ.js.map} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/commands/config/index.ts","../src/commands/config/export.ts","../src/commands/config/import.ts","../src/commands/config/profiles.ts","../src/commands/config/remove.ts","../src/commands/config/reset.ts","../src/commands/config/set.ts","../src/commands/config/show.ts","../src/commands/config/use.ts"],"sourcesContent":["/**\n * `kash config` — inspect and edit the local CLI configuration.\n */\n\nimport { Command } from 'commander';\n\nimport { exportConfigCommand } from './export.js';\nimport { importConfigCommand } from './import.js';\nimport { profilesCommand } from './profiles.js';\nimport { removeProfileCommand } from './remove.js';\nimport { resetConfigCommand } from './reset.js';\nimport { setConfigCommand } from './set.js';\nimport { showConfigCommand } from './show.js';\nimport { useProfileCommand } from './use.js';\n\nexport const configCommand = new Command('config')\n .description('Inspect and edit ~/.kash/config.json (multi-profile).')\n .addCommand(showConfigCommand)\n .addCommand(setConfigCommand)\n .addCommand(profilesCommand)\n .addCommand(useProfileCommand)\n .addCommand(removeProfileCommand)\n .addCommand(resetConfigCommand)\n .addCommand(exportConfigCommand)\n .addCommand(importConfigCommand);\n","/**\n * `kash config export` — dump the entire multi-profile config to\n * stdout (or a file via `--out`).\n *\n * **Default redaction.** API keys are replaced with the literal string\n * `<redacted>` so the dump is safe to commit to a shared bucket or\n * paste into a support ticket. Pass `--include-secrets` to opt into\n * round-trippable export (e.g. moving a profile to a new machine).\n *\n * **Round-trip pairing.** Output of this command is the canonical\n * input for `kash config import`. The file format mirrors the\n * on-disk shape: `{ version: 1, currentProfile, profiles: {...} }`.\n */\n\nimport { writeFile } from 'node:fs/promises';\n\nimport { Command } from 'commander';\n\nimport { CliError, toCliError } from '../../errors.js';\nimport { readWholeFile, type CliFile, type CliConfig } from '../../utils/config-store.js';\nimport { readGlobals } from '../../utils/global-options.js';\nimport { log, print, printJson } from '../../utils/output.js';\n\nconst REDACTED = '<redacted>';\n\ntype ExportOptions = {\n out?: string;\n includeSecrets?: boolean;\n};\n\nexport const exportConfigCommand = new Command('export')\n .description('Dump the entire multi-profile config (API keys redacted by default).')\n .option('-o, --out <path>', 'write to a file instead of stdout (mode 0600)')\n .option('--include-secrets', 'include raw API keys in the export (round-trippable)')\n .addHelpText(\n 'after',\n `\nExamples:\n $ kash config export # safe-by-default; redacted JSON to stdout\n $ kash config export --out kash-config.json # write to a file (mode 0600)\n $ kash config export --include-secrets --out kash.json # round-trippable (DO NOT commit)\n\nNotes:\n - Without --include-secrets, every \\`apiKey\\` is replaced with \\`${REDACTED}\\` —\n safe to commit and share for debugging without leaking credentials.\n - The output is the canonical input for \\`kash config import\\`. Imports\n refuse to apply a profile whose apiKey is still \\`${REDACTED}\\`.\n - Use --out to route to a file the CLI can write at mode 0600. Stdout\n inherits whatever umask the parent shell has.\n`\n )\n .action(async (options: ExportOptions, cmd: Command) => {\n const globals = readGlobals(cmd);\n try {\n const file = await readWholeFile({\n ...(globals.configPath === undefined ? {} : { configPath: globals.configPath }),\n });\n\n // Walk every profile and redact apiKey unless the caller asked\n // to include secrets. Other direct-mode fields (rpcUrl,\n // smartAccount, bundlerUrl, signerKeyRef) are kept as-is —\n // they're configuration, not secrets. Raw private keys never\n // live in the config (signerKeyRef is a `file:`/`env:` pointer).\n const sanitized: CliFile = {\n ...file,\n profiles: Object.fromEntries(\n Object.entries(file.profiles).map(([name, profile]) => [\n name,\n sanitizeProfile(profile, options.includeSecrets ?? false),\n ])\n ),\n };\n\n const payload = JSON.stringify(sanitized, null, 2);\n\n if (options.out) {\n try {\n await writeFile(options.out, `${payload}\\n`, { encoding: 'utf8', mode: 0o600 });\n if (!globals.json) {\n log.success(`Wrote ${options.out} (mode 0600).`);\n if (!options.includeSecrets) {\n log.info(\n `Secrets redacted. Pass --include-secrets to produce a round-trippable export.`\n );\n }\n }\n } catch (cause) {\n throw new CliError(`Failed to write ${options.out}.`, {\n code: 'CONFIGURATION',\n recoverable: true,\n suggestion: 'Verify the path is writable and the parent directory exists.',\n cause,\n });\n }\n return;\n }\n\n // No --out: dump JSON to stdout. Honor --json by emitting the\n // file shape (same payload, but routed through printJson so\n // pretty/compact respects --quiet). Without --json we still emit\n // JSON because that's the only sensible export format — but skip\n // the human-mode banner.\n if (globals.json) {\n printJson(sanitized);\n } else {\n // Plain stdout. Append a header to stderr (so it doesn't\n // pollute the JSON pipe) noting the redaction policy.\n if (!options.includeSecrets) {\n log.info(`API keys redacted. Pass --include-secrets for round-trippable export.`);\n }\n print(payload);\n }\n } catch (cause) {\n throw toCliError(cause);\n }\n });\n\nfunction sanitizeProfile(profile: CliConfig, includeSecrets: boolean): CliConfig {\n if (includeSecrets) return profile;\n if (profile.apiKey === undefined) return profile;\n // Use a marker the importer can detect; real keys never collide\n // because they all start with `kash_`.\n return { ...profile, apiKey: REDACTED };\n}\n\nexport { REDACTED as REDACTED_API_KEY_MARKER };\n","/**\n * `kash config import` — merge a config bundle (produced by\n * `kash config export`) into the local config file.\n *\n * **Source.** Reads from `<file>` argument, or stdin when no argument\n * is given. The input must match the v1 file shape; anything else is\n * rejected as INVALID_INPUT.\n *\n * **Merge policy.** Profiles in the imported file are merged into the\n * existing profiles map. By default, existing profiles with the same\n * name are OVERWRITTEN. Pass `--no-overwrite` to skip those — useful\n * when restoring a backup against a partial config.\n *\n * **Redaction guard.** Profiles whose `apiKey` is still the literal\n * marker (`<redacted>` from `config export` without\n * `--include-secrets`) are refused with a clear error. We don't want\n * to silently overwrite a working key with a placeholder string.\n *\n * **currentProfile.** If the imported file specifies a\n * `currentProfile`, we use it — but only if that profile actually\n * lands in the merged file. Otherwise we keep the existing\n * `currentProfile` unchanged.\n */\n\nimport { readFile } from 'node:fs/promises';\n\nimport { Command } from 'commander';\n\nimport { CliError, toCliError } from '../../errors.js';\nimport {\n cliFileSchema,\n migrateFileShape,\n readWholeFile,\n writeWholeFile,\n type CliFile,\n type CliConfig,\n} from '../../utils/config-store.js';\nimport { readGlobals } from '../../utils/global-options.js';\nimport { log, print, printJson, style } from '../../utils/output.js';\n\nimport { REDACTED_API_KEY_MARKER } from './export.js';\n\ntype ImportOptions = {\n // Commander stores `--no-overwrite` as `{ overwrite: false }` —\n // the default for a `--no-X` boolean option is `true`, so the\n // explicit `false` means the user passed `--no-overwrite`.\n overwrite?: boolean;\n dryRun?: boolean;\n};\n\nexport const importConfigCommand = new Command('import')\n .description('Merge a `kash config export` bundle into the local config (mode 0600).')\n .argument('[file]', 'path to a JSON bundle (omit to read from stdin)')\n .option('--no-overwrite', 'skip profiles whose name already exists locally')\n .option('--dry-run', 'preview the merge without writing to disk')\n .addHelpText(\n 'after',\n `\nExamples:\n $ kash config import kash.json\n $ kash config export --include-secrets | ssh prod-host kash config import\n $ kash config import kash.json --no-overwrite # never replace existing profiles\n $ kash config import kash.json --dry-run --json # preview the merged result\n\nNotes:\n - The input format is exactly what \\`kash config export\\` produces.\n - Profiles whose apiKey is still \\`${REDACTED_API_KEY_MARKER}\\` are refused — re-export\n with --include-secrets to get a round-trippable bundle.\n - --dry-run emits the merged file shape without persisting it. Useful\n for diffing against the on-disk file before committing to a write.\n`\n )\n .action(async (file: string | undefined, options: ImportOptions, cmd: Command) => {\n const globals = readGlobals(cmd);\n try {\n const raw = await readSource(file);\n // Redaction check runs first on the raw JSON so users get the\n // \"you exported without --include-secrets\" message rather than\n // a generic schema-validation error (because `<redacted>`\n // doesn't match the `kash_` prefix the schema enforces).\n validateRedactionRaw(raw);\n const parsed = parseAndValidate(raw);\n\n const existing = await readWholeFile({\n ...(globals.configPath === undefined ? {} : { configPath: globals.configPath }),\n });\n const merged = mergeFiles(existing, parsed, options.overwrite === false);\n\n if (options.dryRun === true) {\n if (globals.json) {\n printJson({ merged, written: false });\n } else {\n log.info('Dry run — no changes written.');\n print(JSON.stringify(merged, null, 2));\n }\n return;\n }\n\n await writeWholeFile(merged, {\n ...(globals.configPath === undefined ? {} : { configPath: globals.configPath }),\n });\n\n if (globals.json) {\n printJson({\n merged,\n written: true,\n profiles: Object.keys(merged.profiles).sort(),\n currentProfile: merged.currentProfile ?? null,\n });\n return;\n }\n\n const importedNames = Object.keys(parsed.profiles);\n const merged_n = Object.keys(merged.profiles).length;\n log.success(\n `Imported ${String(importedNames.length)} profile(s); local config now has ${String(merged_n)} profile(s).`\n );\n if (merged.currentProfile) {\n log.info(`Active profile: ${style.bold(merged.currentProfile)}`);\n }\n } catch (cause) {\n throw toCliError(cause);\n }\n });\n\nasync function readSource(file: string | undefined): Promise<string> {\n if (file !== undefined) {\n try {\n return await readFile(file, 'utf8');\n } catch (cause) {\n throw new CliError(`Failed to read ${file}.`, {\n code: 'CONFIGURATION',\n recoverable: true,\n suggestion: 'Verify the path exists and is readable.',\n cause,\n });\n }\n }\n // No file: read from stdin. process.stdin is async iterable in Node 22+.\n const chunks: Buffer[] = [];\n for await (const chunk of process.stdin) {\n // process.stdin emits Buffer in binary streams and string in\n // text mode; coerce both into Buffer so concat is well-typed.\n if (typeof chunk === 'string') {\n chunks.push(Buffer.from(chunk));\n } else if (chunk instanceof Buffer) {\n chunks.push(chunk);\n } else {\n chunks.push(Buffer.from(chunk as Uint8Array));\n }\n }\n if (chunks.length === 0) {\n throw new CliError('No input received on stdin.', {\n code: 'INVALID_INPUT',\n recoverable: true,\n suggestion: 'Pass a path argument or pipe a `kash config export` bundle into stdin.',\n });\n }\n // Strip a leading UTF-8 BOM. Notepad / VSCode-with-utf8bom and many\n // Windows tools prepend U+FEFF to UTF-8 files; without the strip,\n // `JSON.parse` chokes on the leading non-whitespace character.\n const { stripBom } = await import('../../utils/stdin.js');\n return stripBom(Buffer.concat(chunks).toString('utf8'));\n}\n\nfunction parseAndValidate(raw: string): CliFile {\n let parsed: unknown;\n try {\n parsed = JSON.parse(raw);\n } catch (cause) {\n throw new CliError('Input is not valid JSON.', {\n code: 'INVALID_INPUT',\n recoverable: true,\n suggestion:\n 'The bundle must match the output of `kash config export`. Re-run that command and pipe the result.',\n cause,\n });\n }\n // A bundle exported by 0.1.x carries a numeric `defaultChainId`; bring it\n // up to the current shape exactly as a read of the config file would.\n const result = cliFileSchema.safeParse(migrateFileShape(parsed));\n if (!result.success) {\n const first = result.error.issues[0];\n throw new CliError(\n `Input does not match the config file shape${\n first ? `: ${first.path.join('.')}: ${first.message}` : '.'\n }`,\n {\n code: 'INVALID_INPUT',\n recoverable: true,\n suggestion: 'Re-export from a known-good machine via `kash config export`.',\n }\n );\n }\n return result.data;\n}\n\n/**\n * Cheap raw-text scan for the redaction marker before strict schema\n * validation runs. The marker is a literal sentinel that real API\n * keys can't collide with (real keys start with `kash_`), so a\n * substring check is safe.\n */\nfunction validateRedactionRaw(raw: string): void {\n if (raw.includes(`\"apiKey\": \"${REDACTED_API_KEY_MARKER}\"`)) {\n throw new CliError('Bundle contains redacted API keys — cannot import.', {\n code: 'INVALID_INPUT',\n recoverable: true,\n suggestion:\n 'Re-run `kash config export --include-secrets` on the source machine to produce a round-trippable bundle.',\n });\n }\n}\n\nfunction mergeFiles(existing: CliFile, incoming: CliFile, noOverwrite: boolean): CliFile {\n const profiles: Record<string, CliConfig> = { ...existing.profiles };\n for (const [name, profile] of Object.entries(incoming.profiles)) {\n if (noOverwrite && name in profiles) continue;\n profiles[name] = profile;\n }\n\n // Decide currentProfile: incoming wins only if it points at a real\n // profile post-merge. Otherwise keep the existing setting.\n let currentProfile = existing.currentProfile;\n if (incoming.currentProfile && incoming.currentProfile in profiles) {\n currentProfile = incoming.currentProfile;\n }\n\n return {\n version: 1,\n ...(currentProfile === undefined ? {} : { currentProfile }),\n profiles,\n };\n}\n","/**\n * `kash config profiles` — list every profile in the config file.\n */\n\nimport { Command } from 'commander';\n\nimport { toCliError } from '../../errors.js';\nimport { listProfiles } from '../../utils/config-store.js';\nimport { createTable } from '../../utils/formatting.js';\nimport { readGlobals } from '../../utils/global-options.js';\nimport { log, print, printJson, style } from '../../utils/output.js';\n\nexport const profilesCommand = new Command('profiles')\n .description('List configured profiles in the config file.')\n .addHelpText(\n 'after',\n `\nExamples:\n $ kash config profiles\n $ kash config profiles --json --quiet | jq -r '.profiles[]'\n`\n )\n .action(async (_opts, cmd: Command) => {\n const globals = readGlobals(cmd);\n let result;\n try {\n result = await listProfiles({\n ...(globals.configPath === undefined ? {} : { configPath: globals.configPath }),\n });\n } catch (cause) {\n throw toCliError(cause);\n }\n\n if (globals.json) {\n printJson(result);\n return;\n }\n\n if (result.profiles.length === 0) {\n log.info('No profiles configured.');\n log.detail('Hint', \"Run 'kash auth set-key <key>' to create the default profile.\");\n return;\n }\n\n const table = createTable(['Active', 'Profile']);\n for (const name of result.profiles) {\n table.push([name === result.current ? style.success('•') : ' ', name]);\n }\n print(table.toString());\n });\n","/**\n * `kash config remove <profile>` — delete a named profile from the\n * config file. Refuses to delete the active profile (consistent with\n * `kash auth logout` which only clears the apiKey).\n *\n * Symmetric with `kash config use` and `kash config profiles`: every\n * write surface a multi-profile setup needs is now a first-class\n * command.\n */\n\nimport { Command } from 'commander';\n\nimport { toCliError } from '../../errors.js';\nimport { deleteProfile } from '../../utils/config-store.js';\nimport { readGlobals } from '../../utils/global-options.js';\nimport { log, printJson } from '../../utils/output.js';\n\nexport const removeProfileCommand = new Command('remove')\n .description('Delete a named profile from the config file.')\n .argument('<profile>', 'profile name to remove')\n .addHelpText(\n 'after',\n `\nExamples:\n $ kash config remove staging\n $ kash config remove old-profile --json --quiet\n`\n )\n .action(async (profile: string, _opts, cmd: Command) => {\n const globals = readGlobals(cmd);\n let updated;\n try {\n updated = await deleteProfile(profile, {\n ...(globals.configPath === undefined ? {} : { configPath: globals.configPath }),\n });\n } catch (cause) {\n throw toCliError(cause);\n }\n\n if (globals.json) {\n printJson({\n ok: true,\n removed: profile,\n profiles: Object.keys(updated.profiles).sort(),\n });\n return;\n }\n log.success(`Profile \"${profile}\" removed.`);\n });\n","/**\n * `kash config reset` — delete the on-disk config file.\n *\n * Asks for confirmation when stdin is a TTY (the common interactive\n * case). In `--json` or `--quiet` mode, runs unconditionally so\n * scripts don't hang waiting for input.\n */\n\nimport readline from 'node:readline/promises';\n\nimport { Command } from 'commander';\n\nimport { toCliError } from '../../errors.js';\nimport { deleteConfig, resolveConfigPathsForOverride } from '../../utils/config-store.js';\nimport { readGlobals } from '../../utils/global-options.js';\nimport { log, printJson } from '../../utils/output.js';\n\ntype ResetOptions = {\n yes?: boolean;\n};\n\nexport const resetConfigCommand = new Command('reset')\n .description('Delete ~/.kash/config.json.')\n .option('-y, --yes', 'skip the interactive confirmation')\n .addHelpText(\n 'after',\n `\nExamples:\n $ kash config reset\n $ kash config reset --yes --json --quiet\n`\n )\n .action(async (options: ResetOptions, cmd: Command) => {\n const globals = readGlobals(cmd);\n const paths = resolveConfigPathsForOverride(globals.configPath);\n\n const interactive = process.stdin.isTTY && !globals.quiet && !globals.json;\n const confirmed = options.yes || !interactive ? true : await confirm(paths.file);\n if (!confirmed) {\n log.info('Aborted.');\n return;\n }\n\n try {\n await deleteConfig({\n ...(globals.configPath === undefined ? {} : { configPath: globals.configPath }),\n });\n } catch (cause) {\n throw toCliError(cause);\n }\n\n if (globals.json) {\n printJson({ ok: true, deleted: paths.file });\n return;\n }\n log.success(`Deleted ${paths.file}.`);\n });\n\nasync function confirm(path: string): Promise<boolean> {\n const rl = readline.createInterface({ input: process.stdin, output: process.stderr });\n try {\n const answer = await rl.question(`Delete ${path}? [y/N] `);\n return answer.trim().toLowerCase().startsWith('y');\n } finally {\n rl.close();\n }\n}\n","/**\n * `kash config set <key> <value>` — write a single config field.\n *\n * The value is parsed and validated by the same Zod schema used to\n * read the file, so corruption is impossible without bypassing the\n * CLI.\n *\n * Three field families:\n *\n * - **Kash-orchestrated** (API-backed): `apiKey`, `baseUrl`, `apiVersion`,\n * `defaultChain`.\n * - **Direct mode** (`kash protocol …`): `rpcUrl`, `smartAccount`,\n * `bundlerUrl`, `bundlerProvider`, `signerKeyRef`.\n * - **Custom chain** (Anvil / forks / sidechains, dot-path syntax):\n * `customChain.name`, `customChain.factoryAddress`, etc. Including\n * `customChain.smartAccount.factoryAddress`/`implementationAddress`/\n * `entryPointAddress` for SA mode on chains the protocol-sdk\n * registry doesn't cover.\n */\n\nimport { Command } from 'commander';\n\nimport { CliValidationError, toCliError } from '../../errors.js';\nimport { normaliseChainInput } from '../../utils/chain.js';\nimport {\n cliConfigSchema,\n readConfig,\n updateConfig,\n type CliConfig,\n type UpdateConfigResult,\n} from '../../utils/config-store.js';\nimport { readGlobals } from '../../utils/global-options.js';\nimport { log, printJson } from '../../utils/output.js';\n\nconst TOP_LEVEL_KEYS = [\n // Kash-orchestrated\n 'apiKey',\n 'baseUrl',\n 'apiVersion',\n 'defaultChain',\n // Direct mode\n 'rpcUrl',\n 'smartAccount',\n 'bundlerUrl',\n 'bundlerProvider',\n 'signerKeyRef',\n] as const;\ntype TopLevelKey = (typeof TOP_LEVEL_KEYS)[number];\n\nconst CUSTOM_CHAIN_LEAVES = [\n 'name',\n 'factoryAddress',\n 'usdcAddress',\n 'oracleAddress',\n 'vaultAddress',\n 'tokens1155Address',\n 'paramRegistryAddress',\n] as const;\ntype CustomChainLeaf = (typeof CUSTOM_CHAIN_LEAVES)[number];\n\nconst CUSTOM_CHAIN_SA_LEAVES = [\n 'factoryAddress',\n 'implementationAddress',\n 'entryPointAddress',\n] as const;\ntype CustomChainSaLeaf = (typeof CUSTOM_CHAIN_SA_LEAVES)[number];\n\nconst ALL_KEYS_FOR_HELP = [\n ...TOP_LEVEL_KEYS,\n ...CUSTOM_CHAIN_LEAVES.map((l) => `customChain.${l}`),\n ...CUSTOM_CHAIN_SA_LEAVES.map((l) => `customChain.smartAccount.${l}`),\n];\n\nexport const setConfigCommand = new Command('set')\n .description('Set a single config field.')\n .argument(\n '<key>',\n 'top-level key OR `customChain.<leaf>` / `customChain.smartAccount.<leaf>` dot-path'\n )\n .argument('<value>', 'value to set')\n .addHelpText(\n 'after',\n `\nExamples:\n $ kash config set baseUrl https://api-staging.kash.bot/v1 --profile staging\n $ kash config set defaultChain solana:devnet --profile staging\n $ kash config set apiVersion 2026-08-19\n\nDirect-mode commands (kash protocol / kash eoa) are EVM/Base only. They run on\ndefaultChain when it is an evm chain, and on Base mainnet otherwise:\n $ kash config set defaultChain evm:84532 --profile mm # Base Sepolia\n\nDirect-mode (kash protocol …):\n $ kash config set rpcUrl https://base-mainnet.g.alchemy.com/v2/... --profile mm\n $ kash config set smartAccount 0xabc... --profile mm\n $ kash config set signerKeyRef file:~/.kash/keys/mm-owner.key --profile mm\n $ kash config set bundlerProvider flashbots --profile mm\n\nCustom chain (local Anvil / forks / sidechains, bypasses static registry):\n $ kash config set defaultChain evm:31337 --profile anvil\n $ kash config set rpcUrl http://localhost:8545 --profile anvil\n $ kash config set customChain.name \"Anvil local\" --profile anvil\n $ kash config set customChain.factoryAddress 0xCf7Ed... --profile anvil\n $ kash config set customChain.usdcAddress 0x5FbDB... --profile anvil\n $ kash config set customChain.smartAccount.factoryAddress 0x3Aa5e... --profile anvil\n`\n )\n .action(async (key: string, value: string, _opts, cmd: Command) => {\n const globals = readGlobals(cmd);\n let patch: Partial<CliConfig>;\n try {\n patch = await buildPatchForKey(key, value, {\n ...(globals.profile === undefined ? {} : { profile: globals.profile }),\n ...(globals.configPath === undefined ? {} : { configPath: globals.configPath }),\n });\n } catch (cause) {\n throw toCliError(cause);\n }\n\n let result: UpdateConfigResult;\n try {\n result = await updateConfig(patch, {\n ...(globals.profile === undefined ? {} : { profile: globals.profile }),\n ...(globals.configPath === undefined ? {} : { configPath: globals.configPath }),\n });\n } catch (cause) {\n throw toCliError(cause);\n }\n\n if (globals.json) {\n // The resolved profile (from updateConfig) is the truth — when\n // the user runs `kash config set foo bar` with no flag, the\n // value lands in whatever profile the file's `currentProfile`\n // points at, NOT in the unconditional 'default'.\n const top = key.split('.', 1)[0] as keyof CliConfig;\n printJson({\n ok: true,\n key,\n value: result.stored[top] ?? null,\n profile: result.profile,\n });\n return;\n }\n log.success(`Set ${key} on profile \"${result.profile}\".`);\n });\n\nfunction isTopLevelKey(value: string): value is TopLevelKey {\n return (TOP_LEVEL_KEYS as readonly string[]).includes(value);\n}\n\nfunction isCustomChainLeaf(value: string): value is CustomChainLeaf {\n return (CUSTOM_CHAIN_LEAVES as readonly string[]).includes(value);\n}\n\nfunction isCustomChainSaLeaf(value: string): value is CustomChainSaLeaf {\n return (CUSTOM_CHAIN_SA_LEAVES as readonly string[]).includes(value);\n}\n\n/**\n * Resolve a (possibly dot-pathed) key to a partial-config patch. For\n * `customChain.*` paths we read-modify-write the existing object so\n * the user can set leaves one at a time without losing prior fields.\n */\nasync function buildPatchForKey(\n key: string,\n value: string,\n readOpts: { readonly profile?: string; readonly configPath?: string }\n): Promise<Partial<CliConfig>> {\n if (isTopLevelKey(key)) {\n return buildTopLevelPatch(key, value);\n }\n\n // customChain.<leaf> or customChain.smartAccount.<leaf> — read the\n // existing customChain object so partial sets compose, then validate\n // the merged shape against the full schema.\n if (key.startsWith('customChain.')) {\n const existing = await readConfig(readOpts);\n const existingChain = existing.customChain ?? {};\n const merged = mergeCustomChainLeaf(existingChain, key, value);\n const candidate: Partial<CliConfig> = { customChain: merged };\n // Validate the merged customChain against the schema. If the\n // user has only set a name + factoryAddress so far this will\n // fail the required usdcAddress check — that's the correct\n // behaviour: customChain on disk is always a complete object.\n cliConfigSchema.parse(candidate);\n return candidate;\n }\n\n throw new CliValidationError(\n `Unknown config key \"${key}\".`,\n `Allowed keys: ${ALL_KEYS_FOR_HELP.join(', ')}.`\n );\n}\n\nfunction buildTopLevelPatch(key: TopLevelKey, value: string): Partial<CliConfig> {\n switch (key) {\n case 'apiKey':\n case 'baseUrl':\n case 'apiVersion':\n case 'rpcUrl':\n case 'smartAccount':\n case 'bundlerUrl':\n case 'bundlerProvider':\n case 'signerKeyRef': {\n const candidate: Partial<CliConfig> = { [key]: value };\n cliConfigSchema.parse(candidate);\n return candidate;\n }\n case 'defaultChain': {\n // A bare number is accepted as a legacy EVM chain id: `8453` is\n // stored as `evm:8453`; the CAIP-2 `eip155:8453` is normalised the same way.\n const defaultChain = normaliseChainInput(value);\n if (defaultChain === undefined) {\n throw new CliValidationError(\n `\"${value}\" is not a chain reference.`,\n 'Use solana:mainnet-beta, solana:devnet, evm:<chainId> (e.g. evm:8453; eip155:8453 is accepted too), or a numeric EVM chain id.',\n 'defaultChain'\n );\n }\n return { defaultChain };\n }\n }\n}\n\n/**\n * Merge a single dot-pathed leaf into the existing `customChain`\n * object. Handles both flat leaves (`customChain.factoryAddress`) and\n * the one nested level (`customChain.smartAccount.factoryAddress`).\n *\n * The returned object is then re-validated against the full\n * `customChainSchema` by the caller — leaves that violate the leaf\n * regex (e.g. malformed hex) surface their schema error there, and\n * the required-field check (factoryAddress + usdcAddress) ensures we\n * never persist a half-built customChain.\n */\nfunction mergeCustomChainLeaf(\n existing: NonNullable<CliConfig['customChain']> | Record<string, unknown>,\n key: string,\n value: string\n): NonNullable<CliConfig['customChain']> {\n const path = key.slice('customChain.'.length);\n\n if (path.startsWith('smartAccount.')) {\n const leaf = path.slice('smartAccount.'.length);\n if (!isCustomChainSaLeaf(leaf)) {\n throw new CliValidationError(\n `Unknown customChain.smartAccount leaf \"${leaf}\".`,\n `Allowed: ${CUSTOM_CHAIN_SA_LEAVES.map((l) => `customChain.smartAccount.${l}`).join(', ')}.`\n );\n }\n const sa = (existing as { smartAccount?: Record<string, unknown> }).smartAccount ?? {};\n return {\n ...(existing as NonNullable<CliConfig['customChain']>),\n smartAccount: { ...sa, [leaf]: value } as NonNullable<\n NonNullable<CliConfig['customChain']>['smartAccount']\n >,\n };\n }\n\n if (!isCustomChainLeaf(path)) {\n throw new CliValidationError(\n `Unknown customChain leaf \"${path}\".`,\n `Allowed: ${CUSTOM_CHAIN_LEAVES.map((l) => `customChain.${l}`).join(', ')}, customChain.smartAccount.<leaf>.`\n );\n }\n return {\n ...(existing as NonNullable<CliConfig['customChain']>),\n [path]: value,\n };\n}\n","/**\n * `kash config show` — print the resolved configuration.\n *\n * Sources are surfaced (env vs file vs default) so users can debug\n * \"why is my key not picking up?\" without reading the source.\n */\n\nimport { Command } from 'commander';\n\nimport { readConfig } from '../../utils/config-store.js';\nimport { redact } from '../../utils/formatting.js';\nimport { readGlobals } from '../../utils/global-options.js';\nimport { print, printJson, style } from '../../utils/output.js';\n\nexport const showConfigCommand = new Command('show')\n .description('Print the resolved CLI configuration.')\n .addHelpText(\n 'after',\n `\nExamples:\n $ kash config show\n $ kash config show --profile staging\n $ kash config show --json --quiet | jq -r '.baseUrl'\n`\n )\n .action(async (_opts, cmd: Command) => {\n const globals = readGlobals(cmd);\n const config = await readConfig({\n ...(globals.profile === undefined ? {} : { profile: globals.profile }),\n ...(globals.configPath === undefined ? {} : { configPath: globals.configPath }),\n });\n\n if (globals.json) {\n // Shape pinned by `CliConfigEnvelopeSchema` in `cli-schemas.ts`.\n // Includes `authenticated` so it agrees with `auth status` —\n // agents that bind one shape can consume the other. Direct-mode\n // fields are always emitted (`null` when unset) so operators\n // can introspect the full profile via JSON.\n printJson({\n profile: config.profile,\n authenticated: Boolean(config.apiKey),\n apiKey: config.apiKey ? redact(config.apiKey) : null,\n baseUrl: config.baseUrl,\n apiVersion: config.apiVersion,\n defaultChain: config.defaultChain,\n rpcUrl: config.rpcUrl ?? null,\n smartAccount: config.smartAccount ?? null,\n bundlerUrl: config.bundlerUrl ?? null,\n bundlerProvider: config.bundlerProvider ?? null,\n signerKeyRef: config.signerKeyRef ?? null,\n customChain: config.customChain ?? null,\n sources: config.sources,\n });\n return;\n }\n\n print('');\n print(` ${style.dim('Profile ')} ${config.profile} (${config.sources.profile})`);\n print(\n ` ${style.dim('API key ')} ${config.apiKey ? redact(config.apiKey) : '(unset)'} (${config.sources.apiKey})`\n );\n print(` ${style.dim('Base URL ')} ${config.baseUrl} (${config.sources.baseUrl})`);\n print(` ${style.dim('API version ')} ${config.apiVersion} (${config.sources.apiVersion})`);\n print(\n ` ${style.dim('Default chain ')} ${config.defaultChain} (${config.sources.defaultChain})`\n );\n // Surface direct-mode fields when any are set. Skip the section\n // entirely on a Kash-orchestrated-only profile so human output\n // stays terse.\n const hasDirectMode =\n config.rpcUrl !== undefined ||\n config.smartAccount !== undefined ||\n config.bundlerUrl !== undefined ||\n config.bundlerProvider !== undefined ||\n config.signerKeyRef !== undefined;\n if (hasDirectMode) {\n print('');\n print(` ${style.dim('Direct mode ')}`);\n print(\n ` ${style.dim(' RPC URL ')} ${config.rpcUrl ?? '(unset)'} (${config.sources.rpcUrl})`\n );\n print(\n ` ${style.dim(' Smart account')} ${config.smartAccount ?? '(unset)'} (${config.sources.smartAccount})`\n );\n print(\n ` ${style.dim(' Bundler URL ')} ${config.bundlerUrl ?? '(unset)'} (${config.sources.bundlerUrl})`\n );\n print(\n ` ${style.dim(' Bundler kind ')} ${config.bundlerProvider ?? '(unset)'} (${config.sources.bundlerProvider})`\n );\n print(\n ` ${style.dim(' Signer ref ')} ${config.signerKeyRef ?? '(unset)'} (${config.sources.signerKeyRef})`\n );\n }\n\n // Custom-chain section — surfaces when the profile bypasses the\n // protocol-sdk's static chain registry (Anvil / forks / sidechains).\n if (config.customChain !== undefined) {\n const cc = config.customChain;\n print('');\n print(` ${style.dim('Custom chain ')} (${config.sources.customChain})`);\n print(` ${style.dim(' Name ')} ${cc.name}`);\n print(` ${style.dim(' Factory ')} ${cc.factoryAddress}`);\n print(` ${style.dim(' USDC ')} ${cc.usdcAddress}`);\n if (cc.oracleAddress) print(` ${style.dim(' Oracle ')} ${cc.oracleAddress}`);\n if (cc.vaultAddress) print(` ${style.dim(' Vault ')} ${cc.vaultAddress}`);\n if (cc.tokens1155Address) print(` ${style.dim(' Tokens1155 ')} ${cc.tokens1155Address}`);\n if (cc.paramRegistryAddress)\n print(` ${style.dim(' ParamRegistry')} ${cc.paramRegistryAddress}`);\n if (cc.smartAccount) {\n print(` ${style.dim(' Smart account')}`);\n print(` ${style.dim(' Factory ')} ${cc.smartAccount.factoryAddress}`);\n print(` ${style.dim(' Implement. ')} ${cc.smartAccount.implementationAddress}`);\n print(` ${style.dim(' EntryPoint ')} ${cc.smartAccount.entryPointAddress}`);\n }\n }\n });\n","/**\n * `kash config use <profile>` — switch the active profile by writing\n * the file's `currentProfile` field.\n *\n * **Existence check.** By default we refuse to switch to a profile\n * that doesn't already exist — `kash config use staing` (typo) used\n * to silently succeed and the next command would fail with a\n * confusing `AUTH_REQUIRED`. Now we surface the typo with a list of\n * known profile names. The \"set up a fresh profile\" flow opts in via\n * `--allow-new`: `kash config use newprofile --allow-new` followed by\n * `kash auth set-key --profile newprofile <key>`.\n */\n\nimport { Command } from 'commander';\n\nimport { CliValidationError, toCliError } from '../../errors.js';\nimport { readWholeFile, setCurrentProfile } from '../../utils/config-store.js';\nimport { readGlobals } from '../../utils/global-options.js';\nimport { log, printJson } from '../../utils/output.js';\n\ntype UseProfileOptions = {\n allowNew?: boolean;\n};\n\nexport const useProfileCommand = new Command('use')\n .description('Switch the active profile (writes currentProfile to the config file).')\n .argument('<profile>', 'profile name')\n .option(\n '--allow-new',\n 'permit switching to a profile that does not yet exist (you must populate it via `kash auth set-key --profile <name>` afterwards)'\n )\n .addHelpText(\n 'after',\n `\nExamples:\n $ kash config use staging\n $ kash config use prod --json --quiet\n $ kash config use newprofile --allow-new # explicitly create a fresh profile\n\nNotes:\n - By default \\`kash config use\\` refuses unknown profile names and\n lists the known ones — a typo of an existing profile name would\n otherwise surface later as a confusing AUTH_REQUIRED.\n - Use \\`--allow-new\\` for the bootstrapping flow when you genuinely\n want to switch to a not-yet-populated profile.\n`\n )\n .action(async (profile: string, options: UseProfileOptions, cmd: Command) => {\n const globals = readGlobals(cmd);\n const configPathOpt =\n globals.configPath === undefined ? {} : { configPath: globals.configPath };\n\n // Existence check: load the file once to see which profiles\n // exist, then either surface a structured \"did you mean\" error or\n // proceed with the write.\n let knownProfiles: readonly string[];\n try {\n const file = await readWholeFile(configPathOpt);\n knownProfiles = Object.keys(file.profiles).sort();\n } catch (cause) {\n throw toCliError(cause);\n }\n\n if (!knownProfiles.includes(profile) && options.allowNew !== true) {\n const known = knownProfiles.length === 0 ? '(none yet)' : knownProfiles.join(', ');\n throw new CliValidationError(\n `Profile \"${profile}\" does not exist.`,\n `Known profiles: ${known}. Pass --allow-new to create + switch to a fresh profile (you'll then need to populate it with \\`kash auth set-key --profile ${profile}\\`).`,\n 'profile'\n );\n }\n\n let updated;\n try {\n updated = await setCurrentProfile(profile, configPathOpt);\n } catch (cause) {\n throw toCliError(cause);\n }\n\n if (globals.json) {\n printJson({\n ok: true,\n currentProfile: updated.currentProfile,\n profiles: Object.keys(updated.profiles).sort(),\n // Surface whether this was a new-profile switch — agents can\n // pipe to `kash auth set-key --profile <p>` automatically when\n // `created` is true.\n created: !knownProfiles.includes(profile),\n });\n return;\n }\n log.success(`Active profile is now \"${profile}\".`);\n if (!knownProfiles.includes(profile)) {\n log.info(`Profile is empty. Populate it with: kash auth set-key --profile ${profile} <key>`);\n }\n });\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,SAAS,WAAAA,gBAAe;;;ACUxB,SAAS,iBAAiB;AAE1B,SAAS,eAAe;AAOxB,IAAM,W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AAmE,OAAO,QAAQ;AAAA,EAC7F;AACF,CAAC;;;ARhFI,IAAM,gBAAgB,IAAIC,SAAQ,QAAQ,EAC9C,YAAY,uDAAuD,EACnE,WAAW,iBAAiB,EAC5B,WAAW,gBAAgB,EAC3B,WAAW,eAAe,EAC1B,WAAW,iBAAiB,EAC5B,WAAW,oBAAoB,EAC/B,WAAW,kBAAkB,EAC7B,WAAW,mBAAmB,EAC9B,WAAW,mBAAmB;","names":["Command","Command","Command","Command","Command","Command","Command","Command","Command","Command","Command","Command","Command","Command","Command","Command"]}
@@ -11,6 +11,7 @@ import {
11
11
  deleteProfile,
12
12
  inferBaseUrlFromApiKey,
13
13
  listProfiles,
14
+ migrateFileShape,
14
15
  readConfig,
15
16
  readWholeFile,
16
17
  resolveConfigPaths,
@@ -18,9 +19,9 @@ import {
18
19
  setCurrentProfile,
19
20
  updateConfig,
20
21
  writeWholeFile
21
- } from "./chunk-N26VGVGB.js";
22
- import "./chunk-BVFDUI73.js";
23
- import "./chunk-X2VM6VKM.js";
22
+ } from "./chunk-ZSMI63N3.js";
23
+ import "./chunk-2SR77BYA.js";
24
+ import "./chunk-WL7XUYPH.js";
24
25
  export {
25
26
  DEFAULTS,
26
27
  DEFAULT_PROFILE,
@@ -33,6 +34,7 @@ export {
33
34
  deleteProfile,
34
35
  inferBaseUrlFromApiKey,
35
36
  listProfiles,
37
+ migrateFileShape,
36
38
  readConfig,
37
39
  readWholeFile,
38
40
  resolveConfigPaths,
@@ -41,4 +43,4 @@ export {
41
43
  updateConfig,
42
44
  writeWholeFile
43
45
  };
44
- //# sourceMappingURL=config-store-UTFDUCKW.js.map
46
+ //# sourceMappingURL=config-store-INJY4DDT.js.map
@@ -1,14 +1,14 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  readGlobals
4
- } from "./chunk-A3IH5HUV.js";
4
+ } from "./chunk-AROIP4EQ.js";
5
5
  import {
6
6
  print,
7
7
  printJson,
8
8
  style
9
- } from "./chunk-MQUJG224.js";
10
- import "./chunk-KADB3OKE.js";
11
- import "./chunk-X2VM6VKM.js";
9
+ } from "./chunk-2HFKULGG.js";
10
+ import "./chunk-VFBQVUL4.js";
11
+ import "./chunk-WL7XUYPH.js";
12
12
 
13
13
  // src/commands/docs.ts
14
14
  import { Command } from "commander";
@@ -99,4 +99,4 @@ export {
99
99
  buildDocsCommand,
100
100
  describeCommand
101
101
  };
102
- //# sourceMappingURL=docs-VA7CJ2ZF.js.map
102
+ //# sourceMappingURL=docs-M5RZAQ6P.js.map
@@ -2,15 +2,17 @@
2
2
  import {
3
3
  loadRawPrivateKey,
4
4
  resolveCliCustomChain
5
- } from "./chunk-L4AFV2HK.js";
5
+ } from "./chunk-IOLKGV45.js";
6
6
  import {
7
7
  formatAddress,
8
8
  formatGwei,
9
9
  formatUsdcAtomic
10
- } from "./chunk-R4NGUZKN.js";
10
+ } from "./chunk-6UU43MF5.js";
11
11
  import {
12
+ isEvmChain,
13
+ protocolEvmChainId,
12
14
  readConfig
13
- } from "./chunk-N26VGVGB.js";
15
+ } from "./chunk-ZSMI63N3.js";
14
16
  import {
15
17
  DEFAULT_SLIPPAGE_BPS,
16
18
  MAX_UINT256,
@@ -23,26 +25,26 @@ import {
23
25
  parseUppercaseSide,
24
26
  validateAddress,
25
27
  validateAddressOptional
26
- } from "./chunk-BVFDUI73.js";
28
+ } from "./chunk-2SR77BYA.js";
27
29
  import {
28
30
  parseOptionalPositiveFloat,
29
31
  parseOptionalPositiveInt,
30
32
  parsePositiveInt,
31
33
  readGlobals
32
- } from "./chunk-A3IH5HUV.js";
34
+ } from "./chunk-AROIP4EQ.js";
33
35
  import {
34
36
  log,
35
37
  print,
36
38
  printJson,
37
39
  style
38
- } from "./chunk-MQUJG224.js";
39
- import "./chunk-KADB3OKE.js";
40
+ } from "./chunk-2HFKULGG.js";
41
+ import "./chunk-VFBQVUL4.js";
40
42
  import {
41
43
  CliError,
42
44
  CliValidationError,
43
45
  EXIT_CODES,
44
46
  toCliError
45
- } from "./chunk-X2VM6VKM.js";
47
+ } from "./chunk-WL7XUYPH.js";
46
48
 
47
49
  // src/commands/eoa/index.ts
48
50
  import { Command } from "commander";
@@ -68,14 +70,14 @@ async function buildEoaClient(opts) {
68
70
  const signer = await loadEoaSigner(config.signerKeyRef);
69
71
  const customChain = await maybeBuildCustomChain(config, rpc);
70
72
  const client = createEoaClient({
71
- chainId: config.defaultChainId,
73
+ chainId: protocolEvmChainId(config.defaultChain),
72
74
  rpc,
73
75
  signer,
74
76
  ...customChain === void 0 ? {} : { customChain }
75
77
  });
76
78
  return {
77
79
  client,
78
- chainId: config.defaultChainId,
80
+ chainId: protocolEvmChainId(config.defaultChain),
79
81
  account: signer.ownerAddress
80
82
  };
81
83
  }
@@ -89,15 +91,15 @@ async function loadEoaSigner(ref) {
89
91
  }
90
92
  async function maybeBuildCustomChain(config, rpc) {
91
93
  if (config.customChain === void 0) return void 0;
92
- if (config.defaultChainId === void 0) {
94
+ if (!isEvmChain(config.defaultChain)) {
93
95
  throw missingEoaConfig(
94
- "defaultChainId",
95
- "`kash config set defaultChainId <id>` (required when customChain is set so the CLI can construct the viem chain)"
96
+ "defaultChain",
97
+ "`kash config set defaultChain evm:<id>` (a customChain describes an EVM network, so the profile must name an EVM chain for the CLI to construct the viem chain)"
96
98
  );
97
99
  }
98
100
  return resolveCliCustomChain({
99
101
  customChain: config.customChain,
100
- chainId: config.defaultChainId,
102
+ chainId: protocolEvmChainId(config.defaultChain),
101
103
  rpc
102
104
  });
103
105
  }
@@ -396,7 +398,7 @@ Wait controls \u2014 surface parity with \`kash protocol trade\`:
396
398
  `
397
399
  ).addCommand(tradeBuyCommand).addCommand(tradeSellCommand).addCommand(tradeCloseCommand).addCommand(tradeApproveCommand);
398
400
  var eoaCommand = new Command("eoa").description(
399
- "Self-orchestrated direct-to-chain operations using a vanilla EOA (no smart account). Like every Kash entry point, this path is non-custodial."
401
+ "EVM/Base only: self-orchestrated direct-to-chain operations using a vanilla EOA (no smart account). For Solana markets use the API-backed commands. Like every Kash entry point, this path is non-custodial."
400
402
  ).addCommand(balanceCommand).addCommand(marketCommand).addCommand(quoteCommand).addCommand(positionCommand).addCommand(allowanceCommand).addCommand(feesCommand).addCommand(tradeCommand);
401
403
  async function runTrade(side, market, options, cmd) {
402
404
  const globals = readGlobals(cmd);
@@ -548,4 +550,4 @@ function emitSendResult(side, target, result, json) {
548
550
  export {
549
551
  eoaCommand
550
552
  };
551
- //# sourceMappingURL=eoa-RL3NLN3H.js.map
553
+ //# sourceMappingURL=eoa-N55DYIN3.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/commands/eoa/index.ts","../src/utils/eoa-client.ts"],"sourcesContent":["/**\n * `kash eoa …` — non-custodial direct-to-chain operations using a\n * vanilla EOA (no smart account, no bundler).\n *\n * Wraps `@kashdao/protocol-sdk`'s `createEoaClient`. Best for:\n * - Market makers with existing EIP-1559 signing infra (web3signer,\n * Fireblocks, AWS-KMS, etc.).\n * - Operators who don't want to provision a bundler.\n * - Lowest per-trade gas overhead.\n *\n * Required profile fields:\n * - `rpcUrl` — consumer-owned RPC endpoint\n * - `defaultChain` — an `evm:` chain to run on; a Solana profile falls\n * back to Base mainnet, because this namespace is EVM only\n * - `signerKeyRef` — `file:<path>` or `env:<NAME>` for the EOA key\n *\n * EOA mode does NOT use `smartAccount`, `bundlerUrl`, or\n * `bundlerProvider` — they're SA-mode-only fields.\n *\n * **Surface parity with `kash protocol`.** This namespace mirrors the\n * SA-mode read commands and the trade-execution commands. The\n * UserOp-specific lifecycle (`userop build/simulate/submit/wait/...`)\n * doesn't apply to EOA mode — instead, EOA mode signs serialized\n * EIP-1559 transactions directly. The CLI's `eoa trade {buy,sell,close,approve}`\n * commands run the same all-in-one flow.\n */\n\nimport { Command } from 'commander';\n\nimport { CliValidationError, toCliError } from '../../errors.js';\nimport { buildEoaClient } from '../../utils/eoa-client.js';\nimport { formatAddress, formatGwei, formatUsdcAtomic } from '../../utils/formatting.js';\nimport {\n parseOptionalPositiveFloat,\n parseOptionalPositiveInt,\n parsePositiveInt,\n readGlobals,\n} from '../../utils/global-options.js';\nimport { log, print, printJson, style } from '../../utils/output.js';\nimport {\n DEFAULT_SLIPPAGE_BPS,\n MAX_UINT256,\n type TradeOpSide,\n decimalToAtomicUsdc,\n decimalToAtomicWad,\n extractPartialHash,\n parseDeadlineSec,\n parseOutcomeIndex,\n parseSlippageBps,\n parseUppercaseSide,\n validateAddress,\n validateAddressOptional,\n} from '../../utils/trade-input.js';\n\n// ---------------------------------------------------------------------------\n// Reads: balance, market, quote, position, allowance, fees\n// ---------------------------------------------------------------------------\n\nconst balanceCommand = new Command('balance')\n .description(\n \"Read on-chain USDC + native gas balances for the EOA (defaults to signer's address).\"\n )\n .argument('[account]', \"address to read (default: signer's ownerAddress)\")\n .action(async (account: string | undefined, _opts, cmd: Command) => {\n const globals = readGlobals(cmd);\n const accountAddress = validateAddressOptional(account, 'account');\n try {\n const resolved = await buildEoaClient({ globals });\n const target = accountAddress ?? resolved.account;\n const [usdc, gas] = await Promise.all([\n resolved.client.account.usdcBalance(target),\n resolved.client.account.gasBalance(target),\n ]);\n\n const payload = {\n account: target,\n chainId: resolved.chainId,\n usdcAtomic: usdc.toString(),\n gasWei: gas.toString(),\n };\n if (globals.json) {\n printJson(payload);\n return;\n }\n print('');\n print(` ${style.dim('Account ')} ${formatAddress(target, 10, 8)}`);\n print(` ${style.dim('Chain ')} ${String(resolved.chainId)}`);\n print(` ${style.dim('USDC ')} ${formatUsdcAtomic(usdc.toString())}`);\n print(\n ` ${style.dim('Gas ')} ${formatGwei(gas)} gwei ${style.dim(`(${gas.toString()} wei)`)}`\n );\n } catch (cause) {\n throw toCliError(cause);\n }\n });\n\nconst marketCommand = new Command('market')\n .description('Read on-chain market state (reserves, supplies, weights, derived probabilities).')\n .argument('<address>', 'market contract address (0x-prefixed)')\n .action(async (address: string, _opts, cmd: Command) => {\n const globals = readGlobals(cmd);\n const marketAddress = validateAddress(address, 'address');\n try {\n const resolved = await buildEoaClient({ globals });\n const state = await resolved.client.markets.state(marketAddress);\n const payload = {\n marketAddress: state.marketAddress,\n chainId: resolved.chainId,\n status: state.status,\n readAt: state.readAt.toString(),\n reserveWad: state.reserveWad.toString(),\n outcomes: state.outcomes.map((o) => ({\n index: o.index,\n outstandingTokensWad: o.outstandingTokensWad.toString(),\n weightWad: o.weightWad.toString(),\n probability: o.probability,\n })),\n };\n if (globals.json) {\n printJson(payload);\n return;\n }\n print('');\n print(` ${style.dim('Market ')} ${formatAddress(state.marketAddress, 10, 8)}`);\n print(` ${style.dim('Status ')} ${state.status}`);\n print(` ${style.dim('Outcomes ')} ${String(state.outcomes.length)}`);\n print('');\n for (const outcome of state.outcomes) {\n const pct = (outcome.probability * 100).toFixed(2);\n print(` [${String(outcome.index)}] p=${pct}%`);\n }\n } catch (cause) {\n throw toCliError(cause);\n }\n });\n\ntype QuoteOptions = { side: string; outcome: string; amount: string };\n\nconst quoteCommand = new Command('quote')\n .description('On-chain price quote for buying or selling an outcome.')\n .argument('<address>', 'market contract address')\n .requiredOption('-s, --side <side>', 'buy | sell')\n .requiredOption('-o, --outcome <index>', 'outcome index (0-based)')\n .requiredOption('-a, --amount <decimal>', 'USDC for buy / outcome tokens for sell')\n .action(async (address: string, options: QuoteOptions, cmd: Command) => {\n const globals = readGlobals(cmd);\n const marketAddress = validateAddress(address, 'address');\n const side = parseUppercaseSide(options.side);\n const outcome = parseOutcomeIndex(options.outcome);\n const amount =\n side === 'BUY'\n ? decimalToAtomicUsdc(options.amount, 'amount')\n : decimalToAtomicWad(options.amount, 'amount');\n\n try {\n const resolved = await buildEoaClient({ globals });\n const quote = await resolved.client.markets.quote(marketAddress, {\n side,\n outcome,\n amount,\n });\n const payload = {\n side: quote.side,\n outcomeIndex: quote.outcomeIndex,\n amountIn: quote.amountIn.toString(),\n amountOut: quote.amountOut.toString(),\n reserveAfterWad: quote.reserveAfterWad.toString(),\n pricesAfterWad: quote.pricesAfterWad.map((p) => p.toString()),\n };\n if (globals.json) {\n printJson(payload);\n return;\n }\n print('');\n print(` ${style.dim('Side ')} ${quote.side}`);\n print(` ${style.dim('Outcome ')} ${String(quote.outcomeIndex)}`);\n print(` ${style.dim('In ')} ${quote.amountIn.toString()}`);\n print(` ${style.dim('Out ')} ${quote.amountOut.toString()}`);\n } catch (cause) {\n throw toCliError(cause);\n }\n });\n\nconst positionCommand = new Command('position')\n .description('Read on-chain outcome-token holdings (ERC-1155) for a market.')\n .argument('<market>', 'market contract address (0x-prefixed)')\n .argument('[account]', \"address whose holdings to read (default: signer's)\")\n .action(async (market: string, account: string | undefined, _opts, cmd: Command) => {\n const globals = readGlobals(cmd);\n const marketAddress = validateAddress(market, 'market');\n const accountAddress = validateAddressOptional(account, 'account');\n try {\n const resolved = await buildEoaClient({ globals });\n const target = accountAddress ?? resolved.account;\n const position = await resolved.client.account.position(target, marketAddress);\n const payload = {\n account: target,\n marketAddress: position.marketAddress,\n chainId: resolved.chainId,\n numOutcomes: position.numOutcomes,\n holdings: position.holdings.map((h) => ({\n outcomeIndex: h.outcomeIndex,\n balanceWad: h.balanceWad.toString(),\n })),\n };\n if (globals.json) {\n printJson(payload);\n return;\n }\n print('');\n print(` ${style.dim('Account ')} ${formatAddress(target, 10, 8)}`);\n print(` ${style.dim('Market ')} ${formatAddress(position.marketAddress, 10, 8)}`);\n print('');\n for (const h of position.holdings) {\n print(` [${String(h.outcomeIndex)}] balance=${h.balanceWad.toString()} (WAD)`);\n }\n } catch (cause) {\n throw toCliError(cause);\n }\n });\n\nconst allowanceCommand = new Command('allowance')\n .description('Read the on-chain USDC allowance from `account` to `spender`.')\n .argument('<spender>', 'spender contract address')\n .argument('[account]', \"owner address (default: signer's)\")\n .action(async (spender: string, account: string | undefined, _opts, cmd: Command) => {\n const globals = readGlobals(cmd);\n const spenderAddress = validateAddress(spender, 'spender');\n const accountAddress = validateAddressOptional(account, 'account');\n try {\n const resolved = await buildEoaClient({ globals });\n const owner = accountAddress ?? resolved.account;\n const allowance = await resolved.client.account.usdcAllowance(owner, spenderAddress);\n const payload = {\n owner,\n spender,\n chainId: resolved.chainId,\n allowanceAtomic: allowance.toString(),\n };\n if (globals.json) {\n printJson(payload);\n return;\n }\n print('');\n print(` ${style.dim('Owner ')} ${formatAddress(owner, 10, 8)}`);\n print(` ${style.dim('Spender ')} ${formatAddress(spender, 10, 8)}`);\n print(` ${style.dim('Allowance')} ${formatUsdcAtomic(allowance.toString())}`);\n } catch (cause) {\n throw toCliError(cause);\n }\n });\n\nconst feesCommand = new Command('fees')\n .description('EIP-1559 fee estimate for the configured chain.')\n .option('--blocks <n>', 'number of recent blocks to sample (default 4)')\n .option('--percentile <n>', 'priority-fee percentile per block (1-99, default 50)')\n .option('--base-multiplier <n>', 'multiplier on predicted next-block base fee (default 2.0)')\n .option('--priority-floor-gwei <n>', 'floor for maxPriorityFeePerGas in gwei (default 1)')\n .action(\n async (\n options: {\n blocks?: string;\n percentile?: string;\n baseMultiplier?: string;\n priorityFloorGwei?: string;\n },\n cmd: Command\n ) => {\n const globals = readGlobals(cmd);\n const blocks = parseOptionalPositiveInt(options.blocks, 'blocks');\n const percentile = parseOptionalPositiveInt(options.percentile, 'percentile');\n if (percentile !== undefined && (percentile < 1 || percentile > 99)) {\n throw new CliValidationError('--percentile must be between 1 and 99.');\n }\n const baseMultiplier = parseOptionalPositiveFloat(options.baseMultiplier, 'base-multiplier');\n const priorityFloorGwei = parseOptionalPositiveInt(\n options.priorityFloorGwei,\n 'priority-floor-gwei'\n );\n\n try {\n const resolved = await buildEoaClient({ globals });\n const estimate = await resolved.client.estimateFees({\n ...(blocks === undefined ? {} : { blockCount: blocks }),\n ...(percentile === undefined ? {} : { rewardPercentile: percentile }),\n ...(baseMultiplier === undefined ? {} : { baseMultiplier }),\n ...(priorityFloorGwei === undefined\n ? {}\n : { priorityFeeFloorWei: BigInt(priorityFloorGwei) * 10n ** 9n }),\n });\n\n const payload = {\n chainId: resolved.chainId,\n maxFeePerGas: estimate.maxFeePerGas.toString(),\n maxPriorityFeePerGas: estimate.maxPriorityFeePerGas.toString(),\n };\n if (globals.json) {\n printJson(payload);\n return;\n }\n print('');\n print(\n ` ${style.dim('maxFee ')} ${formatGwei(estimate.maxFeePerGas)} gwei (${estimate.maxFeePerGas.toString()} wei)`\n );\n print(\n ` ${style.dim('maxPrio ')} ${formatGwei(estimate.maxPriorityFeePerGas)} gwei (${estimate.maxPriorityFeePerGas.toString()} wei)`\n );\n } catch (cause) {\n throw toCliError(cause);\n }\n }\n );\n\n// ---------------------------------------------------------------------------\n// Trade execution: buy, sell, close, approve\n// ---------------------------------------------------------------------------\n\ntype SharedTradeOptions = {\n outcome?: string;\n slippageBps?: string;\n deadlineSec?: string;\n dryRun?: boolean;\n // Commander stores `--no-X` as `{ x: false }`. Default is undefined\n // (meaning the user did not pass the negative flag); explicit `false`\n // means they did. Same idiom as `--no-overwrite` in `config import`.\n simulate?: boolean;\n wait?: boolean;\n waitTimeoutMs?: string;\n};\n\ntype Side = TradeOpSide;\n\nconst tradeBuyCommand = new Command('buy')\n .description('One-shot BUY (EIP-1559 tx, signed locally and submitted to chain).')\n .argument('<market>', 'market contract address')\n .requiredOption('-o, --outcome <index>', 'outcome index (0-based)')\n .requiredOption('-a, --amount <usdc>', 'USDC to spend (decimal)')\n .option('--slippage-bps <n>', 'slippage tolerance in bps (default 50)')\n .option('--deadline-sec <n>', 'unix-seconds deadline (default now + 5min)')\n .option('--dry-run', 'prepare + simulate but DO NOT sign or submit')\n .option('--no-simulate', 'skip eth_call preflight')\n .option('--no-wait', 'fire-and-forget: return tx hash without waiting for inclusion')\n .option('--wait-timeout-ms <n>', 'cap on the receipt wait (default 60000)')\n .action(\n async (market: string, options: SharedTradeOptions & { amount: string }, cmd: Command) => {\n await runTrade('buy', market, options, cmd);\n }\n );\n\nconst tradeSellCommand = new Command('sell')\n .description('One-shot SELL.')\n .argument('<market>', 'market contract address')\n .requiredOption('-o, --outcome <index>', 'outcome index (0-based)')\n .requiredOption('-t, --tokens <amount>', 'outcome tokens to sell (WAD decimal)')\n .option('--slippage-bps <n>', 'slippage tolerance in bps (default 50)')\n .option('--deadline-sec <n>', 'unix-seconds deadline (default now + 5min)')\n .option('--dry-run', 'prepare + simulate but DO NOT sign or submit')\n .option('--no-simulate', 'skip eth_call preflight')\n .option('--no-wait', 'fire-and-forget')\n .option('--wait-timeout-ms <n>', 'cap on the receipt wait (default 60000)')\n .action(\n async (market: string, options: SharedTradeOptions & { tokens: string }, cmd: Command) => {\n await runTrade('sell', market, options, cmd);\n }\n );\n\nconst tradeCloseCommand = new Command('close')\n .description('Sell the entire EOA balance for an outcome.')\n .argument('<market>', 'market contract address')\n .requiredOption('-o, --outcome <index>', 'outcome index (0-based)')\n .option('--slippage-bps <n>', 'slippage tolerance in bps (default 50)')\n .option('--deadline-sec <n>', 'unix-seconds deadline (default now + 5min)')\n .option('--dry-run', 'prepare + simulate but DO NOT sign or submit')\n .option('--no-simulate', 'skip eth_call preflight')\n .option('--no-wait', 'fire-and-forget')\n .option('--wait-timeout-ms <n>', 'cap on the receipt wait (default 60000)')\n .action(async (market: string, options: SharedTradeOptions, cmd: Command) => {\n await runTrade('close', market, options, cmd);\n });\n\nconst tradeApproveCommand = new Command('approve')\n .description('USDC approval — required once before the first BUY.')\n .argument('<spender>', 'spender contract address (typically a Market)')\n .option('-a, --amount <usdc>', 'atomic-USDC amount (default unlimited)')\n .option('--dry-run', 'prepare + simulate but DO NOT sign or submit')\n .option('--no-simulate', 'skip eth_call preflight')\n .option('--no-wait', 'fire-and-forget')\n .option('--wait-timeout-ms <n>', 'cap on the receipt wait (default 60000)')\n .action(\n async (\n spender: string,\n options: {\n amount?: string;\n dryRun?: boolean;\n simulate?: boolean;\n wait?: boolean;\n waitTimeoutMs?: string;\n },\n cmd: Command\n ) => {\n const globals = readGlobals(cmd);\n const spenderAddress = validateAddress(spender, 'spender');\n const amount = options.amount ? decimalToAtomicUsdc(options.amount, 'amount') : MAX_UINT256;\n const waitTimeoutMs = options.waitTimeoutMs\n ? parsePositiveInt(options.waitTimeoutMs, 'wait-timeout-ms')\n : undefined;\n\n try {\n const resolved = await buildEoaClient({ globals });\n const params = {\n account: resolved.account,\n spender: spenderAddress,\n amount,\n };\n\n if (options.dryRun === true) {\n const built = await resolved.client.trades.prepareApprove(params, {\n simulate: options.simulate !== false,\n });\n emitDryRun('approve', spender, built, globals.json);\n return;\n }\n\n const sendOptions = {\n simulate: options.simulate !== false,\n wait: options.wait !== false,\n ...(waitTimeoutMs === undefined ? {} : { waitTimeoutMs }),\n };\n let result;\n try {\n result = await resolved.client.trades.send.approve(params, sendOptions);\n } catch (cause) {\n // Approves cost gas — same partial-completion concern as\n // buy/sell/close. The EOA SDK's `sendApproveTransaction`\n // shares `dispatch` with the trade calls, so it throws the\n // identical KashChainError(WAIT_RECEIPT_FAILED) shape on\n // post-submit wait timeout. Surface the hash so the\n // operator can verify inclusion before paying gas for a\n // duplicate approve.\n const partialHash = extractPartialTransactionHash(cause);\n if (partialHash !== undefined) {\n if (globals.json) {\n printJson({ transactionHash: partialHash, waited: false, partial: true });\n } else {\n log.warn(\n `Submit succeeded but wait timed out. The approve tx is on-chain — check inclusion via your block explorer for: ${partialHash}`\n );\n }\n }\n throw cause;\n }\n emitSendResult('approve', spender, result, globals.json);\n } catch (cause) {\n throw toCliError(cause);\n }\n }\n );\n\nconst tradeCommand = new Command('trade')\n .description('Direct-mode trade execution (vanilla EIP-1559 tx, signed locally).')\n .addHelpText(\n 'after',\n `\nWait controls — surface parity with \\`kash protocol trade\\`:\n --wait-timeout-ms <n> Cap on the receipt wait (supported).\n --wait-interval-ms NOT exposed in EOA mode. viem's\n \\`waitForTransactionReceipt\\` controls its\n own polling cadence based on chain block\n time; the EOA SDK does not pass through a\n custom interval. Use SA mode\n (\\`kash protocol trade\\`) if you need\n fine-grained interval control.\n`\n )\n .addCommand(tradeBuyCommand)\n .addCommand(tradeSellCommand)\n .addCommand(tradeCloseCommand)\n .addCommand(tradeApproveCommand);\n\n// ---------------------------------------------------------------------------\n// Top-level eoa namespace\n// ---------------------------------------------------------------------------\n\nexport const eoaCommand = new Command('eoa')\n .description(\n 'EVM/Base only: self-orchestrated direct-to-chain operations using a vanilla EOA (no smart account). For Solana markets use the API-backed commands. Like every Kash entry point, this path is non-custodial.'\n )\n .addCommand(balanceCommand)\n .addCommand(marketCommand)\n .addCommand(quoteCommand)\n .addCommand(positionCommand)\n .addCommand(allowanceCommand)\n .addCommand(feesCommand)\n .addCommand(tradeCommand);\n\n// ---------------------------------------------------------------------------\n// Trade runner (shared across buy/sell/close)\n// ---------------------------------------------------------------------------\n\nasync function runTrade(\n side: Side,\n market: string,\n options: SharedTradeOptions & { amount?: string; tokens?: string },\n cmd: Command\n): Promise<void> {\n const globals = readGlobals(cmd);\n const marketAddress = validateAddress(market, 'market');\n const outcome = parseOutcomeIndex(options.outcome);\n const slippageBps = options.slippageBps\n ? parseSlippageBps(options.slippageBps)\n : DEFAULT_SLIPPAGE_BPS;\n const deadline = options.deadlineSec ? parseDeadlineSec(options.deadlineSec) : undefined;\n const waitTimeoutMs = options.waitTimeoutMs\n ? parsePositiveInt(options.waitTimeoutMs, 'wait-timeout-ms')\n : undefined;\n\n let amountUsdc: bigint | undefined;\n let amountTokens: bigint | undefined;\n if (side === 'buy') {\n amountUsdc = decimalToAtomicUsdc(options.amount!, 'amount');\n } else if (side === 'sell') {\n amountTokens = decimalToAtomicWad(options.tokens!, 'tokens');\n }\n\n try {\n const resolved = await buildEoaClient({ globals });\n // **EOA / SA param-shape note.** The shared `BuildBuyParams` /\n // `BuildSellParams` shapes the SDK exposes still use a\n // `smartAccount: Hex` field name in EOA mode for back-compat with\n // SA-mode call sites. The SDK accepts the EOA address here as the\n // signing-account hint — see protocol-sdk's `eoa/trades/build.ts`.\n // The pinning-test in `tests/component/eoa.test.ts` asserts the\n // SDK still respects this aliasing so SDK upgrades that tighten\n // the field name surface as a test failure instead of a silent\n // mis-trade.\n const baseParams = {\n account: resolved.account,\n smartAccount: resolved.account,\n outcome,\n maxSlippageBps: slippageBps,\n ...(deadline === undefined ? {} : { deadline }),\n };\n const opts = { simulate: options.simulate !== false };\n\n if (options.dryRun === true) {\n let built;\n if (side === 'buy') {\n built = await resolved.client.trades.prepareBuy(\n marketAddress,\n { ...baseParams, amountUsdc: amountUsdc! },\n opts\n );\n } else if (side === 'sell') {\n built = await resolved.client.trades.prepareSell(\n marketAddress,\n { ...baseParams, amountTokens: amountTokens! },\n opts\n );\n } else {\n built = await resolved.client.trades.prepareClosePosition(marketAddress, baseParams, opts);\n }\n emitDryRun(side, market, built, globals.json);\n return;\n }\n\n const sendOptions = {\n simulate: options.simulate !== false,\n wait: options.wait !== false,\n ...(waitTimeoutMs === undefined ? {} : { waitTimeoutMs }),\n };\n\n let result;\n try {\n if (side === 'buy') {\n result = await resolved.client.trades.send.buy(\n marketAddress,\n { ...baseParams, amountUsdc: amountUsdc! },\n sendOptions\n );\n } else if (side === 'sell') {\n result = await resolved.client.trades.send.sell(\n marketAddress,\n { ...baseParams, amountTokens: amountTokens! },\n sendOptions\n );\n } else {\n result = await resolved.client.trades.send.closePosition(\n marketAddress,\n baseParams,\n sendOptions\n );\n }\n } catch (cause) {\n // Partial-completion guard symmetric to the SA-mode path. The\n // EOA SDK throws KashChainError with `code: 'WAIT_RECEIPT_FAILED'`\n // and `context.transactionHash` when submit succeeded but the\n // wait phase timed out (see\n // `protocol-sdk/src/eoa/trades/send.ts:273-281`). Surface that\n // hash so the operator doesn't pay gas and lose the inclusion\n // pointer. The discriminator is narrow on purpose so unrelated\n // KashChainErrors (chain RPC failures, contract reverts) don't\n // get mis-reported as partial completions.\n const partialHash = extractPartialTransactionHash(cause);\n if (partialHash !== undefined) {\n if (globals.json) {\n printJson({ transactionHash: partialHash, waited: false, partial: true });\n } else {\n log.warn(\n `Submit succeeded but wait timed out. The tx is on-chain — check inclusion via your block explorer for: ${partialHash}`\n );\n }\n }\n throw cause;\n }\n emitSendResult(side, market, result, globals.json);\n } catch (cause) {\n throw toCliError(cause);\n }\n}\n\n/**\n * EOA-mode wrapper around the canonical `extractPartialHash` factory\n * (`utils/trade-input.ts`). Pinned to the wait-receipt-failed code so\n * pre-submit `KashChainError` variants (`CHAIN_RPC_FAILED`, etc.)\n * don't masquerade as partial completions.\n *\n * SDK throw site: `protocol-sdk/src/eoa/trades/send.ts:273-281`.\n */\nfunction extractPartialTransactionHash(cause: unknown): `0x${string}` | undefined {\n return extractPartialHash(cause, {\n code: 'WAIT_RECEIPT_FAILED',\n contextKey: 'transactionHash',\n });\n}\n\n// ---------------------------------------------------------------------------\n// Output emitters\n// ---------------------------------------------------------------------------\n\ntype BuiltTxLike = {\n transaction: Record<string, unknown>;\n transactionHash: `0x${string}`;\n};\n\nfunction emitDryRun(\n side: Side | 'approve',\n target: string,\n built: BuiltTxLike,\n json: boolean\n): void {\n if (json) {\n // `printJson`'s jsonReplacer is the single source of truth for\n // bigint-in-JSON: it coerces every bigint field on `transaction`\n // to a decimal string. No pre-conversion needed here.\n printJson({\n side,\n target,\n transaction: built.transaction,\n transactionHash: built.transactionHash,\n dryRun: true,\n });\n return;\n }\n print('');\n print(` ${style.bold('Dry run')} — transaction prepared but NOT signed/submitted.`);\n print(` ${style.dim('Side ')} ${side}`);\n print(` ${style.dim('Target')} ${formatAddress(target, 10, 8)}`);\n print(` ${style.dim('Hash ')} ${built.transactionHash}`);\n print('');\n print(style.dim('Re-run without --dry-run to sign and submit.'));\n}\n\ntype SendResultLike =\n | { transactionHash: `0x${string}` }\n | {\n transactionHash: `0x${string}`;\n blockNumber: bigint;\n success: boolean;\n gasUsed: bigint;\n };\n\nfunction emitSendResult(\n side: Side | 'approve',\n target: string,\n result: SendResultLike,\n json: boolean\n): void {\n const waited = 'blockNumber' in result;\n const payload = waited\n ? {\n side,\n target,\n transactionHash: result.transactionHash,\n blockNumber: result.blockNumber.toString(),\n success: result.success,\n gasUsed: result.gasUsed.toString(),\n }\n : {\n side,\n target,\n transactionHash: result.transactionHash,\n waited: false,\n };\n\n if (json) {\n printJson(payload);\n return;\n }\n\n print('');\n if (waited) {\n if (result.success) {\n log.success(`${side} included in block ${result.blockNumber.toString()}.`);\n } else {\n log.error(`${side} included but reverted on-chain.`);\n }\n print(` ${style.dim('Tx ')} ${result.transactionHash}`);\n print(` ${style.dim('Block ')} ${result.blockNumber.toString()}`);\n print(` ${style.dim('Gas ')} ${result.gasUsed.toString()}`);\n } else {\n log.success(`${side} submitted (fire-and-forget).`);\n print(` ${style.dim('Tx ')} ${result.transactionHash}`);\n }\n}\n\n// ---------------------------------------------------------------------------\n// EOA-mode-only helpers (the shared trade-input parsers live in\n// `utils/trade-input.ts`).\n// ---------------------------------------------------------------------------\n\n// `formatGwei` lives in `utils/formatting.ts` — shared with\n// protocol/fees and balance renderers.\n// `parseOptionalPositiveInt` / `parseOptionalPositiveFloat` live in\n// `utils/global-options.ts` — single source for positive-bound parsers\n// across every CLI command.\n","/**\n * Build a `@kashdao/protocol-sdk` `EoaClient` from the active\n * profile's direct-mode config.\n *\n * EOA mode is the parallel non-custodial path to smart-account mode\n * (`buildDirectClient` in `direct-client.ts`). It signs vanilla\n * EIP-1559 transactions instead of UserOps; the signer's address IS\n * the trading account. Required config:\n *\n * - `rpcUrl` — same field as SA mode\n * - `signerKeyRef` — same field as SA mode (file: or env:)\n * - `defaultChain` — same field as SA mode; an EVM chain, or Base\n * mainnet when the profile names a Solana chain\n *\n * EOA mode does NOT need:\n * - `smartAccount` (the EOA address is derived from the signer)\n * - `bundlerUrl` / `bundlerProvider` (no bundler involvement)\n *\n * **Lazy-loaded.** Same cold-start firewall as `direct-client.ts` —\n * the dynamic `import('@kashdao/protocol-sdk')` keeps viem out of the\n * non-EOA paths.\n */\n\nimport { CliError, EXIT_CODES } from '../errors.js';\n\nimport { isEvmChain, protocolEvmChainId } from './chain.js';\nimport { readConfig, type ResolvedConfig } from './config-store.js';\nimport { resolveCliCustomChain } from './custom-chain.js';\nimport { loadRawPrivateKey } from './signer-key.js';\n\nimport type { GlobalOptions } from './global-options.js';\nimport type { CustomChain, EoaClient, EoaSignerAdapter } from '@kashdao/protocol-sdk';\n\n/**\n * Build a configured `EoaClient`. `requireSigner` is always `true`\n * here — there's no read-only EOA mode (the signer address is the\n * trading account, and reads need the address). Reads against an\n * arbitrary address are still possible by passing the address as a\n * positional argument; the signer just provides the default.\n */\nexport async function buildEoaClient(opts: { readonly globals?: GlobalOptions }): Promise<{\n readonly client: EoaClient;\n readonly chainId: number;\n readonly account: `0x${string}`;\n}> {\n const globals = opts.globals;\n const config = await readConfig({\n ...(globals?.profile === undefined ? {} : { profile: globals.profile }),\n ...(globals?.configPath === undefined ? {} : { configPath: globals.configPath }),\n });\n\n const rpc = globals?.baseUrl ?? config.rpcUrl;\n if (!rpc) {\n throw missingEoaConfig('rpcUrl', '--rpc-url or `kash config set rpcUrl <url>`');\n }\n if (!config.signerKeyRef) {\n throw missingEoaConfig(\n 'signerKeyRef',\n '`kash config set signerKeyRef file:<path>` or `env:<NAME>` (CLI never persists raw keys)'\n );\n }\n\n const { createEoaClient } = await import('@kashdao/protocol-sdk');\n const signer = await loadEoaSigner(config.signerKeyRef);\n\n // If the profile has `customChain` configured, build the SDK\n // CustomChain (viem chain + addresses) so we work against chains\n // outside the static registry — local Anvil, forks, sidechains.\n // EOA mode ignores `customChain.smartAccount`.\n const customChain = await maybeBuildCustomChain(config, rpc);\n\n const client = createEoaClient({\n chainId: protocolEvmChainId(config.defaultChain),\n rpc,\n signer,\n ...(customChain === undefined ? {} : { customChain }),\n });\n\n return {\n client,\n chainId: protocolEvmChainId(config.defaultChain),\n account: signer.ownerAddress,\n };\n}\n\n/**\n * Load an EOA signer from `signerKeyRef`. Mirrors the SA-mode\n * `loadSigner` in `direct-client.ts` but wraps via\n * `viemAccountEoaSigner` for vanilla-tx signing instead of\n * `viemAccountSigner` for UserOp hash signing.\n */\nasync function loadEoaSigner(ref: string): Promise<EoaSignerAdapter> {\n const rawKey = await loadRawPrivateKey(ref);\n // Lazy-load viem + the EOA signer adapter together (matches the\n // SA-mode boundary in `direct-client.ts`). Different adapter, same\n // dynamic-import gate.\n const [{ privateKeyToAccount }, { viemAccountEoaSigner }] = await Promise.all([\n import('viem/accounts'),\n import('@kashdao/protocol-sdk'),\n ]);\n return viemAccountEoaSigner(privateKeyToAccount(rawKey));\n}\n\n/**\n * Build an SDK `CustomChain` from the profile's `customChain` config,\n * if any. The CLI never asks the user to hand-construct a viem Chain\n * — we synthesise one from `defaultChain + rpcUrl + customChain.name`,\n * which is exactly what the local-anvil quickstart in\n * `packages/protocol-sdk/examples/local-anvil/` does inline.\n */\nasync function maybeBuildCustomChain(\n config: ResolvedConfig,\n rpc: string\n): Promise<CustomChain | undefined> {\n if (config.customChain === undefined) return undefined;\n if (!isEvmChain(config.defaultChain)) {\n throw missingEoaConfig(\n 'defaultChain',\n '`kash config set defaultChain evm:<id>` (a customChain describes an EVM network, so the profile must name an EVM chain for the CLI to construct the viem chain)'\n );\n }\n return resolveCliCustomChain({\n customChain: config.customChain,\n chainId: protocolEvmChainId(config.defaultChain),\n rpc,\n });\n}\n\nfunction missingEoaConfig(field: string, hint: string): CliError {\n return new CliError(`EOA-mode config missing: ${field}.`, {\n code: 'DIRECT_CONFIG_MISSING',\n exitCode: EXIT_CODES.GENERIC,\n suggestion: `Set ${field} via ${hint}.`,\n actions: [\n {\n type: 'check_input',\n field,\n description: hint,\n },\n ],\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BA,SAAS,eAAe;;;ACaxB,eAAsB,eAAe,MAIlC;AACD,QAAM,UAAU,KAAK;AACrB,QAAM,SAAS,MAAM,WAAW;AAAA,IAC9B,GAAI,SAAS,YAAY,SAAY,CAAC,IAAI,EAAE,SAAS,QAAQ,QAAQ;AAAA,IACrE,GAAI,SAAS,eAAe,SAAY,CAAC,IAAI,EAAE,YAAY,QAAQ,WAAW;AAAA,EAChF,CAAC;AAED,QAAM,MAAM,SAAS,WAAW,OAAO;AACvC,MA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ACzC,SAAS,OAAO;AAAA,IAChB,SAAS,OAAO,QAAQ,SAAS;AAAA,EACnC,IACA;AAAA,IACE;AAAA,IACA;AAAA,IACA,iBAAiB,OAAO;AAAA,IACxB,QAAQ;AAAA,EACV;AAEJ,MAAI,MAAM;AACR,cAAU,OAAO;AACjB;AAAA,EACF;AAEA,QAAM,EAAE;AACR,MAAI,QAAQ;AACV,QAAI,OAAO,SAAS;AAClB,UAAI,QAAQ,GAAG,IAAI,sBAAsB,OAAO,YAAY,SAAS,CAAC,GAAG;AAAA,IAC3E,OAAO;AACL,UAAI,MAAM,GAAG,IAAI,kCAAkC;AAAA,IACrD;AACA,UAAM,KAAK,MAAM,IAAI,SAAS,CAAC,IAAI,OAAO,eAAe,EAAE;AAC3D,UAAM,KAAK,MAAM,IAAI,SAAS,CAAC,IAAI,OAAO,YAAY,SAAS,CAAC,EAAE;AAClE,UAAM,KAAK,MAAM,IAAI,SAAS,CAAC,IAAI,OAAO,QAAQ,SAAS,CAAC,EAAE;AAAA,EAChE,OAAO;AACL,QAAI,QAAQ,GAAG,IAAI,+BAA+B;AAClD,UAAM,KAAK,MAAM,IAAI,KAAK,CAAC,IAAI,OAAO,eAAe,EAAE;AAAA,EACzD;AACF;","names":[]}
@@ -6,7 +6,7 @@ import {
6
6
  EXIT_CODES,
7
7
  isCommanderError,
8
8
  toCliError
9
- } from "./chunk-X2VM6VKM.js";
9
+ } from "./chunk-WL7XUYPH.js";
10
10
  export {
11
11
  CliConfigurationError,
12
12
  CliError,
@@ -15,4 +15,4 @@ export {
15
15
  isCommanderError,
16
16
  toCliError
17
17
  };
18
- //# sourceMappingURL=errors-2NNXRNES.js.map
18
+ //# sourceMappingURL=errors-SMR7X5DU.js.map