hufi-cli 0.3.1 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +10 -10
  2. package/dist/cli.js +12 -4
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -12,31 +12,31 @@ bun install
12
12
 
13
13
  ```bash
14
14
  # Show help
15
- bun src/cli.ts --help
15
+ bunx hufi-cli --help
16
16
 
17
17
  # Authenticate
18
- bun src/cli.ts auth login --private-key 0x...
18
+ bunx hufi-cli auth login --private-key 0x...
19
19
 
20
20
  # Generate a new wallet
21
- bun src/cli.ts auth generate
21
+ bunx hufi-cli auth generate
22
22
 
23
23
  # Check auth status
24
- bun src/cli.ts auth status
24
+ bunx hufi-cli auth status
25
25
 
26
26
  # Register exchange API key
27
- bun src/cli.ts exchange register --name mexc --api-key xxx --secret-key yyy
27
+ bunx hufi-cli exchange register --name mexc --api-key xxx --secret-key yyy
28
28
 
29
29
  # List exchange API keys
30
- bun src/cli.ts exchange list
30
+ bunx hufi-cli exchange list
31
31
 
32
32
  # Check campaign join status
33
- bun src/cli.ts campaign status --chain-id 137 --address 0x...
33
+ bunx hufi-cli campaign status --chain-id 137 --address 0x...
34
34
 
35
35
  # Join a campaign
36
- bun src/cli.ts campaign join --chain-id 137 --address 0x...
36
+ bunx hufi-cli campaign join --chain-id 137 --address 0x...
37
37
 
38
38
  # List joined campaigns
39
- bun src/cli.ts campaign list --limit 20
39
+ bunx hufi-cli campaign list --limit 20
40
40
  ```
41
41
 
42
42
  ## Global Options
@@ -56,7 +56,7 @@ Configuration is stored at `~/.hufi-cli/config.json`.
56
56
 
57
57
  ```bash
58
58
  # Run directly
59
- bun src/cli.ts --help
59
+ bunx hufi-cli --help
60
60
 
61
61
  # Run tests
62
62
  bun test
package/dist/cli.js CHANGED
@@ -9614,10 +9614,18 @@ function createCampaignCommand() {
9614
9614
  const key = `${c.chain_id}:${c.address}`;
9615
9615
  const joined = joinedKeys.has(key);
9616
9616
  const tag = joined ? " [JOINED]" : "";
9617
+ const decimals = c.fund_token_decimals ?? 0;
9618
+ const div = Math.pow(10, decimals);
9619
+ const fmt = (v) => (Number(v) / div).toLocaleString(undefined, { maximumFractionDigits: decimals });
9620
+ const fundAmount = Number(c.fund_amount);
9621
+ const balanceNum = Number(c.balance);
9622
+ const pct = fundAmount > 0 ? (balanceNum / fundAmount * 100).toFixed(1) : "0.0";
9617
9623
  printText(` ${c.exchange_name} ${c.symbol} (${c.type})${tag}`);
9618
- printText(` address: ${c.address}`);
9619
- printText(` status: ${c.status}`);
9620
- printText(` funded: ${c.fund_amount} ${c.fund_token_symbol} balance: ${c.balance}`);
9624
+ printText(` chain: ${c.chain_id}`);
9625
+ printText(` address: ${c.address}`);
9626
+ printText(` status: ${c.status}`);
9627
+ printText(` duration: ${c.start_date?.split("T")[0] ?? "-"} ~ ${c.end_date?.split("T")[0] ?? "-"}`);
9628
+ printText(` funded: ${fmt(c.fund_amount)} ${c.fund_token_symbol} paid: ${fmt(c.amount_paid)} balance: ${fmt(c.balance)} (${pct}%)`);
9621
9629
  printText("");
9622
9630
  }
9623
9631
  if (opts.status === "active") {
@@ -9886,7 +9894,7 @@ var FISH_COMPLETION = [
9886
9894
  ].join(`
9887
9895
  `);
9888
9896
  var program2 = new Command;
9889
- program2.name("hufi").description("CLI tool for hu.fi DeFi platform").version("0.3.1");
9897
+ program2.name("hufi").description("CLI tool for hu.fi DeFi platform").version("0.4.0");
9890
9898
  program2.command("completion").description("Generate shell completion script").option("--bash", "Bash completion (default)").option("--zsh", "Zsh completion").option("--fish", "Fish completion").action((opts) => {
9891
9899
  if (opts.zsh) {
9892
9900
  console.log(ZSH_COMPLETION);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hufi-cli",
3
- "version": "0.3.1",
3
+ "version": "0.4.0",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "hufi": "./dist/cli.js"