Feat/missing features and bugfixes#84
Open
efekrbas wants to merge 14 commits into
Open
Conversation
- Add sendPayment, account, asset, staking, and claims namespaces to AgentClient - Fix bug in lib/stakeF.ts (unreachable code, robust error throwing) - Add account and asset lib implementations - Export missing types and tools in index.ts - Update vitest coverage and add baseline AgentClient tests - Update API documentation with new namespaces
There was a problem hiding this comment.
11 issues found across 14 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
…, pagination logic, API refactoring, and validation bounds
There was a problem hiding this comment.
5 issues found across 7 files (changes from recent commits).
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
…l & missing methods, friendbot errors)
There was a problem hiding this comment.
2 issues found across 3 files (changes from recent commits).
Tip: Review your code locally with the cubic CLI to iterate faster.
Re-trigger cubic
…, BigInt JSON serialization error)
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.
Description
This PR introduces comprehensive updates to
AgentClientby integrating missing namespaces, establishing robust error handling, and achieving 100% test passing coverage. It fulfills the core features required for the Stellar AgentKit while meticulously avoiding the unwanted structural changes from PR #33.🚀 New Features & Capabilities
AgentClientNamespaces: Fully implemented the missing namespaces withinagent.ts.sendPayment(): Delegated capability to send XLM or custom assets natively.account: Implemented read-only methods (getInfo,getBalances,getTransactions,getOperations,fundTestnet).asset: Implemented SDEX lookups (getDetails,getOrderbook,getTrades).staking: Connected Soroban staking interactions (initialize,stake,unstake,claimRewards,getStake).claims: ImplementedlistClaimableBalancesandclaimBalanceutilities.lib/account.tsandlib/asset.tsto support the new namespaces correctly.index.tsto export all newly mapped types and tools.🐛 Bug Fixes & Refactoring
lib/stakeF.ts: Addressed severe logic flaws wherecatchblocks were returning string messages instead of throwing errors. Refactored the methods to use robustthrow new Error(...)patterns. Cleaned up unreachable code segments ingetStake().🧪 Testing & Documentation
tests/unit/agent.test.tsfocusing on constructor validations, mainnet safeguards, and token launch constraints. All 64 Vitest test cases (unit + integration) now pass successfully.docs/api.mdwith complete usage guides, parameters, and examples forsendPayment,account,asset,staking, andclaims.🛑 What's NOT in this PR
Checklist
npm run test)Summary by cubic
Adds the missing AgentClient capabilities (payments, account/asset explorers, Soroban staking, claimable balances) with stricter validation and Horizon helpers. Also fixes Friendbot funding errors, BigInt JSON serialization in liquidity results, hardens env safety and RPC defaults, and refines bridge, claims, and staking flows.
New Features
sendPaymentwith strict key/amount validation and optional memo.account:getInfo,getBalances,getTransactions,getOperations,fundTestnet; top-level helpersgetBalance,getAccountInfo; newutils/horizon.ts.asset:getDetails,getOrderbook,getTrades.staking:initialize,stake,unstake,claimRewards,getStake(auto Soroban RPC by network).claims:list,claimplusstellar_claim_balance_tool.index.ts(addsStellarAccountTool,StellarAssetTool, balance/account tools, claim APIs; exposes lib-level account/asset/staking/claim functions).Bug Fixes
getReservesusage; RPC URL defaults by network; cleaned responses.lib/stakeF.ts: throw real errors; removed unreachable code..gitignoreto avoid overreach; tests coveragent.ts.Written for commit 1f7a1c2. Summary will update on new commits.