-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Group Open LP Positions by Yield Source and Chain Id #1670
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
6 Skipped Deployments
|
for (const hyperdrive of appConfig.hyperdrives) { | ||
const key = `${hyperdrive.chainId}-${hyperdrive.yieldSource}`; | ||
if (!hyperdrivesByChainAndYieldSource[key]) { | ||
hyperdrivesByChainAndYieldSource[key] = []; | ||
} | ||
hyperdrivesByChainAndYieldSource[key].push(hyperdrive); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: let's use lodash's groupBy
to do this.
export function useTotalOpenLpPositions({ | ||
account, | ||
openLpPositions, | ||
enabled, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: this should default to true
to be consistent with our other hooks that have an enabled
arg
</div> | ||
{/* Custom border with inset for the first and last header cells */} | ||
<span | ||
<> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR refactors the Open LP position tables on the portfolio to take an array of Hyperdrives grouped by yield source. Previously, each Hyperdrive instance rendered one table with one row if there was an open LP position. By grouping these positions by yield source we can add open position totals to the top of each table.