@sodax/dapp-kit 2.0.0-rc.1 → 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.
@@ -4,7 +4,7 @@
4
4
 
5
5
  ## Project
6
6
 
7
- `@sodax/dapp-kit` is a React hooks library that wraps `@sodax/sdk` with React Query. It provides ~95 hooks across 11 feature domains (swap, money market, staking, bridge, dex, migration, partner, recovery, bitcoin/Radfi, backend queries, shared) for consumer dApps. It is **React-only** — Node.js scripts and backend services use `@sodax/sdk` directly.
7
+ `@sodax/dapp-kit` is a React hooks library that wraps `@sodax/sdk` with React Query. It provides hooks across 11 feature domains (swap, money market, staking, bridge, dex, migration, partner, recovery, bitcoin/Radfi, backend queries, shared) for consumer dApps. It is **React-only** — Node.js scripts and backend services use `@sodax/sdk` directly.
8
8
 
9
9
  This package is **v2**. v2 was a deep canonicalization pass over v1's hook shapes — single-object params, mandatory `mutateAsyncSafe`, hook-owned invalidations, throw-on-`Result.!ok` inside `mutationFn`, canonical queryKey/mutationKey conventions. Plus the entire SDK underneath was reshaped (chain-key-driven routing, `Result<T>` everywhere, `WalletProviderSlot<K, Raw>`). Code written against v1 dapp-kit will not compile against v2.
10
10
 
@@ -237,7 +237,7 @@ queryClient.invalidateQueries({ queryKey: ['dex', 'positionInfo', tokenId, poolK
237
237
 
238
238
  ## Hook organization
239
239
 
240
- ~95 hooks (41 mutations + ~50 queries + utilities) organized by feature domain in `src/hooks/`:
240
+ Hooks organized by feature domain in `src/hooks/`:
241
241
 
242
242
  ```
243
243
  hooks/
@@ -248,13 +248,13 @@ hooks/
248
248
  ├── swap/ # useQuote, useSwap, useStatus, useSwapAllowance, useSwapApprove,
249
249
  │ # useCancelSwap, useCreateLimitOrder, useCancelLimitOrder
250
250
  ├── mm/ # useSupply, useWithdraw, useBorrow, useRepay, useMMAllowance, useMMApprove,
251
- │ # reserves data hooks (13 hooks total)
251
+ │ # reserves data hooks
252
252
  ├── bridge/ # useBridge, useBridgeAllowance, useBridgeApprove, bridgeable amounts/tokens
253
- ├── staking/ # useStake, useUnstake, useInstantUnstake, useClaim, staking info hooks (~18)
254
- ├── dex/ # usePools, useDexDeposit, useDexWithdraw, liquidity hooks (~13)
255
- ├── bitcoin/ # useRadfiSession, fund/withdraw, UTXO management (~8)
256
- ├── backend/ # Intent tracking, swap submission, orderbook, money market position queries (~13)
257
- ├── partner/ # Partner fee claim, auto-swap preferences, token approval (6)
253
+ ├── staking/ # useStake, useUnstake, useInstantUnstake, useClaim, staking info hooks
254
+ ├── dex/ # usePools, useDexDeposit, useDexWithdraw, liquidity hooks
255
+ ├── bitcoin/ # useRadfiSession, fund/withdraw, UTXO management
256
+ ├── backend/ # Intent tracking, swap submission, orderbook, money market position queries
257
+ ├── partner/ # Partner fee claim, auto-swap preferences, token approval
258
258
  ├── recovery/ # useHubAssetBalances, useWithdrawHubAsset
259
259
  └── migrate/ # useMigrateIcxToSoda, useRevertMigrateSodaToIcx, useMigratebnUSD,
260
260
  # useMigrateBaln, useMigrationApprove, useMigrationAllowance
@@ -2,16 +2,16 @@
2
2
 
3
3
  Per-feature reference docs. Each file documents the hooks, params types, return types, and feature-specific gotchas — but doesn't include extended worked examples (those live in [`../recipes/`](../recipes/)).
4
4
 
5
- | File | Hook count | What's covered |
6
- |---|---|---|
7
- | [`swap.md`](swap.md) | 8 | Cross-chain swaps via the intent solver: `useQuote`, `useSwap`, allowance/approve, status polling, limit orders. |
8
- | [`money-market.md`](money-market.md) | 13 | Lending/borrowing on the cross-chain MM: `useSupply`, `useBorrow`, `useWithdraw`, `useRepay`, allowance/approve, reserves data hooks. |
9
- | [`staking.md`](staking.md) | ~18 | SODA → xSODA staking: `useStake`, `useUnstake`, `useInstantUnstake`, `useClaim`, `useCancelUnstake`, allowance/approve, info/ratio reads. |
10
- | [`bridge.md`](bridge.md) | 5 | Cross-chain token bridging: `useBridge`, allowance/approve, bridgeable amount/tokens. |
11
- | [`dex.md`](dex.md) | ~13 | Concentrated liquidity DEX: assets in/out, liquidity supply/decrease, claim rewards, position info, pool reads, param builders. |
12
- | [`migration.md`](migration.md) | 6 | Token migration: `useMigrateIcxToSoda`, `useRevertMigrateSodaToIcx`, `useMigratebnUSD`, `useMigrateBaln`, allowance/approve. |
13
- | [`bitcoin.md`](bitcoin.md) | ~8 | Radfi (dapp-kit-unique): session, trading wallet, fund/withdraw, UTXOs. |
14
- | [`auxiliary-services.md`](auxiliary-services.md) | ~30 | Partner fee claiming, recovery, backend queries (intent tracking, orderbook, MM data), shared utilities (xBalances, gas, trustlines). |
5
+ | File | What's covered |
6
+ |---|---|
7
+ | [`swap.md`](swap.md) | Cross-chain swaps via the intent solver: `useQuote`, `useSwap`, allowance/approve, status polling, limit orders. |
8
+ | [`money-market.md`](money-market.md) | Lending/borrowing on the cross-chain MM: `useSupply`, `useBorrow`, `useWithdraw`, `useRepay`, allowance/approve, reserves data hooks. |
9
+ | [`staking.md`](staking.md) | SODA → xSODA staking: `useStake`, `useUnstake`, `useInstantUnstake`, `useClaim`, `useCancelUnstake`, allowance/approve, info/ratio reads. |
10
+ | [`bridge.md`](bridge.md) | Cross-chain token bridging: `useBridge`, allowance/approve, bridgeable amount/tokens. |
11
+ | [`dex.md`](dex.md) | Concentrated liquidity DEX: assets in/out, liquidity supply/decrease, claim rewards, position info, pool reads, param builders. |
12
+ | [`migration.md`](migration.md) | Token migration: `useMigrateIcxToSoda`, `useRevertMigrateSodaToIcx`, `useMigratebnUSD`, `useMigrateBaln`, allowance/approve. |
13
+ | [`bitcoin.md`](bitcoin.md) | Radfi (dapp-kit-unique): session, trading wallet, fund/withdraw, UTXOs. |
14
+ | [`auxiliary-services.md`](auxiliary-services.md) | Partner fee claiming, recovery, backend queries (intent tracking, orderbook, MM data), shared utilities (xBalances, gas, trustlines). |
15
15
 
16
16
  ## Reference vs recipes
17
17
 
@@ -6,7 +6,7 @@ Pair: [`../../migration/features/auxiliary-services.md`](../../migration/feature
6
6
 
7
7
  ## Partner
8
8
 
9
- Partner fee claiming and auto-swap preferences. 6 hooks.
9
+ Partner fee claiming and auto-swap preferences.
10
10
 
11
11
  ```ts
12
12
  // @ai-snippets-skip
@@ -22,7 +22,7 @@ useFeeClaimSwap({ mutationOptions }); // Claim partner fees via sw
22
22
 
23
23
  ## Recovery
24
24
 
25
- Withdraw stuck hub-wallet assets back to a spoke chain. 2 hooks.
25
+ Withdraw stuck hub-wallet assets back to a spoke chain.
26
26
 
27
27
  ```ts
28
28
  // @ai-snippets-skip
@@ -32,7 +32,7 @@ useWithdrawHubAsset({ mutationOptions });
32
32
 
33
33
  ## Backend queries (read-only data)
34
34
 
35
- 12 hooks. No wallet connection required.
35
+ No wallet connection required.
36
36
 
37
37
  ### Intent tracking
38
38
 
@@ -4,7 +4,7 @@ Lookup tables. Read while writing code; not a tutorial.
4
4
 
5
5
  | File | What's in it |
6
6
  |---|---|
7
- | [`hooks-index.md`](hooks-index.md) | Comprehensive hook table (95 hooks, organized by feature, with hook type and purpose). |
7
+ | [`hooks-index.md`](hooks-index.md) | Comprehensive hook table (organized by feature, with hook type and purpose). |
8
8
  | [`querykey-conventions.md`](querykey-conventions.md) | Mandatory queryKey/mutationKey shape rules + per-feature key tables. |
9
9
  | [`public-api.md`](public-api.md) | What `@sodax/dapp-kit` exports + import rules. |
10
10
  | [`glossary.md`](glossary.md) | Type aliases (`ReadHookParams`, `MutationHookParams`, `SafeUseMutationResult`, `MutationHookOptions`, etc.). |
@@ -1,6 +1,6 @@
1
1
  # Hooks index — `@sodax/dapp-kit` v2
2
2
 
3
- Comprehensive hook table. ~95 hooks across 11 feature domains. Use this when you know the feature you're building but don't remember the exact hook name.
3
+ Comprehensive hook table across 11 feature domains. Use this when you know the feature you're building but don't remember the exact hook name.
4
4
 
5
5
  ## Provider + context
6
6
 
@@ -11,7 +11,7 @@ Comprehensive hook table. ~95 hooks across 11 feature domains. Use this when you
11
11
  | `useSodaxContext` | Utility | Access the `Sodax` SDK instance |
12
12
  | `useHubProvider` | Utility | Hub chain (Sonic) provider |
13
13
 
14
- ## Swap (8)
14
+ ## Swap
15
15
 
16
16
  | Hook | Type | Purpose |
17
17
  |---|---|---|
@@ -24,7 +24,7 @@ Comprehensive hook table. ~95 hooks across 11 feature domains. Use this when you
24
24
  | `useCreateLimitOrder` | Mutation | Create a limit order (no deadline) |
25
25
  | `useCancelLimitOrder` | Mutation | Cancel a limit order |
26
26
 
27
- ## Money market (13)
27
+ ## Money market
28
28
 
29
29
  | Hook | Type | Purpose |
30
30
  |---|---|---|
@@ -43,7 +43,7 @@ Comprehensive hook table. ~95 hooks across 11 feature domains. Use this when you
43
43
  | `useAToken` | Query | aToken metadata |
44
44
  | `useATokensBalances` | Query | aToken balances |
45
45
 
46
- ## Bridge (5)
46
+ ## Bridge
47
47
 
48
48
  | Hook | Type | Purpose |
49
49
  |---|---|---|
@@ -53,7 +53,7 @@ Comprehensive hook table. ~95 hooks across 11 feature domains. Use this when you
53
53
  | `useGetBridgeableAmount` | Query | Max bridgeable amount between two `XToken`s |
54
54
  | `useGetBridgeableTokens` | Query | Tokens bridgeable to a destination chain |
55
55
 
56
- ## Staking (~18)
56
+ ## Staking
57
57
 
58
58
  | Hook | Type | Purpose |
59
59
  |---|---|---|
@@ -76,7 +76,7 @@ Comprehensive hook table. ~95 hooks across 11 feature domains. Use this when you
76
76
  | `useInstantUnstakeRatio` | Query | Instant unstake rate |
77
77
  | `useConvertedAssets` | Query | xSODA → SODA conversion |
78
78
 
79
- ## DEX (~13)
79
+ ## DEX
80
80
 
81
81
  | Hook | Type | Purpose |
82
82
  |---|---|---|
@@ -97,7 +97,7 @@ Comprehensive hook table. ~95 hooks across 11 feature domains. Use this when you
97
97
  | `useCreateSupplyLiquidityParams` | Param builder | Build tick-range + liquidity params |
98
98
  | `useCreateDecreaseLiquidityParams` | Param builder | Build decrease params from position state |
99
99
 
100
- ## Migration (6)
100
+ ## Migration
101
101
 
102
102
  | Hook | Type | Purpose |
103
103
  |---|---|---|
@@ -108,7 +108,7 @@ Comprehensive hook table. ~95 hooks across 11 feature domains. Use this when you
108
108
  | `useMigrationApprove` | Mutation | Approve before migration (action-discriminated) |
109
109
  | `useMigrationAllowance` | Query | Approval check (action-discriminated) |
110
110
 
111
- ## Bitcoin / Radfi (~8)
111
+ ## Bitcoin / Radfi
112
112
 
113
113
  | Hook | Type | Purpose |
114
114
  |---|---|---|
@@ -122,7 +122,7 @@ Comprehensive hook table. ~95 hooks across 11 feature domains. Use this when you
122
122
  | `useExpiredUtxos` | Query | Expired UTXOs (polls 60s) |
123
123
  | `useRenewUtxos` | Mutation | Renew expired UTXOs |
124
124
 
125
- ## Backend queries (~13)
125
+ ## Backend queries
126
126
 
127
127
  ### Intents
128
128
 
@@ -151,7 +151,7 @@ Comprehensive hook table. ~95 hooks across 11 feature domains. Use this when you
151
151
  | `useBackendMoneyMarketAssetBorrowers` | Borrowers for an asset |
152
152
  | `useBackendAllMoneyMarketBorrowers` | All borrowers |
153
153
 
154
- ## Partner (6)
154
+ ## Partner
155
155
 
156
156
  | Hook | Type | Purpose |
157
157
  |---|---|---|
@@ -162,14 +162,14 @@ Comprehensive hook table. ~95 hooks across 11 feature domains. Use this when you
162
162
  | `useSetSwapPreference` | Mutation | Set swap preference |
163
163
  | `useFeeClaimSwap` | Mutation | Claim partner fees via swap |
164
164
 
165
- ## Recovery (2)
165
+ ## Recovery
166
166
 
167
167
  | Hook | Type | Purpose |
168
168
  |---|---|---|
169
169
  | `useHubAssetBalances` | Query | Hub asset balances |
170
170
  | `useWithdrawHubAsset` | Mutation | Withdraw hub asset |
171
171
 
172
- ## Shared (~9)
172
+ ## Shared
173
173
 
174
174
  | Hook | Type | Purpose |
175
175
  |---|---|---|
@@ -183,10 +183,6 @@ Comprehensive hook table. ~95 hooks across 11 feature domains. Use this when you
183
183
  | `unwrapResult` | Internal | `Result<T>` → throw / return |
184
184
  | `toResult` | Internal | `Promise<T>` → `Result<T>` |
185
185
 
186
- ## Total
187
-
188
- 41 mutations + ~50 queries + utilities + provider = **~95 hooks**.
189
-
190
186
  ## Cross-references
191
187
 
192
188
  - [`../features/`](../features/) — per-feature reference docs (params types, return shapes, gotchas).
@@ -8,14 +8,14 @@ The package's `src/index.ts` re-exports four buckets:
8
8
 
9
9
  ```ts
10
10
  // @ai-snippets-skip
11
- export * from './hooks/index.js'; // ~95 hooks across 11 feature dirs
11
+ export * from './hooks/index.js'; // hooks across 11 feature dirs
12
12
  export * from './providers/index.js'; // SodaxProvider, createSodaxQueryClient
13
13
  export * from './utils/index.js'; // dex-utils param builders
14
14
  export * from '@sodax/sdk'; // FULL @sodax/sdk re-export
15
15
  ```
16
16
 
17
17
  Practical implications:
18
- - All ~95 hooks are importable from the root: `import { useSwap, useSupply, ... } from '@sodax/dapp-kit'`.
18
+ - All hooks are importable from the root: `import { useSwap, useSupply, ... } from '@sodax/dapp-kit'`.
19
19
  - All `@sodax/sdk` types are importable from `@sodax/dapp-kit` directly: `import { ChainKeys, type SodaxConfig, type CreateIntentParams } from '@sodax/dapp-kit'`.
20
20
  - You may also import directly from `@sodax/sdk` — both work, both are stable.
21
21
 
@@ -4,7 +4,7 @@ Pair: [`../../integration/features/auxiliary-services.md`](../../integration/fea
4
4
 
5
5
  Smaller surfaces grouped together: partner, recovery, backend queries, shared utilities. Most changes are mechanical — single-object params, mutateAsyncSafe — same as the other features.
6
6
 
7
- ## Partner (6 hooks)
7
+ ## Partner
8
8
 
9
9
  ```diff
10
10
  - const claim = useFeeClaimSwap(spokeProvider);
@@ -18,7 +18,7 @@ Smaller surfaces grouped together: partner, recovery, backend queries, shared ut
18
18
 
19
19
  `useFetchAssetsBalances`, `useGetAutoSwapPreferences`, `useIsTokenApproved` — convert to single-object query shape.
20
20
 
21
- ## Recovery (2 hooks)
21
+ ## Recovery
22
22
 
23
23
  ```diff
24
24
  - const withdraw = useWithdrawHubAsset(spokeProvider);
@@ -26,7 +26,7 @@ Smaller surfaces grouped together: partner, recovery, backend queries, shared ut
26
26
  + await withdraw({ params, walletProvider });
27
27
  ```
28
28
 
29
- ## Backend queries (~13 hooks)
29
+ ## Backend queries
30
30
 
31
31
  Read-only. No `walletProvider` involved. Convert to single-object query shape.
32
32
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sodax/dapp-kit",
3
3
  "license": "MIT",
4
- "version": "2.0.0-rc.1",
4
+ "version": "2.0.0-rc.2",
5
5
  "description": "dapp-kit of New World",
6
6
  "type": "module",
7
7
  "main": "dist/index.cjs",
@@ -18,7 +18,7 @@
18
18
  },
19
19
  "dependencies": {
20
20
  "viem": "2.29.2",
21
- "@sodax/sdk": "2.0.0-rc.1"
21
+ "@sodax/sdk": "2.0.0-rc.2"
22
22
  },
23
23
  "devDependencies": {
24
24
  "@tanstack/react-query": "5.87.4",
@@ -33,7 +33,7 @@
33
33
  "react": ">=18"
34
34
  },
35
35
  "engines": {
36
- "node": ">=18.0.0"
36
+ "node": ">=20.0.0"
37
37
  },
38
38
  "exports": {
39
39
  "./package.json": "./package.json",