-
Notifications
You must be signed in to change notification settings - Fork 72
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
feat: migrate positions table to abacus-ts #1375
base: main
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
const numTotalPositions = (useAppSelector(selectParentSubaccountOpenPositions) ?? EMPTY_ARR) | ||
.length; |
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.
ok for now. but i feel like we get this num in multiple places. might be good to move to a hook
}; | ||
}, [position, stringGetter]); | ||
|
||
return ( | ||
<TableCell | ||
slotRight={ | ||
marginMode === AbacusMarginMode.Isolated && ( | ||
marginMode === 'ISOLATED' && ( |
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.
Would it be worth adding MarginMode enums?
@@ -29,31 +27,33 @@ export const PositionsMarginCell = ({ position }: PositionsMarginCellProps) => { | |||
const dispatch = useAppDispatch(); | |||
|
|||
const { marginMode, margin } = useMemo(() => { | |||
const { childSubaccountNumber } = position; | |||
const derivedMarginMode = getMarginModeFromSubaccountNumber(childSubaccountNumber); | |||
const { marginMode: marginModeInner, marginValueInitial } = position; |
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.
not in love with the Inner suffix haha
asset != null | ||
? ({ | ||
id: asset.id, | ||
name: asset.name, | ||
tags: [], | ||
resources: { imageUrl: asset.logo }, | ||
} as unknown as Asset) | ||
: undefined |
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.
can this be updated w/ selectAllAssetsInfo -> selectAssetInfoFromId (new selector). Can probably call selector from <MarketTableCell marketId={...} />
|
||
const openPositions = useAppSelector(getExistingOpenPositions, shallowEqual) ?? EMPTY_ARR; | ||
const perpetualMarkets = orEmptyRecord(useAppSelector(selectRawMarketsData)); |
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.
why use rawMarketsData instead of selectAllMarketsInfo
?
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.
w/ rebase you'll be able to get assetId, tickSizeDecimals, etc.
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.
it might make sense to convert all values to bigNumber within calculateMarkets as well
No description provided.