feat: trigger fiat payout to Stellar Anchors (#943) - #1001
Conversation
|
@pixels26 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
|
@pixels26 |
|
@pixels26 |
|
@ONEONUORA please check now, my apologies for the delay |
|
@pixels26 |
|
on it now |
|
please check @ONEONUORA |
|
@pixels26 |
- Implement AnchorRegistry with real HTTP calls to anchor API endpoints (POST /transactions, GET /transactions/:id, GET /transactions) - Add ANCHOR_API_URL and ANCHOR_API_KEY configuration - Add anchor_payout_id column to payouts table for tracking anchor refs - Update trigger_payout handler to call anchor API and store returned ID - Add proper error types (AnchorError) and status mapping - Fall back to simulated payout when anchor API is not configured - Update tests and main.rs for new AnchorRegistry constructor
9bf2d7e to
8ab01e4
Compare
|
@ONEONUORA please check now |
|
@pixels26 |
|
please check |
|
@pixels26 |
|
i'm fixing now |
|
@pixels26 |
Summary
Trigger fiat payout to Stellar Anchors** by replacing the stub
AnchorRegistrywith real HTTP calls to Stellar Anchor API endpoints.Close #943
Changes
Backend — Anchor API Integration (
backend/src/stellar_anchor.rs)AnchorRegistry::create_payout()— sendsPOST {ANCHOR_API_URL}/transactionswith SEP-31-style payload (amount, asset_code, destination_asset, beneficiary bank details). Parses response for exchange rate, fiat amount, and anchor fee. Falls back to simulated payout when API is unconfigured.AnchorRegistry::get_payout()— sendsGET {ANCHOR_API_URL}/transactions/{id}to retrieve payout status.AnchorRegistry::list_payouts()— sendsGET {ANCHOR_API_URL}/transactionswith optionalsender_idfilter.AnchorErrorenum withHttp,Api,NotConfigured,NotFound,InvalidResponsevariants.pending,processing/in_progress,completed/success,failed/error/rejected.Configuration
backend/src/config.rs— addedanchor_api_urlandanchor_api_keyfields.backend/.env.example— addedANCHOR_API_URLandANCHOR_API_KEYenv vars.Database Migration
backend/migrations/20260726000000_add_anchor_payout_id.up.sql— adds nullableanchor_payout_id TEXTcolumn topayoutstable with index.backend/migrations/20260726000000_add_anchor_payout_id.down.sql— reverses the migration.Payout Flow (
backend/src/api.rs)trigger_payouthandler now callsstate.anchor.create_payout(req).awaitand stores the returned anchor payout ID in thepayoutstable.PayoutRownow includesanchor_payout_id: Option<String>in responses.get_anchor_payoutsendpoint includesanchor_payout_idin results.Tests & Setup
main.rs,api_tests.rs,kyc_webhook_test.rsupdated to pass config to newAnchorRegistry::new(api_url, api_key)constructor.Usage
Set these environment variables to connect to a Stellar Anchor:
When
ANCHOR_API_URLis unset, the system falls back to simulated payouts (development mode).