-
Notifications
You must be signed in to change notification settings - Fork 5
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
[TASK-7014] feat: update squid interfaces #168
Conversation
📝 WalkthroughWalkthroughThe changes in this pull request involve modifications to two main files: Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant API
participant TokenService
Client->>API: Request XChain Options
API->>TokenService: getXChainOptionsForLink()
TokenService->>TokenService: Map tokens to include only selected properties
TokenService-->>API: Return structured token data
API-->>Client: Send XChain Options response
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 0
🧹 Outside diff range and nitpick comments (2)
src/consts/interfaces.consts.ts (1)
246-253
: LGTM! Consider price update mechanism.The new properties enhance the token interface appropriately for UI integration. The addition of
active
,decimals
, andusdPrice
fields provides essential information for token display and calculations.Consider implementing a mechanism to keep
usdPrice
up-to-date, such as:
- Periodic price updates from a reliable price feed
- Caching with TTL to balance freshness with performance
- Websocket updates for real-time price tracking if needed
src/index.ts (1)
2227-2230
: LGTM! Efficient implementation using Map for token grouping.The Map implementation provides efficient token lookup and grouping while maintaining type safety. However, there's a minor formatting inconsistency.
Consider using spaces instead of tabs for indentation to maintain consistency with the rest of the codebase:
- const supportedTokensMap = new Map< - string, - Pick<interfaces.ISquidToken, 'chainId' | 'address' | 'name' | 'symbol' | 'logoURI'>[] - >() + const supportedTokensMap = new Map< + string, + Pick<interfaces.ISquidToken, 'chainId' | 'address' | 'name' | 'symbol' | 'logoURI'>[] + >()
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (2)
src/consts/interfaces.consts.ts
(1 hunks)src/index.ts
(2 hunks)
🔇 Additional comments (2)
src/consts/interfaces.consts.ts (1)
Line range hint 476-484
: LGTM! Verify error code usage consistency.
The new EGenericErrorCodes
enum provides well-structured error codes for common scenarios.
Let's verify consistent error code usage across the codebase:
✅ Verification successful
Error code usage is consistent and well-integrated
The verification shows that the new error codes are being used appropriately throughout the codebase:
ERROR_UNSUPPORTED_TOKEN
is used for unsupported token type validationsERROR_GETTING_TOKENBALANCE
handles token balance fetch failures- Error codes are properly thrown with descriptive messages via
SDKStatus
- Usage patterns align with existing error handling conventions
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check for consistent usage of new error codes
# Search for direct usage of new error codes
echo "Checking direct error code usage..."
rg "EGenericErrorCodes\." -A 2
# Search for error handling patterns
echo "Checking error handling patterns..."
rg "new SDKStatus\(" -A 2
# Look for potential missing error cases
echo "Checking for potential missing error cases..."
rg "(ERROR_UNSUPPORTED_CHAIN|ERROR_GETTING_TOKENBALANCE|ERROR_UNSUPPORTED_TOKEN)" --type ts
Length of output: 2463
src/index.ts (1)
2201-2205
: LGTM! Type definition improves type safety and reduces over-fetching.
The return type definition is well-structured and follows TypeScript best practices by:
- Using Pick to explicitly select required properties
- Including only the necessary token information (chainId, address, name, symbol, logoURI)
@@ -243,11 +243,14 @@ export interface ISquidChain { | |||
} | |||
|
|||
export interface ISquidToken { | |||
active: boolean |
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.
Q: what does active here mean?
To be able to use them from ui