Skip to content

feat: add vault details command#35

Merged
ifdario merged 2 commits intoinfinitefield:mainfrom
lihaostar:fix/vault-tvl-max-timestamp
Mar 10, 2026
Merged

feat: add vault details command#35
ifdario merged 2 commits intoinfinitefield:mainfrom
lihaostar:fix/vault-tvl-max-timestamp

Conversation

@lihaostar
Copy link

@lihaostar lihaostar commented Mar 10, 2026

Summary

  • Add new vault details subcommand to query vault information by address
  • Displays vault name, leader, APR, TVL, follower count, and optional user position
  • TVL is derived from the most recent entry in account_value_history using max_by_key on timestamp
  • Refactor deposit/withdraw into shared execute_transfer helper to remove duplication

Usage

# Query vault info
hypecli vault details --vault <vault-address>

# Include your follower position
hypecli vault details --vault <vault-address> --user <user-address>

Example Output

Vault: My Vault
Address: 0x1234...abcd
Leader: 0xdead...beef
Description: a sample vault

APR: 120.50%
Leader Fraction: 5.00%
Leader Commission: 10.0%
Max Distributable: $1000000.00
Max Withdrawable: $500.00

Followers: 42
TVL: $1234567.89

Your Position:
  Equity: $10000.00
  PnL: $1500.00
  All-time PnL: $2000.00
  Days Following: 30
  Locked Until: 1773157273992

lihao added 2 commits March 10, 2026 23:23
Replace .last() with .iter().max_by_key(|(ts, _)| *ts) when
extracting TVL from account_value_history to correctly find the most
recent value regardless of vector ordering.
@lihaostar lihaostar changed the title fix: use max timestamp for TVL in vault details feat: add vault details command Mar 10, 2026
@lihaostar
Copy link
Author

hi @ifdario would you please help review this PR? thank you.

@ifdario ifdario merged commit 6d0e869 into infinitefield:main Mar 10, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants