@sodax/dapp-kit 2.0.0-rc.3 → 2.0.0-rc.4

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 (61) hide show
  1. package/README.md +9 -63
  2. package/dist/index.mjs +0 -2
  3. package/package.json +31 -20
  4. package/ai-exported/AGENTS.md +0 -134
  5. package/ai-exported/integration/README.md +0 -49
  6. package/ai-exported/integration/ai-rules.md +0 -80
  7. package/ai-exported/integration/architecture.md +0 -276
  8. package/ai-exported/integration/features/README.md +0 -29
  9. package/ai-exported/integration/features/auxiliary-services.md +0 -169
  10. package/ai-exported/integration/features/bitcoin.md +0 -87
  11. package/ai-exported/integration/features/bridge.md +0 -91
  12. package/ai-exported/integration/features/dex.md +0 -152
  13. package/ai-exported/integration/features/migration.md +0 -118
  14. package/ai-exported/integration/features/money-market.md +0 -144
  15. package/ai-exported/integration/features/staking.md +0 -123
  16. package/ai-exported/integration/features/swap.md +0 -101
  17. package/ai-exported/integration/quickstart.md +0 -187
  18. package/ai-exported/integration/recipes/README.md +0 -136
  19. package/ai-exported/integration/recipes/backend-queries.md +0 -157
  20. package/ai-exported/integration/recipes/bitcoin.md +0 -193
  21. package/ai-exported/integration/recipes/bridge.md +0 -174
  22. package/ai-exported/integration/recipes/dex.md +0 -204
  23. package/ai-exported/integration/recipes/invalidations.md +0 -115
  24. package/ai-exported/integration/recipes/migration.md +0 -212
  25. package/ai-exported/integration/recipes/money-market.md +0 -207
  26. package/ai-exported/integration/recipes/mutation-error-handling.md +0 -118
  27. package/ai-exported/integration/recipes/observability.md +0 -93
  28. package/ai-exported/integration/recipes/setup.md +0 -168
  29. package/ai-exported/integration/recipes/staking.md +0 -202
  30. package/ai-exported/integration/recipes/swap.md +0 -272
  31. package/ai-exported/integration/recipes/wallet-connectivity.md +0 -128
  32. package/ai-exported/integration/reference/README.md +0 -12
  33. package/ai-exported/integration/reference/glossary.md +0 -190
  34. package/ai-exported/integration/reference/hooks-index.md +0 -190
  35. package/ai-exported/integration/reference/public-api.md +0 -110
  36. package/ai-exported/integration/reference/querykey-conventions.md +0 -179
  37. package/ai-exported/migration/README.md +0 -60
  38. package/ai-exported/migration/ai-rules.md +0 -81
  39. package/ai-exported/migration/breaking-changes/hook-signatures.md +0 -233
  40. package/ai-exported/migration/breaking-changes/querykey-conventions.md +0 -108
  41. package/ai-exported/migration/breaking-changes/result-handling.md +0 -211
  42. package/ai-exported/migration/breaking-changes/sdk-leakage.md +0 -167
  43. package/ai-exported/migration/checklist.md +0 -89
  44. package/ai-exported/migration/features/README.md +0 -34
  45. package/ai-exported/migration/features/auxiliary-services.md +0 -114
  46. package/ai-exported/migration/features/bitcoin.md +0 -88
  47. package/ai-exported/migration/features/bridge.md +0 -160
  48. package/ai-exported/migration/features/dex.md +0 -101
  49. package/ai-exported/migration/features/migration.md +0 -120
  50. package/ai-exported/migration/features/money-market.md +0 -139
  51. package/ai-exported/migration/features/staking.md +0 -109
  52. package/ai-exported/migration/features/swap.md +0 -133
  53. package/ai-exported/migration/recipes.md +0 -185
  54. package/ai-exported/migration/reference/README.md +0 -15
  55. package/ai-exported/migration/reference/deleted-hooks.md +0 -110
  56. package/ai-exported/migration/reference/error-shape-crosswalk.md +0 -144
  57. package/ai-exported/migration/reference/renamed-hooks.md +0 -68
  58. package/dist/index.cjs +0 -2641
  59. package/dist/index.cjs.map +0 -1
  60. package/dist/index.d.cts +0 -1557
  61. package/dist/index.mjs.map +0 -1
@@ -1,110 +0,0 @@
1
- # Deleted hooks — v1 → v2
2
-
3
- Hooks that existed in v1 dapp-kit (or v1-style consumer-side utilities) and have no v2 equivalent.
4
-
5
- ## `useSpokeProvider`
6
-
7
- | | |
8
- |---|---|
9
- | v1 path | `import { useSpokeProvider } from '@sodax/dapp-kit'` |
10
- | v2 status | **DELETED** |
11
- | v2 alternative | Use `useWalletProvider({ xChainId: chainKey })` from `@sodax/wallet-sdk-react`, then pass `walletProvider` directly into `mutate(vars)` for mutations or as a query-hook param. |
12
-
13
- ```diff
14
- - import { useSpokeProvider } from '@sodax/dapp-kit';
15
- - const spokeProvider = useSpokeProvider({ chainId: BSC_MAINNET_CHAIN_ID });
16
- + import { useWalletProvider } from '@sodax/wallet-sdk-react';
17
- + import { ChainKeys } from '@sodax/sdk';
18
- + const walletProvider = useWalletProvider({ xChainId: ChainKeys.BSC_MAINNET });
19
- ```
20
-
21
- The chain key on the action params is what routes to the right per-chain spoke service inside the SDK; there's no "spoke provider" object for consumers to construct or hold.
22
-
23
- ## `useMigrate(spokeProvider)` (and any v1 single-migration-hook variant)
24
-
25
- | | |
26
- |---|---|
27
- | v1 path | A single `useMigrate(spokeProvider)` hook (often commented out by the time consumers tried to use it) |
28
- | v2 status | **DELETED** |
29
- | v2 alternative | Six per-action hooks: `useMigrateIcxToSoda`, `useRevertMigrateSodaToIcx`, `useMigratebnUSD`, `useMigrateBaln`, `useMigrationApprove`, `useMigrationAllowance`. |
30
-
31
- See [`../features/migration.md`](../features/migration.md) for the full split.
32
-
33
- ## Consumer-side `invalidate*Queries` utilities
34
-
35
- | | |
36
- |---|---|
37
- | v1 path | Often a `lib/invalidateMmQueries.ts` (or similar per-feature) file in the consumer codebase |
38
- | v2 status | **No longer needed — DELETE** |
39
- | v2 alternative | Hook-owned invalidations. Each mutation hook invalidates the relevant query keys in its own `onSuccess`. |
40
-
41
- ```diff
42
- - // lib/invalidateMmQueries.ts — DELETE this file
43
- - export function invalidateMmQueries(qc, srcChainKey, userAddress, token) {
44
- - qc.invalidateQueries({ queryKey: ['mm', 'userReservesData', srcChainKey, userAddress] });
45
- - qc.invalidateQueries({ queryKey: ['shared', 'xBalances', srcChainKey] });
46
- - /* ... */
47
- - }
48
-
49
- - // call site — DROP the manual invalidation
50
- - await supply({ params, spokeProvider });
51
- - invalidateMmQueries(queryClient, srcChainKey, userAddress, token);
52
- + // v2 — supply hook invalidates xBalances + userReservesData itself
53
- + await supply({ params, walletProvider });
54
- ```
55
-
56
- For cross-feature invalidations the hook can't know about (e.g. your custom analytics view), use `mutationOptions.onSuccess`:
57
-
58
- ```ts
59
- // @ai-snippets-skip
60
- const { mutateAsync: supply } = useSupply({
61
- mutationOptions: {
62
- onSuccess: async (data, vars) => {
63
- await queryClient.invalidateQueries({ queryKey: ['my-app', 'analytics'] });
64
- },
65
- },
66
- });
67
- ```
68
-
69
- ## Approve hook return shape (`{ approve, isLoading, error }`)
70
-
71
- | | |
72
- |---|---|
73
- | v1 shape | Per-feature: `useFooApprove(spokeProvider) → { approve, isLoading, error }` |
74
- | v2 status | **DELETED** (return shape, not the hooks themselves) |
75
- | v2 alternative | Standard `SafeUseMutationResult` — `mutateAsync` / `mutateAsyncSafe`, `isPending`, `error`. |
76
-
77
- ```diff
78
- - const { approve, isLoading } = useSwapApprove(spokeProvider);
79
- - await approve(params);
80
- + const { mutateAsync: approve, isPending } = useSwapApprove();
81
- + await approve({ params, walletProvider });
82
- ```
83
-
84
- `isLoading` → `isPending` (React Query 5 convention).
85
-
86
- ## v1 individual chain-id constants (SDK-leakage)
87
-
88
- Not strictly hooks, but they used to be importable from `@sodax/sdk` (or `@sodax/dapp-kit` re-export):
89
-
90
- | Constant | v1 value | v2 alternative |
91
- |---|---|---|
92
- | `BSC_MAINNET_CHAIN_ID` | `'0x38.bsc'` | `ChainKeys.BSC_MAINNET` |
93
- | `ARBITRUM_MAINNET_CHAIN_ID` | `'0xa4b1.arbitrum'` | `ChainKeys.ARBITRUM_MAINNET` |
94
- | `BASE_MAINNET_CHAIN_ID` | `'0x2105.base'` | `ChainKeys.BASE_MAINNET` |
95
- | `POLYGON_MAINNET_CHAIN_ID` | `'0x89.polygon'` | `ChainKeys.POLYGON_MAINNET` |
96
- | `ETHEREUM_MAINNET_CHAIN_ID` | `'0x1.ethereum'` | `ChainKeys.ETHEREUM_MAINNET` |
97
- | ... 11 more | ... | All under `ChainKeys.*` namespace |
98
-
99
- Codemod with sed:
100
-
101
- ```bash
102
- find src -type f \( -name '*.ts' -o -name '*.tsx' \) | xargs sed -i '' -E 's/\b([A-Z_]+)_MAINNET_CHAIN_ID\b/ChainKeys.\1_MAINNET/g'
103
- ```
104
-
105
- ## Cross-references
106
-
107
- - [`renamed-hooks.md`](renamed-hooks.md) — hooks whose name/signature changed (different from deletions).
108
- - [`error-shape-crosswalk.md`](error-shape-crosswalk.md) — error class consolidation.
109
- - [`../breaking-changes/hook-signatures.md`](../breaking-changes/hook-signatures.md) — broader hook-shape changes.
110
- - [`../breaking-changes/sdk-leakage.md`](../breaking-changes/sdk-leakage.md) — SDK-level migrations leaking through.
@@ -1,144 +0,0 @@
1
- # Error shape crosswalk — v1 → v2
2
-
3
- The shape and type of errors flowing through dapp-kit hooks changed in v2. The change is mostly SDK-level (one canonical `SodaxError<C>` replaces 7+ per-feature classes) but it surfaces in dapp-kit at the consumer level — wherever you catch or branch on errors from hooks.
4
-
5
- ## Where v2 errors appear
6
-
7
- | Surface | v1 | v2 |
8
- |---|---|---|
9
- | `mutation.error` | Only on actual exceptions | Includes SDK `!ok` errors (now thrown inside `mutationFn`) |
10
- | `mutation.data` | `Result<T>` (`{ ok, value, error }`) | Unwrapped success type `T`; SDK `!ok` flows to `mutation.error` |
11
- | `mutateAsync` rejection | Only on exceptions | Includes SDK `!ok` rejections |
12
- | `mutateAsyncSafe` `result.error` | (didn't exist) | Includes SDK `!ok` errors (re-packed from the throw) |
13
- | `onError` callback | Fired only for exceptions | Fires for SDK `!ok` too |
14
-
15
- The semantic shift is: v1 treated SDK `!ok` as "successful but with an error inside"; v2 treats it as a thrown error. See [`../breaking-changes/result-handling.md`](../breaking-changes/result-handling.md) for the full picture.
16
-
17
- ## Error class crosswalk (SDK-level — leaks through)
18
-
19
- In v1, each SDK feature had its own error class:
20
-
21
- ```ts
22
- // @ai-snippets-skip — describes deleted v1 type surface, not runnable
23
- // v1
24
- class MoneyMarketError<C extends MoneyMarketErrorCode> extends Error { /* ... */ }
25
- class IntentError<C extends IntentErrorCode> extends Error { /* ... */ }
26
- class StakingError<C extends StakingErrorCode> extends Error { /* ... */ }
27
- class BridgeError<C extends BridgeErrorCode> extends Error { /* ... */ }
28
- class MigrationError<C extends MigrationErrorCode> extends Error { /* ... */ }
29
- class AssetServiceError<C extends AssetServiceErrorCode> extends Error { /* ... */ }
30
- class ConcentratedLiquidityError<C extends ConcentratedLiquidityErrorCode> extends Error { /* ... */ }
31
- // ...
32
- ```
33
-
34
- In v2, all are consolidated:
35
-
36
- ```ts
37
- // @ai-snippets-skip — type-shape reference; the real class is exported from @sodax/sdk
38
- // v2
39
- class SodaxError<C extends SodaxErrorCode = SodaxErrorCode> extends Error {
40
- readonly code: C; // closed reason union (no feature prefix)
41
- readonly feature: SodaxFeature; // 'swap' | 'moneyMarket' | 'bridge' | …
42
- readonly cause?: unknown;
43
- readonly context?: SodaxErrorContext;
44
- }
45
- ```
46
-
47
- Discriminate via `(error.feature, error.code)` instead of class name.
48
-
49
- ## Error code crosswalk (key examples)
50
-
51
- The SDK reduced the per-feature code unions to a unified 13-code reason vocabulary, with feature-specific context on `error.context.action` / `error.context.method`. Examples:
52
-
53
- | v1 (per-feature) | v2 |
54
- |---|---|
55
- | `MoneyMarketError<'CREATE_SUPPLY_INTENT_FAILED'>` | `SodaxError<'INTENT_CREATION_FAILED'>` with `feature: 'moneyMarket'`, `context.action: 'supply'` |
56
- | `MoneyMarketError<'SUPPLY_FAILED'>` | `SodaxError<'EXECUTION_FAILED'>` with `feature: 'moneyMarket'`, `context.action: 'supply'` |
57
- | `IntentError<'CREATE_INTENT_FAILED'>` | `SodaxError<'INTENT_CREATION_FAILED'>` with `feature: 'swap'`, `context.action: 'createIntent'` |
58
- | `IntentError<'POST_EXECUTION_FAILED'>` | `SodaxError<'EXECUTION_FAILED'>` with `feature: 'swap'`, `context.phase: 'postExecution'` |
59
- | `StakingError<'STAKE_FAILED'>` | `SodaxError<'EXECUTION_FAILED'>` with `feature: 'staking'`, `context.action: 'stake'` |
60
- | `BridgeError<'BRIDGE_FAILED'>` | `SodaxError<'EXECUTION_FAILED'>` with `feature: 'bridge'`, `context.action: 'bridge'` |
61
- | `MigrationError<'MIGRATE_BNUSD_FORWARD_FAILED'>` | `SodaxError<'EXECUTION_FAILED'>` with `feature: 'migration'`, `context.action: 'migratebnUSD'`, `context.direction: 'forward'` |
62
- | `*Error<'ALLOWANCE_CHECK_FAILED'>` | `SodaxError<'ALLOWANCE_CHECK_FAILED'>` (unchanged code; new feature/context fields) |
63
- | `*Error<'APPROVE_FAILED'>` | Same |
64
- | `*Error<'GAS_ESTIMATION_FAILED'>` | Same |
65
- | `*Error<'RELAY_TIMEOUT'>` | `SodaxError<'RELAY_TIMEOUT'>` with `relayCode: 'RELAY_TIMEOUT'` on context |
66
-
67
- Full crosswalk (per feature): [`../../../../sdk/ai-exported/migration/reference/error-code-crosswalk.md`](../../../../sdk/ai-exported/migration/reference/error-code-crosswalk.md).
68
-
69
- ## How to migrate error-handling code
70
-
71
- ### Pattern 1: `instanceof` checks → `isSodaxError`
72
-
73
- ```diff
74
- - catch (e) {
75
- - if (e instanceof MoneyMarketError) {
76
- - handleMmError(e.code);
77
- - }
78
- - }
79
- + catch (e) {
80
- + if (isSodaxError(e) && e.feature === 'moneyMarket') {
81
- + handleMmError(e.code);
82
- + }
83
- + }
84
- ```
85
-
86
- `isSodaxError` is exported from `@sodax/dapp-kit` (re-exported from `@sodax/sdk`).
87
-
88
- ### Pattern 2: switch on code
89
-
90
- ```diff
91
- catch (e) {
92
- - if (e instanceof IntentError) {
93
- - switch (e.code) {
94
- - case 'CREATE_INTENT_FAILED': /* ... */ break;
95
- - case 'POST_EXECUTION_FAILED': /* ... */ break;
96
- - case 'RELAY_TIMEOUT': /* ... */ break;
97
- - }
98
- - }
99
- + if (isSodaxError(e) && e.feature === 'swap') {
100
- + switch (e.code) {
101
- + case 'INTENT_CREATION_FAILED': /* was CREATE_INTENT_FAILED */ break;
102
- + case 'EXECUTION_FAILED': /* was POST_EXECUTION_FAILED — check e.context.phase */ break;
103
- + case 'RELAY_TIMEOUT': /* unchanged code */ break;
104
- + }
105
- + }
106
- }
107
- ```
108
-
109
- ### Pattern 3: error-text helper
110
-
111
- If your v1 code has a helper that maps `error.code` to a UI message, write a small adapter:
112
-
113
- ```ts
114
- // adapters/v1ErrorShape.ts
115
- import { isSodaxError } from '@sodax/dapp-kit';
116
-
117
- const V1_CODE_MAP: Record<string, string> = {
118
- 'INTENT_CREATION_FAILED': 'CREATE_INTENT_FAILED',
119
- 'EXECUTION_FAILED': 'POST_EXECUTION_FAILED',
120
- // ... etc.
121
- };
122
-
123
- export function adaptToV1Code(error: unknown): string | undefined {
124
- if (!isSodaxError(error)) return undefined;
125
- return V1_CODE_MAP[error.code] ?? error.code;
126
- }
127
- ```
128
-
129
- Plan to delete the adapter once you've ported all error UI.
130
-
131
- ## Pitfalls
132
-
133
- 1. **`onError` callbacks fire MORE in v2.** They previously didn't fire for SDK `!ok` (success-path-with-error pattern). Now they do. Audit toasts / logs to make sure they're appropriate.
134
- 2. **`mutation.error` reads MORE in v2.** Same reason — SDK errors flow through it now.
135
- 3. **`isSodaxError(e)` is the cross-bundle-safe check.** Bare `instanceof SodaxError` may break in monorepos with multiple package copies (mixed ESM/CJS, etc.). Use the type guard.
136
- 4. **The `feature` field is your discriminator.** A `SodaxError` from a swap mutation has `feature: 'swap'`. A bridge mutation has `feature: 'bridge'`. The `code` is the reason; `feature` is the source.
137
-
138
- ## Cross-references
139
-
140
- - [`../breaking-changes/result-handling.md`](../breaking-changes/result-handling.md) — semantic shift in `Result<T>` handling.
141
- - [`../breaking-changes/sdk-leakage.md`](../breaking-changes/sdk-leakage.md) — broader SDK-side migrations.
142
- - [`../../../../sdk/ai-exported/migration/breaking-changes/result-and-errors.md`](../../../../sdk/ai-exported/migration/breaking-changes/result-and-errors.md) — full SDK error-class consolidation.
143
- - [`../../../../sdk/ai-exported/migration/reference/error-code-crosswalk.md`](../../../../sdk/ai-exported/migration/reference/error-code-crosswalk.md) — per-feature error code crosswalks.
144
- - [`../../integration/architecture.md`](../../integration/architecture.md) § "SDK Result handling" — design rationale.
@@ -1,68 +0,0 @@
1
- # Renamed hooks — v1 → v2
2
-
3
- Hooks whose **name** changed between versions. Most v1 → v2 changes were signature-level (single-object params, `mutateAsyncSafe`, etc.) — actual hook renames are rare. The list below is the small set.
4
-
5
- ## Hooks renamed
6
-
7
- | v1 | v2 | Notes |
8
- |---|---|---|
9
- | (none significant) | | Most hook names are stable across v1 → v2 |
10
-
11
- ### Why this list is short
12
-
13
- The v2 canonicalization pass focused on hook **shapes** (single-object params, return-shape consolidation, mutateAsyncSafe), not naming. For most consumer code, the hook name you `import { ... }`'d in v1 is still the right hook in v2 — the breaking change is in the call shape, not the import.
14
-
15
- ## Hooks whose generic / type shape changed
16
-
17
- These keep their name but their TypeScript signature is different. Usually requires per-call-site fixes.
18
-
19
- | Hook | v1 → v2 change |
20
- |---|---|
21
- | `useSwap` | Hook init: `(spokeProvider) → ({ mutationOptions })`. Vars: `{ params } → { params, walletProvider }`. |
22
- | `useSwapAllowance` | Query params: `(params, spokeProvider) → { params: { payload, srcChainKey, walletProvider } }`. SDK request nested under `params.payload`. Data unwrapped to `boolean`. |
23
- | `useSwapApprove` | Return: `{ approve, isLoading } → SafeUseMutationResult` (with `mutateAsync` / `isPending`). Vars accept `CreateIntentParams \| CreateLimitOrderParams`. TData is `TxReturnType<K, false>` (chain-keyed receipt union). |
24
- | `useStatus` | Now `useStatus({ params: { intentTxHash } })` — single-object shape AND key renamed from `intentHash` → `intentTxHash`. Data is `Result<SolverIntentStatusResponse, SolverErrorResponse> \| undefined` (Result-wrapped). Polls 3s. |
25
- | `useQuote` | Now `useQuote({ params: { payload } })` — SDK request nested under `params.payload` (NOT directly under `params`). Data is `Result<SolverIntentQuoteResponse, SolverErrorResponse> \| undefined`. Polls 3s. |
26
- | `useCancelSwap` / `useCancelLimitOrder` | TVars are FLAT (no `params` wrapper): `{ srcChainKey, intent, walletProvider }`. |
27
- | `useCreateLimitOrder` | Hook init: `(spokeProvider) → ({ mutationOptions })`. Vars: `{ params, walletProvider }`. mutationKey is `['swap', 'limitOrder', 'create']`. |
28
- | All MM mutations (`useSupply`/etc.) | Same as `useSwap`. Plus `srcChainKey` / `srcAddress` required in params (SDK-leakage). All four actions accept optional `dstChainKey`/`dstAddress` for cross-chain delivery (not just borrow/repay). |
29
- | `useMMAllowance` | Query params: `{ params: { payload: MoneyMarketParams<K> } }`. For `'borrow'` / `'withdraw'` actions: `enabled: false` — `data` stays `undefined`. |
30
- | `useUserReservesData` | Param key rename: `address → userAddress`; chain key is `spokeChainKey`. |
31
- | `useUserFormattedSummary` | Same. |
32
- | `useATokensBalances` | Params: `{ aTokens, spokeProvider, userAddress } → { params: { aTokens, spokeChainKey, userAddress } }`. `spokeProvider` dropped; chain key is **`spokeChainKey`** (NOT `srcChainKey`); user field is **`userAddress`** (NOT `address`). Data: `Map<Address, bigint> \| undefined` (already unwrapped). |
33
- | `useAToken` | Unaffected by the position-hook renames — takes only `{ aToken }`. Data: `Erc20Token & { chainKey }` (`hubAsset` / `vault` NOT included). |
34
- | All staking mutations | Same as MM. Plus dedicated approve hooks per token (`useStakeApprove` ↔ `useUnstakeApprove` ↔ `useInstantUnstakeApprove`). |
35
- | `useStakeRatio` | Return: `Result<bigint> → [xSodaAmount, previewDepositAmount]` (unwrapped tuple — NOT Result-wrapped in v2). |
36
- | `useStakingInfo` / `useUnstakingInfo` / `useUnstakingInfoWithPenalty` / `useStakingConfig` / `useInstantUnstakeRatio` / `useConvertedAssets` | All unwrapped in v2 (hooks throw on SDK `!ok`). Branch on `isError`/`error`, not `data?.ok`. |
37
- | `useUnstakingInfo` | Return shape: array → object `{ userUnstakeSodaRequests, totalUnstaking }`. `UserUnstakeInfo` items expose `id` (the requestId) and `request` (original `UnstakeSodaRequest`). |
38
- | All three staking allowance hooks | Query params: `{ params: { payload: Omit<<Action>Params<K>, 'action'> } }`. Data unwrapped to `boolean`. |
39
- | `useBridge` | Params: `srcChainId/dstChainId/recipient → srcChainKey/dstChainKey/recipient`. Plus field renames inside `CreateBridgeIntentParams`: `srcAsset → srcToken`, `dstAsset → dstToken`. Return: tuple → `TxHashPair` object (`{ srcChainTxHash, dstChainTxHash }`). |
40
- | `useBridgeAllowance` | Query params: nested `{ params: { payload, walletProvider } }`. Data unwrapped to `boolean` (queryFn returns `false` on SDK `!ok` — does NOT throw). |
41
- | `useGetBridgeableAmount` | Params: 4 fields → `{ from: XToken, to: XToken }`. Return: `bigint → BridgeLimit` object (`{ amount, decimals, type: 'DEPOSIT_LIMIT' \| 'WITHDRAWAL_LIMIT' }`). |
42
- | `useGetBridgeableTokens` | Params: positional → `{ params: { from, to, token } }`. |
43
- | All DEX mutations | Same as MM. `useSupplyLiquidity` now handles both mint-new and increase-existing — fan-out gated by `params.tokenId` + `params.isValidPosition`. |
44
- | `useDexAllowance` | Now `{ params: { payload: CreateAssetDepositParams<K> } }`. No `walletProvider` (read-only). |
45
- | `PoolKey` shape | Real fields are `currency0`, `currency1`, `fee`, `hooks?`, `poolManager`, `parameters` — NOT `poolAddress`/`token0Symbol`/etc. |
46
- | `useCreate*Params` builders | All take FLAT props object — NOT `{ params }`-wrapped (`useCreateDepositParams`, `useCreateWithdrawParams`, `useCreateSupplyLiquidityParams`, `useCreateDecreaseLiquidityParams`). |
47
- | `useFeeClaimSwap` (partner) | Same as MM mutation pattern. TData is `IntentAutoSwapResult` (NOT `SwapResponse`). |
48
- | `useXBalances` | Params: positional → `{ params: { xService, xChainId, xTokens, address } }`. All four required. `xService` injected from `@sodax/wallet-sdk-react`. |
49
- | `useEstimateGas` | Mutation; vars: `EstimateGasParams<C>` (flat, not `{ params, walletProvider }`-wrapped). |
50
- | `useDeriveUserWalletAddress`, `useGetUserHubWalletAddress` | Single-object query shape. |
51
- | `useStellarTrustlineCheck` | Single-object shape with `{ token, amount, chainId, walletProvider }` under `params`. |
52
- | `useRequestTrustline` | Custom utility hook (NOT a canonical mutation). Takes `(token: string \| undefined)` positionally, returns `{ requestTrustline, isLoading, isRequested, error, data }`. The `requestTrustline` callback takes `{ token, amount, srcChainKey, walletProvider }`. |
53
- | `useBackendOrderbook` / `useBackendAllMoneyMarketBorrowers` | Pagination MUST be nested under `params`: `{ params: { pagination: { offset, limit } } }`. |
54
- | `useBackendUserIntents` | Data is `UserIntentsResponse = { items: IntentResponse[], total, offset, limit }` — NOT a bare array. Access `data?.items`. |
55
- | `useBackendSubmitSwapTx` | Mutation. `apiConfig` moved from hook init to `mutate(vars)`. |
56
- | All migration hooks | **NEW**: 6 per-action hooks replacing v1's single `useMigrate`. See [`deleted-hooks.md`](deleted-hooks.md). |
57
- | `useMigrationAllowance` | Query params nest under `params` with inner field literally named `params` (NOT `payload`): `{ params: { params: <migration-params>, action: 'migrate' \| 'revert' } }`. |
58
- | `BalnMigrateParams` (used by `useMigrateBaln`) | NEW required field `stake: boolean`. `lockupPeriod` is the `LockupPeriod` enum (5 members; values in seconds, not months). |
59
- | `useTradingWalletBalance` | Return is `RadfiWalletBalance = { btcSatoshi, pendingSatoshi, externalPendingSatoshi, totalUtxos }` — NOT `{ confirmed, pending }`. |
60
- | `useExpiredUtxos` | Return is `RadfiUtxo[]` (with `_id`, `txid`, `vout`, `txidVout`, `satoshi`, `amount`, `address`, `isSpent`, `status`, `source`, optional `runes`). Both this and `useTradingWalletBalance` take `{ params: { walletProvider, tradingAddress } }`. |
61
- | `useRadfiAuth` | TData is `RadfiAuthResult = { accessToken, refreshToken, tradingAddress }` (3 fields — `publicKey` is persisted to localStorage but NOT returned). |
62
- | All Bitcoin/Radfi mutations | Standard pattern — drop hook-init args; pass through `mutate(vars)`. |
63
-
64
- ## Cross-references
65
-
66
- - [`deleted-hooks.md`](deleted-hooks.md) — hooks that no longer exist at all.
67
- - [`../breaking-changes/hook-signatures.md`](../breaking-changes/hook-signatures.md) — shape changes in detail.
68
- - [`../features/`](../features/) — per-feature porting playbooks.