flowfi icon indicating copy to clipboard operation
flowfi copied to clipboard

[SDK] Official Python SDK & Rust Client Crates for Automated Streaming Bots

Open blurbeast opened this issue 2 months ago • 9 comments

Overview & Background

Many algorithmic trading bots, automated treasury management systems, corporate payroll backends, and institutional keepers are written in Python or Rust rather than TypeScript/JavaScript. While FlowFi provides a TypeScript SDK (packages/flowfi-sdk), developers in the wider fintech and systems engineering ecosystem need official, idiomatic client libraries in Python (flowfi-py) and Rust (flowfi-rs).


Detailed Problem Statement

  1. Limited Server-Side Automation Ecosystem:
    • Backend engineers building automated payroll integrations with Django, FastAPI, or Rust microservices must manually construct Stellar/Soroban invoke host function operations and parse raw XDR.
  2. Keeper Bots & Monitoring Agents:
    • High-performance keeper bots (monitoring runway, automated top-ups, dispute resolution) written in Rust cannot leverage existing typed abstractions.
  3. No Parity Across SDK Ecosystem:
    • Feature additions in the protocol contract must currently be reverse-engineered by Python and Rust developers.

Technical Specification & Architecture

1. Python SDK (packages/flowfi-py / PyPI)

  • Built on top of official stellar-sdk (Python):
  • Core Modules:
    • flowfi.client.FlowFiClient: Connection manager for Soroban RPC and FlowFi backend API.
    • flowfi.builder.StreamBuilder: Fluent builder for constructing, simulating, and signing stream creation, withdrawal, top-up, and cancel transactions.
    • flowfi.models: Pydantic models for Stream, VestingSchedule, TokenMetadata, and StreamEvent.
  • Async & Sync Support: Provide both asyncio (AsyncFlowFiClient) and synchronous execution modes.

2. Rust Client Crate (packages/flowfi-rs / crates.io)

  • Built on top of soroban-client and stellar-strkey:
  • Core Modules:
    • flowfi::Client: Strongly typed RPC and contract interaction client.
    • flowfi::types: Shared types aligned with stream_contract/src/types.rs.
    • flowfi::keeper: Ready-to-use bot loop helper to scan active streams and trigger batch withdrawals or auto-refuels.

3. CI Publishing Pipeline

  • Add GitHub Actions workflow for automated test, build, and publishing to PyPI and Crates.io on release tags.

Target Files

  • packages/flowfi-py/pyproject.toml
  • packages/flowfi-py/src/flowfi/client.py
  • packages/flowfi-py/src/flowfi/builder.py
  • packages/flowfi-rs/Cargo.toml
  • packages/flowfi-rs/src/lib.rs
  • packages/flowfi-rs/src/client.rs

Acceptance Criteria

  • [ ] Python SDK successfully instantiates streams, queries claimable balances, and signs with Stellar Keypair.
  • [ ] Rust crate compiles against latest Soroban SDK version with zero warnings.
  • [ ] Automated end-to-end tests in both languages verify parity with TypeScript SDK behavior.
  • [ ] Comprehensive documentation and runnable examples provided for each client library.
  • [ ] GitHub Actions workflow verifies packaging and test execution across Python 3.10-3.12 and stable Rust.

blurbeast avatar Sep 27 '26 05:09 blurbeast

@code-ony has applied to work on this issue as part of the Stellar Wave Program's 9th wave.

I would love to work on this issue, please assign it to me

ℹ️ Repo Maintainers: To accept this application, review their application or assign @code-ony to this issue.

code-ony avatar Sep 27 '26 15:09 code-ony

@Richkid2 has applied to work on this issue as part of the Stellar Wave Program's 9th wave.

Hello maintainer, assign me to this issue, let me fix it.

ℹ️ Repo Maintainers: To accept this application, review their application or assign @Richkid2 to this issue.

Richkid2 avatar Sep 27 '26 15:09 Richkid2

@samjay8 has applied to work on this issue as part of the Stellar Wave Program's 9th wave.

I can fix this

ℹ️ Repo Maintainers: To accept this application, review their application or assign @samjay8 to this issue.

samjay8 avatar Sep 27 '26 17:09 samjay8

Congratulations, @code-ony! 🎉 Your application was accepted by the repo's maintainers, and the issue is due on September 30, 2026.

🧑‍💻 @code-ony: Please resolve the issue such that the repo's maintainers have enough time to review your contribution before the due date. You'll earn Points for completing the issue on-time, which will make you eligible for a share of the Stellar Wave Program's reward pool.

[!WARNING] When opening a PR, please link it to this issue to ensure it gets tracked accurately. Points are awarded when this issue is marked as completed by the maintainer.

🤠 Repo maintainers: Please keep an eye on the contributor's progress and review their work before the due date. You can manage this issue, including adjusting its complexity and points, here.

🌊 Happy Wave 🌊

drips-wave[bot] avatar Sep 29 '26 17:09 drips-wave[bot]

@juliet-unoyiza has applied to work on this issue as part of the Stellar Wave Program's 10th wave.

I've reviewed the issue thoroughly and can start working on it right away. Looking forward to contributing

ℹ️ Repo Maintainers: To accept this application, review their application or assign @juliet-unoyiza to this issue.

juliet-unoyiza avatar Oct 15 '26 15:10 juliet-unoyiza

@Max347bot has applied to work on this issue as part of the Stellar Wave Program's 10th wave.

Hello maintainer please I will like to work on this issue

ℹ️ Repo Maintainers: To accept this application, review their application or assign @Max347bot to this issue.

Max347bot avatar Oct 15 '26 23:10 Max347bot

@Hotmopo has applied to work on this issue as part of the Stellar Wave Program's 10th wave.

Hello maintainer, i would like to work on this issue

ℹ️ Repo Maintainers: To accept this application, review their application or assign @Hotmopo to this issue.

Hotmopo avatar Oct 16 '26 22:10 Hotmopo

Congratulations, @Hotmopo! 🎉 Your application was accepted by the repo's maintainers, and the issue is due on October 22, 2026.

🧑‍💻 @Hotmopo: Please resolve the issue such that the repo's maintainers have enough time to review your contribution before the due date. You'll earn Points for completing the issue on-time, which will make you eligible for a share of the Stellar Wave Program's reward pool.

[!WARNING] When opening a PR, please link it to this issue to ensure it gets tracked accurately. Points are awarded when this issue is marked as completed by the maintainer.

🤠 Repo maintainers: Please keep an eye on the contributor's progress and review their work before the due date. You can manage this issue, including adjusting its complexity and points, here.

🌊 Happy Wave 🌊

drips-wave[bot] avatar Oct 16 '26 22:10 drips-wave[bot]

This issue has been completed by @Hotmopo as part of the Stellar Wave Program's 10th Wave 🥳

😎 @Hotmopo: You earned 200 Points for completing this issue! Once the Wave's rewards are finalized, you'll be eligible for a percentage of the Wave's reward pool based on the percentage of total points you've earned. Learn more here. You can also Leave a review to share your experience working on this issue.

🧑‍💻 Repo maintainers: How'd the contributor do? Leave a review to share your experience working with them.

drips-wave[bot] avatar Oct 18 '26 12:10 drips-wave[bot]