hufi-cli 1.0.0 → 1.0.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.
- package/README.md +2 -0
- package/dist/cli.js +18 -13
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -70,6 +70,8 @@ hufi campaign progress --address 0x... --watch --interval 3000
|
|
|
70
70
|
hufi campaign leaderboard --address 0x... # leaderboard
|
|
71
71
|
```
|
|
72
72
|
|
|
73
|
+
`campaign list` and `campaign get` print exact campaign timestamps and round token balances for human-readable text output.
|
|
74
|
+
|
|
73
75
|
#### Campaign Create
|
|
74
76
|
|
|
75
77
|
Requires staked HMT, gas, and fund tokens (USDT/USDC). Creates an escrow contract on-chain.
|
package/dist/cli.js
CHANGED
|
@@ -24966,6 +24966,16 @@ async function runWatchLoop(fn, options = {}) {
|
|
|
24966
24966
|
}
|
|
24967
24967
|
|
|
24968
24968
|
// src/commands/campaign.ts
|
|
24969
|
+
function formatCampaignTimestamp(value) {
|
|
24970
|
+
if (!value)
|
|
24971
|
+
return "-";
|
|
24972
|
+
return value.replace("T", " ").replace(/\.\d+Z$/, "").replace(/Z$/, "");
|
|
24973
|
+
}
|
|
24974
|
+
function formatTokenAmount(value, decimals, displayDecimals = 2) {
|
|
24975
|
+
const amount = new bignumber_default(value).dividedBy(new bignumber_default(10).pow(decimals));
|
|
24976
|
+
const rounded = amount.decimalPlaces(displayDecimals, bignumber_default.ROUND_HALF_UP);
|
|
24977
|
+
return rounded.toFormat().replace(/\.0+$/, "").replace(/(\.\d*?)0+$/, "$1");
|
|
24978
|
+
}
|
|
24969
24979
|
function formatCampaignCreateProgress(confirmations) {
|
|
24970
24980
|
if (confirmations <= 0) {
|
|
24971
24981
|
return "Transaction submitted. Waiting for confirmations...";
|
|
@@ -25008,10 +25018,6 @@ function createCampaignCommand() {
|
|
|
25008
25018
|
const joined = joinedKeys.has(key);
|
|
25009
25019
|
const tag = joined ? " [JOINED]" : "";
|
|
25010
25020
|
const decimals = c.fund_token_decimals ?? 0;
|
|
25011
|
-
const fmt = (v) => {
|
|
25012
|
-
const bn = new bignumber_default(v).dividedBy(new bignumber_default(10).pow(decimals));
|
|
25013
|
-
return bn.toFormat();
|
|
25014
|
-
};
|
|
25015
25021
|
const fundAmount = new bignumber_default(c.fund_amount);
|
|
25016
25022
|
const balanceNum = new bignumber_default(c.balance);
|
|
25017
25023
|
const pct = fundAmount.gt(0) ? balanceNum.dividedBy(fundAmount).times(100).toFixed(1) : "0.0";
|
|
@@ -25019,8 +25025,8 @@ function createCampaignCommand() {
|
|
|
25019
25025
|
printText(` chain: ${c.chain_id}`);
|
|
25020
25026
|
printText(` address: ${c.address}`);
|
|
25021
25027
|
printText(` status: ${c.status}`);
|
|
25022
|
-
printText(` duration: ${c.start_date
|
|
25023
|
-
printText(` funded: ${
|
|
25028
|
+
printText(` duration: ${formatCampaignTimestamp(c.start_date)} ~ ${formatCampaignTimestamp(c.end_date)}`);
|
|
25029
|
+
printText(` funded: ${formatTokenAmount(c.fund_amount, decimals)} ${c.fund_token_symbol} paid: ${formatTokenAmount(c.amount_paid, decimals)} balance: ${formatTokenAmount(c.balance, decimals)} (${pct}%)`);
|
|
25024
25030
|
printText("");
|
|
25025
25031
|
}
|
|
25026
25032
|
if (opts.status === "active") {
|
|
@@ -25048,12 +25054,11 @@ function createCampaignCommand() {
|
|
|
25048
25054
|
printText(` chain: ${c.chain_id}`);
|
|
25049
25055
|
printText(` status: ${c.status}`);
|
|
25050
25056
|
const showDecimals = c.fund_token_decimals ?? 0;
|
|
25051
|
-
|
|
25052
|
-
printText(`
|
|
25053
|
-
printText(`
|
|
25054
|
-
printText(`
|
|
25055
|
-
printText(`
|
|
25056
|
-
printText(` end: ${c.end_date}`);
|
|
25057
|
+
printText(` funded: ${formatTokenAmount(c.fund_amount, showDecimals)} ${c.fund_token_symbol}`);
|
|
25058
|
+
printText(` balance: ${formatTokenAmount(c.balance, showDecimals)} ${c.fund_token_symbol}`);
|
|
25059
|
+
printText(` paid: ${formatTokenAmount(c.amount_paid, showDecimals)} ${c.fund_token_symbol}`);
|
|
25060
|
+
printText(` start: ${formatCampaignTimestamp(c.start_date)}`);
|
|
25061
|
+
printText(` end: ${formatCampaignTimestamp(c.end_date)}`);
|
|
25057
25062
|
printText(` launcher: ${c.launcher}`);
|
|
25058
25063
|
}
|
|
25059
25064
|
} catch (err) {
|
|
@@ -25595,7 +25600,7 @@ function createDashboardCommand() {
|
|
|
25595
25600
|
|
|
25596
25601
|
// src/cli.ts
|
|
25597
25602
|
var program2 = new Command;
|
|
25598
|
-
program2.name("hufi").description("CLI tool for hu.fi DeFi platform").version("1.0.
|
|
25603
|
+
program2.name("hufi").description("CLI tool for hu.fi DeFi platform").version("1.0.1").option("--config-file <path>", "Custom config file path (default: ~/.hufi-cli/config.json)").option("--key-file <path>", "Custom key file path (default: ~/.hufi-cli/key.json)").hook("preAction", (thisCommand) => {
|
|
25599
25604
|
const opts = thisCommand.opts();
|
|
25600
25605
|
if (opts.configFile) {
|
|
25601
25606
|
setConfigFile(opts.configFile);
|