@nuno1026/bithumb-cli 0.1.6 → 0.1.7
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/{chunk-DXX5FHRF.js → chunk-BMPVEJ4Z.js} +6 -6
- package/dist/{chunk-DXX5FHRF.js.map → chunk-BMPVEJ4Z.js.map} +1 -1
- package/dist/{config-VZKZANVL.js → config-O3LXACC4.js} +28 -18
- package/dist/config-O3LXACC4.js.map +1 -0
- package/dist/{deposit-JGPZ7YIP.js → deposit-KEUPMINU.js} +2 -2
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/config-VZKZANVL.js.map +0 -1
- /package/dist/{deposit-JGPZ7YIP.js.map → deposit-KEUPMINU.js.map} +0 -0
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
configFilePath,
|
|
4
4
|
readFullConfig,
|
|
5
5
|
writeFullConfig
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-BMPVEJ4Z.js";
|
|
7
7
|
import {
|
|
8
8
|
errorLine,
|
|
9
9
|
outputLine,
|
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
// src/commands/config.ts
|
|
16
16
|
import { existsSync, mkdirSync } from "fs";
|
|
17
17
|
import { dirname } from "path";
|
|
18
|
+
import { createInterface } from "readline";
|
|
18
19
|
function handleConfigCommand(action, rest, v) {
|
|
19
20
|
const json = v.json ?? false;
|
|
20
21
|
switch (action) {
|
|
@@ -66,29 +67,38 @@ function cmdConfigShow(json) {
|
|
|
66
67
|
outputLine("");
|
|
67
68
|
}
|
|
68
69
|
}
|
|
69
|
-
function
|
|
70
|
+
function ask(rl, prompt) {
|
|
71
|
+
return new Promise((resolve) => rl.question(prompt, (ans) => resolve(ans.trim())));
|
|
72
|
+
}
|
|
73
|
+
async function cmdConfigInit() {
|
|
70
74
|
const path = configFilePath();
|
|
71
75
|
if (existsSync(path)) {
|
|
72
76
|
outputLine(`Config file already exists: ${path}`);
|
|
73
77
|
outputLine("Use 'bithumb config add-profile' to add a new profile.");
|
|
74
78
|
return;
|
|
75
79
|
}
|
|
76
|
-
const
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
80
|
+
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
81
|
+
try {
|
|
82
|
+
const profileInput = await ask(rl, "Profile name (default): ");
|
|
83
|
+
const profileName = profileInput || "default";
|
|
84
|
+
const accessKey = await ask(rl, "Access key: ");
|
|
85
|
+
const secretKey = await ask(rl, "Secret key: ");
|
|
86
|
+
rl.close();
|
|
87
|
+
const dir = dirname(path);
|
|
88
|
+
if (!existsSync(dir)) mkdirSync(dir, { recursive: true });
|
|
89
|
+
const config = {
|
|
90
|
+
default_profile: profileName,
|
|
91
|
+
profiles: {
|
|
92
|
+
[profileName]: { access_key: accessKey, secret_key: secretKey }
|
|
86
93
|
}
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
94
|
+
};
|
|
95
|
+
writeFullConfig(config);
|
|
96
|
+
outputLine(`
|
|
97
|
+
\u2713 Config file created: ${path}`);
|
|
98
|
+
} catch (e) {
|
|
99
|
+
rl.close();
|
|
100
|
+
throw e;
|
|
101
|
+
}
|
|
92
102
|
}
|
|
93
103
|
function cmdConfigSet(key, value, profileName) {
|
|
94
104
|
if (!key || value === void 0) {
|
|
@@ -169,4 +179,4 @@ function cmdConfigUse(profileName) {
|
|
|
169
179
|
export {
|
|
170
180
|
handleConfigCommand
|
|
171
181
|
};
|
|
172
|
-
//# sourceMappingURL=config-
|
|
182
|
+
//# sourceMappingURL=config-O3LXACC4.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/config.ts"],"sourcesContent":["import {\n configFilePath,\n readFullConfig,\n writeFullConfig,\n} from \"@bithumb-tradekit/core\";\nimport type { BithumbTomlConfig } from \"@bithumb-tradekit/core\";\nimport type { CliValues } from \"../parser.js\";\nimport { outputLine, errorLine, printJson, printKv, printTable } from \"../formatter.js\";\nimport { existsSync, mkdirSync } from \"node:fs\";\nimport { dirname } from \"node:path\";\nimport { createInterface } from \"node:readline\";\n\nexport function handleConfigCommand(\n action: string,\n rest: string[],\n v: CliValues,\n): void | Promise<void> {\n const json = v.json ?? false;\n switch (action) {\n case \"show\":\n return cmdConfigShow(json);\n case \"init\":\n return cmdConfigInit();\n case \"set\":\n return cmdConfigSet(rest[0], rest[1], v.profile);\n case \"add-profile\":\n return cmdConfigAddProfile(rest, v);\n case \"list-profiles\":\n return cmdConfigListProfiles(json);\n case \"use\":\n return cmdConfigUse(rest[0]);\n case \"path\":\n outputLine(configFilePath());\n return;\n default:\n if (!action) {\n return cmdConfigShow(json);\n }\n errorLine(`Unknown config command: ${action}. Available: show, init, set, add-profile, list-profiles, use, path`);\n process.exitCode = 1;\n }\n}\n\nfunction cmdConfigShow(json: boolean): void {\n const config = readFullConfig();\n if (json) return printJson(config);\n outputLine(`Config file: ${configFilePath()}`);\n if (config.default_profile) {\n outputLine(`Default profile: ${config.default_profile}`);\n }\n outputLine(\"\");\n const profileNames = Object.keys(config.profiles);\n if (profileNames.length === 0) {\n outputLine(\"No profiles configured. Run 'bithumb config init' to create one.\");\n return;\n }\n for (const name of profileNames) {\n const p = config.profiles[name];\n outputLine(`[${name}]`);\n printKv({\n access_key: p.access_key ? `${p.access_key.slice(0, 8)}...` : \"(not set)\",\n secret_key: p.secret_key ? \"***\" : \"(not set)\",\n ...(p.base_url ? { base_url: p.base_url } : {}),\n ...(p.timeout_ms ? { timeout_ms: p.timeout_ms } : {}),\n });\n outputLine(\"\");\n }\n}\n\nfunction ask(rl: ReturnType<typeof createInterface>, prompt: string): Promise<string> {\n return new Promise((resolve) => rl.question(prompt, (ans) => resolve(ans.trim())));\n}\n\nasync function cmdConfigInit(): Promise<void> {\n const path = configFilePath();\n if (existsSync(path)) {\n outputLine(`Config file already exists: ${path}`);\n outputLine(\"Use 'bithumb config add-profile' to add a new profile.\");\n return;\n }\n\n const rl = createInterface({ input: process.stdin, output: process.stdout });\n try {\n const profileInput = await ask(rl, \"Profile name (default): \");\n const profileName = profileInput || \"default\";\n const accessKey = await ask(rl, \"Access key: \");\n const secretKey = await ask(rl, \"Secret key: \");\n rl.close();\n\n const dir = dirname(path);\n if (!existsSync(dir)) mkdirSync(dir, { recursive: true });\n\n const config: BithumbTomlConfig = {\n default_profile: profileName,\n profiles: {\n [profileName]: { access_key: accessKey, secret_key: secretKey },\n },\n };\n writeFullConfig(config);\n outputLine(`\\n✓ Config file created: ${path}`);\n } catch (e) {\n rl.close();\n throw e;\n }\n}\n\nfunction cmdConfigSet(key: string | undefined, value: string | undefined, profileName?: string): void {\n if (!key || value === undefined) {\n errorLine(\"Usage: bithumb config set <key> <value> [--profile <name>]\");\n errorLine(\"Keys: access_key, secret_key, base_url, timeout_ms\");\n process.exitCode = 1;\n return;\n }\n const validKeys = new Set([\"access_key\", \"secret_key\", \"base_url\", \"timeout_ms\"]);\n if (!validKeys.has(key)) {\n errorLine(`Invalid key: ${key}. Valid keys: ${[...validKeys].join(\", \")}`);\n process.exitCode = 1;\n return;\n }\n const config = readFullConfig();\n const name = profileName ?? config.default_profile ?? \"default\";\n if (!config.profiles[name]) {\n config.profiles[name] = {};\n }\n if (key === \"timeout_ms\") {\n (config.profiles[name] as Record<string, unknown>)[key] = Number(value);\n } else {\n (config.profiles[name] as Record<string, unknown>)[key] = value;\n }\n writeFullConfig(config);\n outputLine(`Set ${name}.${key}`);\n}\n\nfunction cmdConfigAddProfile(rest: string[], _v: CliValues): void {\n const name = rest[0];\n if (!name) {\n errorLine(\"Usage: bithumb config add-profile <name>\");\n process.exitCode = 1;\n return;\n }\n const config = readFullConfig();\n if (config.profiles[name]) {\n errorLine(`Profile '${name}' already exists.`);\n process.exitCode = 1;\n return;\n }\n config.profiles[name] = {\n access_key: \"\",\n secret_key: \"\",\n };\n writeFullConfig(config);\n outputLine(`Profile '${name}' added. Edit ${configFilePath()} to set credentials.`);\n}\n\nfunction cmdConfigListProfiles(json: boolean): void {\n const config = readFullConfig();\n const profiles = Object.entries(config.profiles).map(([name, p]) => ({\n name,\n default: name === (config.default_profile ?? \"default\") ? \"*\" : \"\",\n has_credentials: p.access_key && p.secret_key ? \"yes\" : \"no\",\n }));\n if (json) return printJson(profiles);\n if (profiles.length === 0) {\n outputLine(\"No profiles configured.\");\n return;\n }\n printTable(profiles);\n}\n\nfunction cmdConfigUse(profileName: string | undefined): void {\n if (!profileName) {\n errorLine(\"Usage: bithumb config use <profile-name>\");\n process.exitCode = 1;\n return;\n }\n const config = readFullConfig();\n if (!config.profiles[profileName]) {\n errorLine(`Profile '${profileName}' not found. Run 'bithumb config list-profiles' to see available profiles.`);\n process.exitCode = 1;\n return;\n }\n config.default_profile = profileName;\n writeFullConfig(config);\n outputLine(`Default profile set to '${profileName}'`);\n}\n"],"mappings":";;;;;;;;;;;;;;;AAQA,SAAS,YAAY,iBAAiB;AACtC,SAAS,eAAe;AACxB,SAAS,uBAAuB;AAEzB,SAAS,oBACd,QACA,MACA,GACsB;AACtB,QAAM,OAAO,EAAE,QAAQ;AACvB,UAAQ,QAAQ;AAAA,IACd,KAAK;AACH,aAAO,cAAc,IAAI;AAAA,IAC3B,KAAK;AACH,aAAO,cAAc;AAAA,IACvB,KAAK;AACH,aAAO,aAAa,KAAK,CAAC,GAAG,KAAK,CAAC,GAAG,EAAE,OAAO;AAAA,IACjD,KAAK;AACH,aAAO,oBAAoB,MAAM,CAAC;AAAA,IACpC,KAAK;AACH,aAAO,sBAAsB,IAAI;AAAA,IACnC,KAAK;AACH,aAAO,aAAa,KAAK,CAAC,CAAC;AAAA,IAC7B,KAAK;AACH,iBAAW,eAAe,CAAC;AAC3B;AAAA,IACF;AACE,UAAI,CAAC,QAAQ;AACX,eAAO,cAAc,IAAI;AAAA,MAC3B;AAC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1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
BithumbApiError
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-BMPVEJ4Z.js";
|
|
5
5
|
import {
|
|
6
6
|
toArray,
|
|
7
7
|
toNumber
|
|
@@ -166,4 +166,4 @@ async function cmdAddress(run, v, json) {
|
|
|
166
166
|
export {
|
|
167
167
|
handleDepositCommand
|
|
168
168
|
};
|
|
169
|
-
//# sourceMappingURL=deposit-
|
|
169
|
+
//# sourceMappingURL=deposit-KEUPMINU.js.map
|
package/dist/index.js
CHANGED
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
loadConfig,
|
|
9
9
|
printSetupUsage,
|
|
10
10
|
runSetup
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-BMPVEJ4Z.js";
|
|
12
12
|
import {
|
|
13
13
|
parseCli
|
|
14
14
|
} from "./chunk-XOKGESZ3.js";
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
} from "./chunk-FYO6WLZI.js";
|
|
21
21
|
|
|
22
22
|
// src/constants.ts
|
|
23
|
-
var CLI_VERSION = "0.1.
|
|
23
|
+
var CLI_VERSION = "0.1.7";
|
|
24
24
|
|
|
25
25
|
// src/help.ts
|
|
26
26
|
var GLOBAL_HELP = `
|
|
@@ -386,7 +386,7 @@ async function main() {
|
|
|
386
386
|
const [module, action, ...rest] = positionals;
|
|
387
387
|
const json = v.json ?? false;
|
|
388
388
|
if (module === "config") {
|
|
389
|
-
const { handleConfigCommand } = await import("./config-
|
|
389
|
+
const { handleConfigCommand } = await import("./config-O3LXACC4.js");
|
|
390
390
|
return handleConfigCommand(action, rest, v);
|
|
391
391
|
}
|
|
392
392
|
const config = loadConfig({
|
|
@@ -442,7 +442,7 @@ async function main() {
|
|
|
442
442
|
return handleWithdrawCommand(run, action, v, json);
|
|
443
443
|
}
|
|
444
444
|
if (module === "deposit") {
|
|
445
|
-
const { handleDepositCommand } = await import("./deposit-
|
|
445
|
+
const { handleDepositCommand } = await import("./deposit-KEUPMINU.js");
|
|
446
446
|
return handleDepositCommand(run, action, v, json);
|
|
447
447
|
}
|
|
448
448
|
errorLine(`Unknown command: ${module}. Run 'bithumb --help' for usage.`);
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/constants.ts","../src/help.ts","../src/index.ts"],"sourcesContent":["export const CLI_VERSION = \"0.1.6\";\n","import { outputLine } from \"./formatter.js\";\nimport { CLI_VERSION } from \"./constants.js\";\n\nconst GLOBAL_HELP = `\nbithumb v${CLI_VERSION} — Bithumb Trade CLI\n\nUsage: bithumb <module> <command> [options]\n\nModules:\n market Market data (ticker, orderbook, candles, trades)\n account Account balance, wallet status, API keys\n trade Order management (list, place, cancel, batch)\n twap TWAP (Time-Weighted Average Price) orders\n withdraw Cryptocurrency and KRW withdrawals\n deposit Cryptocurrency and KRW deposits\n system Server capabilities and module availability for agent planning\n\nUtility:\n setup Configure MCP client integration\n config Manage CLI configuration profiles\n diagnose Run connectivity diagnostics\n\nGlobal Options:\n --profile <name> Config profile (default: \"default\")\n --json Output as JSON\n --verbose Enable verbose logging\n --read-only Read-only mode (setup only, disables write operations)\n -h, --help Show help\n -v, --version Show version\n\nRun 'bithumb <module> --help' for module-specific commands.\n`;\n\nconst MARKET_HELP = `\nUsage: bithumb market <command> [options]\n\nCommands:\n markets List all available markets\n ticker <market> Get ticker for market(s) (comma-separated)\n orderbook <market> Get orderbook for market(s) (comma-separated)\n trades <market> Get recent trades\n candles-minutes <market> Get minute candles\n candles-days <market> Get daily candles\n candles-weeks <market> Get weekly candles\n candles-months <market> Get monthly candles\n warnings Get virtual asset warning markets\n notices Get notice list\n fee-inout <currency> Get deposit/withdrawal fees\n\nMarket Options:\n --is-details Include detailed market info (markets only)\n --count <n> Number of results to return\n --to <timestamp> Return results before this timestamp\n --unit <n> Minute unit: 1,3,5,10,15,30,60,240 (candles-minutes only)\n --cursor <cursor> Pagination cursor (trades only)\n --days-ago <n> Filter trades by days ago (trades only)\n --converting-price-unit <unit> Price unit: KRW (candles-days only)\n\nExamples:\n bithumb market markets\n bithumb market ticker KRW-BTC\n bithumb market orderbook KRW-BTC --json\n bithumb market candles-minutes KRW-BTC --unit 5 --count 10\n`;\n\nconst ACCOUNT_HELP = `\nUsage: bithumb account <command> [options]\n\nCommands:\n balance Get account balances\n order-chance --market <market> Get order chance for a market\n audit View trade audit log\n wallet-status Get wallet deposit/withdrawal status\n api-keys Get API key list\n capabilities (alias) Server capabilities for agent planning (same as 'system capabilities')\n\nAccount Options:\n --market <market> Market identifier (e.g., KRW-BTC)\n\nAudit Options:\n --limit <n> Number of log entries (default: 20)\n --tool <name> Filter by tool name\n --since <date> Show entries since date (ISO format)\n --level <level> Filter by log level (INFO, WARN, ERROR, DEBUG)\n\nExamples:\n bithumb account balance\n bithumb account order-chance --market KRW-BTC\n bithumb account audit --limit 10\n`;\n\nconst TRADE_HELP = `\nUsage: bithumb trade <command> [options]\n\nCommands:\n orders List orders\n get Get order details\n place Place a new order\n cancel Cancel an order\n batch-place --file <path> Place multiple orders from JSON file (max 20)\n batch-cancel Cancel multiple orders (max 30)\n\nTrade Options:\n --market <market> Market identifier (e.g., KRW-BTC)\n --uuid <uuid> Order UUID\n --client-order-id <id> Client-assigned order ID\n --side <side> Order side: bid (buy) / ask (sell)\n --order-type <type> Order type: limit / price / market (canonical)\n --ord-type <type> (deprecated alias of --order-type)\n --price <price> Order price\n --volume <volume> Order volume\n --state <state> Filter by state: wait / watch / done / cancel\n --states <states> Filter by multiple states (comma-separated)\n --uuids <uuids> Filter by multiple UUIDs (comma-separated)\n --client-order-ids <ids> Filter by multiple client order IDs (comma-separated)\n --order-by <order> Sort order: asc / desc\n --page <n> Page number\n --limit <n> Results per page\n --file <path> JSON file path (batch-place only)\n\nExamples:\n bithumb trade orders --market KRW-BTC --state wait\n bithumb trade get --uuid abc-123\n bithumb trade place --market KRW-BTC --side bid --order-type limit --price 50000000 --volume 0.01\n bithumb trade cancel --uuid abc-123\n bithumb trade batch-place --file orders.json\n`;\n\nconst SETUP_HELP = `\nUsage: bithumb setup --client <client> [--profile <name>] [--modules <list>]\n\nConfigure MCP client integration for supported AI coding tools.\n\nOptions:\n --client <client> Target client: claude-desktop, cursor, windsurf, vscode, claude-code\n --profile <name> Config profile to use (default: \"default\")\n --modules <list> Comma-separated modules to enable\n\nExamples:\n bithumb setup --client claude-desktop\n bithumb setup --client cursor --modules market,account\n`;\n\nconst TWAP_HELP = `\nUsage: bithumb twap <command> [options]\n\nCommands:\n place Place a TWAP order\n orders List TWAP orders\n cancel Cancel a TWAP order\n\nTWAP Options:\n --market <market> Market identifier (e.g., KRW-BTC)\n --side <side> Order side: bid / ask\n --duration <seconds> Duration in seconds (300-43200)\n --frequency <seconds> Frequency: 5,15,20,30,60,120\n --price <price> Order price (required for bid)\n --volume <volume> Order volume (required for ask)\n --algo-order-id <id> TWAP order ID (for cancel)\n --state <state> Order state filter\n --next-key <key> Pagination cursor\n --limit <n> Results per page\n --uuids <uuids> Filter by TWAP order IDs (comma-separated)\n --order-by <order> Sort order: asc / desc\n\nExamples:\n bithumb twap place --market KRW-BTC --side bid --duration 3600 --frequency 60 --price 50000000\n bithumb twap orders --market KRW-BTC\n bithumb twap cancel --algo-order-id abc-123\n`;\n\nconst WITHDRAW_HELP = `\nUsage: bithumb withdraw <command> [options]\n\nCommands:\n chance Get withdrawal availability info\n get Get specific withdrawal\n list List coin withdrawals\n list-krw List KRW withdrawals\n coin Withdraw cryptocurrency (CAUTION)\n krw Withdraw KRW (CAUTION)\n cancel Cancel coin withdrawal\n addresses List allowed withdrawal addresses\n\nWithdraw Options:\n --currency <code> Currency code (e.g., BTC)\n --net-type <type> Network type (e.g., BTC)\n --amount <amount> Withdrawal amount\n --address <addr> Withdrawal address\n --secondary-address <addr> Secondary address (tag/memo)\n --exchange-name <name> Exchange name\n --receiver-type <type> Receiver type: personal / corporation\n --receiver-ko-name <name> Receiver Korean name\n --receiver-en-name <name> Receiver English name\n --receiver-corp-ko-name <name> Corporation Korean name\n --receiver-corp-en-name <name> Corporation English name\n --two-factor-type <type> 2FA type (kakao)\n --uuid <uuid> Withdrawal UUID\n --txids <txids> Transaction ID(s) (comma-separated for list)\n --uuids <uuids> Filter by UUIDs (comma-separated, for list)\n --withdrawal-id <id> Withdrawal ID (for cancel)\n --state <state> State filter (for list)\n --limit <n> Results per page (max 100)\n --page <n> Page number\n --order-by <order> Sort order: asc / desc\n\nExamples:\n bithumb withdraw chance --currency BTC --net-type BTC\n bithumb withdraw list --currency BTC\n bithumb withdraw addresses\n`;\n\nconst DEPOSIT_HELP = `\nUsage: bithumb deposit <command> [options]\n\nCommands:\n get Get specific deposit\n list List coin deposits\n list-krw List KRW deposits\n krw Request KRW deposit (CAUTION)\n generate-address Generate deposit address\n addresses List all deposit addresses\n address Get specific deposit address\n\nDeposit Options:\n --currency <code> Currency code (e.g., BTC)\n --net-type <type> Network type (e.g., BTC)\n --amount <amount> Deposit amount\n --two-factor-type <type> 2FA type (kakao)\n --uuid <uuid> Deposit UUID\n --txids <txids> Transaction ID(s) (comma-separated for list)\n --uuids <uuids> Filter by UUIDs (comma-separated, for list)\n --state <state> State filter (for list)\n --limit <n> Results per page (max 100)\n --page <n> Page number\n --order-by <order> Sort order: asc / desc\n\nExamples:\n bithumb deposit list --currency BTC\n bithumb deposit address --currency BTC --net-type BTC\n bithumb deposit addresses\n`;\n\nconst SYSTEM_HELP = `\nUsage: bithumb system <command> [options]\n\nCommands:\n capabilities Server capabilities and module availability for agent planning\n\nSystem Options:\n --json Output as JSON\n\nExamples:\n bithumb system capabilities\n bithumb system capabilities --json\n\nNotes:\n - 'bithumb account capabilities' is an alias for 'bithumb system capabilities'.\n - Use this command to discover which modules are enabled and which require auth.\n`;\n\nconst CONFIG_HELP = `\nUsage: bithumb config <command> [options]\n\nCommands:\n show Show current configuration\n init Create config file\n set <key> <value> Set a config value (access_key, secret_key, base_url, timeout_ms)\n add-profile <name> Add a new profile\n list-profiles List all profiles\n use <name> Set default profile\n path Show config file path\n\nOptions:\n --profile <name> Target profile (default: current default)\n\nExamples:\n bithumb config init\n bithumb config set access_key your_key --profile trading\n bithumb config use trading\n bithumb config list-profiles\n`;\n\nexport function printHelp(positionals: string[]): void {\n const module = positionals[0];\n switch (module) {\n case \"market\":\n outputLine(MARKET_HELP.trim());\n break;\n case \"account\":\n outputLine(ACCOUNT_HELP.trim());\n break;\n case \"trade\":\n outputLine(TRADE_HELP.trim());\n break;\n case \"twap\":\n outputLine(TWAP_HELP.trim());\n break;\n case \"withdraw\":\n outputLine(WITHDRAW_HELP.trim());\n break;\n case \"deposit\":\n outputLine(DEPOSIT_HELP.trim());\n break;\n case \"system\":\n outputLine(SYSTEM_HELP.trim());\n break;\n case \"setup\":\n outputLine(SETUP_HELP.trim());\n break;\n case \"config\":\n outputLine(CONFIG_HELP.trim());\n break;\n default:\n outputLine(GLOBAL_HELP.trim());\n break;\n }\n}\n","import {\n loadConfig,\n BithumbRestClient,\n createToolRunner,\n TradeLogger,\n checkForUpdates,\n runSetup,\n printSetupUsage,\n SUPPORTED_CLIENTS,\n} from \"@bithumb-tradekit/core\";\nimport type { ToolRunner, ClientId } from \"@bithumb-tradekit/core\";\nimport { parseCli } from \"./parser.js\";\nimport type { CliValues } from \"./parser.js\";\nimport { outputLine, errorLine, printJson, printKv } from \"./formatter.js\";\nimport { printHelp } from \"./help.js\";\nimport { CLI_VERSION } from \"./constants.js\";\n\nfunction wrapRunnerWithLogger(\n baseRunner: ToolRunner,\n logger: TradeLogger,\n): ToolRunner {\n return async (toolName, args) => {\n const start = Date.now();\n try {\n const result = await baseRunner(toolName, args);\n logger.logTool(\"info\", toolName, args, { status: \"ok\" }, Date.now() - start);\n return result;\n } catch (error) {\n logger.logTool(\"error\", toolName, args, error, Date.now() - start);\n throw error;\n }\n };\n}\n\nfunction handleSetup(argv: string[]): void {\n const idx = argv.indexOf(\"setup\");\n const rest = argv.slice(idx + 1);\n\n let client: string | undefined;\n let profile: string | undefined;\n let modules: string | undefined;\n\n for (let i = 0; i < rest.length; i++) {\n if (rest[i] === \"--client\" && rest[i + 1]) {\n client = rest[++i];\n } else if (rest[i] === \"--profile\" && rest[i + 1]) {\n profile = rest[++i];\n } else if (rest[i] === \"--modules\" && rest[i + 1]) {\n modules = rest[++i];\n } else if (rest[i] === \"--help\" || rest[i] === \"-h\") {\n printSetupUsage();\n return;\n }\n }\n\n if (!client || !SUPPORTED_CLIENTS.includes(client as ClientId)) {\n errorLine(`Error: --client is required. Supported: ${SUPPORTED_CLIENTS.join(\", \")}`);\n process.exitCode = 1;\n return;\n }\n\n runSetup({ client: client as ClientId, profile, modules });\n}\n\nasync function main(): Promise<void> {\n checkForUpdates(\"@bithumb-tradekit/cli\", CLI_VERSION);\n\n // 1. Setup subcommand (before parseCli)\n if (process.argv[2] === \"setup\") {\n handleSetup(process.argv);\n return;\n }\n\n // 2. Parse arguments\n const { values: v, positionals } = parseCli(process.argv.slice(2));\n\n if (v.version) {\n outputLine(CLI_VERSION);\n return;\n }\n\n if (v.help || positionals.length === 0) {\n printHelp(positionals);\n return;\n }\n\n const [module, action, ...rest] = positionals;\n const json = v.json ?? false;\n\n // 3. Config command (no auth needed, no runner needed)\n if (module === \"config\") {\n const { handleConfigCommand } = await import(\"./commands/config.js\");\n return handleConfigCommand(action, rest, v);\n }\n\n // 4. Load config + create runner\n const config = loadConfig({\n modules: v.modules,\n readOnly: v.readOnly,\n verbose: v.verbose,\n profile: v.profile,\n });\n const client = new BithumbRestClient(config);\n const baseRunner = createToolRunner(client, config);\n const logger = new TradeLogger(v.verbose ? \"debug\" : \"info\");\n const run = wrapRunnerWithLogger(baseRunner, logger);\n\n // 5. Diagnose (needs config but no auth)\n if (module === \"diagnose\") {\n const result = await run(\"system_diagnose\", {});\n const data = result.data ?? result;\n if (json) return printJson(data);\n printKv(data as Record<string, unknown>);\n return;\n }\n\n // 5b. System capabilities (no auth needed)\n // Accept both `system capabilities` (canonical) and `account capabilities` (alias)\n if (\n (module === \"system\" && action === \"capabilities\") ||\n (module === \"account\" && action === \"capabilities\")\n ) {\n const result = await run(\"system_get_capabilities\", {});\n const data = result.data ?? result;\n if (json) return printJson(data);\n printKv(data as Record<string, unknown>);\n return;\n }\n\n // 6. Private API auth guard\n const privateModules = new Set([\"account\", \"trade\", \"twap\", \"withdraw\", \"deposit\"]);\n if (privateModules.has(module) && !config.hasAuth) {\n errorLine(\n \"Error: API credentials required. Run 'bithumb setup' or configure ~/.bithumb/config.toml\",\n );\n process.exitCode = 1;\n return;\n }\n\n // 7. Module routing\n if (module === \"market\") {\n const { handleMarketCommand } = await import(\"./commands/market.js\");\n return handleMarketCommand(run, action, rest, v, json);\n }\n if (module === \"account\") {\n const { handleAccountCommand } = await import(\"./commands/account.js\");\n return handleAccountCommand(run, action, v, json);\n }\n if (module === \"trade\") {\n const { handleTradeCommand } = await import(\"./commands/trade.js\");\n return handleTradeCommand(run, action, v, json);\n }\n if (module === \"twap\") {\n const { handleTwapCommand } = await import(\"./commands/twap.js\");\n return handleTwapCommand(run, action, v, json);\n }\n if (module === \"withdraw\") {\n const { handleWithdrawCommand } = await import(\"./commands/withdraw.js\");\n return handleWithdrawCommand(run, action, v, json);\n }\n if (module === \"deposit\") {\n const { handleDepositCommand } = await import(\"./commands/deposit.js\");\n return handleDepositCommand(run, action, v, json);\n }\n\n errorLine(`Unknown command: ${module}. Run 'bithumb --help' for usage.`);\n process.exitCode = 1;\n}\n\nmain().catch((err) => {\n errorLine(`Fatal: ${err instanceof Error ? err.message : String(err)}`);\n process.exitCode = 1;\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAO,IAAM,cAAc;;;ACG3B,IAAM,cAAc;AAAA,WACT,WAAW;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;A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sBAAsB;AACnE,WAAO,oBAAoB,KAAK,QAAQ,MAAM,GAAG,IAAI;AAAA,EACvD;AACA,MAAI,WAAW,WAAW;AACxB,UAAM,EAAE,qBAAqB,IAAI,MAAM,OAAO,uBAAuB;AACrE,WAAO,qBAAqB,KAAK,QAAQ,GAAG,IAAI;AAAA,EAClD;AACA,MAAI,WAAW,SAAS;AACtB,UAAM,EAAE,mBAAmB,IAAI,MAAM,OAAO,qBAAqB;AACjE,WAAO,mBAAmB,KAAK,QAAQ,GAAG,IAAI;AAAA,EAChD;AACA,MAAI,WAAW,QAAQ;AACrB,UAAM,EAAE,kBAAkB,IAAI,MAAM,OAAO,oBAAoB;AAC/D,WAAO,kBAAkB,KAAK,QAAQ,GAAG,IAAI;AAAA,EAC/C;AACA,MAAI,WAAW,YAAY;AACzB,UAAM,EAAE,sBAAsB,IAAI,MAAM,OAAO,wBAAwB;AACvE,WAAO,sBAAsB,KAAK,QAAQ,GAAG,IAAI;AAAA,EACnD;AACA,MAAI,WAAW,WAAW;AACxB,UAAM,EAAE,qBAAqB,IAAI,MAAM,OAAO,uBAAuB;AACrE,WAAO,qBAAqB,KAAK,QAAQ,GAAG,IAAI;AAAA,EAClD;AAEA,YAAU,oBAAoB,MAAM,mCAAmC;AACvE,UAAQ,WAAW;AACrB;AAEA,KAAK,EAAE,MAAM,CAAC,QAAQ;AACpB,YAAU,UAAU,eAAe,QAAQ,IAAI,UAAU,OAAO,GAAG,CAAC,EAAE;AACtE,UAAQ,WAAW;AACrB,CAAC;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/constants.ts","../src/help.ts","../src/index.ts"],"sourcesContent":["export const CLI_VERSION = \"0.1.7\";\n","import { outputLine } from \"./formatter.js\";\nimport { CLI_VERSION } from \"./constants.js\";\n\nconst GLOBAL_HELP = `\nbithumb v${CLI_VERSION} — Bithumb Trade CLI\n\nUsage: bithumb <module> <command> [options]\n\nModules:\n market Market data (ticker, orderbook, candles, trades)\n account Account balance, wallet status, API keys\n trade Order management (list, place, cancel, batch)\n twap TWAP (Time-Weighted Average Price) orders\n withdraw Cryptocurrency and KRW withdrawals\n deposit Cryptocurrency and KRW deposits\n system Server capabilities and module availability for agent planning\n\nUtility:\n setup Configure MCP client integration\n config Manage CLI configuration profiles\n diagnose Run connectivity diagnostics\n\nGlobal Options:\n --profile <name> Config profile (default: \"default\")\n --json Output as JSON\n --verbose Enable verbose logging\n --read-only Read-only mode (setup only, disables write operations)\n -h, --help Show help\n -v, --version Show version\n\nRun 'bithumb <module> --help' for module-specific commands.\n`;\n\nconst MARKET_HELP = `\nUsage: bithumb market <command> [options]\n\nCommands:\n markets List all available markets\n ticker <market> Get ticker for market(s) (comma-separated)\n orderbook <market> Get orderbook for market(s) (comma-separated)\n trades <market> Get recent trades\n candles-minutes <market> Get minute candles\n candles-days <market> Get daily candles\n candles-weeks <market> Get weekly candles\n candles-months <market> Get monthly candles\n warnings Get virtual asset warning markets\n notices Get notice list\n fee-inout <currency> Get deposit/withdrawal fees\n\nMarket Options:\n --is-details Include detailed market info (markets only)\n --count <n> Number of results to return\n --to <timestamp> Return results before this timestamp\n --unit <n> Minute unit: 1,3,5,10,15,30,60,240 (candles-minutes only)\n --cursor <cursor> Pagination cursor (trades only)\n --days-ago <n> Filter trades by days ago (trades only)\n --converting-price-unit <unit> Price unit: KRW (candles-days only)\n\nExamples:\n bithumb market markets\n bithumb market ticker KRW-BTC\n bithumb market orderbook KRW-BTC --json\n bithumb market candles-minutes KRW-BTC --unit 5 --count 10\n`;\n\nconst ACCOUNT_HELP = `\nUsage: bithumb account <command> [options]\n\nCommands:\n balance Get account balances\n order-chance --market <market> Get order chance for a market\n audit View trade audit log\n wallet-status Get wallet deposit/withdrawal status\n api-keys Get API key list\n capabilities (alias) Server capabilities for agent planning (same as 'system capabilities')\n\nAccount Options:\n --market <market> Market identifier (e.g., KRW-BTC)\n\nAudit Options:\n --limit <n> Number of log entries (default: 20)\n --tool <name> Filter by tool name\n --since <date> Show entries since date (ISO format)\n --level <level> Filter by log level (INFO, WARN, ERROR, DEBUG)\n\nExamples:\n bithumb account balance\n bithumb account order-chance --market KRW-BTC\n bithumb account audit --limit 10\n`;\n\nconst TRADE_HELP = `\nUsage: bithumb trade <command> [options]\n\nCommands:\n orders List orders\n get Get order details\n place Place a new order\n cancel Cancel an order\n batch-place --file <path> Place multiple orders from JSON file (max 20)\n batch-cancel Cancel multiple orders (max 30)\n\nTrade Options:\n --market <market> Market identifier (e.g., KRW-BTC)\n --uuid <uuid> Order UUID\n --client-order-id <id> Client-assigned order ID\n --side <side> Order side: bid (buy) / ask (sell)\n --order-type <type> Order type: limit / price / market (canonical)\n --ord-type <type> (deprecated alias of --order-type)\n --price <price> Order price\n --volume <volume> Order volume\n --state <state> Filter by state: wait / watch / done / cancel\n --states <states> Filter by multiple states (comma-separated)\n --uuids <uuids> Filter by multiple UUIDs (comma-separated)\n --client-order-ids <ids> Filter by multiple client order IDs (comma-separated)\n --order-by <order> Sort order: asc / desc\n --page <n> Page number\n --limit <n> Results per page\n --file <path> JSON file path (batch-place only)\n\nExamples:\n bithumb trade orders --market KRW-BTC --state wait\n bithumb trade get --uuid abc-123\n bithumb trade place --market KRW-BTC --side bid --order-type limit --price 50000000 --volume 0.01\n bithumb trade cancel --uuid abc-123\n bithumb trade batch-place --file orders.json\n`;\n\nconst SETUP_HELP = `\nUsage: bithumb setup --client <client> [--profile <name>] [--modules <list>]\n\nConfigure MCP client integration for supported AI coding tools.\n\nOptions:\n --client <client> Target client: claude-desktop, cursor, windsurf, vscode, claude-code\n --profile <name> Config profile to use (default: \"default\")\n --modules <list> Comma-separated modules to enable\n\nExamples:\n bithumb setup --client claude-desktop\n bithumb setup --client cursor --modules market,account\n`;\n\nconst TWAP_HELP = `\nUsage: bithumb twap <command> [options]\n\nCommands:\n place Place a TWAP order\n orders List TWAP orders\n cancel Cancel a TWAP order\n\nTWAP Options:\n --market <market> Market identifier (e.g., KRW-BTC)\n --side <side> Order side: bid / ask\n --duration <seconds> Duration in seconds (300-43200)\n --frequency <seconds> Frequency: 5,15,20,30,60,120\n --price <price> Order price (required for bid)\n --volume <volume> Order volume (required for ask)\n --algo-order-id <id> TWAP order ID (for cancel)\n --state <state> Order state filter\n --next-key <key> Pagination cursor\n --limit <n> Results per page\n --uuids <uuids> Filter by TWAP order IDs (comma-separated)\n --order-by <order> Sort order: asc / desc\n\nExamples:\n bithumb twap place --market KRW-BTC --side bid --duration 3600 --frequency 60 --price 50000000\n bithumb twap orders --market KRW-BTC\n bithumb twap cancel --algo-order-id abc-123\n`;\n\nconst WITHDRAW_HELP = `\nUsage: bithumb withdraw <command> [options]\n\nCommands:\n chance Get withdrawal availability info\n get Get specific withdrawal\n list List coin withdrawals\n list-krw List KRW withdrawals\n coin Withdraw cryptocurrency (CAUTION)\n krw Withdraw KRW (CAUTION)\n cancel Cancel coin withdrawal\n addresses List allowed withdrawal addresses\n\nWithdraw Options:\n --currency <code> Currency code (e.g., BTC)\n --net-type <type> Network type (e.g., BTC)\n --amount <amount> Withdrawal amount\n --address <addr> Withdrawal address\n --secondary-address <addr> Secondary address (tag/memo)\n --exchange-name <name> Exchange name\n --receiver-type <type> Receiver type: personal / corporation\n --receiver-ko-name <name> Receiver Korean name\n --receiver-en-name <name> Receiver English name\n --receiver-corp-ko-name <name> Corporation Korean name\n --receiver-corp-en-name <name> Corporation English name\n --two-factor-type <type> 2FA type (kakao)\n --uuid <uuid> Withdrawal UUID\n --txids <txids> Transaction ID(s) (comma-separated for list)\n --uuids <uuids> Filter by UUIDs (comma-separated, for list)\n --withdrawal-id <id> Withdrawal ID (for cancel)\n --state <state> State filter (for list)\n --limit <n> Results per page (max 100)\n --page <n> Page number\n --order-by <order> Sort order: asc / desc\n\nExamples:\n bithumb withdraw chance --currency BTC --net-type BTC\n bithumb withdraw list --currency BTC\n bithumb withdraw addresses\n`;\n\nconst DEPOSIT_HELP = `\nUsage: bithumb deposit <command> [options]\n\nCommands:\n get Get specific deposit\n list List coin deposits\n list-krw List KRW deposits\n krw Request KRW deposit (CAUTION)\n generate-address Generate deposit address\n addresses List all deposit addresses\n address Get specific deposit address\n\nDeposit Options:\n --currency <code> Currency code (e.g., BTC)\n --net-type <type> Network type (e.g., BTC)\n --amount <amount> Deposit amount\n --two-factor-type <type> 2FA type (kakao)\n --uuid <uuid> Deposit UUID\n --txids <txids> Transaction ID(s) (comma-separated for list)\n --uuids <uuids> Filter by UUIDs (comma-separated, for list)\n --state <state> State filter (for list)\n --limit <n> Results per page (max 100)\n --page <n> Page number\n --order-by <order> Sort order: asc / desc\n\nExamples:\n bithumb deposit list --currency BTC\n bithumb deposit address --currency BTC --net-type BTC\n bithumb deposit addresses\n`;\n\nconst SYSTEM_HELP = `\nUsage: bithumb system <command> [options]\n\nCommands:\n capabilities Server capabilities and module availability for agent planning\n\nSystem Options:\n --json Output as JSON\n\nExamples:\n bithumb system capabilities\n bithumb system capabilities --json\n\nNotes:\n - 'bithumb account capabilities' is an alias for 'bithumb system capabilities'.\n - Use this command to discover which modules are enabled and which require auth.\n`;\n\nconst CONFIG_HELP = `\nUsage: bithumb config <command> [options]\n\nCommands:\n show Show current configuration\n init Create config file\n set <key> <value> Set a config value (access_key, secret_key, base_url, timeout_ms)\n add-profile <name> Add a new profile\n list-profiles List all profiles\n use <name> Set default profile\n path Show config file path\n\nOptions:\n --profile <name> Target profile (default: current default)\n\nExamples:\n bithumb config init\n bithumb config set access_key your_key --profile trading\n bithumb config use trading\n bithumb config list-profiles\n`;\n\nexport function printHelp(positionals: string[]): void {\n const module = positionals[0];\n switch (module) {\n case \"market\":\n outputLine(MARKET_HELP.trim());\n break;\n case \"account\":\n outputLine(ACCOUNT_HELP.trim());\n break;\n case \"trade\":\n outputLine(TRADE_HELP.trim());\n break;\n case \"twap\":\n outputLine(TWAP_HELP.trim());\n break;\n case \"withdraw\":\n outputLine(WITHDRAW_HELP.trim());\n break;\n case \"deposit\":\n outputLine(DEPOSIT_HELP.trim());\n break;\n case \"system\":\n outputLine(SYSTEM_HELP.trim());\n break;\n case \"setup\":\n outputLine(SETUP_HELP.trim());\n break;\n case \"config\":\n outputLine(CONFIG_HELP.trim());\n break;\n default:\n outputLine(GLOBAL_HELP.trim());\n break;\n }\n}\n","import {\n loadConfig,\n BithumbRestClient,\n createToolRunner,\n TradeLogger,\n checkForUpdates,\n runSetup,\n printSetupUsage,\n SUPPORTED_CLIENTS,\n} from \"@bithumb-tradekit/core\";\nimport type { ToolRunner, ClientId } from \"@bithumb-tradekit/core\";\nimport { parseCli } from \"./parser.js\";\nimport type { CliValues } from \"./parser.js\";\nimport { outputLine, errorLine, printJson, printKv } from \"./formatter.js\";\nimport { printHelp } from \"./help.js\";\nimport { CLI_VERSION } from \"./constants.js\";\n\nfunction wrapRunnerWithLogger(\n baseRunner: ToolRunner,\n logger: TradeLogger,\n): ToolRunner {\n return async (toolName, args) => {\n const start = Date.now();\n try {\n const result = await baseRunner(toolName, args);\n logger.logTool(\"info\", toolName, args, { status: \"ok\" }, Date.now() - start);\n return result;\n } catch (error) {\n logger.logTool(\"error\", toolName, args, error, Date.now() - start);\n throw error;\n }\n };\n}\n\nfunction handleSetup(argv: string[]): void {\n const idx = argv.indexOf(\"setup\");\n const rest = argv.slice(idx + 1);\n\n let client: string | undefined;\n let profile: string | undefined;\n let modules: string | undefined;\n\n for (let i = 0; i < rest.length; i++) {\n if (rest[i] === \"--client\" && rest[i + 1]) {\n client = rest[++i];\n } else if (rest[i] === \"--profile\" && rest[i + 1]) {\n profile = rest[++i];\n } else if (rest[i] === \"--modules\" && rest[i + 1]) {\n modules = rest[++i];\n } else if (rest[i] === \"--help\" || rest[i] === \"-h\") {\n printSetupUsage();\n return;\n }\n }\n\n if (!client || !SUPPORTED_CLIENTS.includes(client as ClientId)) {\n errorLine(`Error: --client is required. Supported: ${SUPPORTED_CLIENTS.join(\", \")}`);\n process.exitCode = 1;\n return;\n }\n\n runSetup({ client: client as ClientId, profile, modules });\n}\n\nasync function main(): Promise<void> {\n checkForUpdates(\"@bithumb-tradekit/cli\", CLI_VERSION);\n\n // 1. Setup subcommand (before parseCli)\n if (process.argv[2] === \"setup\") {\n handleSetup(process.argv);\n return;\n }\n\n // 2. Parse arguments\n const { values: v, positionals } = parseCli(process.argv.slice(2));\n\n if (v.version) {\n outputLine(CLI_VERSION);\n return;\n }\n\n if (v.help || positionals.length === 0) {\n printHelp(positionals);\n return;\n }\n\n const [module, action, ...rest] = positionals;\n const json = v.json ?? false;\n\n // 3. Config command (no auth needed, no runner needed)\n if (module === \"config\") {\n const { handleConfigCommand } = await import(\"./commands/config.js\");\n return handleConfigCommand(action, rest, v);\n }\n\n // 4. Load config + create runner\n const config = loadConfig({\n modules: v.modules,\n readOnly: v.readOnly,\n verbose: v.verbose,\n profile: v.profile,\n });\n const client = new BithumbRestClient(config);\n const baseRunner = createToolRunner(client, config);\n const logger = new TradeLogger(v.verbose ? \"debug\" : \"info\");\n const run = wrapRunnerWithLogger(baseRunner, logger);\n\n // 5. Diagnose (needs config but no auth)\n if (module === \"diagnose\") {\n const result = await run(\"system_diagnose\", {});\n const data = result.data ?? result;\n if (json) return printJson(data);\n printKv(data as Record<string, unknown>);\n return;\n }\n\n // 5b. System capabilities (no auth needed)\n // Accept both `system capabilities` (canonical) and `account capabilities` (alias)\n if (\n (module === \"system\" && action === \"capabilities\") ||\n (module === \"account\" && action === \"capabilities\")\n ) {\n const result = await run(\"system_get_capabilities\", {});\n const data = result.data ?? result;\n if (json) return printJson(data);\n printKv(data as Record<string, unknown>);\n return;\n }\n\n // 6. Private API auth guard\n const privateModules = new Set([\"account\", \"trade\", \"twap\", \"withdraw\", \"deposit\"]);\n if (privateModules.has(module) && !config.hasAuth) {\n errorLine(\n \"Error: API credentials required. Run 'bithumb setup' or configure ~/.bithumb/config.toml\",\n );\n process.exitCode = 1;\n return;\n }\n\n // 7. Module routing\n if (module === \"market\") {\n const { handleMarketCommand } = await import(\"./commands/market.js\");\n return handleMarketCommand(run, action, rest, v, json);\n }\n if (module === \"account\") {\n const { handleAccountCommand } = await import(\"./commands/account.js\");\n return handleAccountCommand(run, action, v, json);\n }\n if (module === \"trade\") {\n const { handleTradeCommand } = await import(\"./commands/trade.js\");\n return handleTradeCommand(run, action, v, json);\n }\n if (module === \"twap\") {\n const { handleTwapCommand } = await import(\"./commands/twap.js\");\n return handleTwapCommand(run, action, v, json);\n }\n if (module === \"withdraw\") {\n const { handleWithdrawCommand } = await import(\"./commands/withdraw.js\");\n return handleWithdrawCommand(run, action, v, json);\n }\n if (module === \"deposit\") {\n const { handleDepositCommand } = await import(\"./commands/deposit.js\");\n return handleDepositCommand(run, action, v, json);\n }\n\n errorLine(`Unknown command: ${module}. Run 'bithumb --help' for usage.`);\n process.exitCode = 1;\n}\n\nmain().catch((err) => {\n errorLine(`Fatal: ${err instanceof Error ? err.message : String(err)}`);\n process.exitCode = 1;\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAO,IAAM,cAAc;;;ACG3B,IAAM,cAAc;AAAA,WACT,WAAW;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA6BtB,IAAM,cAAc;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAgCpB,IAAM,eAAe;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA0BrB,IAAM,aAAa;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;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MAAI,WAAW,YAAY;AACzB,UAAM,EAAE,sBAAsB,IAAI,MAAM,OAAO,wBAAwB;AACvE,WAAO,sBAAsB,KAAK,QAAQ,GAAG,IAAI;AAAA,EACnD;AACA,MAAI,WAAW,WAAW;AACxB,UAAM,EAAE,qBAAqB,IAAI,MAAM,OAAO,uBAAuB;AACrE,WAAO,qBAAqB,KAAK,QAAQ,GAAG,IAAI;AAAA,EAClD;AAEA,YAAU,oBAAoB,MAAM,mCAAmC;AACvE,UAAQ,WAAW;AACrB;AAEA,KAAK,EAAE,MAAM,CAAC,QAAQ;AACpB,YAAU,UAAU,eAAe,QAAQ,IAAI,UAAU,OAAO,GAAG,CAAC,EAAE;AACtE,UAAQ,WAAW;AACrB,CAAC;","names":[]}
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/commands/config.ts"],"sourcesContent":["import {\n configFilePath,\n readFullConfig,\n writeFullConfig,\n} from \"@bithumb-tradekit/core\";\nimport type { BithumbTomlConfig } from \"@bithumb-tradekit/core\";\nimport type { CliValues } from \"../parser.js\";\nimport { outputLine, errorLine, printJson, printKv, printTable } from \"../formatter.js\";\nimport { existsSync, mkdirSync } from \"node:fs\";\nimport { dirname } from \"node:path\";\n\nexport function handleConfigCommand(\n action: string,\n rest: string[],\n v: CliValues,\n): void {\n const json = v.json ?? false;\n switch (action) {\n case \"show\":\n return cmdConfigShow(json);\n case \"init\":\n return cmdConfigInit();\n case \"set\":\n return cmdConfigSet(rest[0], rest[1], v.profile);\n case \"add-profile\":\n return cmdConfigAddProfile(rest, v);\n case \"list-profiles\":\n return cmdConfigListProfiles(json);\n case \"use\":\n return cmdConfigUse(rest[0]);\n case \"path\":\n outputLine(configFilePath());\n return;\n default:\n if (!action) {\n return cmdConfigShow(json);\n }\n errorLine(`Unknown config command: ${action}. Available: show, init, set, add-profile, list-profiles, use, path`);\n process.exitCode = 1;\n }\n}\n\nfunction cmdConfigShow(json: boolean): void {\n const config = readFullConfig();\n if (json) return printJson(config);\n outputLine(`Config file: ${configFilePath()}`);\n if (config.default_profile) {\n outputLine(`Default profile: ${config.default_profile}`);\n }\n outputLine(\"\");\n const profileNames = Object.keys(config.profiles);\n if (profileNames.length === 0) {\n outputLine(\"No profiles configured. Run 'bithumb config init' to create one.\");\n return;\n }\n for (const name of profileNames) {\n const p = config.profiles[name];\n outputLine(`[${name}]`);\n printKv({\n access_key: p.access_key ? `${p.access_key.slice(0, 8)}...` : \"(not set)\",\n secret_key: p.secret_key ? \"***\" : \"(not set)\",\n ...(p.base_url ? { base_url: p.base_url } : {}),\n ...(p.timeout_ms ? { timeout_ms: p.timeout_ms } : {}),\n });\n outputLine(\"\");\n }\n}\n\nfunction cmdConfigInit(): void {\n const path = configFilePath();\n if (existsSync(path)) {\n outputLine(`Config file already exists: ${path}`);\n outputLine(\"Use 'bithumb config add-profile' to add a new profile.\");\n return;\n }\n const dir = dirname(path);\n if (!existsSync(dir)) {\n mkdirSync(dir, { recursive: true });\n }\n const config: BithumbTomlConfig = {\n default_profile: \"default\",\n profiles: {\n default: {\n access_key: \"\",\n secret_key: \"\",\n },\n },\n };\n writeFullConfig(config);\n outputLine(`Config file created: ${path}`);\n outputLine(\"Edit it to add your API credentials.\");\n}\n\nfunction cmdConfigSet(key: string | undefined, value: string | undefined, profileName?: string): void {\n if (!key || value === undefined) {\n errorLine(\"Usage: bithumb config set <key> <value> [--profile <name>]\");\n errorLine(\"Keys: access_key, secret_key, base_url, timeout_ms\");\n process.exitCode = 1;\n return;\n }\n const validKeys = new Set([\"access_key\", \"secret_key\", \"base_url\", \"timeout_ms\"]);\n if (!validKeys.has(key)) {\n errorLine(`Invalid key: ${key}. Valid keys: ${[...validKeys].join(\", \")}`);\n process.exitCode = 1;\n return;\n }\n const config = readFullConfig();\n const name = profileName ?? config.default_profile ?? \"default\";\n if (!config.profiles[name]) {\n config.profiles[name] = {};\n }\n if (key === \"timeout_ms\") {\n (config.profiles[name] as Record<string, unknown>)[key] = Number(value);\n } else {\n (config.profiles[name] as Record<string, unknown>)[key] = value;\n }\n writeFullConfig(config);\n outputLine(`Set ${name}.${key}`);\n}\n\nfunction cmdConfigAddProfile(rest: string[], _v: CliValues): void {\n const name = rest[0];\n if (!name) {\n errorLine(\"Usage: bithumb config add-profile <name>\");\n process.exitCode = 1;\n return;\n }\n const config = readFullConfig();\n if (config.profiles[name]) {\n errorLine(`Profile '${name}' already exists.`);\n process.exitCode = 1;\n return;\n }\n config.profiles[name] = {\n access_key: \"\",\n secret_key: \"\",\n };\n writeFullConfig(config);\n outputLine(`Profile '${name}' added. Edit ${configFilePath()} to set credentials.`);\n}\n\nfunction cmdConfigListProfiles(json: boolean): void {\n const config = readFullConfig();\n const profiles = Object.entries(config.profiles).map(([name, p]) => ({\n name,\n default: name === (config.default_profile ?? \"default\") ? \"*\" : \"\",\n has_credentials: p.access_key && p.secret_key ? \"yes\" : \"no\",\n }));\n if (json) return printJson(profiles);\n if (profiles.length === 0) {\n outputLine(\"No profiles configured.\");\n return;\n }\n printTable(profiles);\n}\n\nfunction cmdConfigUse(profileName: string | undefined): void {\n if (!profileName) {\n errorLine(\"Usage: bithumb config use <profile-name>\");\n process.exitCode = 1;\n return;\n }\n const config = readFullConfig();\n if (!config.profiles[profileName]) {\n errorLine(`Profile '${profileName}' not found. Run 'bithumb config list-profiles' to see available profiles.`);\n process.exitCode = 1;\n return;\n }\n config.default_profile = profileName;\n writeFullConfig(config);\n outputLine(`Default profile set to '${profileName}'`);\n}\n"],"mappings":";;;;;;;;;;;;;;;AAQA,SAAS,YAAY,iBAAiB;AACtC,SAAS,eAAe;AAEjB,SAAS,oBACd,QACA,MACA,GACM;AACN,QAAM,OAAO,EAAE,QAAQ;AACvB,UAAQ,QAAQ;AAAA,IACd,KAAK;AACH,aAAO,cAAc,IAAI;AAAA,IAC3B,KAAK;AACH,aAAO,cAAc;AAAA,IACvB,KAAK;AACH,aAAO,aAAa,KAAK,CAAC,GAAG,KAAK,CAAC,GAAG,EA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