Skip to content

fix: improve transaction compatibility and tool safety#32

Open
Feyzanur25 wants to merge 2 commits intoStellar-Tools:mainfrom
Feyzanur25:fix/clean-stellar-signing
Open

fix: improve transaction compatibility and tool safety#32
Feyzanur25 wants to merge 2 commits intoStellar-Tools:mainfrom
Feyzanur25:fix/clean-stellar-signing

Conversation

@Feyzanur25
Copy link
Copy Markdown

@Feyzanur25 Feyzanur25 commented Mar 23, 2026

Summary

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

Changes

Transaction Handling

  • Improved transaction signing compatibility in lib/stellar.ts
  • Ensured safer XDR handling for modern Stellar SDK usage

Contract & Tool Integration

  • Fixed import/export mismatches between contract utilities and tools
  • Improved liquidity contract tool validation and execution flow
  • Improved staking tool typing and input handling

TypeScript & Code Quality

  • Fixed incorrect typing in DynamicStructuredTool func handlers
  • Replaced unsafe any usage with safer unknown
  • Improved schema typing using z.infer<typeof schema>

Environment Safety

  • Added runtime validation for STELLAR_PUBLIC_KEY and STELLAR_PRIVATE_KEY
  • Removed unsafe top-level environment assumptions

Impact

  • Prevents runtime crashes caused by missing environment variables
  • Improves compatibility with newer Stellar SDK versions
  • Strengthens reliability of bridge, staking, and liquidity tools
  • Improves maintainability and developer experience

Summary by cubic

Improves Stellar transaction compatibility and tool safety across contract, bridge, and staking flows. Unifies Soroban XDR handling, enforces env checks, and tightens types to avoid crashes.

  • Bug Fixes

    • Validates inputs and signs XDR with stellar-sdk; clear errors for missing keys and passphrase.
    • Contract calls: detect read-only simulations, parse ScVal safely, return native values (bigint), and surface pending status with hash.
    • Bridge tool: robust restore flow and trustline creation via buildTransactionFromXDR; only sets SRB when provided; blocks mainnet unless ALLOW_MAINNET_BRIDGE=true.
    • Liquidity and staking tools: zod schemas, unknown over any, fail fast on missing STELLAR_PUBLIC_KEY, and clearer error messages.
  • Migration

    • Set STELLAR_PUBLIC_KEY and STELLAR_PRIVATE_KEY; tools now fail fast if missing.
    • Optional: SRB_PROVIDER_URL for @allbridge/bridge-core-sdk; ALLOW_MAINNET_BRIDGE=true to enable mainnet bridging.

Written for commit d1f44e7. 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 5 files

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