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.
- package/README.md +10 -10
- package/dist/cli.js +12 -4
- 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
|
-
|
|
15
|
+
bunx hufi-cli --help
|
|
16
16
|
|
|
17
17
|
# Authenticate
|
|
18
|
-
|
|
18
|
+
bunx hufi-cli auth login --private-key 0x...
|
|
19
19
|
|
|
20
20
|
# Generate a new wallet
|
|
21
|
-
|
|
21
|
+
bunx hufi-cli auth generate
|
|
22
22
|
|
|
23
23
|
# Check auth status
|
|
24
|
-
|
|
24
|
+
bunx hufi-cli auth status
|
|
25
25
|
|
|
26
26
|
# Register exchange API key
|
|
27
|
-
|
|
27
|
+
bunx hufi-cli exchange register --name mexc --api-key xxx --secret-key yyy
|
|
28
28
|
|
|
29
29
|
# List exchange API keys
|
|
30
|
-
|
|
30
|
+
bunx hufi-cli exchange list
|
|
31
31
|
|
|
32
32
|
# Check campaign join status
|
|
33
|
-
|
|
33
|
+
bunx hufi-cli campaign status --chain-id 137 --address 0x...
|
|
34
34
|
|
|
35
35
|
# Join a campaign
|
|
36
|
-
|
|
36
|
+
bunx hufi-cli campaign join --chain-id 137 --address 0x...
|
|
37
37
|
|
|
38
38
|
# List joined campaigns
|
|
39
|
-
|
|
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
|
-
|
|
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(`
|
|
9619
|
-
printText(`
|
|
9620
|
-
printText(`
|
|
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.
|
|
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);
|