feat: onramper headless native buy(OK-58151) - #12875
Draft
weatherstar wants to merge 22 commits into
Draft
Conversation
…-sdk-7baf7b # Conflicts: # packages/kit/src/views/AssetDetails/pages/TokenDetails/ActionBuy.tsx # packages/kit/src/views/Send/components/SendAutoSizeAmountInput/index.tsx
# Conflicts: # packages/shared/src/routes/gallery.ts
- Android real devices get the mock client: creating the real client on Android throws synchronously during render (no native module; reachable via the dev Gallery which bypasses canUseHeadless) - Never quote a real checkout against an empty destination address: gate entry on accountId at tryOpenHeadlessBuy and hold the quote loop at Preparing until the address lookup resolves (mock stays exempt so the Simulator/Gallery preview keeps working) - HeadlessBuy token selector applies the same eligibility as the entry gate (headlessSupported AND onramperNetworkCode) - New Xcode build phase asserts ONEKEY_APPATTEST_ENVIRONMENT=production on Release builds, turning the entitlement/credentials consistency rule into a build-time failure instead of a doc reminder
Align the OneKeyWallet and ServiceExtension targets with the Podfile platform (Podfile.properties.json), which the Onramper Headless SDK's pod spec forces to :ios => '16.0'. The previous 15.5/16.0 split compiled all Pods against a 16.0 floor while the app still installed on iOS 15.x, where constant-folded #available checks could crash.
…58151) Upstream 4.2.0 ships nitrogen 0.35 generated code, so the local patch-package regeneration of the 4.1.0 codegen is no longer needed.
…egen patches (OK-58151) 3.0.82 ships nitrogen 0.35.2 generated code (published from app-modules PR #83), so the 20 patch-package patches that regenerated codegen inside node_modules are no longer needed. The auto-size-input functional patch (mostRecentEventCount sync) is upstreamed in the same release. Non-nitro @onekeyfe packages stay on 3.0.78 deliberately. Verified: published tarballs match the locally regenerated output byte-for-byte, patch-package applies cleanly, agent:check commit profile passes, Android bundleGoogleRelease succeeds (Sentry upload skipped locally), iOS pods resolve (NitroMmkv 4.2.0 / MMKVCore 2.3.0).
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.
Summary
headlessSupportedflag per token (OK-58060); anything unsupported, non-iOS, or missing credentials falls back to the existing web widget (fail-closed).Intent & Context
Buying crypto currently opens Onramper's hosted web widget. This PR ships the native "headless" purchase experience (quote → review → Apple Pay → result) inside the app for a much shorter, native-feeling path. Scope is deliberately iOS-only buy; sell and all unsupported cases stay on the web widget. i18n of the new copy is owned by product and out of scope (strings are English for now).
Design Decisions
onramperNetworkCode, no account address, no production credentials, or Android → web widget / mock. A real checkout is never quoted against an empty destination address.reset()and client teardown are deferred out of navigation-transition windows to avoid device-observed hard freezes.completedevent only means the order was handed to the provider — charge and delivery settle asynchronously and can still fail (observed in production 2026-08-13: Apple Pay authorized,completedfired, yet no charge and no crypto). The result page therefore says "Order submitted", and the full order ID is copyable for support lookups.production); a build-phase check fails the build otherwise.Changes Detail
packages/kit/src/views/FiatCrypto/pages/HeadlessBuy/— amount input (custom keypad, presets, live estimate), review mode with quote breakdown and native pay button, token selector, result page.packages/kit/src/views/FiatCrypto/components/Headless/— checkout lifecycle hook (useOnramperCheckout: session mint, debounced re-quote, event wiring, no-flicker button swap), action zone, info card, error copy mapping.packages/shared/src/modules3rdParty/onramper/— SDK adapter (real client on iOS, mock elsewhere), credentials/env selection, error-code recovery; hardware entry points untouched.packages/kit-bg/ fiat-crypto service — Onramper session mint endpoint wiring and headless-support token gating.fiatCrypto.onramperscope) — enter/quote/completed/failed/web-fallback events,checkoutIdlogged to server for order tracing.@onramper/onramper-react-native1.1.1, react-native-nitro-modules 0.35.2 with regenerated codegen patches for all 21 nitro packages (Android Kotlin compatibility; can be dropped once upstream ships 0.35-based packages), iOS deployment target 15.5 → 16.0 (SDK hard requirement, approved by huhuanming), App Attest entitlement per configuration.Risk Assessment
Test plan
bundleGoogleReleaseand iOS Release compile with regenerated nitro patchesa02871ad…)