-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/main' into tu/turn-on-abacus-ts
- Loading branch information
Showing
10 changed files
with
141 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
import { type RootState } from '@/state/_store'; | ||
import { getCurrentMarketId } from '@/state/perpetualsSelectors'; | ||
|
||
import { | ||
getCurrentMarketAccountFills, | ||
selectAccountFills, | ||
selectAccountFillsLoading, | ||
selectAccountOrdersLoading, | ||
selectCurrentMarketOpenOrders, | ||
selectCurrentMarketOrderHistory, | ||
selectOpenOrders, | ||
selectOrderHistory, | ||
selectParentSubaccountOpenPositions, | ||
selectParentSubaccountOpenPositionsLoading, | ||
selectParentSubaccountSummary, | ||
selectParentSubaccountSummaryLoading, | ||
} from './selectors/account'; | ||
import { | ||
selectAllAssetsInfo, | ||
selectAllAssetsInfoLoading, | ||
selectCurrentMarketAssetInfo, | ||
} from './selectors/assets'; | ||
import { | ||
selectRawIndexerHeightData, | ||
selectRawIndexerHeightDataLoading, | ||
selectRawValidatorHeightData, | ||
selectRawValidatorHeightDataLoading, | ||
} from './selectors/base'; | ||
import { | ||
selectAllMarketsInfo, | ||
selectAllMarketsInfoLoading, | ||
selectCurrentMarketInfo, | ||
} from './selectors/markets'; | ||
|
||
// every leaf is a selector or a paramaterized selector | ||
type NestedSelectors = { | ||
[K: string]: | ||
| NestedSelectors | ||
| ((state: RootState) => any) | ||
| (() => (state: RootState, ...other: any[]) => any); | ||
}; | ||
|
||
// all data should be accessed via selectors in this file | ||
// no files outside abacus-ts should access anything within abacus-ts except this file | ||
export const BonsaiCore = { | ||
account: { | ||
parentSubaccountSummary: { | ||
data: selectParentSubaccountSummary, | ||
loading: selectParentSubaccountSummaryLoading, | ||
}, | ||
parentSubaccountPositions: { | ||
data: selectParentSubaccountOpenPositions, | ||
loading: selectParentSubaccountOpenPositionsLoading, | ||
}, | ||
openOrders: { | ||
data: selectOpenOrders, | ||
loading: selectAccountOrdersLoading, | ||
}, | ||
orderHistory: { | ||
data: selectOrderHistory, | ||
loading: selectAccountOrdersLoading, | ||
}, | ||
fills: { | ||
data: selectAccountFills, | ||
loading: selectAccountFillsLoading, | ||
}, | ||
}, | ||
markets: { | ||
currentMarketId: getCurrentMarketId, | ||
markets: { | ||
data: selectAllMarketsInfo, | ||
loading: selectAllMarketsInfoLoading, | ||
}, | ||
assets: { data: selectAllAssetsInfo, loading: selectAllAssetsInfoLoading }, | ||
}, | ||
network: { | ||
indexerHeight: { | ||
data: selectRawIndexerHeightData, | ||
loading: selectRawIndexerHeightDataLoading, | ||
}, | ||
validatorHeight: { | ||
data: selectRawValidatorHeightData, | ||
loading: selectRawValidatorHeightDataLoading, | ||
}, | ||
}, | ||
} as const satisfies NestedSelectors; | ||
|
||
export const BonsaiHelpers = { | ||
currentMarket: { | ||
marketInfo: selectCurrentMarketInfo, | ||
assetInfo: selectCurrentMarketAssetInfo, | ||
account: { | ||
openOrders: selectCurrentMarketOpenOrders, | ||
orderHistory: selectCurrentMarketOrderHistory, | ||
fills: getCurrentMarketAccountFills, | ||
}, | ||
}, | ||
} as const satisfies NestedSelectors; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters