@sodax/skills 2.0.0-rc.10 → 2.0.0-rc.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/.claude-plugin/plugin.json +24 -1
  2. package/AGENTS.md +18 -8
  3. package/README.md +1 -0
  4. package/package.json +1 -1
  5. package/skills/sodax-dapp-kit/SKILL.md +2 -2
  6. package/skills/sodax-dapp-kit/auxiliary-services/SKILL.md +61 -0
  7. package/skills/sodax-dapp-kit/bitcoin/SKILL.md +53 -0
  8. package/skills/sodax-dapp-kit/bridge/SKILL.md +55 -0
  9. package/skills/sodax-dapp-kit/dex/SKILL.md +56 -0
  10. package/skills/sodax-dapp-kit/integration/knowledge/README.md +1 -1
  11. package/skills/sodax-dapp-kit/integration/knowledge/features/README.md +1 -1
  12. package/skills/sodax-dapp-kit/integration/knowledge/features/auxiliary-services.md +44 -0
  13. package/skills/sodax-dapp-kit/integration/knowledge/features/bitcoin.md +6 -6
  14. package/skills/sodax-dapp-kit/integration/knowledge/features/money-market.md +5 -0
  15. package/skills/sodax-dapp-kit/integration/knowledge/recipes/bitcoin.md +8 -8
  16. package/skills/sodax-dapp-kit/integration/knowledge/recipes/wallet-connectivity.md +3 -0
  17. package/skills/sodax-dapp-kit/integration/knowledge/reference/glossary.md +1 -1
  18. package/skills/sodax-dapp-kit/integration/knowledge/reference/hooks-index.md +6 -2
  19. package/skills/sodax-dapp-kit/integration/knowledge/reference/querykey-conventions.md +2 -0
  20. package/skills/sodax-dapp-kit/migration/SKILL.md +60 -0
  21. package/skills/sodax-dapp-kit/migration-v1-to-v2/knowledge/breaking-changes/hook-signatures.md +1 -1
  22. package/skills/sodax-dapp-kit/migration-v1-to-v2/knowledge/breaking-changes/sdk-leakage.md +1 -1
  23. package/skills/sodax-dapp-kit/migration-v1-to-v2/knowledge/checklist.md +1 -1
  24. package/skills/sodax-dapp-kit/migration-v1-to-v2/knowledge/features/README.md +1 -1
  25. package/skills/sodax-dapp-kit/migration-v1-to-v2/knowledge/features/bitcoin.md +2 -2
  26. package/skills/sodax-dapp-kit/migration-v1-to-v2/knowledge/reference/renamed-hooks.md +1 -1
  27. package/skills/sodax-dapp-kit/money-market/SKILL.md +57 -0
  28. package/skills/sodax-dapp-kit/staking/SKILL.md +56 -0
  29. package/skills/sodax-dapp-kit/swap/SKILL.md +60 -0
  30. package/skills/sodax-sdk/SKILL.md +1 -1
  31. package/skills/sodax-sdk/integration/knowledge/README.md +1 -1
  32. package/skills/sodax-sdk/integration/knowledge/architecture.md +5 -3
  33. package/skills/sodax-sdk/integration/knowledge/chain-specifics.md +33 -8
  34. package/skills/sodax-sdk/integration/knowledge/features/bridge.md +1 -0
  35. package/skills/sodax-sdk/integration/knowledge/features/money-market.md +1 -0
  36. package/skills/sodax-sdk/integration/knowledge/features/swap.md +1 -0
  37. package/skills/sodax-sdk/integration/knowledge/recipes/README.md +1 -0
  38. package/skills/sodax-sdk/integration/knowledge/recipes/initialize-sodax.md +6 -2
  39. package/skills/sodax-sdk/integration/knowledge/recipes/logging.md +102 -0
  40. package/skills/sodax-sdk/integration/knowledge/reference/public-api.md +8 -0
  41. package/skills/sodax-wallet-sdk-core/bitcoin/SKILL.md +50 -0
  42. package/skills/sodax-wallet-sdk-core/evm/SKILL.md +50 -0
  43. package/skills/sodax-wallet-sdk-core/icon/SKILL.md +50 -0
  44. package/skills/sodax-wallet-sdk-core/injective/SKILL.md +50 -0
  45. package/skills/sodax-wallet-sdk-core/integration/knowledge/ai-rules.md +1 -1
  46. package/skills/sodax-wallet-sdk-core/integration/knowledge/recipes/testing.md +1 -1
  47. package/skills/sodax-wallet-sdk-core/migration-v1-to-v2/knowledge/README.md +1 -1
  48. package/skills/sodax-wallet-sdk-core/near/SKILL.md +50 -0
  49. package/skills/sodax-wallet-sdk-core/solana/SKILL.md +50 -0
  50. package/skills/sodax-wallet-sdk-core/stacks/SKILL.md +49 -0
  51. package/skills/sodax-wallet-sdk-core/stellar/SKILL.md +50 -0
  52. package/skills/sodax-wallet-sdk-core/sui/SKILL.md +49 -0
  53. package/skills/sodax-wallet-sdk-react/SKILL.md +0 -2
  54. package/skills/sodax-wallet-sdk-react/bridge-to-sdk/SKILL.md +52 -0
  55. package/skills/sodax-wallet-sdk-react/connect/SKILL.md +55 -0
  56. package/skills/sodax-wallet-sdk-react/migration-v1-to-v2/knowledge/ai-rules.md +1 -1
  57. package/skills/sodax-wallet-sdk-react/sign-message/SKILL.md +47 -0
  58. package/skills/sodax-wallet-sdk-react/switch-chain/SKILL.md +47 -0
  59. package/skills/sodax-wallet-sdk-react/wallet-modal/SKILL.md +50 -0
  60. package/skills/sodax-wallet-sdk-react/walletconnect/SKILL.md +48 -0
@@ -12,7 +12,30 @@
12
12
  "./skills/sodax-sdk/recovery",
13
13
  "./skills/sodax-sdk/backend-api",
14
14
  "./skills/sodax-wallet-sdk-core",
15
+ "./skills/sodax-wallet-sdk-core/evm",
16
+ "./skills/sodax-wallet-sdk-core/solana",
17
+ "./skills/sodax-wallet-sdk-core/sui",
18
+ "./skills/sodax-wallet-sdk-core/bitcoin",
19
+ "./skills/sodax-wallet-sdk-core/stellar",
20
+ "./skills/sodax-wallet-sdk-core/icon",
21
+ "./skills/sodax-wallet-sdk-core/injective",
22
+ "./skills/sodax-wallet-sdk-core/near",
23
+ "./skills/sodax-wallet-sdk-core/stacks",
15
24
  "./skills/sodax-wallet-sdk-react",
16
- "./skills/sodax-dapp-kit"
25
+ "./skills/sodax-wallet-sdk-react/connect",
26
+ "./skills/sodax-wallet-sdk-react/wallet-modal",
27
+ "./skills/sodax-wallet-sdk-react/bridge-to-sdk",
28
+ "./skills/sodax-wallet-sdk-react/switch-chain",
29
+ "./skills/sodax-wallet-sdk-react/sign-message",
30
+ "./skills/sodax-wallet-sdk-react/walletconnect",
31
+ "./skills/sodax-dapp-kit",
32
+ "./skills/sodax-dapp-kit/swap",
33
+ "./skills/sodax-dapp-kit/money-market",
34
+ "./skills/sodax-dapp-kit/staking",
35
+ "./skills/sodax-dapp-kit/bridge",
36
+ "./skills/sodax-dapp-kit/dex",
37
+ "./skills/sodax-dapp-kit/migration",
38
+ "./skills/sodax-dapp-kit/bitcoin",
39
+ "./skills/sodax-dapp-kit/auxiliary-services"
17
40
  ]
18
41
  }
package/AGENTS.md CHANGED
@@ -4,16 +4,16 @@
4
4
 
5
5
  ## What's here
6
6
 
7
- This package ships **four mode-gated broad skills** (`skills/<name>/SKILL.md`) — one per SODAX SDK package — plus **nested granular per-feature skills** under `sodax-sdk` (one per Core SDK feature service). Each broad skill bundles two long-form **knowledge** subtrees: `integration/knowledge/` (writing new v2 code) and `migration-v1-to-v2/knowledge/` (porting v1 → v2). Granular skills are single-file SKILL.md that link into their parent's knowledge tree. Skills are action-oriented (when to use, workflow, anti-patterns, links into knowledge); knowledge is the reference material your workflow points at. SKILL.md gates by mode at the top — pick integration or migration based on the consumer signal.
7
+ This package ships **four mode-gated broad skills** (`skills/<name>/SKILL.md`) — one per SODAX SDK package — plus **nested granular skills** under every broad skill: `sodax-sdk` (one per Core SDK feature service), `sodax-dapp-kit` (one per dapp-kit feature domain), `sodax-wallet-sdk-core` (one per chain family), and `sodax-wallet-sdk-react` (one per connectivity concern). Each broad skill bundles two long-form **knowledge** subtrees: `integration/knowledge/` (writing new v2 code) and `migration-v1-to-v2/knowledge/` (porting v1 → v2). Granular skills are single-file SKILL.md that link into their parent's knowledge tree. Skills are action-oriented (when to use, workflow, anti-patterns, links into knowledge); knowledge is the reference material your workflow points at. SKILL.md gates by mode at the top — pick integration or migration based on the consumer signal.
8
8
 
9
9
  | SDK package | Broad skill | Granular per-feature skills |
10
10
  |---|---|---|
11
11
  | `@sodax/sdk` | `sodax-sdk` | `sodax-sdk/swap`, `sodax-sdk/money-market`, `sodax-sdk/bridge`, `sodax-sdk/staking`, `sodax-sdk/dex`, `sodax-sdk/migration`, `sodax-sdk/partner`, `sodax-sdk/recovery`, `sodax-sdk/backend-api` |
12
- | `@sodax/wallet-sdk-core` | `sodax-wallet-sdk-core` | |
13
- | `@sodax/wallet-sdk-react` | `sodax-wallet-sdk-react` | |
14
- | `@sodax/dapp-kit` | `sodax-dapp-kit` | |
12
+ | `@sodax/wallet-sdk-core` | `sodax-wallet-sdk-core` | `sodax-wallet-sdk-core/evm`, `sodax-wallet-sdk-core/solana`, `sodax-wallet-sdk-core/sui`, `sodax-wallet-sdk-core/bitcoin`, `sodax-wallet-sdk-core/stellar`, `sodax-wallet-sdk-core/icon`, `sodax-wallet-sdk-core/injective`, `sodax-wallet-sdk-core/near`, `sodax-wallet-sdk-core/stacks` |
13
+ | `@sodax/wallet-sdk-react` | `sodax-wallet-sdk-react` | `sodax-wallet-sdk-react/connect`, `sodax-wallet-sdk-react/wallet-modal`, `sodax-wallet-sdk-react/bridge-to-sdk`, `sodax-wallet-sdk-react/switch-chain`, `sodax-wallet-sdk-react/sign-message`, `sodax-wallet-sdk-react/walletconnect` |
14
+ | `@sodax/dapp-kit` | `sodax-dapp-kit` | `sodax-dapp-kit/swap`, `sodax-dapp-kit/money-market`, `sodax-dapp-kit/staking`, `sodax-dapp-kit/bridge`, `sodax-dapp-kit/dex`, `sodax-dapp-kit/migration`, `sodax-dapp-kit/bitcoin`, `sodax-dapp-kit/auxiliary-services` |
15
15
 
16
- **When to prefer a granular skill:** if the consumer has already picked a feature (e.g. *"swap with Sodax"*, *"supply on money market"*), load the matching granular skill — it's ~3 KB vs `sodax-sdk`'s ~13 KB and points at exactly the knowledge files needed for that feature. Load the broad `sodax-sdk` skill when the feature is undecided, the task spans multiple features, or the consumer is porting a full v1 codebase.
16
+ **When to prefer a granular skill:** if the consumer has already picked a sub-domain (e.g. *"swap with Sodax"*, *"supply on money market"*, *"useSwap hook"*, *"instantiate EvmWalletProvider"*, *"add a connect button"*), load the matching granular skill — it's ~3 KB vs the broad skill's ~13 KB and points at exactly the knowledge files needed. For a React dapp that has settled on one feature, load `sodax-dapp-kit/<feature>`; for raw SDK / backend work, load `sodax-sdk/<feature>`; for a known chain in a backend/Node wallet flow, load `sodax-wallet-sdk-core/<chain>`; for a known React wallet concern (connect, wallet-modal, bridge-to-sdk, switch-chain, sign-message, walletconnect), load `sodax-wallet-sdk-react/<concern>`. Load the broad skill when the sub-domain is undecided, the task spans several, or the consumer is porting a full v1 codebase.
17
17
 
18
18
  > **What about `@sodax/types`?** No skill. The package has no consumer-facing surface — it's pure TypeScript types, re-exported through `@sodax/sdk`. Importing `@sodax/types` directly invites version skew. The SDK skills cover all `@sodax/types` symbols you need.
19
19
 
@@ -24,6 +24,9 @@ Pick the consumer's situation, load the listed skills in order. Each entry names
24
24
  | Consumer is… | Load skills (mode) |
25
25
  |---|---|
26
26
  | **Scaffolding ONE specific Core SDK feature** (swap, money-market, bridge, staking, dex, migration, partner, recovery, backend-api) | `sodax-sdk/<feature>` (granular, covers both modes via internal links). Add `sodax-wallet-sdk-core` (integration) if it signs and lives outside React. Skip the broad `sodax-sdk` skill |
27
+ | **Scaffolding ONE specific dapp-kit feature in React** (swap, money-market, staking, bridge, dex, migration, bitcoin, auxiliary-services) | `sodax-wallet-sdk-react` (integration) → `sodax-dapp-kit/<feature>` (granular, covers both modes via internal links). Skip the broad `sodax-dapp-kit` skill. If the wallet concern is also settled (just a connect button, modal, bridge, etc.), narrow to `sodax-wallet-sdk-react/<concern>` too |
28
+ | **Scaffolding ONE chain's wallet provider** (backend/Node/non-React: evm, solana, sui, bitcoin, stellar, icon, injective, near, stacks) | `sodax-wallet-sdk-core/<chain>` (granular, covers both modes) → `sodax-sdk/<feature>` for the operation it signs. Skip the broad `sodax-wallet-sdk-core` skill |
29
+ | **Scaffolding ONE React wallet concern** (connect, wallet-modal, bridge-to-sdk, switch-chain, sign-message, walletconnect) | `sodax-wallet-sdk-react/<concern>` (granular, covers both modes). Skip the broad `sodax-wallet-sdk-react` skill |
27
30
  | **Building a NEW React dapp** | `sodax-wallet-sdk-react` (integration) → `sodax-dapp-kit` (integration) → (`sodax-sdk` (integration) only if dropping below dapp-kit) |
28
31
  | **Building a NEW React app, no dapp-kit** (calling the SDK directly) | `sodax-wallet-sdk-react` (integration) → `sodax-sdk` (integration) |
29
32
  | **Building a NEW Node / backend service or script** | `sodax-sdk` (integration) → `sodax-wallet-sdk-core` (integration; only if it signs) |
@@ -57,9 +60,16 @@ packages/skills/
57
60
  ├── sodax-sdk/ {SKILL.md, integration/knowledge/, migration-v1-to-v2/knowledge/,
58
61
  │ <feature>/SKILL.md ×9 — swap, money-market, bridge, staking, dex,
59
62
  │ migration, partner, recovery, backend-api}
60
- ├── sodax-wallet-sdk-core/ {SKILL.md, integration/knowledge/, migration-v1-to-v2/knowledge/}
61
- ├── sodax-wallet-sdk-react/ {SKILL.md, integration/knowledge/, migration-v1-to-v2/knowledge/ incl. 4 .tsx example apps under integration/knowledge/examples/}
62
- └── sodax-dapp-kit/ {SKILL.md, integration/knowledge/, migration-v1-to-v2/knowledge/}
63
+ ├── sodax-wallet-sdk-core/ {SKILL.md, integration/knowledge/, migration-v1-to-v2/knowledge/,
64
+ │ <chain>/SKILL.md ×9evm, solana, sui, bitcoin, stellar, icon,
65
+ │ injective, near, stacks}
66
+ ├── sodax-wallet-sdk-react/ {SKILL.md, integration/knowledge/, migration-v1-to-v2/knowledge/
67
+ │ (incl. 4 .tsx example apps under integration/knowledge/examples/),
68
+ │ <concern>/SKILL.md ×6 — connect, wallet-modal, bridge-to-sdk,
69
+ │ switch-chain, sign-message, walletconnect}
70
+ └── sodax-dapp-kit/ {SKILL.md, integration/knowledge/, migration-v1-to-v2/knowledge/,
71
+ <feature>/SKILL.md ×8 — swap, money-market, staking, bridge, dex,
72
+ migration, bitcoin, auxiliary-services}
63
73
  ```
64
74
 
65
75
  Each `<mode>/knowledge/` subtree contains `ai-rules.md`, `quickstart.md`, `architecture.md`, `features/`, `recipes/`, `reference/`, and `chain-specifics.md` / `breaking-changes/` where applicable.
package/README.md CHANGED
@@ -22,6 +22,7 @@ Four mode-gated skills land in your repo (under `.claude/skills/` or wherever th
22
22
  | Bundle | Contains |
23
23
  |---|---|
24
24
  | **4 mode-gated skills** under `skills/sodax-<pkg>/SKILL.md` | One skill per SODAX SDK package. `<pkg>` ∈ `sdk`, `wallet-sdk-core`, `wallet-sdk-react`, `dapp-kit`. Each SKILL.md gates by mode (integration vs migration) at the top of the body. |
25
+ | **Granular skills** under `skills/sodax-<pkg>/<sub-domain>/SKILL.md` | Every broad skill ships focused single-domain children: `sodax-sdk` / `sodax-dapp-kit` per feature (swap, money-market, bridge, staking, dex, …); `sodax-wallet-sdk-core` per chain (evm, solana, sui, bitcoin, stellar, icon, injective, near, stacks); `sodax-wallet-sdk-react` per connectivity concern (connect, wallet-modal, bridge-to-sdk, switch-chain, sign-message, walletconnect). Load one when the task is already scoped to a single sub-domain — it points at exactly the knowledge files for it instead of the whole broad skill. |
25
26
  | **Knowledge** under `skills/sodax-<pkg>/{integration,migration-v1-to-v2}/knowledge/` | Long-form supporting docs — features, recipes, reference tables, breaking-change writeups, code examples. Each skill ships both mode subtrees so `npx skills add` copies the full reference together. |
26
27
  | **`AGENTS.md`** at the package root | Tool-neutral router: maps the consumer's stated task to the right skill + mode. |
27
28
 
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
7
- "version": "2.0.0-rc.10",
7
+ "version": "2.0.0-rc.12",
8
8
  "license": "MIT",
9
9
  "description": "AI-agent skills and knowledge for consumers of @sodax/* SDKs (Claude Code, Codex, Cursor, …)",
10
10
  "keywords": [
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: sodax-dapp-kit
3
- description: 'INTEGRATION (write NEW code) — @sodax/dapp-kit is React hooks wrapping @sodax/sdk with React Query across 11 feature domains (swap, money market, staking, bridge, dex, migration, partner, recovery, bitcoin/Radfi, backend queries, shared). React-only — Node and backend code uses `@sodax/sdk` directly. Use whenever a React dapp needs SODAX feature hooks. Triggers on "use @sodax/dapp-kit", "useSwap", "useMoneyMarket", "useStake", "useBridge", "useDex", "useMigrate", any `use<Feature>` hook name from dapp-kit, "Sodax React hooks", "dapp-kit query / mutation". v2 hook shape: mutation hooks return `SafeUseMutationResult` with `mutateAsyncSafe(vars): Promise<Result<TData>>`. mutationFn unwraps SDK Result<T> and throws on `!ok` so React Query''s native error model engages. Hook-owned invalidations — consumer onSuccess runs after. MIGRATION (port v1 → v2) — a deep canonicalization pass: single-object hook params, mandatory `mutateAsyncSafe`, hook-owned invalidations, throw-on-`Result.!ok` inside `mutationFn`, canonical queryKey/mutationKey conventions. Plus the SDK underneath was reshaped (chain-key-driven routing, `Result<T>` everywhere, `WalletProviderSlot<K, Raw>`). v1 dapp-kit code will not compile against v2. Triggers on "migrate @sodax/dapp-kit", "useSpokeProvider gone", "dapp-kit v1 → v2", "invalidateMmQueries broken", "dapp-kit hook signatures changed", v1 fingerprints (positional args, hook-init `spokeProvider`, `useSpokeProvider`, `invalidateMmQueries`, legacy `useMigrate`, `*_MAINNET_CHAIN_ID`). Load this skill if EITHER applies; the body gates by mode.'
3
+ description: 'INTEGRATION (write NEW code) — @sodax/dapp-kit is React hooks wrapping @sodax/sdk with React Query across 11 feature domains (swap, money market, staking, bridge, dex, migration, partner, recovery, bitcoin/Bound Exchange, backend queries, shared). React-only — Node and backend code uses `@sodax/sdk` directly. Use whenever a React dapp needs SODAX feature hooks. Triggers on "use @sodax/dapp-kit", "useSwap", "useMoneyMarket", "useStake", "useBridge", "useDex", "useMigrate", any `use<Feature>` hook name from dapp-kit, "Sodax React hooks", "dapp-kit query / mutation". v2 hook shape: mutation hooks return `SafeUseMutationResult` with `mutateAsyncSafe(vars): Promise<Result<TData>>`. mutationFn unwraps SDK Result<T> and throws on `!ok` so React Query''s native error model engages. Hook-owned invalidations — consumer onSuccess runs after. MIGRATION (port v1 → v2) — a deep canonicalization pass: single-object hook params, mandatory `mutateAsyncSafe`, hook-owned invalidations, throw-on-`Result.!ok` inside `mutationFn`, canonical queryKey/mutationKey conventions. Plus the SDK underneath was reshaped (chain-key-driven routing, `Result<T>` everywhere, `WalletProviderSlot<K, Raw>`). v1 dapp-kit code will not compile against v2. Triggers on "migrate @sodax/dapp-kit", "useSpokeProvider gone", "dapp-kit v1 → v2", "invalidateMmQueries broken", "dapp-kit hook signatures changed", v1 fingerprints (positional args, hook-init `spokeProvider`, `useSpokeProvider`, `invalidateMmQueries`, legacy `useMigrate`, `*_MAINNET_CHAIN_ID`). Load this skill if EITHER applies; the body gates by mode.'
4
4
  ---
5
5
 
6
6
  # When to use this skill
@@ -32,7 +32,7 @@ Pick this mode when the consumer is a React dapp using `@sodax/dapp-kit` hooks.
32
32
  1. Read [`integration/knowledge/ai-rules.md`](./integration/knowledge/ai-rules.md) — DO / DO NOT / workflow / stop conditions.
33
33
  2. Read [`integration/knowledge/quickstart.md`](./integration/knowledge/quickstart.md) — install + wire providers + first feature.
34
34
  3. Read [`integration/knowledge/architecture.md`](./integration/knowledge/architecture.md) — hook shapes, queryKey conventions, `useSafeMutation`, `unwrapResult`, `Result<T>`.
35
- 4. For each feature you use, read [`integration/knowledge/features/`](./integration/knowledge/features/) — `swap.md`, `money-market.md`, `staking.md`, `bridge.md`, `dex.md`, `migration.md`, `bitcoin.md` (Radfi, dapp-kit-unique), `auxiliary-services.md` (partner + recovery + backend + shared).
35
+ 4. For each feature you use, read [`integration/knowledge/features/`](./integration/knowledge/features/) — `swap.md`, `money-market.md`, `staking.md`, `bridge.md`, `dex.md`, `migration.md`, `bitcoin.md` (Bound Exchange, dapp-kit-unique), `auxiliary-services.md` (partner + recovery + backend + shared).
36
36
  5. Recipes → [`integration/knowledge/recipes/`](./integration/knowledge/recipes/) — `setup.md`, `wallet-connectivity.md`, per-feature, `mutation-error-handling.md`, `observability.md`, `invalidations.md`.
37
37
  6. Lookups → [`integration/knowledge/reference/`](./integration/knowledge/reference/) — `hooks-index.md`, `querykey-conventions.md`, `public-api.md`, `glossary.md`.
38
38
 
@@ -0,0 +1,61 @@
1
+ ---
2
+ name: sodax-dapp-kit-auxiliary-services
3
+ description: 'Granular skill for the @sodax/dapp-kit v2 auxiliary surfaces — partner fee claiming (useFeeClaimSwap, useApproveToken, useSetSwapPreference, useGetAutoSwapPreferences, useIsTokenApproved), recovery (useHubAssetBalances, useWithdrawHubAsset), read-only backend queries (useBackendIntentByTxHash, useBackendUserIntents, useBackendOrderbook, useBackendMoneyMarketPosition, useBackendSubmitSwapTx), and shared utilities (useSodaxContext, useHubProvider, useXBalances, useDeriveUserWalletAddress, useEstimateGas, useStellarTrustlineCheck, useRequestTrustline). Use when a React dapp task is partner fees, recovering stuck hub assets, backend data reads (intent tracking / orderbook / MM data, no wallet), or cross-cutting utilities (token balances, gas estimation, Stellar trustlines). Covers BOTH integration and migration. Links into the parent sodax-dapp-kit knowledge tree.'
4
+ ---
5
+
6
+ # Auxiliary services (dapp-kit granular skill)
7
+
8
+ Granular skill for the smaller `@sodax/dapp-kit` v2 surfaces grouped together: **partner** (queryKey `partner`), **recovery** (`recovery`), **backend queries** (`backend`, read-only — no wallet), and **shared utilities** (`shared`). React-only — backend/Node uses `@sodax/sdk` directly.
9
+
10
+ ## Step 1 — Clarify with user before coding
11
+
12
+ 1. **New code or v1 → v2 port?**
13
+ 2. **Which surface?**
14
+ - **Partner fees:** `useIsTokenApproved` → `useApproveToken` → `useSetSwapPreference` → `useFeeClaimSwap` (returns `IntentAutoSwapResult`, NOT `SwapResponse`); `useGetAutoSwapPreferences`, `useFetchAssetsBalances` for reads.
15
+ - **Recovery:** `useHubAssetBalances` (list stuck hub assets) → `useWithdrawHubAsset` (withdraw one back to a spoke). Follows a *known* failed cross-chain op — investigate the failure first.
16
+ - **Backend reads (no wallet):** intent tracking (`useBackendIntentByTxHash` polls 1s, `useBackendIntentByHash`, `useBackendUserIntents`), orderbook (`useBackendOrderbook` — `pagination` nests under `params`), MM data (`useBackendMoneyMarketPosition` etc.), swap submission (`useBackendSubmitSwapTx` mutation + `useBackendSubmitSwapTxStatus`).
17
+ - **Shared utilities:** `useSodaxContext`, `useHubProvider`, `useXBalances` (needs `xService` from wallet-sdk-react), `useDeriveUserWalletAddress` / `useGetUserHubWalletAddress`, `useEstimateGas`, `useStellarTrustlineCheck` / `useRequestTrustline`.
18
+
19
+ ## Integration workflow (new v2 code)
20
+
21
+ 1. [`../integration/knowledge/ai-rules.md`](../integration/knowledge/ai-rules.md) — DO / DO NOT (read first).
22
+ 2. [`../integration/knowledge/architecture.md`](../integration/knowledge/architecture.md) — hook shapes, `mutateAsyncSafe`, `unwrapResult`, queryKey conventions.
23
+ 3. [`../integration/knowledge/features/auxiliary-services.md`](../integration/knowledge/features/auxiliary-services.md) — full hook surface for all four surfaces, `useXBalances` shape, trustline pattern, default polling intervals.
24
+ 4. Worked examples:
25
+ - Backend reads → [`../integration/knowledge/recipes/backend-queries.md`](../integration/knowledge/recipes/backend-queries.md).
26
+ - `useXBalances` → [`../integration/knowledge/recipes/wallet-connectivity.md`](../integration/knowledge/recipes/wallet-connectivity.md).
27
+ 5. Call-shape choice → [`../integration/knowledge/recipes/mutation-error-handling.md`](../integration/knowledge/recipes/mutation-error-handling.md).
28
+
29
+ ### Auxiliary-specific anti-patterns (dapp-kit)
30
+
31
+ - **Treating `useFeeClaimSwap` `data` as a `SwapResponse`.** It's `IntentAutoSwapResult`.
32
+ - **Passing top-level `pagination` to `useBackendOrderbook` / `useBackendAllMoneyMarketBorrowers`.** It nests under `params`; without it those queries are disabled.
33
+ - **Calling `useXBalances` without `xService`.** Supply `xService` from `@sodax/wallet-sdk-react`'s `useXService`; the request-side key is `xChainId` (the cross-chain abstraction), distinct from the token-side `chainKey`.
34
+ - **Treating `useRequestTrustline` as a canonical mutation hook.** It takes a single positional `token` arg and returns `{ requestTrustline, isLoading, ... }`; the callback takes `{ token, amount, srcChainKey, walletProvider }` (NOT `account`/`asset`).
35
+ - **Running recovery on successful flows.** Recovery is a workaround for *failed* ops — `useHubAssetBalances` first, then withdraw the specific entry; investigate the original failure.
36
+ - **Leaving `useBackendIntentByTxHash` polling (1s) running after the intent resolves.**
37
+
38
+ ## Migration workflow (port v1 auxiliary hooks to v2)
39
+
40
+ 1. [`../migration-v1-to-v2/knowledge/ai-rules.md`](../migration-v1-to-v2/knowledge/ai-rules.md) — DO / DO NOT (read first).
41
+ 2. Cross-cutting deltas: [`../migration-v1-to-v2/knowledge/breaking-changes/hook-signatures.md`](../migration-v1-to-v2/knowledge/breaking-changes/hook-signatures.md), [`../migration-v1-to-v2/knowledge/breaking-changes/result-handling.md`](../migration-v1-to-v2/knowledge/breaking-changes/result-handling.md), [`../migration-v1-to-v2/knowledge/breaking-changes/sdk-leakage.md`](../migration-v1-to-v2/knowledge/breaking-changes/sdk-leakage.md).
42
+ 3. [`../migration-v1-to-v2/knowledge/features/auxiliary-services.md`](../migration-v1-to-v2/knowledge/features/auxiliary-services.md) — small per-hook changes across partner / recovery / backend / shared.
43
+
44
+ ## Verification
45
+
46
+ 1. `pnpm tsc --noEmit` clean.
47
+ 2. `useBackendOrderbook` / paginated MM reads nest `pagination` under `params`.
48
+ 3. `useXBalances` is supplied an `xService`.
49
+ 4. Mutation flows (partner / recovery / submit) use `mutateAsyncSafe` and branch on `result.ok`.
50
+ 5. No `useSpokeProvider`, no hook-level `spokeProvider` (migration only).
51
+
52
+ ## Related granular skills (same family)
53
+
54
+ - [`../swap/SKILL.md`](../swap/SKILL.md) — `useBackendSubmitSwapTx` + intent tracking are the backend half of the step-by-step swap flow; partner fee-claim reuses the swap intent layer.
55
+ - [`../money-market/SKILL.md`](../money-market/SKILL.md) — backend MM reads complement the on-chain MM action hooks.
56
+
57
+ For multi-feature tasks, load the broad [`sodax-dapp-kit` skill](../SKILL.md).
58
+
59
+ ## Wallet connectivity (different SDK package family)
60
+
61
+ Partner/recovery mutations take a `walletProvider`; `useXBalances` needs an `xService`. **Also load the `sodax-wallet-sdk-react` skill (integration mode)** for `useWalletProvider` and `useXService`. (Backend read hooks need no wallet.)
@@ -0,0 +1,53 @@
1
+ ---
2
+ name: sodax-dapp-kit-bitcoin
3
+ description: 'Granular skill for the @sodax/dapp-kit v2 Bitcoin/Radfi feature only — React Query hooks for Bitcoin trading via the Radfi protocol: useRadfiAuth, useRadfiSession, useTradingWallet, useFundTradingWallet, useRadfiWithdraw, useExpiredUtxos, useRenewUtxos, useBitcoinBalance, useTradingWalletBalance. This is a dapp-kit-UNIQUE surface (no @sodax/sdk equivalent — the flows are React-shaped). Use when a React dapp task is Bitcoin/Radfi (e.g. "Radfi session hook", "fund trading wallet hook", "Radfi withdraw in React", "manage Bitcoin UTXOs hook", "BIP322 auth with dapp-kit"). Covers BOTH integration (new v2 hooks) and migration (port v1 Radfi hooks — mostly signature tightening, flow unchanged). Links into the parent sodax-dapp-kit knowledge tree.'
4
+ ---
5
+
6
+ # Bitcoin / Radfi (dapp-kit granular skill)
7
+
8
+ Granular skill for the Bitcoin trading hooks of `@sodax/dapp-kit` v2 — authenticate (BIP322), fund a trading wallet, withdraw, manage UTXOs via the Radfi protocol. queryKey/mutationKey first segment: `bitcoin`. **Dapp-kit-unique** — no `@sodax/sdk` equivalent.
9
+
10
+ ## Step 1 — Clarify with user before coding
11
+
12
+ 1. **New code or v1 → v2 port?**
13
+ 2. **Which stage?** Session/auth (`useRadfiAuth`, `useRadfiSession`, `useTradingWallet`), balances (`useBitcoinBalance`, `useTradingWalletBalance`), operations (`useFundTradingWallet`, `useRadfiWithdraw`), UTXO maintenance (`useExpiredUtxos`, `useRenewUtxos`).
14
+ 3. **Session lifecycle handled?** `useRadfiSession(walletProvider)` manages login/refresh/auto-refresh + localStorage persistence; gate trading buttons on `isAuthed`.
15
+
16
+ ## Integration workflow (new v2 code)
17
+
18
+ 1. [`../integration/knowledge/ai-rules.md`](../integration/knowledge/ai-rules.md) — DO / DO NOT (read first).
19
+ 2. [`../integration/knowledge/architecture.md`](../integration/knowledge/architecture.md) — hook shapes, `mutateAsyncSafe`, `unwrapResult`, queryKey conventions.
20
+ 3. [`../integration/knowledge/features/bitcoin.md`](../integration/knowledge/features/bitcoin.md) — full hook surface, session flow, mutation TVars, return shapes, polling notes.
21
+ 4. [`../integration/knowledge/recipes/bitcoin.md`](../integration/knowledge/recipes/bitcoin.md) — full worked examples (session, fund, withdraw, UTXO management).
22
+ 5. Call-shape choice → [`../integration/knowledge/recipes/mutation-error-handling.md`](../integration/knowledge/recipes/mutation-error-handling.md).
23
+
24
+ ### Bitcoin/Radfi-specific anti-patterns (dapp-kit)
25
+
26
+ - **Calling trading operations before auth.** Gate on `useRadfiSession(...).isAuthed`; the trading wallet is created during first authentication, not as a separate step.
27
+ - **Expecting `useTradingWallet` to fetch.** It's synchronous — reads the persisted session from localStorage (keyed by wallet address). Use it when you don't yet have a `walletProvider`.
28
+ - **Hand-rolling PSBT signing for withdrawals.** `useRadfiWithdraw` orchestrates the unsigned-PSBT → local-sign → co-sign → broadcast flow; consumers don't touch PSBTs directly.
29
+ - **Treating `useRadfiAuth` `data` as a full `RadfiSession`.** It's `RadfiAuthResult = { accessToken, refreshToken, tradingAddress }` (no `publicKey` in the return; it's persisted internally).
30
+ - **Leaving `useExpiredUtxos` polling (60s) on hidden UI.** Set `queryOptions.refetchInterval: false` when not visible.
31
+
32
+ ## Migration workflow (port v1 Radfi hooks to v2)
33
+
34
+ 1. [`../migration-v1-to-v2/knowledge/ai-rules.md`](../migration-v1-to-v2/knowledge/ai-rules.md) — DO / DO NOT (read first).
35
+ 2. Cross-cutting deltas: [`../migration-v1-to-v2/knowledge/breaking-changes/hook-signatures.md`](../migration-v1-to-v2/knowledge/breaking-changes/hook-signatures.md), [`../migration-v1-to-v2/knowledge/breaking-changes/result-handling.md`](../migration-v1-to-v2/knowledge/breaking-changes/result-handling.md).
36
+ 3. [`../migration-v1-to-v2/knowledge/features/bitcoin.md`](../migration-v1-to-v2/knowledge/features/bitcoin.md) — Radfi flow is mostly unchanged; provider/session lifecycle hook signatures tightened.
37
+
38
+ ## Verification
39
+
40
+ 1. `pnpm tsc --noEmit` clean.
41
+ 2. Trading buttons gate on `isAuthed`.
42
+ 3. Mutation flows use `mutateAsyncSafe` and branch on `result.ok`.
43
+ 4. No hand-rolled PSBT signing; `useRadfiWithdraw` owns the flow.
44
+
45
+ ## Related granular skills (same family)
46
+
47
+ - [`../auxiliary-services/SKILL.md`](../auxiliary-services/SKILL.md) — `useXBalances` and other shared utilities used alongside Bitcoin UI.
48
+
49
+ For multi-feature tasks, load the broad [`sodax-dapp-kit` skill](../SKILL.md).
50
+
51
+ ## Wallet connectivity (different SDK package family)
52
+
53
+ These hooks take an `IBitcoinWalletProvider`. **Also load the `sodax-wallet-sdk-react` skill (integration mode)** to wire a Bitcoin wallet and obtain the provider via `useWalletProvider({ xChainId: ChainKeys.BITCOIN_MAINNET })`.
@@ -0,0 +1,55 @@
1
+ ---
2
+ name: sodax-dapp-kit-bridge
3
+ description: 'Granular skill for the @sodax/dapp-kit v2 bridge feature only — React Query hooks for cross-chain token transfer via the hub-and-spoke vault: useBridge, useBridgeApprove, useBridgeAllowance, useGetBridgeableAmount, useGetBridgeableTokens. Use when a React dapp task is specifically bridging (e.g. "useBridge with dapp-kit", "bridge tokens cross-chain in React", "check bridgeable amount hook", "list bridgeable destinations"). useBridge resolves to TxHashPair = { srcChainTxHash, dstChainTxHash }. Covers BOTH integration (new v2 hooks) and migration (port v1 bridge hooks — field renames srcChainId→srcChainKey, recipient→dstAddress, mutateAsyncSafe). Links into the parent sodax-dapp-kit knowledge tree. For backend/Node, use the sodax-sdk skill.'
4
+ ---
5
+
6
+ # Bridge (dapp-kit granular skill)
7
+
8
+ Granular skill for the bridge hooks of `@sodax/dapp-kit` v2. queryKey/mutationKey first segment: `bridge`. React-only — backend uses `@sodax/sdk` directly.
9
+
10
+ ## Step 1 — Clarify with user before coding
11
+
12
+ 1. **New code or v1 → v2 port?**
13
+ 2. **Need a bridgeable precheck?** `useGetBridgeableAmount` (vault deposit/withdrawal cap, returns a `BridgeLimit`) and `useGetBridgeableTokens` (enumerate compatible destinations).
14
+ 3. **Allowance gating?** `useBridgeAllowance` + `useBridgeApprove` before `useBridge`.
15
+ 4. **Source/destination chains + recipient format** — confirm both are supported spokes and the `recipient` matches the destination chain encoding.
16
+
17
+ ## Integration workflow (new v2 code)
18
+
19
+ 1. [`../integration/knowledge/ai-rules.md`](../integration/knowledge/ai-rules.md) — DO / DO NOT (read first).
20
+ 2. [`../integration/knowledge/architecture.md`](../integration/knowledge/architecture.md) — hook shapes, `mutateAsyncSafe`, `unwrapResult`, queryKey conventions.
21
+ 3. [`../integration/knowledge/features/bridge.md`](../integration/knowledge/features/bridge.md) — full hook surface, `CreateBridgeIntentParams` shape, `useBridgeAllowance` nesting, `BridgeLimit` return.
22
+ 4. [`../integration/knowledge/recipes/bridge.md`](../integration/knowledge/recipes/bridge.md) — full worked example.
23
+ 5. Call-shape choice → [`../integration/knowledge/recipes/mutation-error-handling.md`](../integration/knowledge/recipes/mutation-error-handling.md).
24
+
25
+ ### Bridge-specific anti-patterns (dapp-kit)
26
+
27
+ - **Destructuring `useBridge` `data` as an array or single hash.** It resolves to `TxHashPair = { srcChainTxHash, dstChainTxHash }` — destructure by name.
28
+ - **Treating `useGetBridgeableAmount` `data` as a bare bigint.** It's a `BridgeLimit = { amount, decimals, type }` — read `data.amount` / `data.decimals`.
29
+ - **Passing addresses + chain ids to `useGetBridgeableAmount`.** It takes two `XToken` objects (each carries its own `chainKey`); v1's 4-arg shape is gone.
30
+ - **Passing the bridge params directly under `params` on `useBridgeAllowance`.** They nest under `params.payload` alongside `walletProvider`.
31
+ - **Submitting an incompatible token pair.** Tokens bridge only if they share the same hub vault — gate with `useGetBridgeableTokens` (incompatible pairs reject with `VALIDATION_FAILED`).
32
+
33
+ ## Migration workflow (port v1 bridge hooks to v2)
34
+
35
+ 1. [`../migration-v1-to-v2/knowledge/ai-rules.md`](../migration-v1-to-v2/knowledge/ai-rules.md) — DO / DO NOT (read first).
36
+ 2. Cross-cutting deltas: [`../migration-v1-to-v2/knowledge/breaking-changes/hook-signatures.md`](../migration-v1-to-v2/knowledge/breaking-changes/hook-signatures.md), [`../migration-v1-to-v2/knowledge/breaking-changes/result-handling.md`](../migration-v1-to-v2/knowledge/breaking-changes/result-handling.md), [`../migration-v1-to-v2/knowledge/breaking-changes/sdk-leakage.md`](../migration-v1-to-v2/knowledge/breaking-changes/sdk-leakage.md).
37
+ 3. [`../migration-v1-to-v2/knowledge/features/bridge.md`](../migration-v1-to-v2/knowledge/features/bridge.md) — `useBridge` param renames (`srcChainId` → `srcChainKey`, `recipient` → `dstAddress`); `useGetBridgeableAmount` shape change (bigint → `BridgeLimit`).
38
+
39
+ ## Verification
40
+
41
+ 1. `pnpm tsc --noEmit` clean.
42
+ 2. `useBridge` consumers destructure `{ srcChainTxHash, dstChainTxHash }` (no array/string).
43
+ 3. `useGetBridgeableAmount` consumers read `data.amount` (not a scalar).
44
+ 4. No `useSpokeProvider`, no `srcChainId`/`recipient` v1 field names (migration only).
45
+
46
+ ## Related granular skills (same family)
47
+
48
+ - [`../swap/SKILL.md`](../swap/SKILL.md) — intent-based cross-chain swaps (solver-routed; different from a direct vault bridge).
49
+ - [`../auxiliary-services/SKILL.md`](../auxiliary-services/SKILL.md) — recovery (`useWithdrawHubAsset`) for assets stranded on the hub after a failed bridge.
50
+
51
+ For multi-feature tasks, load the broad [`sodax-dapp-kit` skill](../SKILL.md).
52
+
53
+ ## Wallet connectivity (different SDK package family)
54
+
55
+ `walletProvider` flows through `mutate(vars)`. **Also load the `sodax-wallet-sdk-react` skill (integration mode)** to wire wallets and get a typed `walletProvider` via `useWalletProvider({ xChainId: chainKey })`.
@@ -0,0 +1,56 @@
1
+ ---
2
+ name: sodax-dapp-kit-dex
3
+ description: 'Granular skill for the @sodax/dapp-kit v2 DEX feature only — React Query hooks for concentrated-liquidity LP plus asset deposit/withdraw: useDexDeposit, useDexWithdraw, useSupplyLiquidity, useDecreaseLiquidity, useClaimRewards, useDexApprove/useDexAllowance, the useCreate*Params builders, and reads (usePools, usePoolData, usePositionInfo, useLiquidityAmounts). Use when a React dapp task is concentrated-liquidity LP (e.g. "create LP position with dapp-kit", "useSupplyLiquidity hook", "increase/decrease liquidity in React", "claim LP fees hook", "deposit hub assets for LP"). Two-step flow: deposit assets → supply liquidity. Covers BOTH integration (new v2 hooks) and migration (port v1 dex hooks — field renames + srcChainKey, mint/increase routing). Links into the parent sodax-dapp-kit knowledge tree. For backend/Node, use the sodax-sdk skill.'
4
+ ---
5
+
6
+ # DEX (dapp-kit granular skill)
7
+
8
+ Granular skill for the concentrated-liquidity DEX hooks of `@sodax/dapp-kit` v2. queryKey/mutationKey first segment: `dex`. Two-step flow: `useDexDeposit` (spoke asset → hub ERC-4626 pool shares) then `useSupplyLiquidity` (shares → position). React-only — backend uses `@sodax/sdk` directly.
9
+
10
+ ## Step 1 — Clarify with user before coding
11
+
12
+ 1. **New code or v1 → v2 port?**
13
+ 2. **Which operation?** Asset deposit/withdraw (`useDexDeposit`/`useDexWithdraw`), supply liquidity (`useSupplyLiquidity` — mint-new OR increase-existing), decrease (`useDecreaseLiquidity`), claim fees (`useClaimRewards`).
14
+ 3. **Does opening a position require a deposit first?** Yes — positions hold hub pool shares; deposit from a spoke before supplying liquidity. UI flows usually combine the two steps.
15
+ 4. **Using the param builders?** `useCreate*Params` compute derived params (tick range, ERC-4626 conversions) client-side; spread their result into `mutate({ params: { ...result, srcChainKey, srcAddress }, walletProvider })`.
16
+
17
+ ## Integration workflow (new v2 code)
18
+
19
+ 1. [`../integration/knowledge/ai-rules.md`](../integration/knowledge/ai-rules.md) — DO / DO NOT (read first).
20
+ 2. [`../integration/knowledge/architecture.md`](../integration/knowledge/architecture.md) — hook shapes, `mutateAsyncSafe`, `unwrapResult`, queryKey conventions.
21
+ 3. [`../integration/knowledge/features/dex.md`](../integration/knowledge/features/dex.md) — full hook surface, SDK param types, the FLAT-props param builders, position-lifecycle notes.
22
+ 4. [`../integration/knowledge/recipes/dex.md`](../integration/knowledge/recipes/dex.md) — full worked examples.
23
+ 5. Call-shape choice → [`../integration/knowledge/recipes/mutation-error-handling.md`](../integration/knowledge/recipes/mutation-error-handling.md).
24
+
25
+ ### DEX-specific anti-patterns (dapp-kit)
26
+
27
+ - **Skipping `useDexDeposit` before `useSupplyLiquidity`.** Positions reference hub pool shares; without a deposit there's nothing to provide.
28
+ - **Wrapping param builders in `{ params }`.** `useCreate*Params` take a FLAT props object (not `{ params }`-wrapped) and return memoized derived params; you add `srcChainKey` + `srcAddress` at the mutation call site.
29
+ - **Treating ticks as prices.** `tickLower`/`tickUpper` are logarithmic indices — convert with Q96 math / SDK helpers.
30
+ - **Calling a separate hook for increase-existing.** `useSupplyLiquidity` fans out to mint-new vs increase based on `params.tokenId` + `isValidPosition`; `useCreateSupplyLiquidityParams` handles the routing.
31
+ - **`usePositionInfo` `tokenId` is `string | null`, not bigint.**
32
+ - **Expecting `usePools` to auto-refresh.** It's `staleTime: Infinity` (static config).
33
+
34
+ ## Migration workflow (port v1 dex hooks to v2)
35
+
36
+ 1. [`../migration-v1-to-v2/knowledge/ai-rules.md`](../migration-v1-to-v2/knowledge/ai-rules.md) — DO / DO NOT (read first).
37
+ 2. Cross-cutting deltas: [`../migration-v1-to-v2/knowledge/breaking-changes/hook-signatures.md`](../migration-v1-to-v2/knowledge/breaking-changes/hook-signatures.md), [`../migration-v1-to-v2/knowledge/breaking-changes/result-handling.md`](../migration-v1-to-v2/knowledge/breaking-changes/result-handling.md), [`../migration-v1-to-v2/knowledge/breaking-changes/sdk-leakage.md`](../migration-v1-to-v2/knowledge/breaking-changes/sdk-leakage.md).
38
+ 3. [`../migration-v1-to-v2/knowledge/features/dex.md`](../migration-v1-to-v2/knowledge/features/dex.md) — two-step flow unchanged; field renames + `srcChainKey` requirement; `useSupplyLiquidity` mint/increase routing.
39
+
40
+ ## Verification
41
+
42
+ 1. `pnpm tsc --noEmit` clean.
43
+ 2. Deposit precedes supply in combined flows.
44
+ 3. Param-builder output is spread with `srcChainKey`/`srcAddress` added at the call site.
45
+ 4. Mutation flows use `mutateAsyncSafe` and branch on `result.ok`.
46
+ 5. No `useSpokeProvider`, no hook-level `spokeProvider` (migration only).
47
+
48
+ ## Related granular skills (same family)
49
+
50
+ - [`../auxiliary-services/SKILL.md`](../auxiliary-services/SKILL.md) — recovery (`useWithdrawHubAsset`) for stuck hub LP assets; `useXBalances` / gas utilities.
51
+
52
+ For multi-feature tasks, load the broad [`sodax-dapp-kit` skill](../SKILL.md).
53
+
54
+ ## Wallet connectivity (different SDK package family)
55
+
56
+ `walletProvider` flows through `mutate(vars)`. **Also load the `sodax-wallet-sdk-react` skill (integration mode)** to wire wallets and get a typed `walletProvider` via `useWalletProvider({ xChainId: chainKey })`.
@@ -15,7 +15,7 @@ This tree documents v2 of the dapp-kit React hooks for **new consumers** buildin
15
15
  | [`features/bridge.md`](features/bridge.md) | Bridge hooks: `useBridge`, allowance/approve, bridgeable amount/tokens. |
16
16
  | [`features/dex.md`](features/dex.md) | DEX hooks: deposit/withdraw, supply/decrease liquidity, claim rewards, position info, pools. |
17
17
  | [`features/migration.md`](features/migration.md) | Migration hooks: ICX/bnUSD/BALN forward + reverse, allowance/approve. |
18
- | [`features/bitcoin.md`](features/bitcoin.md) | Radfi hooks (dapp-kit-unique): session, trading wallet, fund/withdraw, UTXOs. |
18
+ | [`features/bitcoin.md`](features/bitcoin.md) | Bound Exchange hooks (dapp-kit-unique): session, trading wallet, fund/withdraw, UTXOs. |
19
19
  | [`features/auxiliary-services.md`](features/auxiliary-services.md) | Partner, recovery, backend queries, shared (xBalances, gas estimation, trustlines). |
20
20
  | [`recipes/`](recipes/) | Copy-paste patterns: setup, wallet connectivity, per-feature flows, mutation error handling, observability, invalidations. |
21
21
  | [`reference/`](reference/) | Lookup tables: full hook index, queryKey conventions, public API surface, glossary. |
@@ -10,7 +10,7 @@ Per-feature reference docs. Each file documents the hooks, params types, return
10
10
  | [`bridge.md`](bridge.md) | Cross-chain token bridging: `useBridge`, allowance/approve, bridgeable amount/tokens. |
11
11
  | [`dex.md`](dex.md) | Concentrated liquidity DEX: assets in/out, liquidity supply/decrease, claim rewards, position info, pool reads, param builders. |
12
12
  | [`migration.md`](migration.md) | Token migration: `useMigrateIcxToSoda`, `useRevertMigrateSodaToIcx`, `useMigratebnUSD`, `useMigrateBaln`, allowance/approve. |
13
- | [`bitcoin.md`](bitcoin.md) | Radfi (dapp-kit-unique): session, trading wallet, fund/withdraw, UTXOs. |
13
+ | [`bitcoin.md`](bitcoin.md) | Bound Exchange (dapp-kit-unique): session, trading wallet, fund/withdraw, UTXOs. |
14
14
  | [`auxiliary-services.md`](auxiliary-services.md) | Partner fee claiming, recovery, backend queries (intent tracking, orderbook, MM data), shared utilities (xBalances, gas, trustlines). |
15
15
 
16
16
  ## Reference vs recipes
@@ -94,6 +94,10 @@ useGetUserHubWalletAddress({ params, queryOptions }); // Hub wallet via wallet r
94
94
  useEstimateGas({ mutationOptions }); // Gas estimation for raw tx
95
95
  useStellarTrustlineCheck({ params, queryOptions });
96
96
  useRequestTrustline({ mutationOptions });
97
+ useNearStorageCheck({ params, queryOptions }); // NEP-141 storage registration check (NEAR)
98
+ useRegisterNearStorage({ mutationOptions }); // NEP-141 storage_deposit (NEAR)
99
+ useNearStorageGate({ dstChainKey, token, accountId, walletProvider }); // composite NEAR receive-side gate
100
+ resolveNearStorageGate(chainKey, check); // unwrapped util: gate-state from a useNearStorageCheck result
97
101
  ```
98
102
 
99
103
  ### `useXBalances` shape
@@ -144,6 +148,46 @@ if (hasTrustline === false) {
144
148
  }
145
149
  ```
146
150
 
151
+ ### NEAR storage registration
152
+
153
+ NEP-141 accounts must pay a one-time storage bond before they can receive a token — delivering to an unregistered account fails. The receive-side analogue of Stellar trustlines: gate any flow that delivers a token to the user on NEAR (swap output on NEAR, bridge into NEAR, money-market borrow/withdraw to NEAR). Use `useNearStorageGate` for app UI; use the lower-level `useNearStorageCheck` + `useRegisterNearStorage` pair when you need custom wiring.
154
+
155
+ ```ts
156
+ // @ai-snippets-skip — illustrative only; real types pulled into agents below.
157
+ // useNearStorageCheck is a canonical read hook: { params: { token, accountId, chainId }, queryOptions }.
158
+ // `chainId` is a SpokeChainKey typed loosely — the hook returns `true` for non-NEAR chains (safe to
159
+ // gate conditionally) and `true` for native NEAR (not a NEP-141 token). data is a boolean;
160
+ // queryKey: ['shared', 'nearStorageCheck', chainId, token, accountId].
161
+ const { data: isRegistered, isLoading } = useNearStorageCheck({
162
+ params: { token, accountId, chainId: ChainKeys.NEAR_MAINNET },
163
+ });
164
+
165
+ // useRegisterNearStorage IS a canonical mutation hook: { mutationOptions }, returns
166
+ // SafeUseMutationResult. Domain inputs flow through mutate / mutateAsync / mutateAsyncSafe.
167
+ // Vars: { token, accountId, walletProvider, deposit? } — deposit defaults to the NEP-141
168
+ // storage bond (0.00125 NEAR). mutationKey: ['shared', 'registerNearStorage'].
169
+ const { mutateAsyncSafe: registerStorage } = useRegisterNearStorage();
170
+ if (isRegistered === false) {
171
+ await registerStorage({ token, accountId, walletProvider });
172
+ }
173
+ ```
174
+
175
+ For the common UI path, `useNearStorageGate` returns `{ isNear, needsRegistration, blocksAction, isChecking, isRegistering, registerStorage }`.
176
+
177
+ Derive UI gate flags with the unwrapped `resolveNearStorageGate` util (no hook) when you need custom check/register composition:
178
+
179
+ ```ts
180
+ // @ai-snippets-skip — illustrative only.
181
+ // resolveNearStorageGate(chainKey, check) reads `isLoading` + `data` off the useNearStorageCheck
182
+ // result and returns { isNear, needsRegistration, blocksAction }:
183
+ // needsRegistration — show the register action (check resolved AND not registered)
184
+ // blocksAction — keep the downstream action disabled (still checking OR needs registration)
185
+ const check = useNearStorageCheck({ params: { token, accountId, chainId: dstChainKey } });
186
+ const { needsRegistration, blocksAction } = resolveNearStorageGate(dstChainKey, check);
187
+ ```
188
+
189
+ The underlying SDK methods (`isStorageRegistered` / `registerStorage` on the NEAR spoke service, and the `NEAR_STORAGE_DEPOSIT` constant) are documented in the `sodax-sdk` skill (integration mode).
190
+
147
191
  ## Default polling intervals
148
192
 
149
193
  | Hook | Polling | Notes |
@@ -1,6 +1,6 @@
1
- # Bitcoin (Radfi) — `@sodax/dapp-kit`
1
+ # Bitcoin (Bound Exchange) — `@sodax/dapp-kit`
2
2
 
3
- Bitcoin trading via the Radfi protocol — authenticate, fund a trading wallet, withdraw, manage UTXOs. **Dapp-kit-unique surface** (no SDK equivalent — these flows are React-shaped).
3
+ Bitcoin trading via the Bound Exchange protocol — authenticate, fund a trading wallet, withdraw, manage UTXOs. **Dapp-kit-unique surface** (no SDK equivalent — these flows are React-shaped).
4
4
 
5
5
  Pair: [`features/bitcoin.md`](../../../migration-v1-to-v2/knowledge/features/bitcoin.md).
6
6
 
@@ -15,7 +15,7 @@ useTradingWallet(walletAddress); // Synchronous: read persisted
15
15
 
16
16
  // Balances
17
17
  useBitcoinBalance({ params: { address, rpcUrl? }, queryOptions }); // Personal wallet (default mempool.space)
18
- useTradingWalletBalance({ params: { walletProvider, tradingAddress }, queryOptions }); // Radfi API
18
+ useTradingWalletBalance({ params: { walletProvider, tradingAddress }, queryOptions }); // Bound Exchange API
19
19
 
20
20
  // Operations
21
21
  useFundTradingWallet({ mutationOptions });
@@ -26,7 +26,7 @@ useRenewUtxos({ mutationOptions });
26
26
 
27
27
  ## Session flow
28
28
 
29
- Radfi requires authentication before trading operations. `useRadfiSession` handles the full lifecycle:
29
+ Bound Exchange requires authentication before trading operations. `useRadfiSession` handles the full lifecycle:
30
30
 
31
31
  ```ts
32
32
  // @ai-snippets-skip
@@ -76,8 +76,8 @@ type RenewUtxosVars = { txIdVouts: string[]; walletProvider: IBitcoinWalletProvi
76
76
 
77
77
  1. **Authentication required before any trading operation.** `useRadfiSession` manages this automatically — gate buttons on `isAuthed`.
78
78
  2. **Trading wallet is created during first authentication** — not a separate step.
79
- 3. **`useTradingWallet(walletAddress)` is synchronous** (no network call). It reads persisted Radfi session from localStorage. Use it when you don't have a `walletProvider` available yet but need the trading address.
80
- 4. **PSBT signing flow for withdrawals.** Radfi server builds an unsigned PSBT, the user signs locally via the wallet provider, then submits back for co-signing and broadcast. The dapp-kit hook orchestrates this — consumers don't see PSBTs directly.
79
+ 3. **`useTradingWallet(walletAddress)` is synchronous** (no network call). It reads persisted Bound Exchange session from localStorage. Use it when you don't have a `walletProvider` available yet but need the trading address.
80
+ 4. **PSBT signing flow for withdrawals.** Bound Exchange server builds an unsigned PSBT, the user signs locally via the wallet provider, then submits back for co-signing and broadcast. The dapp-kit hook orchestrates this — consumers don't see PSBTs directly.
81
81
  5. **Session tokens are for API rate-limiting, not asset access.** Stored in localStorage keyed by wallet address. Compromise of localStorage data doesn't affect funds.
82
82
  6. **`useExpiredUtxos` polls every 60s** — set `queryOptions.refetchInterval: false` to disable while UI is hidden.
83
83
 
@@ -43,6 +43,8 @@ type UseUserFormattedSummaryParams = ReadHookParams<FormatUserSummaryResponse, {
43
43
  userAddress: string | undefined;
44
44
  }>;
45
45
  // Same shape on useUserReservesData. The hook derives the hub wallet from (spokeChainKey, userAddress) internally.
46
+ // Bitcoin: always pass the personal address as userAddress — the hook transparently resolves to the
47
+ // Bound Exchange trading-wallet-derived hub wallet when a session is active (local lookup, no network).
46
48
 
47
49
  // useAToken — single aToken metadata; FLAT (no chain/user fields)
48
50
  type UseATokenParams = ReadHookParams<ATokenData, {
@@ -57,10 +59,13 @@ type UseATokensBalancesParams = ReadHookParams<Map<Address, bigint>, {
57
59
  userAddress: string | undefined;
58
60
  }>;
59
61
  // Returns a Map keyed by aToken address. The hook resolves the hub wallet from (spokeChainKey, userAddress).
62
+ // Bitcoin: always pass the personal address — trading-wallet resolution is automatic when a session exists.
60
63
  ```
61
64
 
62
65
  > **Read-side chain key is `spokeChainKey`, not `srcChainKey`.** Mutation hooks (`useSupply`/`useBorrow`/etc.) use `srcChainKey` because the request crosses chains and needs a source. Read hooks describe a user's position on a single spoke chain — the field is `spokeChainKey`. Applies to `useATokensBalances`, `useUserFormattedSummary`, and `useUserReservesData` (`useAToken` is metadata-only and takes neither). Don't grep-replace one for the other.
63
66
 
67
+ > **Bitcoin `userAddress`**: always pass the **personal** address (the user's wallet address), not the Bound Exchange trading address. The read hooks (`useATokensBalances`, `useUserReservesData`, `useUserFormattedSummary`, `useGetUserHubWalletAddress`) automatically resolve to the trading-wallet-derived hub wallet when a Bound Exchange session is active — this is a local lookup with no network call and no throw on an unauthenticated session. See [`features/bitcoin.md`](bitcoin.md) for Bound Exchange session setup.
68
+
64
69
  ## Mutation params
65
70
 
66
71
  All four user mutations share the same TVars shape (only the `action` literal differs):
@@ -1,6 +1,6 @@
1
- # Recipe: Bitcoin (Radfi)
1
+ # Recipe: Bitcoin (Bound Exchange)
2
2
 
3
- Bitcoin trading via the Radfi protocol. Authenticate, fund a trading wallet, trade, withdraw, and manage UTXOs.
3
+ Bitcoin trading via the Bound Exchange protocol. Authenticate, fund a trading wallet, trade, withdraw, and manage UTXOs.
4
4
 
5
5
  **Depends on:** [setup.md](setup.md), [wallet-connectivity.md](wallet-connectivity.md)
6
6
 
@@ -10,7 +10,7 @@ Bitcoin trading via the Radfi protocol. Authenticate, fund a trading wallet, tra
10
10
 
11
11
  | Hook | Type | Purpose |
12
12
  |------|------|---------|
13
- | `useRadfiAuth` | Mutation | Authenticate with Radfi via BIP322 signing |
13
+ | `useRadfiAuth` | Mutation | Authenticate with Bound Exchange via BIP322 signing |
14
14
  | `useRadfiSession` | Utility | Manage full session lifecycle (login, refresh, auto-refresh) |
15
15
  | `useTradingWallet` | Utility | Get trading wallet address from persisted session (synchronous) |
16
16
 
@@ -19,7 +19,7 @@ Bitcoin trading via the Radfi protocol. Authenticate, fund a trading wallet, tra
19
19
  | Hook | Type | Purpose |
20
20
  |------|------|---------|
21
21
  | `useBitcoinBalance` | Query | BTC balance for any address (sums UTXOs from mempool.space) |
22
- | `useTradingWalletBalance` | Query | Trading wallet balance from Radfi API (confirmed + pending) |
22
+ | `useTradingWalletBalance` | Query | Trading wallet balance from Bound Exchange API (confirmed + pending) |
23
23
 
24
24
  ### Operations
25
25
 
@@ -32,7 +32,7 @@ Bitcoin trading via the Radfi protocol. Authenticate, fund a trading wallet, tra
32
32
 
33
33
  ## Session Flow
34
34
 
35
- Radfi requires authentication before any trading operation. The typical flow:
35
+ Bound Exchange requires authentication before any trading operation. The typical flow:
36
36
 
37
37
  ```tsx
38
38
  import { useRadfiSession } from '@sodax/dapp-kit';
@@ -49,7 +49,7 @@ function BitcoinAuth() {
49
49
 
50
50
  return (
51
51
  <button onClick={login} disabled={isLoginPending}>
52
- {isLoginPending ? 'Signing...' : 'Login to Radfi'}
52
+ {isLoginPending ? 'Signing...' : 'Login to Bound Exchange'}
53
53
  </button>
54
54
  );
55
55
  }
@@ -77,7 +77,7 @@ function BitcoinBalances({ walletAddress }: { walletAddress: string }) {
77
77
  params: { address: walletAddress },
78
78
  });
79
79
 
80
- // Trading wallet balance (from Radfi API). `RadfiWalletBalance` fields:
80
+ // Trading wallet balance (from Bound Exchange API). `RadfiWalletBalance` fields:
81
81
  // `btcSatoshi`, `pendingSatoshi`, `externalPendingSatoshi`, `totalUtxos`.
82
82
  const { data: tradingBalance } = useTradingWalletBalance({
83
83
  params: { walletProvider, tradingAddress },
@@ -188,6 +188,6 @@ function UtxoManager({ tradingAddress }: { tradingAddress: string }) {
188
188
 
189
189
  - **Authentication required** before any trading operation. `useRadfiSession` manages this automatically.
190
190
  - **Trading wallet** is created during first authentication — not a separate step.
191
- - **`useTradingWallet(walletAddress)`** is a synchronous utility (no network call) — it reads the persisted Radfi session from localStorage.
191
+ - **`useTradingWallet(walletAddress)`** is a synchronous utility (no network call) — it reads the persisted Bound Exchange session from localStorage.
192
192
  - **PSBT signing flow**: withdraw and renew operations build an unsigned PSBT server-side, user signs it locally, then submits back for co-signing and broadcast.
193
193
  - **Session tokens** are stored in localStorage keyed by wallet address. They're for API rate-limiting, not for accessing user assets.
@@ -16,6 +16,9 @@ Connect wallets and pass wallet providers to feature hooks.
16
16
  | `useEstimateGas` | `@sodax/dapp-kit` | Mutation | Estimate gas for raw transactions |
17
17
  | `useStellarTrustlineCheck` | `@sodax/dapp-kit` | Query | Check if Stellar account has sufficient trustline |
18
18
  | `useRequestTrustline` | `@sodax/dapp-kit` | Mutation | Request a Stellar trustline for a token |
19
+ | `useNearStorageCheck` | `@sodax/dapp-kit` | Query | Check if a NEAR account is NEP-141 storage-registered for a token |
20
+ | `useRegisterNearStorage` | `@sodax/dapp-kit` | Mutation | Submit a NEP-141 `storage_deposit` so a NEAR account can receive a token |
21
+ | `useNearStorageGate` | `@sodax/dapp-kit` | Hook | Combine the NEAR storage check, registration mutation, and UI gate flags |
19
22
 
20
23
  ## Connect a Wallet
21
24
 
@@ -130,7 +130,7 @@ App-level React component. Provides:
130
130
  - RPC config for all chains
131
131
  - Hub provider access (via `useHubProvider()`)
132
132
 
133
- Optional config: `<SodaxProvider config={DeepPartial<SodaxConfig>}>`. Without config, SDK uses packaged defaults.
133
+ Optional config: `<SodaxProvider config={SodaxOptions}>` (`SodaxOptions = DeepPartial<SodaxConfig> & { logger? }`). Without config, SDK uses packaged defaults.
134
134
 
135
135
  Config is tracked by **reference** - see [`recipes/setup.md § Config reactivity`](../recipes/setup.md#config-reactivity) for module-const vs `useMemo` patterns.
136
136