/sodax-skills:sodax-wallet-sdk-reactfrom sodax-skills
Adds SODAX multi-chain wallet connectivity to React dapps using @sodax/wallet-sdk-react v2. Handles integration (SodaxWalletProvider setup, hooks for connect/account/signing, WalletConnect, Privy email login) and migration from v1 (replacing useXWagmiStore, updating provider config).
Ships in sodax-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
AGENTS.md routes you here when you're working with @sodax/wallet-sdk-react v2 — either writing new code or porting from v1.
Pick your mode:
useXWagmiStore, rpcConfig, initialState, or positional-args hooks)? → § Migration mode below.For backend / non-React → use sodax-wallet-sdk-core instead.
For React dapps with hooks wrapping the SDK → also load sodax-dapp-kit.
If the task is one wallet concern, load its granular skill instead of this broad one. Each links straight to its recipe, for both integration and migration.
| Concern | Granular skill | Trigger phrases |
|---|---|---|
| Connect / disconnect, account and connection state | ./connect/SKILL.md | "useXConnect", "useXAccount", "connect button" |
| Headless wallet modal and multi-chain UI | ./wallet-modal/SKILL.md | "useWalletModal", "wallet modal", "connect several chains" |
| Connected wallet → SDK signer | ./bridge-to-sdk/SKILL.md | "useWalletProvider", "pass the wallet to @sodax/sdk" |
| EVM chain switching / wrong network | ./switch-chain/SKILL.md | "useEvmSwitchChain", "wrong network banner" |
| Sign an arbitrary message | ./sign-message/SKILL.md | "useXSignMessage", "prove wallet ownership", "SIWE" |
| WalletConnect / enterprise custody | ./walletconnect/SKILL.md | "WalletConnect", "Fireblocks", "Ledger", "mobile-only wallet" |
| Email login (Privy embedded wallet) | ./privy/SKILL.md | "add email login", "Privy", "embedded wallet" |
Load this broad skill (keep reading below) for a full wallet setup, several concerns at once, or a v1 port.
Pick this mode when the consumer is a React dapp that needs SODAX wallet connectivity. Common signals:
useXConnect, useXAccount.useWalletModal, useChainGroups, useConnectedChains.@sodax/sdk swap" — useWalletProvider({ xChainId }).walletConnect field on SodaxWalletConfig.EVM.privy field on SodaxWalletConfig.EVM, built with privy() from @sodax/wallet-sdk-react/privy.ssr: true flag on the EVM slot.integration/knowledge/ai-rules.md — DO / DON'T + workflow.integration/knowledge/recipes/setup.md. Mount SodaxWalletProvider, declare chain-type slots, wire @tanstack/react-query.integration/knowledge/architecture.md — provider mount tree, frozen config, EVM single-connection model, xChainType vs xChainId.integration/knowledge/recipes/ — connect-button.md, multi-chain-modal.md, walletconnect-setup.md, privy-email-login.md, bridge-to-sdk.md, sign-message.md, switch-chain.md, batch-operations.md, chain-detection.md, sub-path-imports.md.integration/knowledge/examples/ — 5 working .tsx app shells (01-minimal-evm, 02-multi-chain-modal, 03-nextjs-app-router, 04-walletconnect-setup, 05-privy-email-login).integration/knowledge/reference/ — hooks, connectors, chain-support, wallet-brands, api-surface.useXConnectors({ xChainType: 'EVM' }), useXAccount({ xChainId: ChainKeys.BSC_MAINNET }), useWalletProvider({ xChainType: 'EVM' }). useXAccount and useWalletProvider take either xChainId (chain key) or xChainType (family) — never both.useXConnect is a React Query mutation. Pass an IXConnector to mutate / mutateAsync. For provider-managed chains (EVM/Solana/Sui), the resolved value is undefined — read the connected account via useXAccount after the mutation lands.localStorage (key xwagmi-store). Gate UI on hydration with useConnectedChains().status === 'ready' to avoid flicker.useChainGroups / useConnectedChains report a single EVM row.SodaxWalletProvider config accepts a SodaxWalletConfig where top-level keys are ChainType slots (one per ChainTypeArr member in @sodax/types). Omit a slot to skip mounting that adapter; pass {} to mount with SDK defaults.EvmXService, XverseXConnector, etc. are deep-import only (@sodax/wallet-sdk-react/xchains/<chain>). The barrel only exports hooks, types, interfaces, and SodaxWalletProvider.Headless building blocks (render-agnostic, wallet-agnostic):
| Hook | Purpose |
|---|---|
useWalletModal({ onConnected }) | State machine: closed → chainSelect → walletSelect → connecting → success | error. |
useConnectionFlow() | connect + status + retry without a modal. |
useBatchConnect({ connectors, skipConnected }) | Sequential connect across every chain a wallet identifier covers. |
useBatchDisconnect({ connectors? }) | Mirror of useBatchConnect; omit connectors to disconnect all. |
useChainGroups({ order? }) | One entry per enabled chain; EVM collapses to one group. |
useConnectedChains({ order? }) | Aggregate connected view; status: 'loading' | 'ready'. |
useIsWalletInstalled({ connectors?, chainType? }) | Cross-chain install check; filters AND. |
sortConnectors(xs, { preferred }) | Preferred first, then installed, then original. |
xChainId and xChainType to useXAccount / useWalletProvider. They're mutually exclusive.useWalletProvider. Use the chain-key narrowing pattern (passing a specific xChainId) to get the typed IXxxWalletProvider without as.EvmXService, XverseXConnector, etc. live behind @sodax/wallet-sdk-react/xchains/<chain> deep imports.useConnectedChains().status === 'ready' and you get a flicker / stale-state.walletConnect field on the EVM slot.pnpm tsc --noEmit # must exit clean
Manually verify in browser:
useXDisconnect).useWalletProvider({ xChainId: ChainKeys.X }) returns the chain-narrowed IXxxWalletProvider, ready to pass into @sodax/sdk calls (with raw: false).Pick this mode if the consumer has v1 wallet-sdk-react patterns. Grep signals:
grep -rE 'useXWagmiStore|rpcConfig|initialState' src/
grep -rE 'SodaxWalletProvider.*(options|rpcConfig|initialState)' src/
The package name did not change between v1 and v2 — both versions publish as @sodax/wallet-sdk-react. Migration is detected by import surface, not by package name.
If a project has both v1 patterns AND a request for new features: migration first, then integration.
migration-v1-to-v2/knowledge/ai-rules.md — DO / DON'T + workflow + stop conditions.migration-v1-to-v2/knowledge/breaking-changes.md — full narrative of every v1 → v2 change.migration-v1-to-v2/knowledge/recipes/ — connect-button.md, multi-chain-modal.md, ssr-setup.md, walletconnect-migration.md.reference/ lookups when symbols don't match — imports.md, hooks.md, config.md, components.md.checklist.md.useXWagmiStore removed from the public API. v2 does not export the store hook at all — neither useXWagmiStore nor useXWalletStore is available from the package barrel. Replace each useXWagmiStore(state => state.X) selector with the matching public hook (useXServices, useXService({ xChainType }), useXConnections, useXConnection({ xChainType }), etc.). See migration-v1-to-v2/knowledge/reference/imports.md § "Store hook removed from the public API" for the full field-to-hook map and a STOP decision tree for selectors hitting v2-internal fields. The localStorage persistence key 'xwagmi-store' is unchanged, so user connections survive the upgrade.{ xChainType } or { xChainId } (mutually exclusive on useXAccount / useWalletProvider).SodaxWalletProvider props. v1's rpcConfig, options, initialState props are removed. v2 takes one config: SodaxWalletConfig prop where top-level keys are ChainType slots (EVM, SOLANA, SUI, …). The old chains: { EVM, SOLANA, ... } wrapper is also gone — chain-type slots are now top-level.{ rpcUrl?, defaults? }; SUI uses { grpcUrl?, defaults? } (rpcUrl is a deprecated alias, and the two are mutually exclusive); BITCOIN/STELLAR/INJECTIVE extend their *RpcConfig with { defaults? }; STACKS accepts a preset name or StacksNetworkLike & { defaults? }.| Signal | Why stop |
|---|---|
User wants a chain family not in integration/knowledge/reference/chain-support.md | Adding a new chain is a maintainer task. |
User has a custom XService / XConnector subclass with non-trivial logic | Custom subclasses are a maintainer-only path. Confirm scope first. |
| User mixes v1 and v2 patterns in new code being written | Do migration first, then integration. |
useXWagmiStore(state => state.X) selector with the matching v2 public hook (useXServices, useXService({ xChainType }), useXConnections, useXConnection({ xChainType }), …) — drop the useXWagmiStore import entirely. See migration-v1-to-v2/knowledge/reference/imports.md § "Store hook removed" for the field-to-hook map.SodaxWalletProvider props to the single config object.rpcConfig prop to per-chain { rpcUrl } under the relevant slot.walletConnect: { projectId: '…' } to the EVM slot — see recipes/walletconnect-migration.md.useXWagmiStore to useXWalletStore. The v2 barrel does not export either name. The store implementation file is named useXWalletStore.ts internally, but the hook is private — every consumer call site must move to a public hook.rpcConfig / options / initialState props on SodaxWalletProvider — they're gone.xChainId and xChainType to useXAccount / useWalletProvider — mutually exclusive.useConnectedChains().status === 'ready' gates UI; render too early and you get flicker.pnpm tsc --noEmit # must exit clean
grep -rE 'useXWagmiStore|useXWalletStore' src/ # empty — v2 exports neither
grep -rE 'SodaxWalletProvider.*(rpcConfig|initialState)' src/ # empty
Manual: connections still survive page reload (localStorage key xwagmi-store was preserved for backward compat).
sodax-dapp-kit — React hooks wrapping @sodax/sdk. Use useWalletProvider to bridge.sodax-sdk — for any direct SDK call from the React app (or for the SDK-level v1 → v2 work that often runs alongside this one).sodax-wallet-sdk-core — the underlying provider classes that useWalletProvider returns.integration/knowledge/README.md (opens in a new tab)integration/knowledge/ai-rules.md (opens in a new tab)integration/knowledge/architecture.md (opens in a new tab)integration/knowledge/examples/01-minimal-evm.tsx (opens in a new tab)integration/knowledge/examples/02-multi-chain-modal.tsx (opens in a new tab)integration/knowledge/examples/03-nextjs-app-router.tsx (opens in a new tab)integration/knowledge/examples/04-walletconnect-setup.tsx (opens in a new tab)integration/knowledge/examples/05-privy-email-login.tsx (opens in a new tab)integration/knowledge/examples/README.md (opens in a new tab)integration/knowledge/recipes/batch-operations.md (opens in a new tab)integration/knowledge/recipes/bridge-to-sdk.md (opens in a new tab)integration/knowledge/recipes/chain-detection.md (opens in a new tab)integration/knowledge/recipes/connect-button.md (opens in a new tab)integration/knowledge/recipes/multi-chain-modal.md (opens in a new tab)integration/knowledge/recipes/privy-email-login.md (opens in a new tab)integration/knowledge/recipes/setup.md (opens in a new tab)integration/knowledge/recipes/sign-message.md (opens in a new tab)integration/knowledge/recipes/sub-path-imports.md (opens in a new tab)integration/knowledge/recipes/switch-chain.md (opens in a new tab)integration/knowledge/recipes/walletconnect-setup.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
4 skills in this plugin
/sodax-dapp-kitIntegrate SODAX into a React dapp with @sodax/dapp-kit — React Query hooks for swaps, money market lending/borrowing, staking, bridging, DEX liquidity, leverage-yield vaults (deposit/withdraw, APR / TVL / health) and leverage positions, token migration, Bitcoin trading (Radfi / Bound Exchange), partner fees, recovery, and backend API reads. INTEGRATION (write NEW code) — use whenever a React dapp needs SODAX feature hooks; backend code uses `@sodax/sdk`. Triggers on "use @sodax/dapp-kit", "useSwap", "useMoneyMarket", "useStake", "useBridge", "useDex", "useMigrate", "useLeverageYield", "leverage yield vault in React", "vault UI", any dapp-kit `use<Feature>` hook, "Sodax React hooks". v2 hook shape: mutation hooks return `SafeUseMutationResult` with `mutateAsyncSafe(vars): Promise<Result<TData>>`; mutationFn throws on SDK `!ok`; hooks own their invalidations. MIGRATION (port v1 → v2) — single-object hook params, mandatory `mutateAsyncSafe`, hook-owned invalidations, canonical queryKey/mutationKey conventions, on top of the reshaped SDK (chain-key-driven routing, `Result<T>` everywhere, `WalletProviderSlot<K, Raw>`). 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./sodax-sdkOther plugins' skills for the same job
Generated from the plugin's indexed repository (gosodax/sodax-sdks) — no native marketplace selected
npx claudepluginhub p/icon-project-sodax-skills