@sodax/wallet-sdk-react 1.5.7-beta → 2.0.0-rc.2
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.
- package/README.md +103 -145
- package/ai-exported/AGENTS.md +122 -0
- package/ai-exported/integration/README.md +102 -0
- package/ai-exported/integration/ai-rules.md +136 -0
- package/ai-exported/integration/architecture.md +181 -0
- package/ai-exported/integration/examples/01-minimal-evm.tsx +75 -0
- package/ai-exported/integration/examples/02-multi-chain-modal.tsx +169 -0
- package/ai-exported/integration/examples/03-nextjs-app-router.tsx +99 -0
- package/ai-exported/integration/examples/04-walletconnect-setup.tsx +89 -0
- package/ai-exported/integration/examples/README.md +29 -0
- package/ai-exported/integration/recipes/batch-operations.md +223 -0
- package/ai-exported/integration/recipes/bridge-to-sdk.md +164 -0
- package/ai-exported/integration/recipes/chain-detection.md +254 -0
- package/ai-exported/integration/recipes/connect-button.md +156 -0
- package/ai-exported/integration/recipes/multi-chain-modal.md +199 -0
- package/ai-exported/integration/recipes/setup.md +158 -0
- package/ai-exported/integration/recipes/sign-message.md +137 -0
- package/ai-exported/integration/recipes/sub-path-imports.md +95 -0
- package/ai-exported/integration/recipes/switch-chain.md +141 -0
- package/ai-exported/integration/recipes/walletconnect-setup.md +139 -0
- package/ai-exported/integration/reference/api-surface.md +175 -0
- package/ai-exported/integration/reference/chain-support.md +78 -0
- package/ai-exported/integration/reference/connectors.md +74 -0
- package/ai-exported/integration/reference/hooks.md +204 -0
- package/ai-exported/integration/reference/wallet-brands.md +106 -0
- package/ai-exported/migration/README.md +49 -0
- package/ai-exported/migration/ai-rules.md +144 -0
- package/ai-exported/migration/breaking-changes.md +305 -0
- package/ai-exported/migration/checklist.md +159 -0
- package/ai-exported/migration/recipes/connect-button.md +166 -0
- package/ai-exported/migration/recipes/multi-chain-modal.md +244 -0
- package/ai-exported/migration/recipes/ssr-setup.md +162 -0
- package/ai-exported/migration/recipes/walletconnect-migration.md +168 -0
- package/ai-exported/migration/reference/components.md +73 -0
- package/ai-exported/migration/reference/config.md +307 -0
- package/ai-exported/migration/reference/hooks.md +278 -0
- package/ai-exported/migration/reference/imports.md +157 -0
- package/dist/XConnector-B9YQTVJ4.d.ts +146 -0
- package/dist/chunk-2BOUGCJ7.mjs +150 -0
- package/dist/chunk-2BOUGCJ7.mjs.map +1 -0
- package/dist/chunk-66BAUK56.mjs +202 -0
- package/dist/chunk-66BAUK56.mjs.map +1 -0
- package/dist/chunk-7ULB6DW4.mjs +102 -0
- package/dist/chunk-7ULB6DW4.mjs.map +1 -0
- package/dist/chunk-BKJB527E.mjs +125 -0
- package/dist/chunk-BKJB527E.mjs.map +1 -0
- package/dist/chunk-BXJLBR4G.mjs +88 -0
- package/dist/chunk-BXJLBR4G.mjs.map +1 -0
- package/dist/chunk-E5IAZ7E6.mjs +186 -0
- package/dist/chunk-E5IAZ7E6.mjs.map +1 -0
- package/dist/chunk-MAQ47Q52.mjs +33 -0
- package/dist/chunk-MAQ47Q52.mjs.map +1 -0
- package/dist/chunk-MXZVF5HR.mjs +34 -0
- package/dist/chunk-MXZVF5HR.mjs.map +1 -0
- package/dist/chunk-N5A2TMF6.mjs +33 -0
- package/dist/chunk-N5A2TMF6.mjs.map +1 -0
- package/dist/chunk-NY7U7OJW.mjs +64 -0
- package/dist/chunk-NY7U7OJW.mjs.map +1 -0
- package/dist/chunk-PJLEJVAU.mjs +140 -0
- package/dist/chunk-PJLEJVAU.mjs.map +1 -0
- package/dist/chunk-PLCA4ZDJ.mjs +1585 -0
- package/dist/chunk-PLCA4ZDJ.mjs.map +1 -0
- package/dist/chunk-TZMKDXFA.mjs +3 -0
- package/dist/chunk-TZMKDXFA.mjs.map +1 -0
- package/dist/chunk-X2MHIWXO.mjs +100 -0
- package/dist/chunk-X2MHIWXO.mjs.map +1 -0
- package/dist/chunk-XZ7CHO2S.mjs +41 -0
- package/dist/chunk-XZ7CHO2S.mjs.map +1 -0
- package/dist/config-OlnzyEUE.d.ts +146 -0
- package/dist/index.cjs +2784 -1594
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +768 -1498
- package/dist/index.mjs +463 -2004
- package/dist/index.mjs.map +1 -1
- package/dist/xchains/bitcoin/index.cjs +1927 -0
- package/dist/xchains/bitcoin/index.cjs.map +1 -0
- package/dist/xchains/bitcoin/index.d.ts +125 -0
- package/dist/xchains/bitcoin/index.mjs +16 -0
- package/dist/xchains/bitcoin/index.mjs.map +1 -0
- package/dist/xchains/evm/index.cjs +316 -0
- package/dist/xchains/evm/index.cjs.map +1 -0
- package/dist/xchains/evm/index.d.ts +39 -0
- package/dist/xchains/evm/index.mjs +5 -0
- package/dist/xchains/evm/index.mjs.map +1 -0
- package/dist/xchains/icon/index.cjs +311 -0
- package/dist/xchains/icon/index.cjs.map +1 -0
- package/dist/xchains/icon/index.d.ts +37 -0
- package/dist/xchains/icon/index.mjs +7 -0
- package/dist/xchains/icon/index.mjs.map +1 -0
- package/dist/xchains/injective/index.cjs +223 -0
- package/dist/xchains/injective/index.cjs.map +1 -0
- package/dist/xchains/injective/index.d.ts +35 -0
- package/dist/xchains/injective/index.mjs +5 -0
- package/dist/xchains/injective/index.mjs.map +1 -0
- package/dist/xchains/near/index.cjs +190 -0
- package/dist/xchains/near/index.cjs.map +1 -0
- package/dist/xchains/near/index.d.ts +34 -0
- package/dist/xchains/near/index.mjs +6 -0
- package/dist/xchains/near/index.mjs.map +1 -0
- package/dist/xchains/solana/index.cjs +186 -0
- package/dist/xchains/solana/index.cjs.map +1 -0
- package/dist/xchains/solana/index.d.ts +26 -0
- package/dist/xchains/solana/index.mjs +7 -0
- package/dist/xchains/solana/index.mjs.map +1 -0
- package/dist/xchains/stacks/index.cjs +240 -0
- package/dist/xchains/stacks/index.cjs.map +1 -0
- package/dist/xchains/stacks/index.d.ts +36 -0
- package/dist/xchains/stacks/index.mjs +5 -0
- package/dist/xchains/stacks/index.mjs.map +1 -0
- package/dist/xchains/stellar/index.cjs +322 -0
- package/dist/xchains/stellar/index.cjs.map +1 -0
- package/dist/xchains/stellar/index.d.ts +44 -0
- package/dist/xchains/stellar/index.mjs +6 -0
- package/dist/xchains/stellar/index.mjs.map +1 -0
- package/dist/xchains/sui/index.cjs +248 -0
- package/dist/xchains/sui/index.cjs.map +1 -0
- package/dist/xchains/sui/index.d.ts +37 -0
- package/dist/xchains/sui/index.mjs +7 -0
- package/dist/xchains/sui/index.mjs.map +1 -0
- package/docs/ADDING_A_NEW_CHAIN.md +440 -0
- package/docs/ARCHITECTURE.md +291 -0
- package/docs/BATCH_OPERATIONS.md +267 -0
- package/docs/CHAIN_DETECTION.md +216 -0
- package/docs/CONFIGURE_PROVIDER.md +360 -0
- package/docs/CONNECTORS.md +247 -0
- package/docs/CONNECT_FLOW.md +276 -0
- package/docs/EVM_SWITCH_CHAIN.md +161 -0
- package/docs/SIGN_MESSAGE.md +213 -0
- package/docs/SUB_PATH_EXPORTS.md +246 -0
- package/docs/WALLETCONNECT.md +154 -0
- package/docs/WALLET_MODAL.md +331 -0
- package/docs/WALLET_PROVIDER_BRIDGE.md +226 -0
- package/package.json +37 -12
- package/skills/SKILLS.md +84 -0
- package/skills/bridge-to-sdk.md +148 -0
- package/skills/connect-button.md +116 -0
- package/skills/evm-only-walletconnect.md +111 -0
- package/skills/multi-chain-modal.md +178 -0
- package/skills/setup.md +107 -0
- package/dist/index.d.cts +0 -1579
- package/src/Hydrate.ts +0 -65
- package/src/SodaxWalletProvider.tsx +0 -97
- package/src/actions/getXChainType.ts +0 -8
- package/src/actions/getXService.ts +0 -33
- package/src/actions/index.ts +0 -2
- package/src/assets/wallets/hana.svg +0 -6
- package/src/assets/wallets/havah.svg +0 -76
- package/src/assets/wallets/keplr.svg +0 -30
- package/src/assets/wallets/metamask.svg +0 -60
- package/src/assets/wallets/phantom.svg +0 -4
- package/src/assets/wallets/sui.svg +0 -20
- package/src/core/XConnector.ts +0 -54
- package/src/core/XService.ts +0 -85
- package/src/core/index.ts +0 -2
- package/src/hooks/index.ts +0 -11
- package/src/hooks/useEthereumChainId.ts +0 -44
- package/src/hooks/useEvmSwitchChain.ts +0 -91
- package/src/hooks/useWalletProvider.ts +0 -206
- package/src/hooks/useXAccount.ts +0 -51
- package/src/hooks/useXAccounts.ts +0 -56
- package/src/hooks/useXBalances.ts +0 -65
- package/src/hooks/useXConnect.ts +0 -118
- package/src/hooks/useXConnection.ts +0 -72
- package/src/hooks/useXConnectors.ts +0 -72
- package/src/hooks/useXDisconnect.ts +0 -73
- package/src/hooks/useXService.ts +0 -8
- package/src/hooks/useXSignMessage.ts +0 -82
- package/src/index.ts +0 -19
- package/src/types/index.ts +0 -22
- package/src/useXWagmiStore.ts +0 -116
- package/src/utils/index.ts +0 -21
- package/src/xchains/bitcoin/BitcoinXConnector.ts +0 -34
- package/src/xchains/bitcoin/BitcoinXService.ts +0 -40
- package/src/xchains/bitcoin/OKXXConnector.ts +0 -117
- package/src/xchains/bitcoin/UnisatXConnector.ts +0 -117
- package/src/xchains/bitcoin/XverseXConnector.ts +0 -232
- package/src/xchains/bitcoin/index.ts +0 -7
- package/src/xchains/bitcoin/useBitcoinXConnectors.ts +0 -14
- package/src/xchains/evm/EvmXConnector.ts +0 -27
- package/src/xchains/evm/EvmXService.ts +0 -211
- package/src/xchains/evm/index.ts +0 -3
- package/src/xchains/icon/IconHanaXConnector.ts +0 -39
- package/src/xchains/icon/IconXService.ts +0 -117
- package/src/xchains/icon/actions.ts +0 -28
- package/src/xchains/icon/iconex/index.tsx +0 -46
- package/src/xchains/icon/index.ts +0 -2
- package/src/xchains/injective/InjectiveXConnector.ts +0 -60
- package/src/xchains/injective/InjectiveXService.ts +0 -62
- package/src/xchains/injective/actions.ts +0 -32
- package/src/xchains/injective/index.ts +0 -2
- package/src/xchains/near/NearXConnector.ts +0 -42
- package/src/xchains/near/NearXService.ts +0 -46
- package/src/xchains/near/useNearXConnectors.ts +0 -23
- package/src/xchains/solana/SolanaXConnector.ts +0 -26
- package/src/xchains/solana/SolanaXService.ts +0 -46
- package/src/xchains/solana/index.ts +0 -2
- package/src/xchains/stacks/StacksXConnector.ts +0 -63
- package/src/xchains/stacks/StacksXService.ts +0 -59
- package/src/xchains/stacks/constants.ts +0 -42
- package/src/xchains/stacks/index.ts +0 -4
- package/src/xchains/stacks/useStacksXConnectors.ts +0 -7
- package/src/xchains/stellar/CustomSorobanServer.ts +0 -93
- package/src/xchains/stellar/StellarWalletsKitXConnector.ts +0 -53
- package/src/xchains/stellar/StellarXService.ts +0 -93
- package/src/xchains/stellar/actions.ts +0 -24
- package/src/xchains/stellar/index.tsx +0 -2
- package/src/xchains/stellar/useStellarXConnectors.ts +0 -21
- package/src/xchains/stellar/utils.ts +0 -49
- package/src/xchains/sui/SuiXConnector.ts +0 -28
- package/src/xchains/sui/SuiXService.ts +0 -66
- package/src/xchains/sui/index.ts +0 -2
package/README.md
CHANGED
|
@@ -1,80 +1,73 @@
|
|
|
1
1
|
# @sodax/wallet-sdk-react
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
React layer over [`@sodax/wallet-sdk-core`](https://github.com/icon-project/sodax-sdks/blob/main/packages/wallet-sdk-core/README.md) — wallet connection, signing, and account management for the SODAX cross-chain ecosystem. Hooks read from a single Zustand store; per-chain native SDKs (wagmi, `@solana/wallet-adapter`, `@mysten/dapp-kit`, …) are wrapped behind a uniform `IXService` / `IXConnector` interface.
|
|
4
4
|
|
|
5
5
|
## Features
|
|
6
|
-
- Seamless wallet connectivity for all supported wallets in the Sodax network
|
|
7
|
-
- EVM Wallets: All browser extensions that support [EIP-6963](https://eips.ethereum.org/EIPS/eip-6963) (Hana Wallet, MetaMask, Phantom, etc.) ✅
|
|
8
|
-
- Sui Wallets: All browser extension that @mysten/dapp-kit supports (Hana, Sui Wallet, Suiet, etc.) ✅
|
|
9
|
-
- Solana Wallets: ✅
|
|
10
|
-
- Stellar Wallets: ✅
|
|
11
|
-
- Injective Wallets: ✅
|
|
12
|
-
- ICON Wallets: ✅ (Hana Wallet and other ICON-compatible extensions)
|
|
13
|
-
|
|
14
|
-
- Address and connection state management
|
|
15
|
-
- EVM (Arbitrum, Avalanche, Base, BSC, Optimism, Polygon, Sonic, HyperEVM, LightLink, Ethereum, Redbelly, Kaia) ✅
|
|
16
|
-
- Sui ✅
|
|
17
|
-
- Solana ✅
|
|
18
|
-
- Stellar ✅
|
|
19
|
-
- Injective ✅
|
|
20
|
-
- ICON ✅
|
|
21
6
|
|
|
7
|
+
- **Unified wallet connectivity** for 9 chain families across 20 chains
|
|
8
|
+
- EVM (Sonic hub, Ethereum, Arbitrum, Base, BSC, Optimism, Polygon, Avalanche, HyperEVM, Lightlink, Redbelly, Kaia) — EIP-6963 + WalletConnect
|
|
9
|
+
- Solana, Sui, Stellar, ICON, Injective, Bitcoin, NEAR, Stacks
|
|
10
|
+
- **Single-store state** — `useXAccount`, `useXConnection`, `useXAccounts` all read the same Zustand slice; persisted to `localStorage`
|
|
11
|
+
- **Bridge to `@sodax/sdk`** — `useWalletProvider` returns a typed `IXxxWalletProvider` ready to plug into any SDK call
|
|
12
|
+
- **Headless wallet modal** — `useWalletModal` state machine (chainSelect → walletSelect → connecting → success | error), render-agnostic
|
|
13
|
+
- **Batch operations** — connect/disconnect every chain a wallet identifier covers, in sequence
|
|
14
|
+
- **WalletConnect** — opt-in for enterprise custody (Fireblocks, etc.) via `config.EVM.walletConnect`
|
|
22
15
|
|
|
23
16
|
## Installation
|
|
24
17
|
|
|
25
18
|
```bash
|
|
26
|
-
|
|
19
|
+
pnpm add @sodax/wallet-sdk-react
|
|
20
|
+
# or
|
|
27
21
|
npm install @sodax/wallet-sdk-react
|
|
28
|
-
|
|
29
|
-
# Using yarn
|
|
22
|
+
# or
|
|
30
23
|
yarn add @sodax/wallet-sdk-react
|
|
31
|
-
|
|
32
|
-
# Using pnpm
|
|
33
|
-
pnpm add @sodax/wallet-sdk-react
|
|
34
24
|
```
|
|
35
25
|
|
|
36
|
-
## Peer
|
|
37
|
-
|
|
38
|
-
This package requires the following peer dependencies:
|
|
26
|
+
## Peer dependencies
|
|
39
27
|
|
|
40
28
|
```json
|
|
41
29
|
{
|
|
42
30
|
"react": ">=19",
|
|
43
|
-
"@tanstack/react-query": "
|
|
31
|
+
"@tanstack/react-query": "5.x"
|
|
44
32
|
}
|
|
45
33
|
```
|
|
46
34
|
|
|
47
|
-
## Quick
|
|
35
|
+
## Quick start
|
|
48
36
|
|
|
49
|
-
```
|
|
50
|
-
import {
|
|
37
|
+
```tsx
|
|
38
|
+
import {
|
|
39
|
+
SodaxWalletProvider,
|
|
40
|
+
type SodaxWalletConfig,
|
|
41
|
+
useXAccount,
|
|
42
|
+
useXConnect,
|
|
43
|
+
useXConnectors,
|
|
44
|
+
} from '@sodax/wallet-sdk-react';
|
|
51
45
|
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
|
52
|
-
import
|
|
46
|
+
import { ChainKeys } from '@sodax/types';
|
|
53
47
|
|
|
54
|
-
// Create a QueryClient instance
|
|
55
48
|
const queryClient = new QueryClient();
|
|
56
49
|
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
50
|
+
const config: SodaxWalletConfig = {
|
|
51
|
+
EVM: {
|
|
52
|
+
ssr: true,
|
|
53
|
+
chains: {
|
|
54
|
+
[ChainKeys.SONIC_MAINNET]: { rpcUrl: 'https://rpc.soniclabs.com' },
|
|
55
|
+
[ChainKeys.ETHEREUM_MAINNET]: { rpcUrl: 'https://ethereum-rpc.publicnode.com' },
|
|
56
|
+
},
|
|
57
|
+
// Optional: add WalletConnect support (requires wc projectId)
|
|
58
|
+
// walletConnect: { projectId: '...' },
|
|
59
|
+
},
|
|
60
|
+
ICON: {
|
|
61
|
+
chains: {
|
|
62
|
+
[ChainKeys.ICON_MAINNET]: { rpcUrl: 'https://ctz.solidwallet.io/api/v3' },
|
|
63
|
+
},
|
|
64
|
+
},
|
|
72
65
|
};
|
|
73
66
|
|
|
74
67
|
function App() {
|
|
75
68
|
return (
|
|
76
69
|
<QueryClientProvider client={queryClient}>
|
|
77
|
-
<SodaxWalletProvider
|
|
70
|
+
<SodaxWalletProvider config={config}>
|
|
78
71
|
<WalletConnect />
|
|
79
72
|
</SodaxWalletProvider>
|
|
80
73
|
</QueryClientProvider>
|
|
@@ -82,132 +75,97 @@ function App() {
|
|
|
82
75
|
}
|
|
83
76
|
|
|
84
77
|
function WalletConnect() {
|
|
85
|
-
|
|
86
|
-
const connectors = useXConnectors('EVM');
|
|
87
|
-
|
|
88
|
-
// Get connect mutation
|
|
78
|
+
const connectors = useXConnectors({ xChainType: 'EVM' });
|
|
89
79
|
const { mutateAsync: connect } = useXConnect();
|
|
80
|
+
const account = useXAccount({ xChainType: 'EVM' });
|
|
90
81
|
|
|
91
|
-
|
|
92
|
-
|
|
82
|
+
if (account.address) {
|
|
83
|
+
return <p>Connected: {account.address}</p>;
|
|
84
|
+
}
|
|
93
85
|
|
|
94
86
|
return (
|
|
95
|
-
<div
|
|
96
|
-
{
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
)}
|
|
103
|
-
|
|
104
|
-
{/* Display available connectors */}
|
|
105
|
-
<div className="space-y-2">
|
|
106
|
-
{connectors.map((connector) => (
|
|
107
|
-
<button
|
|
108
|
-
key={connector.id}
|
|
109
|
-
onClick={() => connect(connector)}
|
|
110
|
-
className="flex items-center gap-2 p-2 border rounded-lg hover:bg-gray-50"
|
|
111
|
-
>
|
|
112
|
-
<img
|
|
113
|
-
src={connector.icon}
|
|
114
|
-
alt={connector.name}
|
|
115
|
-
width={24}
|
|
116
|
-
height={24}
|
|
117
|
-
className="rounded-md"
|
|
118
|
-
/>
|
|
119
|
-
<span>Connect {connector.name}</span>
|
|
120
|
-
</button>
|
|
121
|
-
))}
|
|
122
|
-
</div>
|
|
87
|
+
<div>
|
|
88
|
+
{connectors.map(connector => (
|
|
89
|
+
<button key={connector.id} onClick={() => connect(connector)}>
|
|
90
|
+
{connector.icon && <img src={connector.icon} alt="" width={20} height={20} />}
|
|
91
|
+
{connector.name}
|
|
92
|
+
</button>
|
|
93
|
+
))}
|
|
123
94
|
</div>
|
|
124
95
|
);
|
|
125
96
|
}
|
|
126
97
|
```
|
|
127
98
|
|
|
128
|
-
|
|
129
|
-
1. Setting up the required providers (`QueryClientProvider` and `SodaxWalletProvider`)
|
|
130
|
-
2. Using `useXConnectors` to get available wallet connectors
|
|
131
|
-
3. Using `useXConnect` to handle wallet connections
|
|
132
|
-
4. Using `useXAccount` to display the connected wallet address
|
|
133
|
-
5. A basic UI to display and connect to available wallets
|
|
99
|
+
## Documentation
|
|
134
100
|
|
|
101
|
+
The full guide lives in [`docs/`](docs/). Start with the topic that matches what you're building.
|
|
135
102
|
|
|
136
|
-
|
|
103
|
+
| Topic | What it covers |
|
|
104
|
+
|-------|----------------|
|
|
105
|
+
| [Configure SodaxWalletProvider](docs/CONFIGURE_PROVIDER.md) | `SodaxWalletConfig` shape, opt-in chain mounting, per-chain RPC + wallet defaults, breaking changes from v1 |
|
|
106
|
+
| [Connect Flow](docs/CONNECT_FLOW.md) | Discover connectors, connect, read account, disconnect; provider-managed vs non-provider chains; persisted reconnect |
|
|
107
|
+
| [Wallet Provider Bridge](docs/WALLET_PROVIDER_BRIDGE.md) | `useWalletProvider` → typed `IXxxWalletProvider` for `@sodax/sdk` calls; `useXService` / `useXServices` |
|
|
108
|
+
| [Wallet Modal](docs/WALLET_MODAL.md) | Headless state machine for multi-chain modal UIs; `useConnectionFlow` non-modal alternative |
|
|
109
|
+
| [WalletConnect](docs/WALLETCONNECT.md) | Enterprise custody integration (Fireblocks, Ledger); `qrModalOptions` filtering |
|
|
110
|
+
| [Batch Operations](docs/BATCH_OPERATIONS.md) | Sequential multi-chain connect/disconnect by wallet identifier |
|
|
111
|
+
| [Chain Detection](docs/CHAIN_DETECTION.md) | `useChainGroups`, `useConnectedChains`, `useIsWalletInstalled`, `useEnabledChains`; hydration status |
|
|
112
|
+
| [Sign Message](docs/SIGN_MESSAGE.md) | `useXSignMessage` cross-chain; Bitcoin BIP-322 vs ECDSA auto-detect |
|
|
113
|
+
| [EVM Switch Chain](docs/EVM_SWITCH_CHAIN.md) | Single wagmi connection across all configured EVM networks |
|
|
114
|
+
| [Connectors](docs/CONNECTORS.md) | `IXConnector` contract, deep-import concrete classes, custom connectors |
|
|
115
|
+
| [Architecture](docs/ARCHITECTURE.md) | Zustand store, Provider/Hydrator/Actions trio, persist hydration caveat |
|
|
116
|
+
| [Adding a New Chain](https://github.com/icon-project/sodax-sdks/blob/main/packages/wallet-sdk-react/docs/ADDING_A_NEW_CHAIN.md) | `ChainMeta` extension, chain registry, sub-path export wiring |
|
|
137
117
|
|
|
138
|
-
|
|
139
|
-
- React >= 19
|
|
140
|
-
- TypeScript
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
## API Reference
|
|
118
|
+
## AI agent docs
|
|
144
119
|
|
|
145
|
-
|
|
120
|
+
This package ships with AI-consumable integration & migration docs at `node_modules/@sodax/wallet-sdk-react/ai-exported/`. Point your AI coding agent at [`ai-exported/AGENTS.md`](ai-exported/AGENTS.md) to start — it routes to integration recipes (new consumers), migration recipes (v1 → v2), and reference tables.
|
|
146
121
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
#### Core Wallet Hooks
|
|
152
|
-
- [`useXConnectors`](https://github.com/icon-project/sodax-frontend/tree/main/packages/wallet-sdk-react/src/hooks/useXConnectors.ts) - Get available wallet connectors
|
|
153
|
-
- [`useXConnect`](https://github.com/icon-project/sodax-frontend/tree/main/packages/wallet-sdk-react/src/hooks/useXConnect.ts) - Connect to a wallet
|
|
154
|
-
- [`useXAccount`](https://github.com/icon-project/sodax-frontend/tree/main/packages/wallet-sdk-react/src/hooks/useXAccount.ts) - Get account information
|
|
155
|
-
- [`useXDisconnect`](https://github.com/icon-project/sodax-frontend/tree/main/packages/wallet-sdk-react/src/hooks/useXDisconnect.ts) - Disconnect from a wallet
|
|
122
|
+
```
|
|
123
|
+
> Read node_modules/@sodax/wallet-sdk-react/ai-exported/AGENTS.md and integrate
|
|
124
|
+
> SODAX wallet connectivity into my Next.js app.
|
|
125
|
+
```
|
|
156
126
|
|
|
157
|
-
|
|
158
|
-
- [`useEvmSwitchChain`](https://github.com/icon-project/sodax-frontend/tree/main/packages/wallet-sdk-react/src/hooks/evm/useEvmSwitchChain.ts) - Switch between EVM chains
|
|
127
|
+
The CI guard `scripts/check-ai-exported.sh` validates that every hook reference and sub-path in those docs resolves to a real export.
|
|
159
128
|
|
|
160
|
-
|
|
161
|
-
- [`useXBalances`](https://github.com/icon-project/sodax-frontend/tree/main/packages/wallet-sdk-react/src/hooks/useXBalances.ts) - Fetch token balances
|
|
129
|
+
---
|
|
162
130
|
|
|
163
|
-
|
|
164
|
-
- [`useXService`](https://github.com/icon-project/sodax-frontend/tree/main/packages/wallet-sdk-react/src/hooks/useXService.ts) - Access chain-specific service
|
|
131
|
+
## Sub-path exports
|
|
165
132
|
|
|
166
|
-
|
|
133
|
+
Concrete connector / service classes are **not** exported from the package barrel — they live behind sub-path imports to prevent accidental coupling to internals:
|
|
167
134
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
- [`XConnector`](https://github.com/icon-project/sodax-frontend/tree/main/packages/wallet-sdk-react/src/types/index.ts) - Wallet connector type
|
|
172
|
-
- [`XToken`](https://github.com/icon-project/sodax-frontend/tree/main/packages/wallet-sdk-react/src/types/index.ts) - Cross-chain token type
|
|
135
|
+
```typescript
|
|
136
|
+
// ✅ Normal usage — barrel import
|
|
137
|
+
import { useXConnect, useXAccount, type IXConnector } from '@sodax/wallet-sdk-react';
|
|
173
138
|
|
|
174
|
-
|
|
139
|
+
// ✅ Advanced — concrete class via deep import
|
|
140
|
+
import { XverseXConnector } from '@sodax/wallet-sdk-react/xchains/bitcoin';
|
|
141
|
+
if (connector instanceof XverseXConnector) {
|
|
142
|
+
connector.setAddressPurpose('payment');
|
|
143
|
+
}
|
|
144
|
+
```
|
|
175
145
|
|
|
176
|
-
|
|
177
|
-
- [`XConnector`](https://github.com/icon-project/sodax-frontend/tree/main/packages/wallet-sdk-react/src/core/XConnector.ts) - Base class for wallet connectors
|
|
178
|
-
- [`EvmXConnector`](https://github.com/icon-project/sodax-frontend/tree/main/packages/wallet-sdk-react/src/xchains/evm/EvmXConnector.ts) - EVM wallet connector
|
|
179
|
-
- [`SolanaXConnector`](https://github.com/icon-project/sodax-frontend/tree/main/packages/wallet-sdk-react/src/xchains/solana/SolanaXConnector.ts) - Solana wallet connector
|
|
180
|
-
- [`SuiXConnector`](https://github.com/icon-project/sodax-frontend/tree/main/packages/wallet-sdk-react/src/xchains/sui/SuiXConnector.ts) - Sui wallet connector
|
|
181
|
-
- [`StellarXConnector`](https://github.com/icon-project/sodax-frontend/tree/main/packages/wallet-sdk-react/src/xchains/stellar/StellarWalletsKitXConnector.ts) - Stellar wallet connector
|
|
182
|
-
- [`InjectiveMetamaskXConnector`](https://github.com/icon-project/sodax-frontend/tree/main/packages/wallet-sdk-react/src/xchains/injective/InjectiveMetamaskXConnector.ts) - Injective MetaMask connector
|
|
183
|
-
- [`InjectiveKelprXConnector`](https://github.com/icon-project/sodax-frontend/tree/main/packages/wallet-sdk-react/src/xchains/injective/InjectiveKelprXConnector.ts) - Injective Keplr connector
|
|
184
|
-
- [`IconXConnector`](https://github.com/icon-project/sodax-frontend/tree/main/packages/wallet-sdk-react/src/xchains/icon/IconHanaXConnector.ts) - ICON wallet connector
|
|
146
|
+
See [Connectors](docs/CONNECTORS.md) for the full list of deep-import sub-paths.
|
|
185
147
|
|
|
186
|
-
##
|
|
148
|
+
## Requirements
|
|
187
149
|
|
|
188
|
-
|
|
150
|
+
- Node.js >= 18.0.0
|
|
151
|
+
- React >= 19
|
|
152
|
+
- TypeScript
|
|
189
153
|
|
|
190
154
|
## Development
|
|
191
155
|
|
|
192
156
|
```bash
|
|
193
|
-
# Install dependencies
|
|
194
|
-
pnpm
|
|
195
|
-
|
|
196
|
-
#
|
|
197
|
-
pnpm
|
|
198
|
-
|
|
199
|
-
#
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
# Run type checking
|
|
203
|
-
pnpm checkTs
|
|
157
|
+
pnpm install # Install dependencies
|
|
158
|
+
pnpm build # Build the package (ESM + CJS, multi-entry)
|
|
159
|
+
pnpm dev # Watch mode
|
|
160
|
+
pnpm checkTs # Type checking
|
|
161
|
+
pnpm test # Run tests
|
|
162
|
+
pnpm pretty # Format code
|
|
163
|
+
pnpm lint # Lint code
|
|
164
|
+
```
|
|
204
165
|
|
|
205
|
-
|
|
206
|
-
pnpm pretty
|
|
166
|
+
## Contributing
|
|
207
167
|
|
|
208
|
-
|
|
209
|
-
pnpm lint
|
|
210
|
-
```
|
|
168
|
+
Contributions welcome — see the repo [Contributing Guide](https://github.com/icon-project/sodax-sdks/blob/main/CONTRIBUTING.md). For onboarding a new chain family, follow [`docs/ADDING_A_NEW_CHAIN.md`](https://github.com/icon-project/sodax-sdks/blob/main/packages/wallet-sdk-react/docs/ADDING_A_NEW_CHAIN.md).
|
|
211
169
|
|
|
212
170
|
## License
|
|
213
171
|
|
|
@@ -215,5 +173,5 @@ pnpm lint
|
|
|
215
173
|
|
|
216
174
|
## Support
|
|
217
175
|
|
|
218
|
-
- [GitHub Issues](https://github.com/icon-project/sodax-
|
|
176
|
+
- [GitHub Issues](https://github.com/icon-project/sodax-sdks/issues)
|
|
219
177
|
- [Discord Community](https://discord.gg/sodax-formerly-icon-880651922682560582)
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
# AGENTS.md — `@sodax/wallet-sdk-react` AI Export
|
|
2
|
+
|
|
3
|
+
You are a coding agent helping a developer **integrate** or **migrate** the `@sodax/wallet-sdk-react` package. This document is your entry point. Read this first, then route to the right sub-folder.
|
|
4
|
+
|
|
5
|
+
The files in this `ai-exported/` directory are designed for AI consumption: short, table-heavy, self-contained recipes, and machine-checkable checklists. Human-readable narrative lives in each folder's `README.md`.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Step 1 — Identify the task
|
|
10
|
+
|
|
11
|
+
| User says... | Path | Start at |
|
|
12
|
+
|---|---|---|
|
|
13
|
+
| "upgrade to v2", "migrate from v1", "old hooks no longer work", "useXWagmiStore is gone" | **migration** | `migration/ai-rules.md` |
|
|
14
|
+
| "add wallet connect", "set up SodaxWalletProvider", "first time using this lib" | **integration** | `integration/ai-rules.md` |
|
|
15
|
+
| Looking up a v1 → v2 symbol mapping | direct | `migration/reference/*.md` |
|
|
16
|
+
| Looking up a hook signature or available connector | direct | `integration/reference/*.md` |
|
|
17
|
+
|
|
18
|
+
The package name **did not change** between v1 and v2 — both versions publish as `@sodax/wallet-sdk-react`. Migration is detected by import surface (`useXWagmiStore`, positional hook args, `rpcConfig` / `options` / `initialState` props on `SodaxWalletProvider`), not by package name.
|
|
19
|
+
|
|
20
|
+
If both signals appear (project has v1 patterns AND wants new features), **migration first, then integration**.
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## Step 2 — Load the right context
|
|
25
|
+
|
|
26
|
+
**For migration tasks:**
|
|
27
|
+
|
|
28
|
+
1. `migration/ai-rules.md` — DO/DON'T + workflow + stop conditions
|
|
29
|
+
2. `migration/breaking-changes.md` — narrative WHY behind each change
|
|
30
|
+
3. `migration/reference/*.md` — lookup tables (imports, hooks, config, components)
|
|
31
|
+
4. `migration/recipes/<task>.md` — paired before/after for the specific use case
|
|
32
|
+
5. `migration/checklist.md` — verification loop
|
|
33
|
+
|
|
34
|
+
**For integration tasks:**
|
|
35
|
+
|
|
36
|
+
1. `integration/ai-rules.md` — DO/DON'T + workflow
|
|
37
|
+
2. `integration/recipes/setup.md` — always read this first (everything else depends on it)
|
|
38
|
+
3. `integration/recipes/<task>.md` — task-specific guide
|
|
39
|
+
4. `integration/reference/*.md` — API surface lookup
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## Step 3 — Honor flow-specific stop conditions
|
|
44
|
+
|
|
45
|
+
Each flow has its own list of conditions that **HARD STOP** code generation and require asking the user:
|
|
46
|
+
|
|
47
|
+
- Migration stops → [`migration/ai-rules.md`](./migration/ai-rules.md) § "Stop conditions"
|
|
48
|
+
- Integration stops → [`integration/ai-rules.md`](./integration/ai-rules.md) § "Stop conditions"
|
|
49
|
+
|
|
50
|
+
Read the relevant list **before** applying any change. When stopping, quote the offending file/line and present the user with concrete options. Do **not** guess.
|
|
51
|
+
|
|
52
|
+
Cross-flow signals (true regardless of flow):
|
|
53
|
+
|
|
54
|
+
- User explicitly requests a behavior that v2 does not support (custom chain not in [`integration/reference/chain-support.md`](./integration/reference/chain-support.md), custom `XService` / `XConnector` subclass with non-trivial logic).
|
|
55
|
+
- User mixes both v1 and v2 patterns in new code being written — do migration first, then integration.
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
## Step 4 — Verification protocol
|
|
60
|
+
|
|
61
|
+
After **every** code change you make:
|
|
62
|
+
|
|
63
|
+
1. Run `pnpm checkTs` from the user's app root (or the package the change touched).
|
|
64
|
+
2. If errors mention `@sodax/wallet-sdk-react`, look up the symbol in `migration/reference/` or `integration/reference/`.
|
|
65
|
+
3. If a symbol isn't in any reference file, **stop and ask**. Do not invent migrations.
|
|
66
|
+
4. After all errors resolve, mark the relevant items in `migration/checklist.md` (for migrations) or move to the next recipe.
|
|
67
|
+
|
|
68
|
+
You are **done** when:
|
|
69
|
+
- `pnpm checkTs` exits clean for the user's project.
|
|
70
|
+
- All items in `migration/checklist.md` are checked (migration only).
|
|
71
|
+
- The user has confirmed the changed flow works in their dev environment.
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
## Conventions in this directory
|
|
76
|
+
|
|
77
|
+
- **Recipes are self-contained.** A recipe file in `recipes/` contains everything needed to apply the change — before/after code, steps, verification. Do not jump between files.
|
|
78
|
+
- **Reference files are tables.** `reference/*.md` contains markdown tables and paired code blocks marked `// v1 ❌` and `// v2 ✅`. Treat them as lookup, not narrative.
|
|
79
|
+
- **Token budget**: Each file is sized to fit comfortably in your context. If you find yourself loading more than 3 files for a single task, you are probably doing it wrong — re-route via the table above.
|
|
80
|
+
- **Single source of truth**: Behavioral / breaking-change *explanations* live only in `migration/breaking-changes.md`. Other files reference it but do not duplicate the prose.
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
## Quick symbol lookup
|
|
85
|
+
|
|
86
|
+
If the user mentions a symbol you don't recognize, grep these files in order:
|
|
87
|
+
|
|
88
|
+
```
|
|
89
|
+
migration/reference/imports.md — import path changes
|
|
90
|
+
migration/reference/hooks.md — hook renames + signature changes
|
|
91
|
+
migration/reference/config.md — SodaxWalletProvider config changes
|
|
92
|
+
migration/reference/components.md — component / provider renames
|
|
93
|
+
integration/reference/hooks.md — full v2 hook surface
|
|
94
|
+
integration/reference/connectors.md — available wallet connectors per chain
|
|
95
|
+
integration/reference/chain-support.md — supported chains + slots
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
If still not found: the symbol may be **internal** (not exported from v2) or **removed**. Ask the user to share the v1 file/line so you can decide.
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
## Package context
|
|
103
|
+
|
|
104
|
+
- **Name**: `@sodax/wallet-sdk-react` (same package name in v1 and v2)
|
|
105
|
+
- **Version target**: v2.x (current).
|
|
106
|
+
- **Peer deps**: `react >= 19`, `@tanstack/react-query 5.x`
|
|
107
|
+
- **Install**: `pnpm add @sodax/wallet-sdk-react @tanstack/react-query`
|
|
108
|
+
- **Audience**: dApp builders integrating multi-chain wallet connectivity (9 chain types: EVM, Solana, Sui, Bitcoin, Stellar, ICON, Injective, NEAR, Stacks).
|
|
109
|
+
|
|
110
|
+
For internal architecture (only relevant if you're modifying the package itself, not consuming it), see `../CLAUDE.md` in the parent directory.
|
|
111
|
+
|
|
112
|
+
---
|
|
113
|
+
|
|
114
|
+
## Pointers
|
|
115
|
+
|
|
116
|
+
- [`integration/README.md`](./integration/README.md) — start here for new integrations: file index, recommended reading order, install snippet, provider-stack ordering.
|
|
117
|
+
- [`migration/README.md`](./migration/README.md) — start here for v1 → v2 ports: file index, reading order, cross-cutting checklist pointer.
|
|
118
|
+
- [`integration/recipes/setup.md`](./integration/recipes/setup.md) — install, mount `SodaxWalletProvider`, pick chain slots.
|
|
119
|
+
- [`integration/architecture.md`](./integration/architecture.md) — mental model: provider mount tree, frozen config, EVM single-connection, `xChainType` vs `xChainId`.
|
|
120
|
+
- [`integration/reference/`](./integration/reference/) — hooks, connectors, chain-support, wallet-brand identifiers lookup tables.
|
|
121
|
+
- [`integration/reference/wallet-brands.md`](./integration/reference/wallet-brands.md) — known wallet brand identifiers (`'hana'`, `'phantom'`, `'xverse'`, …) for batch hooks, plus a runtime discovery snippet.
|
|
122
|
+
- [`migration/breaking-changes.md`](./migration/breaking-changes.md) — full narrative of every v1 → v2 change.
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
# Integration: First-time setup (Human-readable overview)
|
|
2
|
+
|
|
3
|
+
This folder helps you integrate `@sodax/wallet-sdk-react` into a fresh React app. It is the **human-facing** entry point for new integrations. If you are a coding agent, read [`ai-rules.md`](./ai-rules.md) first.
|
|
4
|
+
|
|
5
|
+
If you are migrating from v1 instead, see `../migration/`.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## What this package does
|
|
10
|
+
|
|
11
|
+
`@sodax/wallet-sdk-react` is the React layer over `@sodax/wallet-sdk-core`. It gives you:
|
|
12
|
+
|
|
13
|
+
- **Multi-chain wallet connect** across 9 chain types (EVM, Solana, Sui, Bitcoin, Stellar, ICON, Injective, NEAR, Stacks).
|
|
14
|
+
- **Hooks** (`useXConnect`, `useXAccount`, `useXDisconnect`, `useXSignMessage`, etc.) backed by a Zustand store — composable and SSR-safe.
|
|
15
|
+
- **Headless modal primitives** (`useWalletModal`, `useChainGroups`, `useBatchConnect`) — bring your own UI.
|
|
16
|
+
- **Typed wallet providers** for hand-off to `@sodax/sdk` calls (`useWalletProvider`).
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Recommended path (in order)
|
|
21
|
+
|
|
22
|
+
If this is your first time using the package:
|
|
23
|
+
|
|
24
|
+
1. [`recipes/setup.md`](./recipes/setup.md) — install, wire `SodaxWalletProvider`, pick chain slots. **Always do this first**.
|
|
25
|
+
2. Pick a connect UX (one, not both):
|
|
26
|
+
- [`recipes/connect-button.md`](./recipes/connect-button.md) — single chain, simplest UX.
|
|
27
|
+
- [`recipes/multi-chain-modal.md`](./recipes/multi-chain-modal.md) — chain picker + connector picker, headless.
|
|
28
|
+
3. [`recipes/sign-message.md`](./recipes/sign-message.md) — sign messages cross-chain (auth flows).
|
|
29
|
+
4. [`recipes/bridge-to-sdk.md`](./recipes/bridge-to-sdk.md) — pass `walletProvider` to `@sodax/sdk` calls (swaps, lending, staking, etc.).
|
|
30
|
+
5. [`recipes/switch-chain.md`](./recipes/switch-chain.md) — switch the active EVM network when source chain doesn't match.
|
|
31
|
+
6. [`recipes/chain-detection.md`](./recipes/chain-detection.md) — list enabled chains, render connected list with hydration gate, install detection.
|
|
32
|
+
7. Add advanced features as needed:
|
|
33
|
+
- [`recipes/walletconnect-setup.md`](./recipes/walletconnect-setup.md) — enable WalletConnect for enterprise-custody / mobile-only wallets.
|
|
34
|
+
- [`recipes/batch-operations.md`](./recipes/batch-operations.md) — batch connect / disconnect across multiple chains.
|
|
35
|
+
- [`recipes/sub-path-imports.md`](./recipes/sub-path-imports.md) — deep imports from `xchains/<chain>` for `instanceof` checks or custom connector lists.
|
|
36
|
+
8. Reference docs (lookup as needed):
|
|
37
|
+
- [`reference/hooks.md`](./reference/hooks.md) — full hook surface with signatures.
|
|
38
|
+
- [`reference/connectors.md`](./reference/connectors.md) — available wallet connectors per chain.
|
|
39
|
+
- [`reference/chain-support.md`](./reference/chain-support.md) — supported chains, slots, and adapter notes.
|
|
40
|
+
9. Copy-paste examples (runnable code, minimal narrative):
|
|
41
|
+
- [`examples/`](./examples/) — 4 self-contained `.tsx` files: minimal EVM setup, multi-chain modal, Next.js App Router, WalletConnect setup.
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## Install
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
pnpm add @sodax/wallet-sdk-react @tanstack/react-query
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Peer dependencies:
|
|
52
|
+
|
|
53
|
+
```json
|
|
54
|
+
{
|
|
55
|
+
"react": ">=19",
|
|
56
|
+
"@tanstack/react-query": "5.x"
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## Pair with `@sodax/sdk` and `@sodax/dapp-kit`
|
|
63
|
+
|
|
64
|
+
Most apps integrate this package together with the SDK and dapp-kit:
|
|
65
|
+
|
|
66
|
+
```
|
|
67
|
+
@sodax/sdk ← business logic (swaps, lending, staking, etc.)
|
|
68
|
+
@sodax/dapp-kit ← high-level React hooks combining SDK + wallet-sdk
|
|
69
|
+
@sodax/wallet-sdk-react ← wallet connectivity (this package)
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
If you are using all three, mount providers in this order at the app root:
|
|
73
|
+
|
|
74
|
+
```tsx
|
|
75
|
+
<SodaxProvider config={sodaxConfig}> {/* @sodax/dapp-kit */}
|
|
76
|
+
<QueryClientProvider client={queryClient}>
|
|
77
|
+
<SodaxWalletProvider config={walletConfig}> {/* this package */}
|
|
78
|
+
{children}
|
|
79
|
+
</SodaxWalletProvider>
|
|
80
|
+
</QueryClientProvider>
|
|
81
|
+
</SodaxProvider>
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
`SodaxProvider` (from dapp-kit) wraps the lot. `QueryClientProvider` must wrap `SodaxWalletProvider` because hooks inside use React Query.
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
88
|
+
## Conventions worth knowing
|
|
89
|
+
|
|
90
|
+
- **Hooks use a single options object.** `useXConnectors({ xChainType: 'EVM' })`, not positional args.
|
|
91
|
+
- **`xChainId` (chain key) and `xChainType` (family) are both accepted** by `useXAccount` and `useWalletProvider`. Pass one, not both.
|
|
92
|
+
- **`useXConnect` is a React Query mutation.** Pass an `IXConnector` to `mutateAsync`.
|
|
93
|
+
- **Persisted connections.** Connections survive reload via `localStorage` key `xwagmi-store`. Gate UI on `useConnectedChains().status === 'ready'` to avoid hydration flicker.
|
|
94
|
+
- **EVM is one connection across all networks.** wagmi treats every configured EVM chain as part of one connector — there is no per-network connect/disconnect.
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
## Getting help
|
|
99
|
+
|
|
100
|
+
- API surface lookup: [`reference/`](./reference/).
|
|
101
|
+
- Bug or missing feature: [open an issue](https://github.com/icon-project/sodax-sdks/issues).
|
|
102
|
+
- Internal architecture (only relevant for SODAX maintainers): `../CLAUDE.md` in the package root.
|