Repository navigation
Conversation
CumpsD
force-pushed
the
chainflip-baas-provider
branch
from
November 13, 2026 01:09
79bff91 to
ca9951b
Compare
Add a Chainflip exchange provider backed by the Chainflip broker API at chainflip-broker.io. - Offers the Chainflip assets Stack Wallet holds: BTC, ETH, SOL, and the default USDC/USDT tokens on Ethereum and Solana, from the live /assets catalog. Exact native-unit conversion, real minimums and the API's hard maximum. - Floating-rate quotes via /quotes-native; fixed-rate and reversed quotes are declined explicitly. An estimate is reused only for the same pair and amount; minimumPrice is the quote's estimatedPrice minus the recommended slippage, floored. - Deposit channels via /swap and status via /status-by-id or /status-by-deposit-channel, mapped onto the wallet's status vocabulary; only a full refund is reported as Refunded. Destination/refund memos are rejected. - Tor: the production onion through the Tor proxy, listed in exchangesWithTorSupport. - getTrades is declined: the broker's /swaps lists the whole partner's swaps, not this wallet's. - Per-build key kChainflipApiKey in the gitignored external_api_keys.dart, added to the prebuild templates and the CI no-secret fallback. - Icon: the Color logomark from Chainflip's official brand kit.
CumpsD
force-pushed
the
chainflip-baas-provider
branch
from
November 13, 2026 01:16
ca9951b to
3469b6e
Compare
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.
What this adds
A Chainflip exchange provider in
lib/services/exchange/chainflip/, served through the Chainflip broker API atchainflip-broker.io("BaaS" below), registered inExchange.fromName,exchangesWithTorSupport, the provider selector, the currency cache and the trade-tracking view. It offers the Chainflip assets Stack Wallet holds (BTC, ETH, SOL, and the default USDC/USDT tokens on Ethereum and Solana) from the live BaaSGET /assetscatalog, quotes viaGET /quotes-native, opens deposit channels viaGET /swap, and follows status by swap id or deposit channel.usdt.bsc/bnb.bsc; amounts finer than the asset's decimals are rejected, not truncated), and a real minimum fromminimalAmountNativeplus BaaS's hard quote cap.chainflip37gkyf3nkgufkolp2grpbchoysvro57wz3d3kurhhyj4zad.onion) through the existing SOCKS proxy, and membership ofexchangesWithTorSupport. Clearnet useshttps://chainflip-broker.io.Waiting,Confirming,Exchanging,Sending,Completed,Failed,Refunded), so the trade card, colours and notifications render them correctly. BaaS reports refunds ascompletedwith arefundEgress; a full refund maps toRefunded, a partial refund staysCompletedwith the refund inTrade.other, as isfallbackEgress.minimumPriceis the quote'sestimatedPrice × (1 − recommended slippage), floored. An estimate is reused only for the same pair and amount; otherwise the trade requotes.getTradesreturns a typed "not supported" response: BaaS/swapslists every swap under the partner key (all users of a build), not this wallet's trades. Like the other providers, the app does not call it.Logo/Logomark/CF-Original.svg) from Chainflip's official brand kit, unmodified.Key placement
The partner API key is a gitignored per-build constant
kChainflipApiKeyinlib/external_api_keys.dart, created byscripts/prebuild.sh, exactly like the seven sibling providers. The public GPLv3 source carries no credential; Cypher Stack's official builds carry their partner key. If you would rather not embed it, the alternative is a Cypher Stack-hosted proxy; the provider only reads the constant. With the constant empty,/assetsstill loads and keyed calls return an explicit "API key is not configured" decline; a test pins that path.scripts/prebuild.shonly writes the template whenlib/external_api_keys.dartis absent, so an existing keys file (and theCHANGE_NOWsecret that CI decodes) needsconst kChainflipApiKey = "";(or the real key) appended, or the build fails to compile. The CI no-secret fallback andscripts/prebuild.ps1templates are updated in this PR.Scope and honesty
Verification
dart format --output=none --set-exit-if-changedon the changed files: clean.dart analyzeon the changed files: no new issues (the remaining infos on touched lines are pre-existing deprecatedcolor:usages that the formatter re-wrapped).flutter test test/services/exchange/chainflip/: 29/29 pass.Existing exchange-layer tests (
test/services/exchange,test/models/exchange,test/pages/exchange_view,test/screen_tests/exchange): 63/63 pass.Full
flutter test: 1019 passed, 8 skipped, 3 failed. The 3 failures aresetUpAllintest/wallets/{owned_input_signatures,receiving_address_index,spark_message}_test.dart, which cannot loadlibsecp256k1.soin a local build without native dependencies; none of those files are touched here.API-contract evidence, gathered against the broker's full catalog rather than through this provider: a testnet quote matrix with every Chainflip chain as source and destination, and production
/assetsreturning 20 assets without a key. The provider narrows those 20 to the 7 Stack Wallet holds.The matrix was gathered with Python/urllib directly against the API, not through the Dart provider; with
kChainflipApiKeyempty, no provider code path has executed against a live endpoint. The unit tests inject a fake HTTP client. The evidence proves the API contract and the mapping logic separately, never together.Upstream CI has not run on this PR yet: the fork's
Testworkflow runs are waiting for maintainer approval (action_required).Draft status
This is a draft until the two human gates are done: a real end-to-end swap through a locally built wallet, and a quote plus channel-open over Tor. No key value or commission/earnings figure is included.