Skip to content

feat: trigger fiat payout to Stellar Anchors via API (#943) - #1020

Merged
ONEONUORA merged 2 commits into
Fracverse:masterfrom
pixels26:feat/fiat-payout-anchor-943
Jul 30, 2026
Merged

feat: trigger fiat payout to Stellar Anchors via API (#943)#1020
ONEONUORA merged 2 commits into
Fracverse:masterfrom
pixels26:feat/fiat-payout-anchor-943

Conversation

@pixels26

Copy link
Copy Markdown
Contributor

Close #943

Summary

Replaces the stub AnchorRegistry::create_payout with a real async HTTP client that POSTs payout requests to the configured Stellar Anchor API endpoint.

Changes

  • config.rs: Added anchor_api_url field loaded from ANCHOR_API_URL env var (defaults to http://localhost:8081)
  • stellar_anchor.rs: Refactored AnchorRegistry to hold a reqwest::Client and anchor base URL; create_payout now makes an async POST to {anchor_api_url}/transactions/send with the payout payload and parses the response into an AnchorPayout with proper status tracking (Pending/Processing/Completed/Failed)
  • main.rs: Passes config.anchor_api_url to AnchorRegistry::new
  • .env.example: Added ANCHOR_API_URL documentation
  • api.rs: Updated call site to .await the now-async create_payout
  • Tests: Updated AnchorRegistry::new() calls to pass an API URL

Anchor API Contract

The implementation follows SEP-31 conventions. The anchor is expected to expose a POST /transactions/send endpoint accepting:

{
  "beneficiary_address": "...",
  "beneficiary_name": "...",
  "token": "...",
  "token_amount": 0.0,
  "fiat_currency": "USD",
  "bank_name": "...",
  "account_number": "..."
}

And responding with:

{
  "id": "tx-id",
  "transaction_id": "alt-id",
  "status": "pending|processing|completed|failed",
  "exchange_rate": 1.0,
  "fiat_amount": 100.0,
  "fee": 0.5
}

@pixels26

Copy link
Copy Markdown
Contributor Author

@ONEONUORA please trigger cli

@ONEONUORA

Copy link
Copy Markdown
Contributor

@pixels26
Run cargo fmt --all -- --check

@pixels26

Copy link
Copy Markdown
Contributor Author

@ONEONUORA please allow auto trigger

@pixels26
pixels26 force-pushed the feat/fiat-payout-anchor-943 branch from ffa3fcd to 5cca2da Compare July 30, 2026 11:58
@ONEONUORA

Copy link
Copy Markdown
Contributor

@pixels26
Run cargo clippy --all-targets --all-features -- -D warnings

@pixels26

Copy link
Copy Markdown
Contributor Author

@ONEONUORA all solved

@ONEONUORA ONEONUORA left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@pixels26
Great job

@ONEONUORA
ONEONUORA merged commit 798ef10 into Fracverse:master Jul 30, 2026
4 checks passed
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.

[Backend] Issue #34: Trigger Fiat payout to Stellar Anchors

2 participants