You are building the quoting and FX layer for my BlindPay integration.
Before writing code, read these sources and follow them over any prior knowledge:
- https://blindpay.com/docs/llms.txt (read payin quotes, payout quotes, transfer quotes, and cut-off times)
- The OpenAPI spec: curl https://api.blindpay.com/doc
Implement:
1. Payout quotes: POST /v1/instances/{instance_id}/quotes with bank_account_id, network, and token. Here currency_type "sender" means the stablecoin side.
2. Payin quotes: POST /v1/instances/{instance_id}/payin-quotes with wallet_id and payment_method. Here currency_type "sender" means the fiat side. Encode this asymmetry in named types or enums so call sites cannot mix them up.
3. Transfer quotes (managed wallet to any address): POST /v1/instances/{instance_id}/transfer-quotes with amount_reference sender or receiver; rate is fixed 1:1.
4. Expiry: read expires_at (epoch milliseconds) on every quote and never hardcode a window. Standard quotes last about 5 minutes, BRL OTC payin quotes about 10 seconds. Build a re-quote path: if execution fails because the quote expired, fetch a fresh quote and surface the new rate for confirmation when it moved.
5. Amounts and display: request_amount is an integer in minor units. From the response use commercial_quotation vs blindpay_quotation to show the user the rate and the spread, plus flat_fee and partner_fee_amount for a complete price breakdown. Respect cover_fees when the sender absorbs fees.
6. Enforce documented per-currency minimums and maximums before quoting, so users get a validation error instead of an API error.
Constraints:
- Quotes are point-in-time server state: never cache or reuse one across payment attempts.
- Store the quote ID (qu_) and its full response with each payment for reconciliation and support.
Deliverables: a typed quote client distinguishing the three quote kinds, a re-quote-on-expiry helper, a price-breakdown formatter for UI display, and unit tests covering the currency_type conventions in both directions.