degate-cli 1.0.6 → 1.0.8
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/cli.js +5 -3
- package/package.json +1 -1
package/cli.js
CHANGED
|
@@ -943,7 +943,8 @@ async function cmdPositions(options) {
|
|
|
943
943
|
const upper = p.tick_upper != null ? parseFloat(p.tick_upper).toFixed(4) : '-';
|
|
944
944
|
const range = `${lower} - ${upper}`;
|
|
945
945
|
const yieldUsd = parseFloat(p.total_yield_usd || 0);
|
|
946
|
-
const
|
|
946
|
+
const decimals = p.token_b?.decimals || 6;
|
|
947
|
+
const principal = parseFloat(p.init_principal || 0) / Math.pow(10, decimals);
|
|
947
948
|
const currentValue = principal + yieldUsd;
|
|
948
949
|
const value = currentValue > 0 ? `$${currentValue.toFixed(2)}` : '-';
|
|
949
950
|
const yield_ = p.total_yield_usd ? `$${yieldUsd.toFixed(4)}` : '-';
|
|
@@ -1003,7 +1004,8 @@ async function cmdWithdraw(options) {
|
|
|
1003
1004
|
choices: positions.map((p, i) => {
|
|
1004
1005
|
const base = p.token_a?.symbol || '?';
|
|
1005
1006
|
const quote = p.token_b?.symbol || '?';
|
|
1006
|
-
const
|
|
1007
|
+
const decimals = p.token_b?.decimals || 6;
|
|
1008
|
+
const currentValue = parseFloat(p.init_principal || 0) / Math.pow(10, decimals) + parseFloat(p.total_yield_usd || 0);
|
|
1007
1009
|
const value = currentValue > 0 ? `$${currentValue.toFixed(2)}` : '-';
|
|
1008
1010
|
const apy = p.yesterday_apy ? `${parseFloat(p.yesterday_apy).toFixed(2)}%` : '-';
|
|
1009
1011
|
return {
|
|
@@ -1102,7 +1104,7 @@ const program = new Command();
|
|
|
1102
1104
|
program
|
|
1103
1105
|
.name('degate-cli')
|
|
1104
1106
|
.description('DeGate Turbo Range CLI - 开仓/平仓工具')
|
|
1105
|
-
.version('
|
|
1107
|
+
.version(require('./package.json').version);
|
|
1106
1108
|
|
|
1107
1109
|
program
|
|
1108
1110
|
.command('setup')
|