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

Open
wants to merge 38 commits into
base: main
Choose a base branch
from
Open

feat: abacus-ts raw data loading #1341

wants to merge 38 commits into from

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 12, 2024 9:47pm
v4-testnet ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 12, 2024 9:47pm

@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
@@ -42,7 +42,7 @@
"test": "vitest run",
"tsc": "tsc",
"postinstall": "tar -xzC public -f tradingview/tradingview.tgz",
"prepare": "husky",
"prepare": "ts-patch install && typia patch && husky",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I honestly don't know what this is for, the typia installer helper did this.

Copy link
Contributor

Choose a reason for hiding this comment

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

----------------------------------------
 Typia Setup Wizard
----------------------------------------
Since TypeScript v5.3 update, "tsc" no more parses JSDoc comments.

Therefore, "typia" revives the JSDoc parsing feature by patching "tsc".

This is a temporary feature of "typia", and it would be removed when "ts-patch" being updated.

This is the message I got from installing

Copy link
Contributor

Choose a reason for hiding this comment

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

the grammar is great

Copy link
Contributor Author

Choose a reason for hiding this comment

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

lmao I have no clue what that even means

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.

2 participants