degate-cli 1.0.5 → 1.0.6

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 (2) hide show
  1. package/cli.js +12 -7
  2. package/package.json +1 -1
package/cli.js CHANGED
@@ -939,11 +939,15 @@ async function cmdPositions(options) {
939
939
  const quoteSymbol = p.token_b?.symbol || '?';
940
940
  const poolName = `${baseSymbol}/${quoteSymbol}`;
941
941
  const posAddr = (p.position || '').slice(0, 16) + '...';
942
- const range = `${p.tick_lower || '-'} - ${p.tick_upper || '-'}`;
943
- const totalYield = p.total_yields || p.total_yield_usd;
944
- const value = p.position_value ? `$${parseFloat(p.position_value).toFixed(2)}` : '-';
945
- const yield_ = totalYield ? `$${parseFloat(totalYield).toFixed(4)}` : '-';
946
- const apy = p.apy ? `${parseFloat(p.apy).toFixed(2)}%` : '-';
942
+ const lower = p.tick_lower != null ? parseFloat(p.tick_lower).toFixed(4) : '-';
943
+ const upper = p.tick_upper != null ? parseFloat(p.tick_upper).toFixed(4) : '-';
944
+ const range = `${lower} - ${upper}`;
945
+ const yieldUsd = parseFloat(p.total_yield_usd || 0);
946
+ const principal = parseFloat(p.init_principal || 0);
947
+ const currentValue = principal + yieldUsd;
948
+ const value = currentValue > 0 ? `$${currentValue.toFixed(2)}` : '-';
949
+ const yield_ = p.total_yield_usd ? `$${yieldUsd.toFixed(4)}` : '-';
950
+ const apy = p.yesterday_apy ? `${parseFloat(p.yesterday_apy).toFixed(2)}%` : '-';
947
951
  table.push([i + 1, poolName, posAddr, range, value, yield_, apy, p.status]);
948
952
  });
949
953
 
@@ -999,8 +1003,9 @@ async function cmdWithdraw(options) {
999
1003
  choices: positions.map((p, i) => {
1000
1004
  const base = p.token_a?.symbol || '?';
1001
1005
  const quote = p.token_b?.symbol || '?';
1002
- const value = p.position_value ? `$${parseFloat(p.position_value).toFixed(2)}` : '-';
1003
- const apy = p.apy ? `${parseFloat(p.apy).toFixed(2)}%` : '-';
1006
+ const currentValue = parseFloat(p.init_principal || 0) + parseFloat(p.total_yield_usd || 0);
1007
+ const value = currentValue > 0 ? `$${currentValue.toFixed(2)}` : '-';
1008
+ const apy = p.yesterday_apy ? `${parseFloat(p.yesterday_apy).toFixed(2)}%` : '-';
1004
1009
  return {
1005
1010
  name: `[${i + 1}] ${base}/${quote} ${value} APY ${apy} ${p.position}`,
1006
1011
  value: p.position,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "degate-cli",
3
- "version": "1.0.5",
3
+ "version": "1.0.6",
4
4
  "description": "DeGate Turbo Range CLI - deposit/withdraw LP positions across Solana & EVM chains",
5
5
  "main": "cli.js",
6
6
  "bin": {