-
Notifications
You must be signed in to change notification settings - Fork 619
Fix: Fallback insight owned tokens request to mainnet #7375
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
Fix: Fallback insight owned tokens request to mainnet #7375
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
5 Skipped Deployments
|
WalkthroughThe change updates the logic for setting the Changes
Sequence Diagram(s)sequenceDiagram
participant Caller
participant getOwnedTokens
participant QueryEngine
Caller->>getOwnedTokens: Call with chains[]
getOwnedTokens->>getOwnedTokens: Check if chains is empty
alt chains is empty
getOwnedTokens->>QueryEngine: Query with chain_id = [1]
else chains provided
getOwnedTokens->>QueryEngine: Query with chain_id = chains.map(chain => chain.chainId)
end
QueryEngine-->>getOwnedTokens: Return owned tokens
getOwnedTokens-->>Caller: Return result
Possibly related PRs
Suggested labels
Warning Review ran into problems🔥 ProblemsErrors were encountered while retrieving linked issues. Errors (1)
✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. 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 (
|
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. |
Merge activity
|
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
🧹 Nitpick comments (1)
packages/thirdweb/src/insight/get-tokens.ts (1)
54-54: Document the fallback behavior and consider making it configurable.The fallback logic is sound and prevents issues with empty chain arrays, but consider these improvements:
- Documentation: Update the JSDoc to mention the mainnet fallback behavior when no chains are provided.
- Configurable fallback: The hardcoded
[1](mainnet) might not be appropriate for all use cases. Consider making the fallback chain configurable or throwing an error for truly empty chains./** * Get ERC20 tokens owned by an address + * If no chains are provided, defaults to mainnet (chain ID 1). * @exampleAlternatively, consider making the fallback configurable:
- chain_id: chains.length > 0 ? chains.map((chain) => chain.id) : [1], + chain_id: chains.length > 0 ? chains.map((chain) => chain.id) : [queryOptions?.fallbackChainId ?? 1],
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
packages/thirdweb/src/insight/get-tokens.ts(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (8)
- GitHub Check: Size
- GitHub Check: E2E Tests (pnpm, vite)
- GitHub Check: Lint Packages
- GitHub Check: E2E Tests (pnpm, esbuild)
- GitHub Check: Build Packages
- GitHub Check: E2E Tests (pnpm, webpack)
- GitHub Check: Unit Tests
- GitHub Check: Analyze (javascript)
size-limit report 📦
|
…ils-when-no-routes
|
Codecov ReportAttention: Patch coverage is
❌ Your patch status has failed because the patch coverage (0.00%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #7375 +/- ##
=======================================
Coverage 52.35% 52.35%
=======================================
Files 939 939
Lines 63161 63161
Branches 4214 4213 -1
=======================================
Hits 33070 33070
Misses 29984 29984
Partials 107 107
🚀 New features to boost your workflow:
|
PR-Codex overview
This PR modifies the
defaultQueryOptionsin theget-tokens.tsfile to ensure that if no chains are provided, a default chain ID of1is used instead of an empty array.Detailed summary
chain_idproperty indefaultQueryOptions:-chain_id: chains.map((chain) => chain.id)+chain_id: chains.length > 0 ? chains.map((chain) => chain.id) : [1]Summary by CodeRabbit