feat: add Account & Asset Explorer tools with read-only Horizon queries#81
Open
efekrbas wants to merge 13 commits into
Open
feat: add Account & Asset Explorer tools with read-only Horizon queries#81efekrbas wants to merge 13 commits into
efekrbas wants to merge 13 commits into
Conversation
There was a problem hiding this comment.
5 issues found across 17 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="tools/bridge.ts">
<violation number="1" location="tools/bridge.ts:172">
P2: Bridge responses no longer include the documented `targetChain` field, breaking the public return contract.</violation>
</file>
<file name="tools/contract.ts">
<violation number="1" location="tools/contract.ts:56">
P1: `swap` is stubbed out and no longer performs the contract swap, but still returns a success-like response.</violation>
</file>
<file name="tools/claim_balance_tool.ts">
<violation number="1" location="tools/claim_balance_tool.ts:8">
P2: Top-level env validation throws during import, which can crash startup even if this tool is never invoked.</violation>
</file>
<file name="lib/claimF.ts">
<violation number="1" location="lib/claimF.ts:21">
P2: Swallows `response.next()` failures and returns a partial claimable-balance list as if it were complete.</violation>
<violation number="2" location="lib/claimF.ts:42">
P2: Horizon endpoint and network passphrase can drift because they are derived from separate env vars without validation, causing transactions to be built for the wrong network.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
f24b8b4 to
3015663
Compare
9d13095 to
858204c
Compare
There was a problem hiding this comment.
2 issues found across 3 files (changes from recent commits).
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="tools/stake.ts">
<violation number="1" location="tools/stake.ts:13">
P1: Default RPC URL is hardcoded to testnet and does not track STELLAR_NETWORK, so mainnet runs can be sent to the wrong Soroban endpoint when SOROBAN_RPC_URL is unset.</violation>
</file>
<file name="tools/contract.ts">
<violation number="1" location="tools/contract.ts:12">
P2: Hardcoded testnet RPC fallback can send mainnet runs to the wrong backend when STELLAR_NETWORK=mainnet and SOROBAN_RPC_URL is unset.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds two new LangChain tools (
StellarAccountTool,StellarAssetTool) and their underlying libraries that provide read-only access to Stellar account data and SDEX market information. These tools fill a critical gap in the toolkit — agents can now inspect accounts, check balances, review transaction history, and analyze market data without requiring a private key.Motivation
The existing toolset covers transactional operations (swap, bridge, stake, LP, claim) but lacks any read-only exploration capability. An agent currently has no way to:
This PR adds all of the above as a cohesive, well-tested feature.
What's New
StellarAccountTool— 5 actionsget_infoget_balancesget_transactionsget_operationsfund_testnetStellarAssetTool— 3 actionsget_asset_detailsget_orderbookget_tradesAgentClient Integration
agent.account.*namespace —getInfo(),getBalances(),getTransactions(),getOperations(),fundTestnet()agent.asset.*namespace —getDetails(),getOrderbook(),getTrades()publicKeyandnetworkAccountInfo,AccountBalance,TransactionRecord,OperationRecord,AssetDetails,OrderbookSummary,TradeRecordArchitecture
lib/account.ts → Core Horizon queries (account, tx, ops, friendbot) lib/asset.ts → Core Horizon queries (assets, orderbook, trades) tools/account.ts → LangChain DynamicStructuredTool wrapper tools/asset.ts → LangChain DynamicStructuredTool wrapper agent.ts → account.* and asset.* namespace integration index.ts → Exports + stellarTools array registration
_deps.createServer) for testability without fragile module-level mocksnetworkparameterTest Coverage
tests/unit/lib/account.test.tstests/unit/lib/asset.test.tstests/unit/tools/account.test.tstests/unit/tools/asset.test.tsSafety
fund_testnetis guarded to reject mainnet usage@stellar/stellar-sdkand@langchain/core