Skip to content

Conversation

@premiumjibles
Copy link
Contributor

@premiumjibles premiumjibles commented Dec 16, 2025

Summary by CodeRabbit

Release Notes

  • New Features

    • Added address validation for external wallet lookups
  • Improvements

    • Updated user interface labels for wallet address operations
    • Enhanced error messaging for address lookup operations
    • Clarified input descriptions for external wallet addresses

✏️ Tip: You can customize this high-level summary in your review settings.

@vercel
Copy link

vercel bot commented Dec 16, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
shapeshift-agentic Ready Ready Preview, Comment Dec 16, 2025 1:36am

@coderabbitai
Copy link

coderabbitai bot commented Dec 16, 2025

📝 Walkthrough

Walkthrough

This change refactors the account lookup tool throughout the agentic stack by renaming from getAccountTool to lookupExternalAddressTool, updating the schema field from account to address, adding address validation, and adjusting UI labels and logging throughout the codebase.

Changes

Cohort / File(s) Summary
Tool Definition
apps/agentic-server/src/tools/getAccount.ts
Renamed exported tool from getAccountTool to lookupExternalAddressTool; updated schema field from account to address with updated description; added validateAddress call; changed logging label to [lookupExternalAddress]; destructuring adjusted to use address parameter name.
Server Exports & Routing
apps/agentic-server/src/index.ts, apps/agentic-server/src/routes/chat.ts
Updated export statement to reference lookupExternalAddressTool; updated buildTools to register tool as lookupExternalAddress with new import of lookupExternalAddressTool.
Client UI & Registry
apps/agentic-chat/src/components/toolUIRegistry.tsx, apps/agentic-chat/src/components/tools/GetAccountUI.tsx
Updated registry key from getAccountTool to lookupExternalAddress; changed UI label to "external address"; updated user-facing messages from "Checking..." to "Looking up..." and "Failed to find..." to "Failed to look up..."; adjusted address source handling.
Internal Call Sites
apps/agentic-server/src/tools/portfolio.ts, apps/agentic-server/src/utils/balanceHelpers.ts
Updated function calls to executeGetAccount to use address: parameter name instead of account:.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Key areas requiring attention: Verify all call sites to executeGetAccount have been updated with the new address parameter name; confirm the validateAddress integration in getAccount.ts handles all expected address formats; validate that the UI component correctly displays address information with the updated logic.

Poem

🐰 A tool renamed with care, lookupExternalAddress fair,
From account to address we go, schema fields all aglow,
Validation steps added with grace, consistency set in place! ✨

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Title check ⚠️ Warning The title mentions improving wallet connection and portfolio query reliability, but the actual changes are a systematic renaming of a tool from getAccountTool to lookupExternalAddress with input parameter updates—not specifically about connection reliability improvements. Update the title to reflect the actual changes, such as 'refactor: rename getAccountTool to lookupExternalAddress with address validation' or similar, to accurately represent the codebase modifications.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch wallet-connect-reliability

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
apps/agentic-server/src/routes/chat.ts (1)

97-119: Consider simplifying the conditional routing logic.

The logic is functionally correct but could be more readable. The double-check pattern (line 109 includes check, then line 112 undefined check) is safe but verbose.

Consider this cleaner approach:

     lookupExternalAddress: {
       description: lookupExternalAddressTool.description,
       inputSchema: lookupExternalAddressTool.inputSchema,
       execute: async (args: GetAccountInput) => {
         console.log('[Tool] lookupExternalAddress:', JSON.stringify(args, null, 2))
 
         const { address, network } = args
         const chainId = networkToChainIdMap[network]
 
         const connectedAddress = walletContext.connectedWallets?.[chainId]?.address
         if (connectedAddress && address.toLowerCase() === connectedAddress.toLowerCase()) {
           console.log('[Tool] lookupExternalAddress: Redirecting to portfolioTool (connected wallet detected)')
-          const evmSolanaNetwork = EVM_SOLANA_NETWORKS.includes(network as EvmSolanaNetwork)
-            ? (network as EvmSolanaNetwork)
-            : undefined
-          if (evmSolanaNetwork) {
-            return portfolioTool.execute({ networks: [evmSolanaNetwork] }, walletContext)
-          }
+          if (EVM_SOLANA_NETWORKS.includes(network as EvmSolanaNetwork)) {
+            return portfolioTool.execute({ networks: [network as EvmSolanaNetwork] }, walletContext)
+          }
         }
 
         return lookupExternalAddressTool.execute(args)
       },
     },
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between ac8f530 and fdf06bf.

📒 Files selected for processing (8)
  • apps/agentic-chat/src/components/CustomConnectButton.tsx (2 hunks)
  • apps/agentic-chat/src/components/toolUIRegistry.tsx (1 hunks)
  • apps/agentic-chat/src/components/tools/GetAccountUI.tsx (1 hunks)
  • apps/agentic-server/src/index.ts (1 hunks)
  • apps/agentic-server/src/routes/chat.ts (2 hunks)
  • apps/agentic-server/src/tools/getAccount.ts (3 hunks)
  • apps/agentic-server/src/tools/portfolio.ts (1 hunks)
  • apps/agentic-server/src/utils/balanceHelpers.ts (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (5)
apps/agentic-chat/src/components/toolUIRegistry.tsx (1)
apps/agentic-chat/src/components/tools/GetAccountUI.tsx (1)
  • GetAccountUI (4-29)
apps/agentic-chat/src/components/tools/GetAccountUI.tsx (1)
apps/agentic-chat/src/components/tools/toolUIHelpers.tsx (1)
  • useToolStateRender (10-31)
apps/agentic-server/src/tools/getAccount.ts (3)
packages/types/src/network.ts (1)
  • networkToChainIdMap (63-82)
apps/agentic-server/src/utils/addressValidation.ts (1)
  • validateAddress (6-14)
apps/agentic-server/src/index.ts (1)
  • lookupExternalAddressTool (12-12)
apps/agentic-server/src/tools/portfolio.ts (1)
apps/agentic-server/src/tools/getAccount.ts (1)
  • executeGetAccount (27-94)
apps/agentic-server/src/routes/chat.ts (4)
apps/agentic-server/src/index.ts (4)
  • lookupExternalAddressTool (12-12)
  • GetAccountInput (14-14)
  • GetAccountInput (15-15)
  • portfolioTool (40-40)
apps/agentic-server/src/tools/getAccount.ts (2)
  • lookupExternalAddressTool (96-101)
  • GetAccountInput (19-19)
packages/types/src/network.ts (3)
  • networkToChainIdMap (63-82)
  • EVM_SOLANA_NETWORKS (59-59)
  • EvmSolanaNetwork (61-61)
apps/agentic-server/src/tools/portfolio.ts (1)
  • portfolioTool (182-187)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: main
🔇 Additional comments (11)
apps/agentic-server/src/index.ts (1)

12-12: LGTM! Export rename is consistent.

The export rename from getAccountTool to lookupExternalAddressTool correctly aligns with the tool's updated purpose of looking up external wallet addresses.

apps/agentic-server/src/tools/portfolio.ts (1)

84-84: LGTM! Parameter update aligns with schema changes.

The parameter change from { account, network } to { address: account, network } correctly matches the updated GetAccountInput schema.

apps/agentic-server/src/utils/balanceHelpers.ts (1)

9-12: LGTM! Cleaner parameter passing.

Using the shorthand { address, network } is more idiomatic and aligns with the updated schema.

apps/agentic-chat/src/components/toolUIRegistry.tsx (1)

29-29: LGTM! Registry key updated consistently.

The registry key lookupExternalAddress correctly aligns with the renamed server-side tool.

apps/agentic-chat/src/components/tools/GetAccountUI.tsx (2)

8-18: LGTM! Good backward compatibility.

The fallback input?.address ?? input?.account ensures compatibility during the transition while the label update correctly reflects the tool's purpose.


20-24: LGTM! Clear status messages.

The updated messages ("Looking up", "Failed to look up") are consistent with the external address lookup workflow.

apps/agentic-server/src/tools/getAccount.ts (4)

8-8: LGTM! Address validation import added.

The new import enables proper address validation before querying external addresses.


11-15: Excellent input description for LLM guidance.

The detailed description with examples ("0x..." for EVM, "base58" for Solana) and the explicit warning "NEVER pass descriptions like 'connected wallet'" helps guide the LLM to use this tool correctly.


33-34: LGTM! Address validation added for security.

Validating the address format before making external API calls is a good security practice that will catch malformed addresses early.


96-98: Clear tool description distinguishes from portfolioTool.

The description effectively communicates when to use this tool versus portfolioTool, which should help the LLM make the right choice.

apps/agentic-server/src/routes/chat.ts (1)

107-108: Good case-insensitive address comparison.

The case-insensitive comparison correctly handles Ethereum addresses which are case-insensitive (ignoring EIP-55 checksums).

Copy link

@coderabbitai coderabbitai bot left a 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 (2)
apps/agentic-server/src/tools/getAccount.ts (1)

1-101: Consider renaming the file for consistency.

The file is named getAccount.ts but now exports lookupExternalAddressTool and uses [lookupExternalAddress] logging. Additionally, the GetAccountOutput type and executeGetAccount function retain the old naming. While the code functions correctly, renaming the file to lookupExternalAddress.ts and updating the type/function names would improve clarity and reduce confusion for future maintainers.

Suggested renaming:

  • File: getAccount.tslookupExternalAddress.ts
  • Type: GetAccountOutputLookupExternalAddressOutput
  • Function: executeGetAccountexecuteLookupExternalAddress
apps/agentic-server/src/utils/balanceHelpers.ts (1)

9-12: Correct alignment with the updated schema.

The change from account: address to address: address properly aligns with the renamed schema field. Consider using ES6 shorthand property syntax for slightly cleaner code.

Apply this diff to use ES6 shorthand:

   const accountData = await executeGetAccount({
-    address,
+    address,
     network,
   })

Actually, the current code already uses the shorthand if it's just address, - please verify the actual formatting. If it's written as address: address,, then apply:

   const accountData = await executeGetAccount({
-    address: address,
+    address,
     network,
   })
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between fdf06bf and e269c5e.

📒 Files selected for processing (7)
  • apps/agentic-chat/src/components/toolUIRegistry.tsx (1 hunks)
  • apps/agentic-chat/src/components/tools/GetAccountUI.tsx (1 hunks)
  • apps/agentic-server/src/index.ts (1 hunks)
  • apps/agentic-server/src/routes/chat.ts (2 hunks)
  • apps/agentic-server/src/tools/getAccount.ts (3 hunks)
  • apps/agentic-server/src/tools/portfolio.ts (1 hunks)
  • apps/agentic-server/src/utils/balanceHelpers.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (4)
  • apps/agentic-server/src/routes/chat.ts
  • apps/agentic-chat/src/components/toolUIRegistry.tsx
  • apps/agentic-server/src/index.ts
  • apps/agentic-server/src/tools/portfolio.ts
🧰 Additional context used
🧬 Code graph analysis (2)
apps/agentic-chat/src/components/tools/GetAccountUI.tsx (1)
apps/agentic-chat/src/components/tools/toolUIHelpers.tsx (1)
  • useToolStateRender (10-31)
apps/agentic-server/src/tools/getAccount.ts (3)
packages/types/src/network.ts (1)
  • networkToChainIdMap (63-82)
apps/agentic-server/src/utils/addressValidation.ts (1)
  • validateAddress (6-14)
apps/agentic-server/src/index.ts (1)
  • lookupExternalAddressTool (12-12)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: main
🔇 Additional comments (6)
apps/agentic-server/src/tools/getAccount.ts (4)

8-9: LGTM!

The import is correctly placed and the validation function is properly utilized later in the code.


11-15: Excellent schema description clarity.

The emphatic description clearly distinguishes between external addresses and placeholder text. This should help prevent the LLM from passing invalid inputs like "connected wallet" or "my wallet".


28-34: LGTM! Validation and logging updates are well-implemented.

The validation is correctly placed after the chainId is determined (since the validation function requires it), and the destructuring pattern { address: account, network } maintains internal backward compatibility while supporting the new schema.


96-101: Excellent tool description clarity.

The renamed export and emphatic description effectively distinguish this tool's purpose (external addresses only) from the portfolio tool (connected wallet). The explicit guidance should significantly improve tool selection reliability.

apps/agentic-chat/src/components/tools/GetAccountUI.tsx (2)

9-18: Excellent backward compatibility and defensive programming.

The fallback logic input?.address ?? input?.account ensures the UI works with both old and new message formats, and the type guards prevent runtime errors. The label update to "external address" aligns well with the tool's renamed purpose.


21-24: LGTM! Message updates are consistent.

The updated loading and error messages ("Looking up" and "Failed to look up") are appropriate for the external address lookup context. All messages consistently use accountDetailsText for cohesive user feedback.

@premiumjibles premiumjibles merged commit 20cf195 into main Dec 16, 2025
4 checks passed
@premiumjibles premiumjibles deleted the wallet-connect-reliability branch December 16, 2025 01:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants