feat(onramp): cache buyable token mints from Coinbase BuyOptions API#893
Open
bmc08gt wants to merge 3 commits into
Open
feat(onramp): cache buyable token mints from Coinbase BuyOptions API#893bmc08gt wants to merge 3 commits into
bmc08gt wants to merge 3 commits into
Conversation
Extract buy options caching into a @singleton BuyOptionsCache with CoinbaseJwtExecutor for shared JWT execution. Prefetch on app foreground and after phone verification so resolveOnRampToken is instant. Support USDC fallback during deposit flow when USDF is not tradable in the user region. Signed-off-by: Brandon McAnsh <git@bmcreations.dev>
1040274 to
aafb280
Compare
…posit flow resolveOnRampToken existed but wasn't called from the production deposit path. Now placeOrderAndStartPayment resolves the on-ramp token via BuyOptionsCache before placing the order, so users in regions where USDF isn't tradable (e.g. US/NY) buy USDC instead and UsdcDepositSweep auto-converts it. Also promotes purchaseCurrency from a hardcoded "USDF" body property to a constructor parameter on OnRampPurchaseRequest, threaded through as token.symbol.uppercase(). Signed-off-by: Brandon McAnsh <git@bmcreations.dev>
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.
Extract buy-options caching into a @singleton BuyOptionsCache so it can be shared across scopes. Parse and cache the full set of buyable mints per region instead of just a boolean. Prefetch on app foreground and after phone verification so resolveOnRampToken() is instant.
USDC fallback is scoped to the deposit flow only (allowUsdcFallback param) -- launchpad token buys always use USDF until there is a program to support USDC swaps for arbitrary tokens.
destinationForToken now routes USDC purchases to the owner authority key (ATA), where UsdcDepositSweep picks it up. placeOrderAndStartPayment treats USDC the same as USDF (no stateful swap, DepositSubmitted path).