@sodax/skills 2.0.0-rc.10

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 (202) hide show
  1. package/.claude-plugin/plugin.json +18 -0
  2. package/AGENTS.md +83 -0
  3. package/LICENSE +21 -0
  4. package/README.md +49 -0
  5. package/package.json +58 -0
  6. package/skills/sodax-dapp-kit/SKILL.md +129 -0
  7. package/skills/sodax-dapp-kit/integration/knowledge/README.md +49 -0
  8. package/skills/sodax-dapp-kit/integration/knowledge/ai-rules.md +80 -0
  9. package/skills/sodax-dapp-kit/integration/knowledge/architecture.md +276 -0
  10. package/skills/sodax-dapp-kit/integration/knowledge/features/README.md +29 -0
  11. package/skills/sodax-dapp-kit/integration/knowledge/features/auxiliary-services.md +169 -0
  12. package/skills/sodax-dapp-kit/integration/knowledge/features/bitcoin.md +87 -0
  13. package/skills/sodax-dapp-kit/integration/knowledge/features/bridge.md +91 -0
  14. package/skills/sodax-dapp-kit/integration/knowledge/features/dex.md +152 -0
  15. package/skills/sodax-dapp-kit/integration/knowledge/features/migration.md +118 -0
  16. package/skills/sodax-dapp-kit/integration/knowledge/features/money-market.md +144 -0
  17. package/skills/sodax-dapp-kit/integration/knowledge/features/staking.md +123 -0
  18. package/skills/sodax-dapp-kit/integration/knowledge/features/swap.md +101 -0
  19. package/skills/sodax-dapp-kit/integration/knowledge/quickstart.md +188 -0
  20. package/skills/sodax-dapp-kit/integration/knowledge/recipes/README.md +136 -0
  21. package/skills/sodax-dapp-kit/integration/knowledge/recipes/backend-queries.md +157 -0
  22. package/skills/sodax-dapp-kit/integration/knowledge/recipes/bitcoin.md +193 -0
  23. package/skills/sodax-dapp-kit/integration/knowledge/recipes/bridge.md +174 -0
  24. package/skills/sodax-dapp-kit/integration/knowledge/recipes/dex.md +204 -0
  25. package/skills/sodax-dapp-kit/integration/knowledge/recipes/invalidations.md +115 -0
  26. package/skills/sodax-dapp-kit/integration/knowledge/recipes/migration.md +212 -0
  27. package/skills/sodax-dapp-kit/integration/knowledge/recipes/money-market.md +207 -0
  28. package/skills/sodax-dapp-kit/integration/knowledge/recipes/mutation-error-handling.md +118 -0
  29. package/skills/sodax-dapp-kit/integration/knowledge/recipes/observability.md +93 -0
  30. package/skills/sodax-dapp-kit/integration/knowledge/recipes/setup.md +168 -0
  31. package/skills/sodax-dapp-kit/integration/knowledge/recipes/staking.md +202 -0
  32. package/skills/sodax-dapp-kit/integration/knowledge/recipes/swap.md +272 -0
  33. package/skills/sodax-dapp-kit/integration/knowledge/recipes/wallet-connectivity.md +128 -0
  34. package/skills/sodax-dapp-kit/integration/knowledge/reference/README.md +12 -0
  35. package/skills/sodax-dapp-kit/integration/knowledge/reference/glossary.md +190 -0
  36. package/skills/sodax-dapp-kit/integration/knowledge/reference/hooks-index.md +190 -0
  37. package/skills/sodax-dapp-kit/integration/knowledge/reference/public-api.md +110 -0
  38. package/skills/sodax-dapp-kit/integration/knowledge/reference/querykey-conventions.md +179 -0
  39. package/skills/sodax-dapp-kit/migration-v1-to-v2/knowledge/README.md +60 -0
  40. package/skills/sodax-dapp-kit/migration-v1-to-v2/knowledge/ai-rules.md +81 -0
  41. package/skills/sodax-dapp-kit/migration-v1-to-v2/knowledge/breaking-changes/hook-signatures.md +233 -0
  42. package/skills/sodax-dapp-kit/migration-v1-to-v2/knowledge/breaking-changes/querykey-conventions.md +108 -0
  43. package/skills/sodax-dapp-kit/migration-v1-to-v2/knowledge/breaking-changes/result-handling.md +211 -0
  44. package/skills/sodax-dapp-kit/migration-v1-to-v2/knowledge/breaking-changes/sdk-leakage.md +167 -0
  45. package/skills/sodax-dapp-kit/migration-v1-to-v2/knowledge/checklist.md +89 -0
  46. package/skills/sodax-dapp-kit/migration-v1-to-v2/knowledge/features/README.md +34 -0
  47. package/skills/sodax-dapp-kit/migration-v1-to-v2/knowledge/features/auxiliary-services.md +114 -0
  48. package/skills/sodax-dapp-kit/migration-v1-to-v2/knowledge/features/bitcoin.md +88 -0
  49. package/skills/sodax-dapp-kit/migration-v1-to-v2/knowledge/features/bridge.md +160 -0
  50. package/skills/sodax-dapp-kit/migration-v1-to-v2/knowledge/features/dex.md +101 -0
  51. package/skills/sodax-dapp-kit/migration-v1-to-v2/knowledge/features/migration.md +120 -0
  52. package/skills/sodax-dapp-kit/migration-v1-to-v2/knowledge/features/money-market.md +139 -0
  53. package/skills/sodax-dapp-kit/migration-v1-to-v2/knowledge/features/staking.md +109 -0
  54. package/skills/sodax-dapp-kit/migration-v1-to-v2/knowledge/features/swap.md +133 -0
  55. package/skills/sodax-dapp-kit/migration-v1-to-v2/knowledge/recipes.md +185 -0
  56. package/skills/sodax-dapp-kit/migration-v1-to-v2/knowledge/reference/README.md +15 -0
  57. package/skills/sodax-dapp-kit/migration-v1-to-v2/knowledge/reference/deleted-hooks.md +110 -0
  58. package/skills/sodax-dapp-kit/migration-v1-to-v2/knowledge/reference/error-shape-crosswalk.md +144 -0
  59. package/skills/sodax-dapp-kit/migration-v1-to-v2/knowledge/reference/renamed-hooks.md +68 -0
  60. package/skills/sodax-sdk/SKILL.md +140 -0
  61. package/skills/sodax-sdk/backend-api/SKILL.md +52 -0
  62. package/skills/sodax-sdk/bridge/SKILL.md +49 -0
  63. package/skills/sodax-sdk/dex/SKILL.md +50 -0
  64. package/skills/sodax-sdk/integration/knowledge/README.md +43 -0
  65. package/skills/sodax-sdk/integration/knowledge/ai-rules.md +75 -0
  66. package/skills/sodax-sdk/integration/knowledge/architecture.md +517 -0
  67. package/skills/sodax-sdk/integration/knowledge/chain-specifics.md +189 -0
  68. package/skills/sodax-sdk/integration/knowledge/features/README.md +21 -0
  69. package/skills/sodax-sdk/integration/knowledge/features/backend-api.md +81 -0
  70. package/skills/sodax-sdk/integration/knowledge/features/bridge.md +172 -0
  71. package/skills/sodax-sdk/integration/knowledge/features/dex.md +182 -0
  72. package/skills/sodax-sdk/integration/knowledge/features/migration.md +181 -0
  73. package/skills/sodax-sdk/integration/knowledge/features/money-market.md +198 -0
  74. package/skills/sodax-sdk/integration/knowledge/features/partner.md +63 -0
  75. package/skills/sodax-sdk/integration/knowledge/features/recovery.md +50 -0
  76. package/skills/sodax-sdk/integration/knowledge/features/staking.md +171 -0
  77. package/skills/sodax-sdk/integration/knowledge/features/swap.md +273 -0
  78. package/skills/sodax-sdk/integration/knowledge/quickstart.md +213 -0
  79. package/skills/sodax-sdk/integration/knowledge/recipes/README.md +21 -0
  80. package/skills/sodax-sdk/integration/knowledge/recipes/backend-server-init.md +69 -0
  81. package/skills/sodax-sdk/integration/knowledge/recipes/chain-key-narrowing.md +65 -0
  82. package/skills/sodax-sdk/integration/knowledge/recipes/gas-estimation.md +33 -0
  83. package/skills/sodax-sdk/integration/knowledge/recipes/initialize-sodax.md +78 -0
  84. package/skills/sodax-sdk/integration/knowledge/recipes/raw-tx-flow.md +71 -0
  85. package/skills/sodax-sdk/integration/knowledge/recipes/result-and-errors.md +104 -0
  86. package/skills/sodax-sdk/integration/knowledge/recipes/signed-tx-flow.md +46 -0
  87. package/skills/sodax-sdk/integration/knowledge/recipes/testing.md +101 -0
  88. package/skills/sodax-sdk/integration/knowledge/reference/README.md +18 -0
  89. package/skills/sodax-sdk/integration/knowledge/reference/chain-keys.md +67 -0
  90. package/skills/sodax-sdk/integration/knowledge/reference/error-codes.md +165 -0
  91. package/skills/sodax-sdk/integration/knowledge/reference/glossary.md +32 -0
  92. package/skills/sodax-sdk/integration/knowledge/reference/public-api.md +138 -0
  93. package/skills/sodax-sdk/integration/knowledge/reference/wallet-providers.md +62 -0
  94. package/skills/sodax-sdk/migration/SKILL.md +65 -0
  95. package/skills/sodax-sdk/migration-v1-to-v2/knowledge/README.md +58 -0
  96. package/skills/sodax-sdk/migration-v1-to-v2/knowledge/ai-rules.md +76 -0
  97. package/skills/sodax-sdk/migration-v1-to-v2/knowledge/breaking-changes/architecture.md +344 -0
  98. package/skills/sodax-sdk/migration-v1-to-v2/knowledge/breaking-changes/result-and-errors.md +363 -0
  99. package/skills/sodax-sdk/migration-v1-to-v2/knowledge/breaking-changes/type-system.md +341 -0
  100. package/skills/sodax-sdk/migration-v1-to-v2/knowledge/checklist.md +67 -0
  101. package/skills/sodax-sdk/migration-v1-to-v2/knowledge/features/README.md +37 -0
  102. package/skills/sodax-sdk/migration-v1-to-v2/knowledge/features/backend-api.md +92 -0
  103. package/skills/sodax-sdk/migration-v1-to-v2/knowledge/features/bridge.md +128 -0
  104. package/skills/sodax-sdk/migration-v1-to-v2/knowledge/features/dex.md +143 -0
  105. package/skills/sodax-sdk/migration-v1-to-v2/knowledge/features/migration.md +151 -0
  106. package/skills/sodax-sdk/migration-v1-to-v2/knowledge/features/money-market.md +214 -0
  107. package/skills/sodax-sdk/migration-v1-to-v2/knowledge/features/partner.md +59 -0
  108. package/skills/sodax-sdk/migration-v1-to-v2/knowledge/features/recovery.md +35 -0
  109. package/skills/sodax-sdk/migration-v1-to-v2/knowledge/features/staking.md +143 -0
  110. package/skills/sodax-sdk/migration-v1-to-v2/knowledge/features/swap.md +198 -0
  111. package/skills/sodax-sdk/migration-v1-to-v2/knowledge/recipes.md +350 -0
  112. package/skills/sodax-sdk/migration-v1-to-v2/knowledge/reference/README.md +18 -0
  113. package/skills/sodax-sdk/migration-v1-to-v2/knowledge/reference/deleted-exports.md +127 -0
  114. package/skills/sodax-sdk/migration-v1-to-v2/knowledge/reference/error-code-crosswalk.md +104 -0
  115. package/skills/sodax-sdk/migration-v1-to-v2/knowledge/reference/return-shapes.md +49 -0
  116. package/skills/sodax-sdk/migration-v1-to-v2/knowledge/reference/sodax-config.md +145 -0
  117. package/skills/sodax-sdk/money-market/SKILL.md +52 -0
  118. package/skills/sodax-sdk/partner/SKILL.md +51 -0
  119. package/skills/sodax-sdk/recovery/SKILL.md +49 -0
  120. package/skills/sodax-sdk/staking/SKILL.md +49 -0
  121. package/skills/sodax-sdk/swap/SKILL.md +67 -0
  122. package/skills/sodax-wallet-sdk-core/SKILL.md +114 -0
  123. package/skills/sodax-wallet-sdk-core/integration/knowledge/README.md +108 -0
  124. package/skills/sodax-wallet-sdk-core/integration/knowledge/ai-rules.md +141 -0
  125. package/skills/sodax-wallet-sdk-core/integration/knowledge/architecture.md +212 -0
  126. package/skills/sodax-wallet-sdk-core/integration/knowledge/features/README.md +22 -0
  127. package/skills/sodax-wallet-sdk-core/integration/knowledge/features/bitcoin.md +103 -0
  128. package/skills/sodax-wallet-sdk-core/integration/knowledge/features/evm.md +102 -0
  129. package/skills/sodax-wallet-sdk-core/integration/knowledge/features/icon.md +88 -0
  130. package/skills/sodax-wallet-sdk-core/integration/knowledge/features/injective.md +92 -0
  131. package/skills/sodax-wallet-sdk-core/integration/knowledge/features/near.md +92 -0
  132. package/skills/sodax-wallet-sdk-core/integration/knowledge/features/solana.md +104 -0
  133. package/skills/sodax-wallet-sdk-core/integration/knowledge/features/stacks.md +91 -0
  134. package/skills/sodax-wallet-sdk-core/integration/knowledge/features/stellar.md +95 -0
  135. package/skills/sodax-wallet-sdk-core/integration/knowledge/features/sui.md +96 -0
  136. package/skills/sodax-wallet-sdk-core/integration/knowledge/quickstart.md +259 -0
  137. package/skills/sodax-wallet-sdk-core/integration/knowledge/recipes/README.md +15 -0
  138. package/skills/sodax-wallet-sdk-core/integration/knowledge/recipes/bridge-to-sdk.md +145 -0
  139. package/skills/sodax-wallet-sdk-core/integration/knowledge/recipes/defaults-and-overrides.md +159 -0
  140. package/skills/sodax-wallet-sdk-core/integration/knowledge/recipes/library-exports.md +129 -0
  141. package/skills/sodax-wallet-sdk-core/integration/knowledge/recipes/setup-browser-extension.md +137 -0
  142. package/skills/sodax-wallet-sdk-core/integration/knowledge/recipes/setup-private-key.md +115 -0
  143. package/skills/sodax-wallet-sdk-core/integration/knowledge/recipes/sign-and-broadcast.md +201 -0
  144. package/skills/sodax-wallet-sdk-core/integration/knowledge/recipes/testing.md +163 -0
  145. package/skills/sodax-wallet-sdk-core/integration/knowledge/reference/README.md +13 -0
  146. package/skills/sodax-wallet-sdk-core/integration/knowledge/reference/chain-support.md +65 -0
  147. package/skills/sodax-wallet-sdk-core/integration/knowledge/reference/glossary.md +28 -0
  148. package/skills/sodax-wallet-sdk-core/integration/knowledge/reference/interfaces.md +131 -0
  149. package/skills/sodax-wallet-sdk-core/integration/knowledge/reference/provider-classes.md +54 -0
  150. package/skills/sodax-wallet-sdk-core/integration/knowledge/reference/public-api.md +128 -0
  151. package/skills/sodax-wallet-sdk-core/migration-v1-to-v2/knowledge/README.md +84 -0
  152. package/skills/sodax-wallet-sdk-core/migration-v1-to-v2/knowledge/ai-rules.md +139 -0
  153. package/skills/sodax-wallet-sdk-core/migration-v1-to-v2/knowledge/breaking-changes/README.md +14 -0
  154. package/skills/sodax-wallet-sdk-core/migration-v1-to-v2/knowledge/breaking-changes/base-wallet-provider.md +52 -0
  155. package/skills/sodax-wallet-sdk-core/migration-v1-to-v2/knowledge/breaking-changes/defaults-config.md +57 -0
  156. package/skills/sodax-wallet-sdk-core/migration-v1-to-v2/knowledge/breaking-changes/folder-layout.md +99 -0
  157. package/skills/sodax-wallet-sdk-core/migration-v1-to-v2/knowledge/breaking-changes/library-exports.md +58 -0
  158. package/skills/sodax-wallet-sdk-core/migration-v1-to-v2/knowledge/checklist.md +62 -0
  159. package/skills/sodax-wallet-sdk-core/migration-v1-to-v2/knowledge/recipes/README.md +12 -0
  160. package/skills/sodax-wallet-sdk-core/migration-v1-to-v2/knowledge/recipes/adopt-defaults.md +84 -0
  161. package/skills/sodax-wallet-sdk-core/migration-v1-to-v2/knowledge/recipes/adopt-library-exports.md +99 -0
  162. package/skills/sodax-wallet-sdk-core/migration-v1-to-v2/knowledge/reference/README.md +12 -0
  163. package/skills/sodax-wallet-sdk-core/migration-v1-to-v2/knowledge/reference/added-fields.md +71 -0
  164. package/skills/sodax-wallet-sdk-core/migration-v1-to-v2/knowledge/reference/deleted-exports.md +35 -0
  165. package/skills/sodax-wallet-sdk-core/migration-v1-to-v2/knowledge/reference/renamed-symbols.md +31 -0
  166. package/skills/sodax-wallet-sdk-core/migration-v1-to-v2/knowledge/reference/return-shapes.md +23 -0
  167. package/skills/sodax-wallet-sdk-react/SKILL.md +154 -0
  168. package/skills/sodax-wallet-sdk-react/integration/knowledge/README.md +103 -0
  169. package/skills/sodax-wallet-sdk-react/integration/knowledge/ai-rules.md +136 -0
  170. package/skills/sodax-wallet-sdk-react/integration/knowledge/architecture.md +185 -0
  171. package/skills/sodax-wallet-sdk-react/integration/knowledge/examples/01-minimal-evm.tsx +75 -0
  172. package/skills/sodax-wallet-sdk-react/integration/knowledge/examples/02-multi-chain-modal.tsx +169 -0
  173. package/skills/sodax-wallet-sdk-react/integration/knowledge/examples/03-nextjs-app-router.tsx +99 -0
  174. package/skills/sodax-wallet-sdk-react/integration/knowledge/examples/04-walletconnect-setup.tsx +89 -0
  175. package/skills/sodax-wallet-sdk-react/integration/knowledge/examples/README.md +29 -0
  176. package/skills/sodax-wallet-sdk-react/integration/knowledge/recipes/batch-operations.md +224 -0
  177. package/skills/sodax-wallet-sdk-react/integration/knowledge/recipes/bridge-to-sdk.md +165 -0
  178. package/skills/sodax-wallet-sdk-react/integration/knowledge/recipes/chain-detection.md +259 -0
  179. package/skills/sodax-wallet-sdk-react/integration/knowledge/recipes/connect-button.md +159 -0
  180. package/skills/sodax-wallet-sdk-react/integration/knowledge/recipes/multi-chain-modal.md +203 -0
  181. package/skills/sodax-wallet-sdk-react/integration/knowledge/recipes/setup.md +163 -0
  182. package/skills/sodax-wallet-sdk-react/integration/knowledge/recipes/sign-message.md +138 -0
  183. package/skills/sodax-wallet-sdk-react/integration/knowledge/recipes/sub-path-imports.md +97 -0
  184. package/skills/sodax-wallet-sdk-react/integration/knowledge/recipes/switch-chain.md +144 -0
  185. package/skills/sodax-wallet-sdk-react/integration/knowledge/recipes/walletconnect-setup.md +139 -0
  186. package/skills/sodax-wallet-sdk-react/integration/knowledge/reference/api-surface.md +176 -0
  187. package/skills/sodax-wallet-sdk-react/integration/knowledge/reference/chain-support.md +79 -0
  188. package/skills/sodax-wallet-sdk-react/integration/knowledge/reference/connectors.md +75 -0
  189. package/skills/sodax-wallet-sdk-react/integration/knowledge/reference/hooks.md +212 -0
  190. package/skills/sodax-wallet-sdk-react/integration/knowledge/reference/wallet-brands.md +107 -0
  191. package/skills/sodax-wallet-sdk-react/migration-v1-to-v2/knowledge/README.md +49 -0
  192. package/skills/sodax-wallet-sdk-react/migration-v1-to-v2/knowledge/ai-rules.md +144 -0
  193. package/skills/sodax-wallet-sdk-react/migration-v1-to-v2/knowledge/breaking-changes.md +310 -0
  194. package/skills/sodax-wallet-sdk-react/migration-v1-to-v2/knowledge/checklist.md +159 -0
  195. package/skills/sodax-wallet-sdk-react/migration-v1-to-v2/knowledge/recipes/connect-button.md +170 -0
  196. package/skills/sodax-wallet-sdk-react/migration-v1-to-v2/knowledge/recipes/multi-chain-modal.md +245 -0
  197. package/skills/sodax-wallet-sdk-react/migration-v1-to-v2/knowledge/recipes/ssr-setup.md +165 -0
  198. package/skills/sodax-wallet-sdk-react/migration-v1-to-v2/knowledge/recipes/walletconnect-migration.md +170 -0
  199. package/skills/sodax-wallet-sdk-react/migration-v1-to-v2/knowledge/reference/components.md +75 -0
  200. package/skills/sodax-wallet-sdk-react/migration-v1-to-v2/knowledge/reference/config.md +339 -0
  201. package/skills/sodax-wallet-sdk-react/migration-v1-to-v2/knowledge/reference/hooks.md +336 -0
  202. package/skills/sodax-wallet-sdk-react/migration-v1-to-v2/knowledge/reference/imports.md +158 -0
@@ -0,0 +1,336 @@
1
+ # Reference: Hook Signature Map
2
+
3
+ Per-hook signature changes for v1 → v2. See [`../breaking-changes.md`](../breaking-changes.md) §3 for the WHY.
4
+
5
+ ---
6
+
7
+ ## Quick rule
8
+
9
+ | Pattern | v1 (positional) | v2 (options object) |
10
+ |---|---|---|
11
+ | Pass chain family | `useX('EVM')` | `useX({ xChainType: 'EVM' })` |
12
+ | Pass chain id | `useX('0x1.eth')` | `useX({ xChainId: ChainKeys.ETHEREUM_MAINNET })` |
13
+ | Cannot pass both | (runtime detected) | TypeScript-enforced (`xChainType: never` on the chain-id branch and vice versa) |
14
+
15
+ `xChainId` in v2 is typed as `SpokeChainKey` (the enum from `@sodax/types`), not the raw string id. The narrower type lets v2 hooks return chain-typed providers (e.g. `IEvmWalletProvider | undefined`) instead of the v1 union.
16
+
17
+ ---
18
+
19
+ ## Canonical rule — `xChainId` is non-nullable
20
+
21
+ Hooks that take `xChainId` declare it via overloads as required `SpokeChainKey`. Passing a nullable value (e.g. `token?.chainKey`) does not compile.
22
+
23
+ The exported `UseWalletProviderOptions` (and similar) is the *implementation* type and looks permissive — but calls resolve against the overloads, which are stricter. Casting around the error is unsafe: it either fails to bypass the overload at all, or silently strips the nullable from the type while the runtime value stays `undefined` (some hooks tolerate that and return `undefined`; `useXAccount` throws).
24
+
25
+ Handle the nullable **before** the hook call:
26
+
27
+ ```ts
28
+ // @ai-snippets-skip
29
+ // Narrow, default-fallback, or split into a child component — pick the one that fits.
30
+ if (!chainKey) return null;
31
+ const wp = useWalletProvider({ xChainId: chainKey });
32
+ ```
33
+
34
+ ---
35
+
36
+ ## `useXAccount`
37
+
38
+ ```ts
39
+ // @ai-snippets-skip
40
+ // v1 ❌
41
+ const { address } = useXAccount('EVM');
42
+ const { address } = useXAccount('0x1.eth');
43
+
44
+ // v2 ✅
45
+ import { ChainKeys } from '@sodax/types';
46
+
47
+ const { address } = useXAccount({ xChainType: 'EVM' });
48
+ const { address } = useXAccount({ xChainId: ChainKeys.ETHEREUM_MAINNET });
49
+ ```
50
+
51
+ **Decision rule (positional value → field name):** v1 accepted both `ChainType` and `ChainId` and detected at runtime. In v2 you must choose the right field:
52
+
53
+ - v1 value is a family literal (`'EVM'`, `'SOLANA'`, …) → v2 `xChainType`.
54
+ - v1 value is a chain-key string (`'0x1.eth'`, `XToken.xChainId`, …) → v2 `xChainId` typed as `SpokeChainKey`.
55
+ - v1 value comes from `getXChainType(...)` (returns `ChainType | undefined`) → v2 `xChainType`, but **guard against `undefined`** — see below.
56
+
57
+ **v2 asserts at runtime that exactly one of `xChainId` / `xChainType` is present.** Both undefined throws `'[useXAccount] pass xChainId or xChainType'`; both present throws `'[useXAccount] pass either xChainId or xChainType, not both'`. v1 was permissive (called with `undefined`, it returned an empty account). v2 is strict.
58
+
59
+ **Common nullable patterns and their fixes:**
60
+
61
+ ```ts
62
+ // @ai-snippets-skip
63
+ // ❌ v1 idiom — returns empty account when nothing selected, runs every render
64
+ const { address } = useXAccount(selectedChainId ?? undefined);
65
+
66
+ // ✅ v2 fix 1 — index a snapshot from useXAccounts (no per-key hook call)
67
+ const xAccounts = useXAccounts();
68
+ const chainType = selectedChainId ? getXChainType(selectedChainId) : undefined;
69
+ const address = chainType ? xAccounts[chainType]?.address : undefined;
70
+
71
+ // ✅ v2 fix 2 — supply a sensible default chain key so the hook always has input
72
+ const { address } = useXAccount({
73
+ xChainId: selectedChainId ?? ChainKeys.SONIC_MAINNET,
74
+ });
75
+
76
+ // ✅ v2 fix 3 — split into a child component that only mounts when input is known
77
+ {selectedChainId ? <Account xChainId={selectedChainId} /> : null}
78
+ function Account({ xChainId }: { xChainId: SpokeChainKey }) {
79
+ const { address } = useXAccount({ xChainId });
80
+ // ...
81
+ }
82
+ ```
83
+
84
+ The other "options-object" hooks (`useXConnection`, `useXConnectors`, `useXService`, `useWalletProvider`) are **lenient** — passing no field returns the empty/undefined value silently. `useXAccount` is the only one that asserts.
85
+
86
+ **Other notes:**
87
+ - Return shape unchanged: `XAccount = { address, xChainType, publicKey? }`.
88
+ - When a valid chain is supplied but no wallet is connected, `address` is `undefined` while `xChainType` is filled — same as v1's connected-empty state.
89
+
90
+ ---
91
+
92
+ ## `useXConnectors`
93
+
94
+ ```ts
95
+ // @ai-snippets-skip
96
+ // v1 ❌
97
+ const connectors = useXConnectors('EVM');
98
+
99
+ // v2 ✅
100
+ const connectors = useXConnectors({ xChainType: 'EVM' });
101
+ ```
102
+
103
+ **Other notes:**
104
+ - Return type changed from `XConnector[]` to `IXConnector[]` (interface). For most consumers this is invisible — both expose `id`, `name`, `icon`, `xChainType`, `connect()`, `disconnect()`.
105
+ - v2 enriches each connector with `isInstalled`, `installUrl`, `icon` (read at access time from `window.*`).
106
+ - v2 returns `[]` and logs a one-time warning if the chain isn't in `enabledChains`. v1 returned `[]` silently.
107
+
108
+ ---
109
+
110
+ ## `useXConnection`
111
+
112
+ ```ts
113
+ // @ai-snippets-skip
114
+ // v1 ❌
115
+ const connection = useXConnection('EVM');
116
+
117
+ // v2 ✅
118
+ const connection = useXConnection({ xChainType: 'EVM' });
119
+ ```
120
+
121
+ Return shape unchanged: `XConnection | undefined = { xAccount, xConnectorId } | undefined`.
122
+
123
+ ---
124
+
125
+ ## `useXService`
126
+
127
+ ```ts
128
+ // @ai-snippets-skip
129
+ // v1 ❌
130
+ const service = useXService('EVM');
131
+
132
+ // v2 ✅
133
+ const service = useXService({ xChainType: 'EVM' });
134
+ ```
135
+
136
+ Return type unchanged.
137
+
138
+ > **Need the typed concrete class** (e.g. `EvmXService.publicClient`, `StellarXService.server`, `BitcoinXService` for `instanceof` checks)? The concrete classes (`EvmXService`, `SolanaXService`, `StellarXService`, etc.) are **still exported in v2**, but moved from the package barrel to per-chain sub-paths: `@sodax/wallet-sdk-react/xchains/<chain>`. See [`imports.md` § Concrete chain classes](./imports.md#concrete-chain-classes--moved-behind-sub-path-imports) for the full per-chain table. The TS error `TS2724: '"@sodax/wallet-sdk-react"' has no exported member named 'StellarXService'. Did you mean 'useXService'?` is misleading when you actually need the class — the class is at the sub-path, not the hook.
139
+
140
+ ---
141
+
142
+ ## `useWalletProvider`
143
+
144
+ ```ts
145
+ // @ai-snippets-skip
146
+ // v1 ❌ — positional spokeChainId, returns wide union
147
+ const wp = useWalletProvider('sui');
148
+
149
+ // v2 ✅ — options object, narrowest type when xChainId is passed
150
+ import { ChainKeys } from '@sodax/types';
151
+
152
+ const wp = useWalletProvider({ xChainId: ChainKeys.SUI_MAINNET });
153
+ // ^ inferred as ISuiWalletProvider | undefined
154
+
155
+ const wp2 = useWalletProvider({ xChainType: 'EVM' });
156
+ // ^ inferred as IEvmWalletProvider | undefined
157
+
158
+ const wp3 = useWalletProvider();
159
+ // ^ inferred as IWalletProvider | undefined (any)
160
+ ```
161
+
162
+ **Other notes:**
163
+ - Pass either `xChainId` (`SpokeChainKey`) or `xChainType` (`ChainType`), never both. Chain key gives narrower TypeScript inference.
164
+ - Returns `undefined` when the chain isn't enabled in `walletConfig` (logs a one-time warning) or when no wallet is connected.
165
+
166
+ ---
167
+
168
+ ## `useXConnect`
169
+
170
+ ```ts
171
+ // @ai-snippets-skip
172
+ // v1 ✅ AND v2 ✅ — same signature
173
+ const { mutateAsync: connect } = useXConnect();
174
+ await connect(connector);
175
+ ```
176
+
177
+ No change in shape. The `connector` argument type is `IXConnector` in v2 (was `XConnector` abstract class in v1) — runtime behavior identical for any connector returned by `useXConnectors`.
178
+
179
+ ---
180
+
181
+ ## `useXDisconnect`
182
+
183
+ ```ts
184
+ // @ai-snippets-skip
185
+ // v1 ❌ — returned function takes positional ChainType
186
+ const disconnect = useXDisconnect();
187
+ await disconnect('EVM');
188
+
189
+ // v2 ✅ — returned function takes options object
190
+ const disconnect = useXDisconnect();
191
+ await disconnect({ xChainType: 'EVM' });
192
+ ```
193
+
194
+ The hook itself takes no args in both versions. The **returned function** changed: v1 was positional `(xChainType: ChainType) => Promise<void>`; v2 is `(args: UseXDisconnectArgs) => Promise<void>` where `UseXDisconnectArgs = { xChainType: ChainType }`. Same forward-compat reason as the other hooks — see [`../breaking-changes.md`](../breaking-changes.md) §3.
195
+
196
+ **Common breakage:** `await disconnect(xChainType)` raises `TS2345: Argument of type 'string' is not assignable to parameter of type 'UseXDisconnectArgs'`. Wrap in an object.
197
+
198
+ ---
199
+
200
+ ## `useXSignMessage`
201
+
202
+ ```ts
203
+ // @ai-snippets-skip
204
+ // v1 ✅ AND v2 ✅ — same signature
205
+ const { mutateAsync: signMessage } = useXSignMessage();
206
+ const sig = await signMessage({ xChainType: 'EVM', message: 'hello' });
207
+ ```
208
+
209
+ No change.
210
+
211
+ ---
212
+
213
+ ## `useXAccounts`
214
+
215
+ ```ts
216
+ // @ai-snippets-skip
217
+ // v1
218
+ const accounts = useXAccounts();
219
+
220
+ // v2 — return type is now strictly typed
221
+ const accounts = useXAccounts();
222
+ // → Partial<Record<ChainType, XAccount>>
223
+ ```
224
+
225
+ Call signature unchanged. **Indexing tightened**: `accounts[chainType]` returns `XAccount | undefined`. The index variable must be typed as `ChainType` (not `string` or `any`) — otherwise you'll see `TS7053: Element implicitly has an 'any' type`.
226
+
227
+ ```ts
228
+ // @ai-snippets-skip
229
+ // ❌ FAILS — chainType is `string`, can't index Partial<Record<ChainType, ...>>
230
+ const chainType = someStringFromConfig;
231
+ const account = accounts[chainType];
232
+
233
+ // ✅ FIX 1 — narrow with getXChainType (returns ChainType | undefined)
234
+ import { getXChainType } from '@sodax/wallet-sdk-react';
235
+ const chainType = getXChainType(chainId);
236
+ const account = chainType ? accounts[chainType] : undefined;
237
+
238
+ // ✅ FIX 2 — call useXAccount per-chain instead of indexing
239
+ const account = useXAccount({ xChainType: 'EVM' });
240
+ ```
241
+
242
+ ---
243
+
244
+ ## `useEvmSwitchChain`
245
+
246
+ ```ts
247
+ // @ai-snippets-skip
248
+ // v1 ❌ — positional `expectedXChainId: ChainId`
249
+ const { isWrongChain, handleSwitchChain } = useEvmSwitchChain(chainId);
250
+
251
+ // v2 ✅ — options object; `xChainId: SpokeChainKey`
252
+ import { ChainKeys } from '@sodax/types';
253
+
254
+ const { isWrongChain, handleSwitchChain } = useEvmSwitchChain({
255
+ xChainId: ChainKeys.ETHEREUM_MAINNET,
256
+ });
257
+
258
+ if (isWrongChain) handleSwitchChain();
259
+ ```
260
+
261
+ **Breaking changes:**
262
+
263
+ - **Call shape**: positional → options object. Same forward-compat reason as the other hooks.
264
+ - **Parameter type**: `ChainId` → `SpokeChainKey` (rename in `@sodax/types`). If the chain key value comes from `XToken.chainKey` (v2) or any `ChainKeys.*` constant, no value change is needed — the rename is type-only.
265
+
266
+ **Return shape is unchanged** — both v1 and v2 return `{ isWrongChain: boolean, handleSwitchChain: () => void }`. The hook compares the connected EVM chain to the chain expected by `xChainId` and exposes `isWrongChain` so UI can render a "switch network" CTA without recomputing.
267
+
268
+ **Behavior added in v2:**
269
+
270
+ - **Injective + MetaMask auto-switch.** When the user connects to Injective via MetaMask, v2 automatically targets Ethereum mainnet underneath. v1 had no Injective awareness.
271
+ - **Safe when EVM is disabled.** v2 returns no-op values (`isWrongChain: false`, `handleSwitchChain: () => {}`) if `walletConfig.EVM` is absent, so UI doesn't need to branch.
272
+
273
+ ---
274
+
275
+ ## `useEthereumChainId`
276
+
277
+ **Removed from the public barrel in v2.** Despite the generic-sounding name, the v1 hook was **Injective + MetaMask specific** — it read the underlying Ethereum chain ID exposed by Injective's wallet strategy and was almost always used to drive the "switch back to Ethereum mainnet" UX. v2 makes the hook internal because `useEvmSwitchChain` now handles that Injective auto-switch case directly.
278
+
279
+ Migration:
280
+
281
+ ```diff
282
+ - // v1 ❌ — manual chain-ID comparison for Injective + MetaMask UX
283
+ - import { useEthereumChainId } from '@sodax/wallet-sdk-react';
284
+ - const chainId = useEthereumChainId();
285
+ - if (chainId !== 1) /* prompt user to switch to Ethereum mainnet */;
286
+ + // v2 ✅ — useEvmSwitchChain auto-handles Injective + MetaMask underneath
287
+ + import { useEvmSwitchChain } from '@sodax/wallet-sdk-react';
288
+ + import { ChainKeys } from '@sodax/types';
289
+ + const { isWrongChain, handleSwitchChain } = useEvmSwitchChain({
290
+ + xChainId: ChainKeys.INJECTIVE_MAINNET,
291
+ + });
292
+ + if (isWrongChain) handleSwitchChain();
293
+ ```
294
+
295
+ If you genuinely need the raw EVM chain ID (rare — almost no usage outside the Injective case), wagmi's `useAccount().chainId` is the underlying source. Prefer staying inside `@sodax/wallet-sdk-react` hooks where possible.
296
+
297
+ ---
298
+
299
+ ## Removed in v2
300
+
301
+ | Hook / symbol | Replacement |
302
+ |---|---|
303
+ | `useXBalances` | Moved to `@sodax/dapp-kit` **AND signature changed**. See note below. |
304
+ | `useXWagmiStore` | Removed entirely — direct store reads are not part of the v2 API. Use public hooks (`useXServices`, `useXConnections`, `useXService({ xChainType })`, `useXConnection({ xChainType })`, etc.). See note below. |
305
+ | Concrete X-service / X-connector classes (`EvmXService`, `SolanaXService`, `StellarXService`, `BitcoinXService`, `IconXService`, `InjectiveXService`, `SuiXService`, `NearXService`, `StacksXService`, `XverseXConnector`, `UnisatXConnector`, `OKXXConnector`, `IconHanaXConnector`, …) | **Not removed — moved to per-chain sub-paths.** TS error `TS2724: '"@sodax/wallet-sdk-react"' has no exported member named 'StellarXService'. Did you mean 'useXService'?` is misleading — the hint points at `useXService` (which returns the abstract `XService \| undefined`), but the typed class itself lives at `@sodax/wallet-sdk-react/xchains/<chain>`. See [`imports.md` § "Concrete chain classes — moved behind sub-path imports"](./imports.md#concrete-chain-classes--moved-behind-sub-path-imports) for the per-chain table. |
306
+
307
+ ### `useXBalances` — moved + reshaped
308
+
309
+ Not a simple package-rename. The v2 hook also wraps params and adds a required `xService` field:
310
+
311
+ ```diff
312
+ - // v1 — flat args from @sodax/wallet-sdk-react
313
+ - import { useXBalances } from '@sodax/wallet-sdk-react';
314
+ - const { data } = useXBalances({ xChainId, xTokens, address });
315
+
316
+ + // v2 — from @sodax/dapp-kit; params wrapped; xService required
317
+ + import { useXBalances } from '@sodax/dapp-kit';
318
+ + import { useXService, getXChainType } from '@sodax/wallet-sdk-react';
319
+ +
320
+ + const xService = useXService({ xChainType: getXChainType(xChainId) });
321
+ + const { data } = useXBalances({
322
+ + params: { xService, xChainId, xTokens, address },
323
+ + });
324
+ ```
325
+
326
+ The `xService` injection is part of dapp-kit's "no implicit wallet-sdk dependency" design — dapp-kit doesn't import from `wallet-sdk-react`, so the consumer wires the service across at the call site. See `sodax-dapp-kit`: `integration/knowledge/architecture.md` § "Decoupling from wallet-sdk-react".
327
+
328
+ ### `useXWagmiStore` — removed (store reads moved to public hooks)
329
+
330
+ The v1 Zustand store hook is gone from the v2 barrel. Direct store access is no longer supported. Every `useXWagmiStore(state => state.X)` selector maps to a public hook — see [`imports.md` § "Store hook removed from the public API"](./imports.md#store-hook-removed-from-the-public-api) for the full field-to-hook map and decision tree (`state.xServices` → `useXServices()`, `state.xConnections[chainType]` → `useXConnection({ xChainType })`, etc.). The localStorage key (`xwagmi-store`) is unchanged, so user connections survive the upgrade.
331
+
332
+ ---
333
+
334
+ ## Added in v2 (no v1 equivalent)
335
+
336
+ See [`imports.md`](./imports.md) § "Added in v2" for the full list (`useWalletModal`, `useChainGroups`, `useBatchConnect`, etc.). These are not migration items — they are new capabilities you may opt into.
@@ -0,0 +1,158 @@
1
+ # Reference: Import Path Map
2
+
3
+ Mechanical import-path replacements for v1 → v2. The package name (`@sodax/wallet-sdk-react`) is unchanged. See [`../breaking-changes.md`](../breaking-changes.md) §5 for the WHY behind concrete-class sub-path imports.
4
+
5
+ ---
6
+
7
+ ## Store hook removed from the public API
8
+
9
+ v1 exported the Zustand store hook (`useXWagmiStore`) from the package barrel. **v2 does not export the store hook at all** — direct store access is no longer supported. The localStorage key (`xwagmi-store`) is unchanged, so user connections survive the upgrade.
10
+
11
+ For each `useXWagmiStore(state => state.X)` selector, replace with the equivalent public hook below. **Do not rename to `useXWalletStore`** — the v2 barrel does not export it.
12
+
13
+ ### Field-to-hook map
14
+
15
+ | v1 selector | v2 replacement |
16
+ |---|---|
17
+ | `state.xServices` (whole map) | `useXServices()` |
18
+ | `state.xServices[chainType]` (per chain) | `useXService({ xChainType })` |
19
+ | `state.xConnections` (whole map) | `useXConnections()` |
20
+ | `state.xConnections[chainType]` (per chain) | `useXConnection({ xChainType })` |
21
+ | `state.setXConnection` | not a public mutation — use `useXConnect()` (mutation hook) |
22
+ | `state.unsetXConnection` | not a public mutation — use `useXDisconnect()` |
23
+
24
+ ```diff
25
+ - // v1 ❌
26
+ - import { useXWagmiStore } from '@sodax/wallet-sdk-react';
27
+ - const xServices = useXWagmiStore(state => state.xServices);
28
+ + // v2 ✅ — public hook, no store access
29
+ + import { useXServices } from '@sodax/wallet-sdk-react';
30
+ + const xServices = useXServices();
31
+ ```
32
+
33
+ ### Decision tree — `useXWagmiStore` selector handling
34
+
35
+ For each occurrence of `useXWagmiStore(state => state.X)`:
36
+
37
+ 1. **Is `X` a public-hook-equivalent read** (`xServices`, `xConnections`, or per-chain access of either)?
38
+ → Replace with the public hook from the table. Drop the `useXWagmiStore` import.
39
+ 2. **Is `X` a mutation** (`setXConnection`, `unsetXConnection`) **or a v2-internal field** (`enabledChains`, `chainActions`, `walletProviders`, `xConnectorsByChain`)?
40
+ → STOP. The user's code is poking at internal API or was hand-edited mid-migration. Ask the user before changing.
41
+ 3. **Anything else** (typo, removed v1 field)?
42
+ → STOP. Ask user.
43
+
44
+ ### Worked example
45
+
46
+ ```ts
47
+ // @ai-snippets-skip
48
+ // v1 ❌ — direct store read
49
+ const xServices = useXWagmiStore(state => state.xServices);
50
+
51
+ // v2 ✅ — public hook (no store access)
52
+ const xServices = useXServices();
53
+
54
+ // 🛑 STOP — mutation through store; v2 does not expose this on a hook
55
+ const setConn = useXWagmiStore(state => state.setXConnection);
56
+ // → Ask user. Likely they want useXConnect()'s mutation instead.
57
+ ```
58
+
59
+ Always prefer public hooks (`useXService`, `useXServices`, `useXConnection`, `useXConnections`, `useEnabledChains`, `useWalletProvider`) over store reads — see [`reference/hooks.md`](../../../integration/knowledge/reference/hooks.md).
60
+
61
+ ---
62
+
63
+ ## Concrete chain classes — moved behind sub-path imports
64
+
65
+ v1 re-exported every concrete `XService` / `XConnector` subclass from the package barrel. v2's barrel exports only types, hooks, abstractions, and `SodaxWalletProvider`.
66
+
67
+ | Concrete class | v1 import path | v2 import path |
68
+ |---|---|---|
69
+ | `EvmXService`, `EvmXConnector` | `@sodax/wallet-sdk-react` | `@sodax/wallet-sdk-react/xchains/evm` |
70
+ | `SolanaXService`, `SolanaXConnector` | `@sodax/wallet-sdk-react` | `@sodax/wallet-sdk-react/xchains/solana` |
71
+ | `SuiXService`, `SuiXConnector` | `@sodax/wallet-sdk-react` | `@sodax/wallet-sdk-react/xchains/sui` |
72
+ | `BitcoinXService`, `UnisatXConnector`, `XverseXConnector`, `OKXXConnector` | `@sodax/wallet-sdk-react` | `@sodax/wallet-sdk-react/xchains/bitcoin` |
73
+ | `StellarXService`, `StellarWalletsKitXConnector` | `@sodax/wallet-sdk-react` | `@sodax/wallet-sdk-react/xchains/stellar` |
74
+ | `InjectiveXService`, `InjectiveXConnector` | `@sodax/wallet-sdk-react` | `@sodax/wallet-sdk-react/xchains/injective` |
75
+ | `IconXService`, `IconHanaXConnector` | `@sodax/wallet-sdk-react` | `@sodax/wallet-sdk-react/xchains/icon` |
76
+ | `NearXService`, `NearXConnector` | `@sodax/wallet-sdk-react` | `@sodax/wallet-sdk-react/xchains/near` |
77
+ | `StacksXService`, `StacksXConnector`, `STACKS_PROVIDERS` | `@sodax/wallet-sdk-react` | `@sodax/wallet-sdk-react/xchains/stacks` |
78
+
79
+ ### Examples
80
+
81
+ ```diff
82
+ - // v1 ❌ — all concrete classes from barrel
83
+ - import {
84
+ - EvmXService,
85
+ - XverseXConnector,
86
+ - IconHanaXConnector,
87
+ - } from '@sodax/wallet-sdk-react';
88
+ + // v2 ✅ — sub-path per chain
89
+ + import { EvmXService } from '@sodax/wallet-sdk-react/xchains/evm';
90
+ + import { XverseXConnector } from '@sodax/wallet-sdk-react/xchains/bitcoin';
91
+ + import { IconHanaXConnector } from '@sodax/wallet-sdk-react/xchains/icon';
92
+ ```
93
+
94
+ ### Type imports also use sub-path
95
+
96
+ Even when you only need a **type** (not the runtime class), the v2 barrel does not re-export concrete chain types. Use the sub-path import with `import type`:
97
+
98
+ ```diff
99
+ - // v1 ❌
100
+ - import { type StellarXService, useXService } from '@sodax/wallet-sdk-react';
101
+ + // v2 ✅ — sub-path import for both type and runtime
102
+ + import type { StellarXService } from '@sodax/wallet-sdk-react/xchains/stellar';
103
+ + import type { XverseXConnector, BtcWalletAddressType } from '@sodax/wallet-sdk-react/xchains/bitcoin';
104
+ + import { useXService } from '@sodax/wallet-sdk-react';
105
+ ```
106
+
107
+ `import type` from sub-paths is **erased at build time** — no runtime cost. Use it freely for type annotations, `as`, generics, etc.
108
+
109
+ ---
110
+
111
+ ## Hooks — same package, same names (signatures changed)
112
+
113
+ | Hook | v1 path | v2 path | Signature changed? |
114
+ |---|---|---|---|
115
+ | `useXAccount` | `@sodax/wallet-sdk-react` | `@sodax/wallet-sdk-react` | yes — see [`hooks.md`](./hooks.md) |
116
+ | `useXAccounts` | `@sodax/wallet-sdk-react` | `@sodax/wallet-sdk-react` | no |
117
+ | `useXConnect` | `@sodax/wallet-sdk-react` | `@sodax/wallet-sdk-react` | no |
118
+ | `useXConnection` | `@sodax/wallet-sdk-react` | `@sodax/wallet-sdk-react` | yes |
119
+ | `useXConnectors` | `@sodax/wallet-sdk-react` | `@sodax/wallet-sdk-react` | yes |
120
+ | `useXDisconnect` | `@sodax/wallet-sdk-react` | `@sodax/wallet-sdk-react` | yes — returned function now takes `{ xChainType }` object (was positional) |
121
+ | `useXService` | `@sodax/wallet-sdk-react` | `@sodax/wallet-sdk-react` | yes |
122
+ | `useWalletProvider` | `@sodax/wallet-sdk-react` | `@sodax/wallet-sdk-react` | yes |
123
+ | `useXSignMessage` | `@sodax/wallet-sdk-react` | `@sodax/wallet-sdk-react` | no |
124
+ | `useEvmSwitchChain` | `@sodax/wallet-sdk-react` | `@sodax/wallet-sdk-react` | yes — now takes `{ xChainId }`, returns `{ isWrongChain, handleSwitchChain }` |
125
+
126
+ For signature changes see [`hooks.md`](./hooks.md).
127
+
128
+ ---
129
+
130
+ ## Removed in v2
131
+
132
+ | Symbol | v1 path | Replacement |
133
+ |---|---|---|
134
+ | `useXBalances` | `@sodax/wallet-sdk-react` | Moved to `@sodax/dapp-kit` with a new signature (`{ params: { xService, xChainId, xTokens, address } }`). See [`../breaking-changes.md`](../breaking-changes.md) §10. |
135
+ | `useEthereumChainId` | `@sodax/wallet-sdk-react` | Internal in v2. Use `useAccount().chainId` from `wagmi` for the raw EVM chain ID, or `useEvmSwitchChain({ xChainId })` if you only needed it for "wrong network" UX. See [`hooks.md`](./hooks.md) § `useEthereumChainId`. |
136
+
137
+ ---
138
+
139
+ ## Added in v2 (informational — no v1 to migrate from)
140
+
141
+ These are new exports — no v1 import to replace, but knowing they exist may let you simplify hand-rolled v1 code during migration:
142
+
143
+ | New hook / utility | Path | Purpose |
144
+ |---|---|---|
145
+ | `useWalletModal` | `@sodax/wallet-sdk-react` | Headless modal state machine |
146
+ | `useConnectionFlow` | `@sodax/wallet-sdk-react` | `connect + status + retry` without modal |
147
+ | `useBatchConnect` | `@sodax/wallet-sdk-react` | Sequential connect across multiple connectors |
148
+ | `useBatchDisconnect` | `@sodax/wallet-sdk-react` | Mirror of `useBatchConnect` |
149
+ | `useChainGroups` | `@sodax/wallet-sdk-react` | One row per enabled chain (EVM collapses) |
150
+ | `useConnectedChains` | `@sodax/wallet-sdk-react` | Aggregate connected view + hydration `status` |
151
+ | `useEnabledChains` | `@sodax/wallet-sdk-react` | List of chain types enabled in config |
152
+ | `useIsWalletInstalled` | `@sodax/wallet-sdk-react` | Cross-chain install check |
153
+ | `useXConnections` | `@sodax/wallet-sdk-react` | All connections (plural) |
154
+ | `useXConnectorsByChain` | `@sodax/wallet-sdk-react` | Multi-chain connector list (no per-chain warnings) |
155
+ | `useXServices` | `@sodax/wallet-sdk-react` | All services (plural) |
156
+ | `sortConnectors` | `@sodax/wallet-sdk-react` | Helper: preferred → installed → original |
157
+ | `getXChainType` | `@sodax/wallet-sdk-react` | Imperative: map a `SpokeChainKey` to its `ChainType` family. Common pattern: `useXService({ xChainType: getXChainType(srcChainKey) })` when you only have a chain key on hand. |
158
+ | `getXService` | `@sodax/wallet-sdk-react` | Imperative variant of `useXService` for non-React call sites (e.g. inside event handlers that don't re-render). Prefer `useXService` in component bodies. |