Skip to content

fix: improve transaction compatibility and harden Stellar tools validation#31

Open
Feyzanur25 wants to merge 2 commits intoStellar-Tools:mainfrom
Feyzanur25:fix/final-stellar-improvements
Open

fix: improve transaction compatibility and harden Stellar tools validation#31
Feyzanur25 wants to merge 2 commits intoStellar-Tools:mainfrom
Feyzanur25:fix/final-stellar-improvements

Conversation

@Feyzanur25
Copy link
Copy Markdown

@Feyzanur25 Feyzanur25 commented Mar 22, 2026

Summary

This PR improves transaction signing compatibility, TypeScript safety, and the overall reliability of multiple Stellar tools within AgentKit.

Changes

Transaction Handling

  • Improved transaction/XDR handling to ensure compatibility with newer Stellar SDK versions
  • Replaced outdated patterns with a unified and safer transaction building approach
  • Added validation for required parameters such as txXDR and networkPassphrase

Environment Validation

  • Added runtime validation for STELLAR_PRIVATE_KEY and STELLAR_PUBLIC_KEY
  • Removed unsafe non-null assertions (!) on environment variables
  • Improved error messages for missing configuration

Bridge Tool Improvements

  • Cleaned up duplicate and unused imports from the Stellar SDK
  • Simplified keypair usage to avoid redundant creation
  • Improved Soroban restore transaction handling
  • Improved overall readability and maintainability

Liquidity Contract Tool Fixes

  • Fixed TypeScript errors caused by checking truthiness on void return values
  • Improved input validation for deposit, swap, withdraw, and reserve actions
  • Refactored schema typing using z.infer<typeof schema>
  • Improved response consistency and control flow

Staking Contract Tool Fixes

  • Fixed incorrect handling of void return values in contract calls
  • Improved validation for initialize, stake, unstake, and claim flows
  • Simplified execution flow and success responses
  • Removed unsafe any usage in error handling

TypeScript & Code Quality

  • Replaced any with safer unknown error handling patterns
  • Improved type safety and schema consistency
  • Fixed invalid TypeScript typing issues
  • Cleaned up code structure for better maintainability

Technical Impact

  • Ensures compatibility with modern Stellar SDK versions
  • Prevents runtime crashes caused by missing environment variables
  • Improves TypeScript correctness and developer experience
  • Strengthens reliability of bridge, staking, and liquidity tools
  • Makes the codebase more production-ready and maintainable

Notes

This PR focuses on improving both runtime safety and developer experience while aligning the codebase with current best practices for Stellar and TypeScript-based tooling.


Summary by cubic

Improves Stellar transaction signing and tool reliability with stronger runtime validation and a unified transaction builder. Adds AgentClient export and ensures compatibility with newer Stellar SDK versions.

  • New Features

    • Added buildTransaction utility (with XDR support) to standardize fees, timeouts, and memos across tools; includes tests.
    • Exported AgentClient from index to simplify usage.
  • Bug Fixes

    • Hardened signing: validate STELLAR_PRIVATE_KEY, txXDR, and networkPassphrase; switch to Transaction.fromXDR for safer parsing.
    • Enforced env checks for STELLAR_PUBLIC_KEY and STELLAR_PRIVATE_KEY to prevent runtime crashes.
    • Bridge tool cleanup and Soroban restore improvements; now uses the unified builder for consistent transactions.
    • Liquidity tool: fixed void handling, tightened input schemas (zod), and clarified control flow and responses.
    • Staking tool: corrected void handling, improved validation for initialize/stake/unstake/claim flows, and removed unsafe any.
    • General TypeScript safety improvements and cleanup for maintainability.

Written for commit 2da0744. Summary will update on new commits.

Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

No issues found across 3000 files

Note: This PR contains a large number of files. cubic only reviews up to 75 files per PR, so some files may not have been reviewed.

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.

1 participant