Skip to content

Add docs for @tetherto/wdk-react-native-core#96

Open
gatteo wants to merge 5 commits intotetherto:developfrom
gatteo:docs/react-native-core
Open

Add docs for @tetherto/wdk-react-native-core#96
gatteo wants to merge 5 commits intotetherto:developfrom
gatteo:docs/react-native-core

Conversation

@gatteo
Copy link
Contributor

@gatteo gatteo commented Feb 20, 2026

Summary

Adds full documentation for @tetherto/wdk-react-native-core (v1.0.0-beta.3), the hooks-based React Native integration layer for WDK. Replaces all references to the deprecated wdk-react-native-provider.

Changes

File Action
tools/react-native-core/README.md New - Landing page with features, quick start, bundle configuration (custom + pre-built), architecture
tools/react-native-core/api-reference.md New - Complete API reference with table of contents: WdkAppProvider, useWdkApp (discriminated union WdkAppState), useWalletManager, useAccount (with estimateFee, extension), useAddresses, useBalance, useBalancesForWallet, useRefreshBalance, BaseAsset, types, utilities
start-building/react-native-quickstart.md Updated - Rewrote Option 2 with Sepolia testnet config (works out of the box), bundle setup with wdk-worklet-bundler, hints for Indexer API keys / module selection / biometrics on simulator, link to API reference
ui-kits/react-native-ui-kit/get-started.md Updated - Integration example uses useWdkApp state pattern + useBalance(accountIndex, asset) signature
skills/wdk/SKILL.md Updated - wdk-react-native-providerwdk-react-native-core in package table
SUMMARY.md Updated - Added nav entry under Tools
overview/changelog.md Updated - Added March 7 entry for react-native-core docs
sdk/core-module/configuration.md Fix - Fixed broken middleware configuration section (missing code block closing tags)

Key API changes documented (beta.2 → beta.3)

  • useWdkApp() returns { state: WdkAppState, retry } with discriminated union (INITIALIZING, NO_WALLET, LOCKED, READY, ERROR)
  • useAccount() always returns an object (never null), adds isLoading, error, estimateFee, UseAccountResponse-based return types
  • useBalance() signature changed to (accountIndex, asset, options?) - network derived from asset
  • useWalletManager() updated createTemporaryWallet(walletId, mnemonic?), added advanced crypto methods
  • WdkAppProvider adds requireBiometrics prop
  • Removed AppStatus/InitializationStatus enums (no longer exported)

Test plan

  • Preview - React Native Core appears in Tools nav with API Reference sub-page
  • All hooks documented with params, return types, and code examples
  • Quickstart Option 2 works end-to-end with Sepolia testnet config
  • No remaining references to wdk-react-native-provider except deprecation notes
  • All cross-links resolve correctly
  • Middleware configuration section in sdk/core-module/configuration.md renders correctly

@gatteo gatteo changed the base branch from main to develop February 20, 2026 22:38
@gatteo gatteo closed this Feb 27, 2026
@gatteo gatteo deleted the docs/react-native-core branch February 27, 2026 09:26
@gatteo gatteo restored the docs/react-native-core branch March 7, 2026 08:44
@gatteo gatteo reopened this Mar 7, 2026
Adds landing page and API reference for the new React Native Core
library that replaces wdk-react-native-provider. Updates the quickstart
guide, UI Kit integration example, and SKILL.md to use the new
hooks-based API (useWdkApp, useWalletManager, useAccount, useBalance).
@gatteo gatteo force-pushed the docs/react-native-core branch from 79ed077 to 1bcaec2 Compare March 7, 2026 09:51
gatteo added 4 commits March 7, 2026 11:04
- useWdkApp() now returns { state, retry } with WdkAppState discriminated union
- useAccount() always returns object (never null), adds isLoading, error, estimateFee
- useBalance() signature changed to (accountIndex, asset, options?) — network derived from asset
- useWalletManager() updated createTemporaryWallet(walletId, mnemonic?), added crypto methods
- useAddresses() loadAddresses now returns Promise<AddressInfoResult[]>
- Removed AppStatus/InitializationStatus enums (no longer exported)
- WalletInfo no longer has isActive field
- Added requireBiometrics prop to WdkAppProvider
- Custom bundle (.wdk/) now recommended over pre-built bundle
README.md:
- Simplify to one-line description, remove old provider reference
- Reorder: Quick Start before Bundle Configuration
- Add full bundler script from repo README (wdk.config.js example)
- Simplify Features section (less technical)
- Move Architecture to last section
- Replace em dashes with normal dashes

API Reference:
- Add lightweight table of contents at top
- Remove duplicate description line
- Simplify hook titles (remove parameter signatures)
- Replace em dashes with normal dashes

React Native Quickstart:
- Remove Step 2 (install dependencies) - handled by npm install
- Add wdk-worklet-bundler link in bundle step
- Remove currentUserId from provider snippets
- Shorten Step 6 hook example to match README style
- Convert troubleshooting headings to bold text
- Remove checkmark emojis from checklist
- Replace em dashes with normal dashes
Quickstart:
- Step 4: use Sepolia testnet with free public RPC (no API key needed)
- Step 4: add hint for where to get Indexer API keys
- Step 4: add hint that config uses testnet, link to mainnet guide
- Step 6: add link to full API Reference for hooks
- Step 3 (bundle): add hint about which WDK modules to install
- Starter template: improve indexer API key hint
- Troubleshooting: add biometric prompt on simulator section

Configuration (out of topic):
- Fix broken middleware section - missing code block closing tags
@gatteo gatteo marked this pull request as ready for review March 7, 2026 11:08
Copy link
Contributor

@ihsraham ihsraham left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did a full audit against @tetherto/wdk-react-native-core@1.0.0-beta.3, cross-referencing with the source and running tsc import checks. Overall this is solid, the hooks, BaseAsset, WdkAppState discriminated union, WdkAppProvider props, IAsset, AssetConfig, BalanceFetchResult, BundleConfig, BalanceQueryOptions, WalletInfo, and AccountInfo all match the types exactly. The config fix for configuration.md is a nice bonus too. Left a few comments on the type stuff.

### March 7, 2026

**What's New**
- **[React Native Core](../tools/react-native-core/)**: Added documentation for `@tetherto/wdk-react-native-core` (v1.0.0-beta.3), the hooks-based React Native integration layer for WDK. Includes [API Reference](../tools/react-native-core/api-reference.md) covering `WdkAppProvider`, `useWdkApp`, `useWalletManager`, `useAccount`, `useBalance`, and more. Updated [React Native Quickstart](../start-building/react-native-quickstart.md) with step-by-step integration guide.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


# API Reference

| Export | Type | Description |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The package also exports these types that aren't listed here: WdkAppProviderProps, WdkAppContextValue, UseAddressesReturn, UseAccountParams, UseAccountReturn, UseWalletManagerResult. Not blocking but worth adding so TS users know they can import them.


```typescript
interface WdkConfigs<TNetwork = Record<string, unknown>, TProtocol = Record<string, unknown>> {
indexer: {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jonathunne @gatteo the indexer field here doesn't seem to be present in the TypeScript types. WdkConfigs extends WdkWorkletConfig from pear-wrk-wdk, and neither of them include indexer. I installed @tetherto/wdk-react-native-core@1.0.0-beta.3 and ran tsc against a test file with const config: WdkConfigs = { indexer: {...}, networks: {...} } and it gives TS2353: Object literal may only specify known properties, and 'indexer' does not exist in type 'WdkConfigs'. The config does get forwarded to the worklet via JSON.stringify so it probably works at runtime, but users who type their config as WdkConfigs will get a TS error. I haven't tried running an app with this package, if it is needed we should have it in the types, right?


```typescript
interface WdkConfigs<TNetwork = Record<string, unknown>, TProtocol = Record<string, unknown>> {
indexer: {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jonathunne @gatteo the indexer field here doesn't seem to be present in the TypeScript types. WdkConfigs extends WdkWorkletConfig from pear-wrk-wdk, and neither of them include indexer. I ran tsc against a test file with const config: WdkConfigs = { indexer: {...}, networks: {...} } and it gives TS2353: Object literal may only specify known properties, and 'indexer' does not exist in type 'WdkConfigs'. The config does get forwarded to the worklet via JSON.stringify so it probably works at runtime, but users who type their config as WdkConfigs will get a TS error. I haven't tried running an app with this package, if it is needed we should have it in the types, right?

Root configuration object passed to `WdkAppProvider`. Defines network and protocol configurations for the WDK worklet.

```typescript
interface WdkConfigs<TNetwork = Record<string, unknown>, TProtocol = Record<string, unknown>> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This type definition inlines the network/protocol shapes instead of using the actual wrapper types from the source. The real type uses WdkNetworkConfig<TNetwork> and WdkProtocolConfig<TProtocol>, and WdkConfigs extends WdkWorkletConfig. If we just show the actual types here and document WdkNetworkConfig and WdkProtocolConfig below (like AddressInfo/AddressInfoResult under useAddresses).

| Field | Type | Description |
|-------|------|-------------|
| `accountIndex` | `number` | Account index |
| `network` | `string` | Network (required for `'token'` and `'network'` types) |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checked RefreshBalanceParams in the source, all fields except accountIndex are optional (?). The table here shows network, assetId, type, and walletId as plain string without optional markers. Verified with tsc: { accountIndex: 0 } alone compiles fine, confirming the others are optional. The description for walletId says "Optional" but the type column doesn't reflect it. Same inconsistency for type which has a default value mentioned but isn't marked optional.

| `success` | `boolean` | Whether the transaction succeeded |
| `hash` | `string` | Transaction hash |
| `fee` | `string` | Fee paid |
| `error` | `string` | Error message (only if `success` is `false`) |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

error is shown as string here but it's actually optional. TransactionResult extends UseAccountResponse where error is declared as error?: string. The UseAccountResponse block right above (line 246) correctly shows error?: string, but the TransactionResult table loses the ?. Small thing but would confuse someone checking types.

| `state` | [`WdkAppState`](#wdkappstate) | Current app state (discriminated union) |
| `retry` | `() => void` | Retry initialization after an error |

### WdkAppState
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two things:

  1. WdkAppState isn't exported from index.ts, so import { WdkAppState } from '@tetherto/wdk-react-native-core' fails. Verified with tsc. Same for TransactionParams, TransactionResult, UseAccountResponse (all in useAccount.ts), AddressInfo, AddressInfoResult, and BalanceQueryOptions (in useBalance.ts). They're defined in hook files but not re-exported. Worth a note, or better, adding the exports to the package.

  2. Some return types are referenced by name but never defined: UseBalanceResult (line 414), UseBalancesForWalletResult (line 470). The properties are described in tables which is great, but someone reading "Returns UseBalanceResult" will look for a definition and not find one. Either show a type definition block or drop the type name from the heading and just say "Returns" with the table.

### March 7, 2026

**What's New**
- **[React Native Core](../tools/react-native-core/)**: Added documentation for `@tetherto/wdk-react-native-core` (v1.0.0-beta.3), the hooks-based React Native integration layer for WDK. Includes [API Reference](../tools/react-native-core/api-reference.md) covering `WdkAppProvider`, `useWdkApp`, `useWalletManager`, `useAccount`, `useBalance`, and more. Updated [React Native Quickstart](../start-building/react-native-quickstart.md) with step-by-step integration guide.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small thing: the version mention should be a link per our style guide. Something like ([v1.0.0-beta.3](https://github.com/tetherto/wdk-core-react-native/releases/tag/v1.0.0-beta.3)) instead of just (v1.0.0-beta.3).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants