Add L-BTC funding option to WapuPay direct-fiat orders#122
Draft
andycreed0x wants to merge 1 commit into
Draft
Conversation
Direct-fiat orders can now be funded with L-BTC on Liquid, not just USDT. Add a `funding_method` param (default "USDT") threaded through create_order → the MCP tool → the MCP schema → the CLI (`--funding-method`), and make pay_instructions currency-aware: the L-BTC rail sends real satoshis (funding_amount_sat) instead of USDT-derived base units. Also fixes a persistence bug this feature would otherwise trigger: WapuPayOrder.from_dict dropped funding_amount_sat for any Liquid-network order, assuming Liquid always meant USDT. That wiped the real L-BTC sat amount on every reload (order-status, orders, fund-order). Now keyed off funding_currency instead, and total_funding_amount_base_units is cleared on the L-BTC rail so a USDT-scale figure is never paired with the L-BTC asset_id. The quote/preview endpoint stays USDT-only (WapuPay 500s on LBTC there), so wapupay_quote and the CLI's pre-confirm preview are untouched. Verified live against WapuPay's stage sandbox for both rails, including the order-status/fund-order reload paths.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
Direct-fiat orders created via WapuPay can now be funded with L-BTC on Liquid, in addition to USDT. Sending
funding_method: "LBTC"on order creation gets a Liquid address funded with real satoshis instead of USDT.Description
Verified live against WapuPay's stage sandbox for both rails, including the
order-status/fund-orderreload paths. The quote/preview endpoint (tentative-amount) returns a 500 for LBTC, sowapupay_quoteand the CLI's pre-confirm preview intentionally stay USDT-only and never passfunding_method.Main Changes
funding_methodparam ("USDT"default /"LBTC") toWapuPayManager.create_order, validated up front before any network callfunding_methodthrough the MCP tool (wapupay_create_order), the MCP input schema, and the CLI (aqua wapupay create-order --funding-method)pay_instructionscurrency-aware: the L-BTC rail tells the caller to send the realfunding_amount_satsats, instead of USDT-derived base unitsWapuPayOrder.from_dictsilently droppingfunding_amount_satfor any Liquid-network order — it assumed Liquid always meant USDT, which would have wiped the real L-BTC sat amount on every reload (order-status,orders,fund-order). Now keyed offfunding_currencyinstead offunding_networkalonetotal_funding_amount_base_unitson the L-BTC rail so a USDT-scale figure is never paired with the L-BTCasset_idin the response (found and fixed during adversarial review — a defensive guard against a would-be ~10⁸x overpayment if a consumer read that field directly instead ofpay_instructions)AGENTS.mdand module docstringsfunding_methodrejection,from_dictsat-preservation regression, USDT default preserved, and a money-safety regression test for the base-units guardChecklist