feat(sdk-react): react native support with /native entry point (#123) - #150
Conversation
|
@ZeePearl56 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
…ative-support-sdk-react # Conflicts: # packages/sdk-react/src/env.d.ts
|
Cascade conflict from sdk#152 landing right before you. Rebase against develop, force-push. |
…ative-support-sdk-react
pnpm-lock.yaml merged without conflict markers but was left in a broken state (missing an entry for @stellar/stellar-sdk resolved peer), and etc/sdk-stellar.api.md didn't account for the RpcClient exports wraith-protocol#168 added to develop. Neither is a change to this PR's own react-native feature; both are fallout from the develop merge.
|
Resolved the cascade conflict — pnpm-lock.yaml and etc/sdk-stellar.api.md are back in sync with develop. One remaining CI failure (format:check on src/chains/stellar/rpc.ts/rpc.test.ts) is pre-existing on develop itself from #168, unrelated to this PR — confirmed by running format:check directly on develop. @truthixify |
I can't merge if the CI is failing, so try to fix it. Thanks. |
Pre-existing formatting drift from wraith-protocol#168 on develop, unrelated to this PR's react-native feature. Fixing here since it's blocking CI and merge. Note: 6 tests in rpc.test.ts also fail, but that failure is confirmed pre-existing on develop itself (independently reproduced), not introduced by this commit or this PR.
|
CI fails in the Stellar RPC fallback tests. A 404 from |
maxAttempts didn't account for circuitBreaker.failureThreshold, so a low maxRetries could exhaust the retry loop before the circuit breaker ever tripped -- failover was unreachable with the tested config (maxRetries: 0, failureThreshold: 3, 2 endpoints). Also fixes two test bugs surfaced while investigating: mockFetchSequence's URL comparison didn't normalize the trailing slash the client always appends (every call fell through to its own 404 fallback), and two tests had a leading success entry in their mock sequences that contradicted their own failover assertions. Verified: all 11 rpc.test.ts tests pass, full suite (1122 tests) has zero regressions.
|
Merged. Thanks @ZeePearl56. Native React support and RPC fallback fixes are green. |
Summary
Adds React Native support to @wraith-protocol/sdk-react via a new /native subpath export. The existing web entry point is completely unchanged. 990 tests pass, 0 failures.
Changes
Platform abstraction layer (
src/platform.ts)PlatformStorage,PlatformCrypto, andPlatforminterfaceslocalStoragegetPlatform()/setPlatform()registry pattern (no circular deps)hooks.tsfor consumer accessReact Native platform (
src/platform-native.ts)@react-native-async-storage/async-storageexpo-crypto(SHA-256) with fallback toglobalThis.crypto.getRandomValuessetup()installs polyfills:react-native-get-random-values,BufferNew entry points
src/native.ts— callssetPlatform(nativePlatform)then re-exports all hooks@wraith-protocol/sdk-react/nativesubpath export added topackage.jsonexports andtsup.config.tsExample:
examples/stellar-react-native-receive/@wraith-protocol/sdk-react/nativeFiles changed
packages/sdk-react/src/platform.tspackages/sdk-react/src/platform-native.tspackages/sdk-react/src/native.tspackages/sdk-react/src/hooks.tspackages/sdk-react/src/env.d.tspackages/sdk-react/package.jsonpackages/sdk-react/tsup.config.tsexamples/stellar-react-native-receive/Verification
pnpm build— all entry points build cleanly (index + native)pnpm test— 990 tests pass (0 failures, 5 skipped — same as before)useStellarStealthKeys,useStellarBalance)pnpm format:check— all files use Prettier styleCloses #123