Skip to content
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: abacus-ts raw data loading #1341

Merged
merged 46 commits into from
Dec 18, 2024
Merged

feat: abacus-ts raw data loading #1341

merged 46 commits into from
Dec 18, 2024

Conversation

tyleroooo
Copy link
Contributor

@tyleroooo tyleroooo commented Nov 27, 2024

New Library

  • Typia: used to generate runtime type checker functions for arbitrary typescript interfaces. This ensures the indexer types are always correct.

Core Library Files

  • loadable.ts: Defines a type system for representing loading states that is compatible with react query.
  • createStoreEffect.ts: Creates Redux store effects with cleanup handling. Like useEffect but with no react.
  • resourceCacheManager.ts: A generic resource management system with reference counting. Give it a constructor and destructor for a resource and it manages a cache of them.
  • signal.ts: Provides a simple event emitting system for cross-component communication.

Websocket Library Files

  • reconnectingWebsocket.ts: Implements a WebSocket connection with automatic reconnection and exponential backoff.
  • indexerWebsocket.ts: Manages channel subscriptions and message handling for the indexer WebSocket connection.
  • indexerWebsocketManager.ts: Provides resource management for Indexer WebSocket connections with reference counting.
  • websocketDerivedValue.ts: Provides a wrapper class for managing derived state from WebSocket data with change notifications.

Websocket Files

  • parentSubaccount.ts: Manages real-time state of current wallet parent/child subaccount data through WebSocket connection.
  • markets.ts: Handles market data through websocket.
  • orderbook.ts: Maintains current market orderbook state through websocket.

REST Library Files

  • indexerQueryStoreEffect.ts: Provides a framework for creating store effects tied to indexer REST API queries.
  • indexerClientManager.ts: Manages indexer client instances with resource sharing and cleanup.

REST Files

  • fills.ts: Manages REST API queries for trade fill data.
  • orders.ts: Handles REST API queries for order data.
  • transfers.ts: Manages REST API queries for transfer data.
  • blockTradingRewards.ts: Handles REST API queries for block trading rewards.

Root Files

  • accountRefreshSignal.ts: Manages signals for account data refresh events. This ensures that any time the socket gets reset we fetch the latest REST data too (if it's stale).

@tyleroooo tyleroooo requested a review from a team as a code owner November 27, 2024 00:10
Copy link

vercel bot commented Nov 27, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
v4-staging ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 17, 2024 10:46pm
v4-testnet ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 17, 2024 10:46pm

@tyleroooo tyleroooo marked this pull request as draft November 27, 2024 00:10
@tyleroooo tyleroooo changed the title feat: add all indexer/chain types types feat: add all indexer/chain model types Nov 27, 2024
scripts/swagger_codegen.sh Outdated Show resolved Hide resolved
sed -i '' '/markets: { \[key: string\]: PerpetualMarketResponseObject; };/s/;$//' generated/api.ts
sed -i '' 's/openPerpetualPositions: PerpetualPositionsMap;/openPerpetualPositions: { [market: string]: PerpetualPositionResponseObject };/' generated/api.ts
sed -i '' 's/assetPositions: AssetPositionsMap;/assetPositions: { [symbol: string]: AssetPositionResponseObject };/' generated/api.ts
sed -i '' 's/= <any>/=/' generated/api.ts
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe add a note to top of file that it's generated

src/types/indexer/chain.ts Outdated Show resolved Hide resolved
package.json Outdated
@@ -60,7 +60,6 @@
"@dydxprotocol/v4-localization": "^1.1.257",
"@dydxprotocol/v4-proto": "^7.0.0-dev.0",
"@emotion/is-prop-valid": "^1.3.0",
"@ethersproject/providers": "^5.7.2",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

was this on purpose?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oop I thought tina removed it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah it's not on main i think

Copy link
Contributor

@tinaszheng tinaszheng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice!

@tyleroooo tyleroooo merged commit 0a1678a into main Dec 18, 2024
9 checks passed
@tyleroooo tyleroooo deleted the tu/abacus-ts-types branch December 18, 2024 19:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants