@sodax/dapp-kit 2.2.0 → 2.3.0-rc.1
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 +176 -166
- package/dist/index.d.ts +313 -30
- package/dist/index.mjs +392 -3
- package/package.json +5 -5
- package/src/hooks/_apiKeyWire.test.ts +10 -0
- package/src/hooks/_mutationContract.test.ts +4 -0
- package/src/hooks/bridge/index.ts +2 -0
- package/src/hooks/bridge/useBridgeApprovalStrategy.test.ts +75 -0
- package/src/hooks/bridge/useBridgeApprovalStrategy.ts +53 -0
- package/src/hooks/bridge/useBridgeWithApproval.test.ts +73 -0
- package/src/hooks/bridge/useBridgeWithApproval.ts +48 -0
- package/src/hooks/leverageYield/index.ts +2 -0
- package/src/hooks/leverageYield/useLeverageYieldApprovalStrategy.test.ts +82 -0
- package/src/hooks/leverageYield/useLeverageYieldApprovalStrategy.ts +55 -0
- package/src/hooks/leverageYield/useLeverageYieldVaultSwapWithApproval.test.ts +73 -0
- package/src/hooks/leverageYield/useLeverageYieldVaultSwapWithApproval.ts +48 -0
- package/src/hooks/shared/useNearStorageGate.ts +10 -4
- package/src/hooks/swap/index.ts +3 -0
- package/src/hooks/swap/useSwapApprovalStrategy.test.ts +92 -0
- package/src/hooks/swap/useSwapApprovalStrategy.ts +54 -0
- package/src/hooks/swap/useSwapLifecycle.test.ts +329 -0
- package/src/hooks/swap/useSwapLifecycle.ts +212 -0
- package/src/hooks/swap/useSwapWithApproval.test.ts +63 -0
- package/src/hooks/swap/useSwapWithApproval.ts +45 -0
- package/src/hooks/swapsApi/index.ts +1 -0
- package/src/hooks/swapsApi/useSwapsApiBroadcastWithApproval.test.ts +331 -0
- package/src/hooks/swapsApi/useSwapsApiBroadcastWithApproval.ts +183 -0
- package/src/utils/nearStorageGate.ts +4 -1
- package/src/utils/swapLifecycle.test.ts +292 -0
- package/src/utils/swapLifecycle.ts +183 -0
package/README.md
CHANGED
|
@@ -4,18 +4,18 @@ High-level React hooks library for dApp developers. Wraps `@sodax/sdk` with Reac
|
|
|
4
4
|
|
|
5
5
|
## Features
|
|
6
6
|
|
|
7
|
-
- **Swap/Intent** — `useQuote`, `useSwap`, `useSwapAllowance`, `useSwapApprove`, `useCancelSwap`, `useCreateLimitOrder`, `useCancelLimitOrder`, `useStatus`
|
|
8
|
-
- **Bridge** — `useBridge`, `useBridgeDetailedStatus`, `useBridgeAllowance`, `useBridgeApprove`, `useGetBridgeableAmount`, `useGetBridgeableTokens`
|
|
7
|
+
- **Swap/Intent** — `useSwapLifecycle`, `useQuote`, `useSwap`, `useSwapWithApproval`, `useSwapApprovalStrategy`, `useSwapAllowance`, `useSwapApprove`, `useDetailedStatus`, `useCancelSwap`, `useCreateLimitOrder`, `useCancelLimitOrder`, `useStatus`
|
|
8
|
+
- **Bridge** — `useBridge`, `useBridgeWithApproval`, `useBridgeApprovalStrategy`, `useBridgeDetailedStatus`, `useBridgeAllowance`, `useBridgeApprove`, `useGetBridgeableAmount`, `useGetBridgeableTokens`
|
|
9
9
|
- **Money Market** — `useSupply`, `useWithdraw`, `useBorrow`, `useRepay`, `useMMAllowance`, `useMMApprove`, plus reserves data hooks
|
|
10
10
|
- **Staking** — `useStake`, `useUnstake`, `useInstantUnstake`, `useClaim`, `useCancelUnstake`, approval hooks, info/config/ratio queries
|
|
11
11
|
- **DEX** — `useDexDeposit`, `useDexWithdraw`, `useSupplyLiquidity`, `useDecreaseLiquidity`, `useClaimRewards`, pool/position queries, param builders
|
|
12
|
-
- **Leverage Yield** — `useLeverageYieldDeposit`, `useLeverageYieldWithdraw`, `useLeverageYieldVaultSwap`, `useLeverageYieldDetailedStatus`, `useLeverageYieldNotifySolver`, plus vault position/APR/TVL/share queries
|
|
12
|
+
- **Leverage Yield** — `useLeverageYieldDeposit`, `useLeverageYieldWithdraw`, `useLeverageYieldVaultSwap`, `useLeverageYieldVaultSwapWithApproval`, `useLeverageYieldApprovalStrategy`, `useLeverageYieldDetailedStatus`, `useLeverageYieldNotifySolver`, plus vault position/APR/TVL/share queries
|
|
13
13
|
- **Migration** — `useMigrateIcxToSoda`, `useRevertMigrateSodaToIcx`, `useMigratebnUSD`, `useMigrateBaln`, `useMigrationApprove`, `useMigrationAllowance`
|
|
14
14
|
- **Bitcoin (Bound Exchange)** — `useRadfiAuth`, `useEnsureRadfiAccessToken`, `useRadfiSession`, `useTradingWallet`, `useTradingWalletBalance`, `useBitcoinBalance`, `useBitcoinTradingSetup`, `useFundTradingWallet`, `useRadfiWithdraw`, `useExpiredUtxos`, `useRenewUtxos`
|
|
15
15
|
- **Partner** — `useFetchAssetsBalances`, `useGetAutoSwapPreferences`, `useIsTokenApproved`, `useApproveToken`, `useSetSwapPreference`, `useFeeClaimSwap`, `useFeeClaimWithdraw`, `usePartnerCancelIntent`, `useGetUserIntent`, `useGetIntentDetails`
|
|
16
16
|
- **Recovery** — `useHubAssetBalances`, `useWithdrawHubAsset`
|
|
17
17
|
- **Backend Queries** — Intent tracking, swap-tx submission + status, orderbook, money market position queries
|
|
18
|
-
- **Shared** — `useXBalances`, `useDeriveUserWalletAddress`, `useGetUserHubWalletAddress`, `useStellarTrustlineCheck`, `useEstablishTrustline`, `useStellarGate`, `useNearStorageCheck`, `useRegisterNearStorage`, `useNearStorageGate`, `useEstimateGas`
|
|
18
|
+
- **Shared** — `useBalances`, `useXBalances`, `useDeriveUserWalletAddress`, `useGetUserHubWalletAddress`, `useStellarTrustlineCheck`, `useEstablishTrustline`, `useStellarGate`, `useNearStorageCheck`, `useRegisterNearStorage`, `useNearStorageGate`, `useEstimateGas`
|
|
19
19
|
- **Sponsoring** — `useStellarAccountActive`, `useStellarAccountStatus`, `useSponsorConfig`, `useActivateStellarAccount`
|
|
20
20
|
|
|
21
21
|
## Installation
|
|
@@ -131,66 +131,72 @@ function SwapButton({ intentParams }: { intentParams: CreateIntentParams }) {
|
|
|
131
131
|
|
|
132
132
|
### Provider
|
|
133
133
|
|
|
134
|
-
- [`SodaxProvider`](https://github.com/
|
|
135
|
-
- [`createSodaxQueryClient()`](https://github.com/
|
|
134
|
+
- [`SodaxProvider`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/providers/SodaxProvider.tsx) — Wraps your app, creates the `Sodax` SDK instance. Accepts `config?: SodaxOptions`.
|
|
135
|
+
- [`createSodaxQueryClient()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/providers/createSodaxQueryClient.ts) — Factory for a `QueryClient` with global mutation observability (`onMutationError` hook, `meta.silent` opt-out).
|
|
136
136
|
|
|
137
137
|
### Swap Hooks
|
|
138
138
|
|
|
139
|
-
- [`useQuote()`](https://github.com/
|
|
140
|
-
- [`useSwap()`](https://github.com/
|
|
141
|
-
- [`useSwapAllowance()`](https://github.com/
|
|
142
|
-
- [`useSwapApprove()`](https://github.com/
|
|
143
|
-
- [`
|
|
144
|
-
- [`
|
|
145
|
-
- [`
|
|
146
|
-
- [`
|
|
139
|
+
- [`useQuote()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/swap/useQuote.ts) — Real-time quote (auto-refreshes every 3s)
|
|
140
|
+
- [`useSwap()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/swap/useSwap.ts) — Submit a cross-chain swap intent
|
|
141
|
+
- [`useSwapAllowance()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/swap/useSwapAllowance.ts) — Check token approval
|
|
142
|
+
- [`useSwapApprove()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/swap/useSwapApprove.ts) — Approve token spending
|
|
143
|
+
- [`useSwapLifecycle()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/swap/useSwapLifecycle.ts) — A whole swap form as one discriminated `state` and one `next()` action: approval strategy, Stellar/NEAR destination gates, source-chain switch (passed in), the swap and its status. A swap that fails after broadcast stays `pending` with its `error`; a batch that was sent but not confirmed is `unconfirmed`, and `next()` waits for it again (never re-sends it) and finishes the swap once it lands. The hooks it composes are returned as escape hatches
|
|
144
|
+
- [`useSwapWithApproval()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/swap/useSwapWithApproval.ts) — `useSwap` with the approval folded in: approve + swap as one EIP-5792 batch (one signature) on a wallet that can batch, otherwise approve then swap. `allowAccountUpgrade: false` skips the smart-account upgrade prompt a `'ready'` wallet would show and approves separately
|
|
145
|
+
- [`useSwapApprovalStrategy()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/swap/useSwapApprovalStrategy.ts) — Which path `useSwapWithApproval` will take (`'not-required'` / `'atomic-batch'` / `'sequential'`), to label the button
|
|
146
|
+
- [`useDetailedStatus()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/swap/useDetailedStatus.ts) — Poll a swap's status from its **source** tx (`{ srcChainKey, srcTxHash }`), whichever completion path ran — the default status read. Collapse `data.value` with `summarizeSwapStatus` from `@sodax/sdk`
|
|
147
|
+
- [`useStatus()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/swap/useStatus.ts) — Poll the solver's status by **hub** tx hash (`intentDeliveryInfo.dstTxHash`)
|
|
148
|
+
- [`useCancelSwap()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/swap/useCancelSwap.ts) — Cancel a pending swap
|
|
149
|
+
- [`useCreateLimitOrder()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/swap/useCreateLimitOrder.ts) — Create a limit order (no deadline)
|
|
150
|
+
- [`useCancelLimitOrder()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/swap/useCancelLimitOrder.ts) — Cancel a limit order
|
|
147
151
|
|
|
148
152
|
### Money Market Hooks
|
|
149
153
|
|
|
150
|
-
- [`useSupply()`](https://github.com/
|
|
151
|
-
- [`useWithdraw()`](https://github.com/
|
|
152
|
-
- [`useBorrow()`](https://github.com/
|
|
153
|
-
- [`useRepay()`](https://github.com/
|
|
154
|
-
- [`useMMAllowance()`](https://github.com/
|
|
155
|
-
- [`useMMApprove()`](https://github.com/
|
|
156
|
-
- [`useReservesData()`](https://github.com/
|
|
157
|
-
- [`useReservesHumanized()`](https://github.com/
|
|
158
|
-
- [`useReservesList()`](https://github.com/
|
|
159
|
-
- [`useReservesUsdFormat()`](https://github.com/
|
|
160
|
-
- [`useUserFormattedSummary()`](https://github.com/
|
|
161
|
-
- [`useUserReservesData()`](https://github.com/
|
|
162
|
-
- [`useAToken()`](https://github.com/
|
|
163
|
-
- [`useATokensBalances()`](https://github.com/
|
|
154
|
+
- [`useSupply()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/mm/useSupply.ts) — Supply collateral
|
|
155
|
+
- [`useWithdraw()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/mm/useWithdraw.ts) — Withdraw supplied tokens
|
|
156
|
+
- [`useBorrow()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/mm/useBorrow.ts) — Borrow against collateral
|
|
157
|
+
- [`useRepay()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/mm/useRepay.ts) — Repay borrowed tokens
|
|
158
|
+
- [`useMMAllowance()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/mm/useMMAllowance.ts) — Check approval (auto-skips for borrow/withdraw)
|
|
159
|
+
- [`useMMApprove()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/mm/useMMApprove.ts) — Approve token spending
|
|
160
|
+
- [`useReservesData()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/mm/useReservesData.ts) — All reserve data
|
|
161
|
+
- [`useReservesHumanized()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/mm/useReservesHumanized.ts) — Reserves in decimal-normalized format
|
|
162
|
+
- [`useReservesList()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/mm/useReservesList.ts) — List of reserve asset addresses
|
|
163
|
+
- [`useReservesUsdFormat()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/mm/useReservesUsdFormat.ts) — Reserves with USD values
|
|
164
|
+
- [`useUserFormattedSummary()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/mm/useUserFormattedSummary.ts) — User portfolio summary (health factor, collateral, debt)
|
|
165
|
+
- [`useUserReservesData()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/mm/useUserReservesData.ts) — User reserve positions
|
|
166
|
+
- [`useAToken()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/mm/useAToken.ts) — aToken metadata
|
|
167
|
+
- [`useATokensBalances()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/mm/useATokensBalances.ts) — aToken balances
|
|
164
168
|
|
|
165
169
|
### Bridge Hooks
|
|
166
170
|
|
|
167
|
-
- [`useBridge()`](https://github.com/
|
|
168
|
-
- [`
|
|
169
|
-
- [`
|
|
170
|
-
- [`
|
|
171
|
-
- [`
|
|
172
|
-
- [`
|
|
171
|
+
- [`useBridge()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/bridge/useBridge.ts) — Execute a cross-chain bridge transfer
|
|
172
|
+
- [`useBridgeWithApproval()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/bridge/useBridgeWithApproval.ts) — Bridge with the approval folded in: one signature on an EIP-5792 wallet
|
|
173
|
+
- [`useBridgeApprovalStrategy()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/bridge/useBridgeApprovalStrategy.ts) — Which approval path `useBridgeWithApproval` would take
|
|
174
|
+
- [`useBridgeDetailedStatus()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/bridge/useBridgeDetailedStatus.ts) — Track a bridge from its source tx, whichever completion path ran
|
|
175
|
+
- [`useBridgeAllowance()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/bridge/useBridgeAllowance.ts) — Check token approval
|
|
176
|
+
- [`useBridgeApprove()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/bridge/useBridgeApprove.ts) — Approve token spending
|
|
177
|
+
- [`useGetBridgeableAmount()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/bridge/useGetBridgeableAmount.ts) — Max bridgeable amount between two tokens
|
|
178
|
+
- [`useGetBridgeableTokens()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/bridge/useGetBridgeableTokens.ts) — Tokens bridgeable to a destination chain
|
|
173
179
|
|
|
174
180
|
### Staking Hooks
|
|
175
181
|
|
|
176
|
-
- [`useStake()`](https://github.com/
|
|
177
|
-
- [`useUnstake()`](https://github.com/
|
|
178
|
-
- [`useInstantUnstake()`](https://github.com/
|
|
179
|
-
- [`useClaim()`](https://github.com/
|
|
180
|
-
- [`useCancelUnstake()`](https://github.com/
|
|
181
|
-
- [`useStakeApprove()`](https://github.com/
|
|
182
|
-
- [`useUnstakeApprove()`](https://github.com/
|
|
183
|
-
- [`useInstantUnstakeApprove()`](https://github.com/
|
|
184
|
-
- [`useStakeAllowance()`](https://github.com/
|
|
185
|
-
- [`useUnstakeAllowance()`](https://github.com/
|
|
186
|
-
- [`useInstantUnstakeAllowance()`](https://github.com/
|
|
187
|
-
- [`useStakingInfo()`](https://github.com/
|
|
188
|
-
- [`useUnstakingInfo()`](https://github.com/
|
|
189
|
-
- [`useUnstakingInfoWithPenalty()`](https://github.com/
|
|
190
|
-
- [`useStakingConfig()`](https://github.com/
|
|
191
|
-
- [`useStakeRatio()`](https://github.com/
|
|
192
|
-
- [`useInstantUnstakeRatio()`](https://github.com/
|
|
193
|
-
- [`useConvertedAssets()`](https://github.com/
|
|
182
|
+
- [`useStake()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/staking/useStake.ts) — Stake SODA, receive xSODA
|
|
183
|
+
- [`useUnstake()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/staking/useUnstake.ts) — Request unstake (waiting period)
|
|
184
|
+
- [`useInstantUnstake()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/staking/useInstantUnstake.ts) — Instant unstake with slippage
|
|
185
|
+
- [`useClaim()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/staking/useClaim.ts) — Claim SODA after waiting period
|
|
186
|
+
- [`useCancelUnstake()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/staking/useCancelUnstake.ts) — Cancel pending unstake
|
|
187
|
+
- [`useStakeApprove()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/staking/useStakeApprove.ts) — Approve SODA for staking
|
|
188
|
+
- [`useUnstakeApprove()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/staking/useUnstakeApprove.ts) — Approve xSODA for unstaking
|
|
189
|
+
- [`useInstantUnstakeApprove()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/staking/useInstantUnstakeApprove.ts) — Approve xSODA for instant unstaking
|
|
190
|
+
- [`useStakeAllowance()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/staking/useStakeAllowance.ts) — Check SODA approval
|
|
191
|
+
- [`useUnstakeAllowance()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/staking/useUnstakeAllowance.ts) — Check xSODA approval for unstaking
|
|
192
|
+
- [`useInstantUnstakeAllowance()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/staking/useInstantUnstakeAllowance.ts) — Check xSODA approval for instant unstaking
|
|
193
|
+
- [`useStakingInfo()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/staking/useStakingInfo.ts) — User staking position
|
|
194
|
+
- [`useUnstakingInfo()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/staking/useUnstakingInfo.ts) — Pending unstake requests
|
|
195
|
+
- [`useUnstakingInfoWithPenalty()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/staking/useUnstakingInfoWithPenalty.ts) — Unstake requests with penalty calcs
|
|
196
|
+
- [`useStakingConfig()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/staking/useStakingConfig.ts) — Unstaking period, max penalty
|
|
197
|
+
- [`useStakeRatio()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/staking/useStakeRatio.ts) — SODA-to-xSODA exchange rate
|
|
198
|
+
- [`useInstantUnstakeRatio()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/staking/useInstantUnstakeRatio.ts) — Instant unstake rate
|
|
199
|
+
- [`useConvertedAssets()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/staking/useConvertedAssets.ts) — xSODA to SODA conversion
|
|
194
200
|
|
|
195
201
|
### Leverage Position Hooks
|
|
196
202
|
|
|
@@ -202,158 +208,162 @@ Which write hook to use is decided by the operation, not by preference. `increas
|
|
|
202
208
|
expires unfilled, so those go through `useSubmitLeveragePositionIntent()`, which reports it.
|
|
203
209
|
`withdraw`, `settle` and `cancel` are synchronous on the hub and need no notification.
|
|
204
210
|
|
|
205
|
-
- [`useOpenLeveragePosition()`](https://github.com/
|
|
206
|
-
- [`useSubmitLeveragePositionIntent()`](https://github.com/
|
|
207
|
-
- [`useRunLeveragePositionOperation()`](https://github.com/
|
|
208
|
-
- [`useLeveragePositionPayoutAddress()`](https://github.com/
|
|
209
|
-
- [`useLeveragePositionFundingAllowance()`](https://github.com/
|
|
210
|
-
- [`useApproveLeveragePositionFunding()`](https://github.com/
|
|
211
|
-
- [`useLeveragePositionsForUser()`](https://github.com/
|
|
212
|
-
- [`useLeveragePositionAccount()`](https://github.com/
|
|
213
|
-
- [`useLeveragePositionInfo()`](https://github.com/
|
|
214
|
-
- [`useLeveragePositionCollateral()`](https://github.com/
|
|
215
|
-
- [`useLeveragePositionPending()`](https://github.com/
|
|
211
|
+
- [`useOpenLeveragePosition()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/leverageYield/useOpenLeveragePosition.ts) — Open a position (`side: 'collateral' | 'debt'`) and report its intent
|
|
212
|
+
- [`useSubmitLeveragePositionIntent()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/leverageYield/useSubmitLeveragePositionIntent.ts) — Run `increaseLeverage` / `decreaseLeverage` and report the intent
|
|
213
|
+
- [`useRunLeveragePositionOperation()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/leverageYield/useRunLeveragePositionOperation.ts) — Run `withdraw` / `settle` / `cancel`; no intent, nothing to report
|
|
214
|
+
- [`useLeveragePositionPayoutAddress()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/leverageYield/useLeveragePositionPayoutAddress.ts) — Where a withdrawal can be paid, which off the hub is not the signer
|
|
215
|
+
- [`useLeveragePositionFundingAllowance()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/leverageYield/useLeveragePositionFundingAllowance.ts) — Whether the funding token is approved; the spender is chain-dependent
|
|
216
|
+
- [`useApproveLeveragePositionFunding()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/leverageYield/useApproveLeveragePositionFunding.ts) — Approve it, against the spender the SDK resolves
|
|
217
|
+
- [`useLeveragePositionsForUser()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/leverageYield/useLeveragePositionsForUser.ts) — A user's positions, discovered through their hub wallet
|
|
218
|
+
- [`useLeveragePositionAccount()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/leverageYield/useLeveragePositionAccount.ts) — Collateral, debt, LTV and health factor
|
|
219
|
+
- [`useLeveragePositionInfo()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/leverageYield/useLeveragePositionInfo.ts) — The position's collateral and borrow reserves
|
|
220
|
+
- [`useLeveragePositionCollateral()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/leverageYield/useLeveragePositionCollateral.ts) — Collateral balance held
|
|
221
|
+
- [`useLeveragePositionPending()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/leverageYield/useLeveragePositionPending.ts) — The pending-operation slot; a position permits one at a time
|
|
216
222
|
|
|
217
223
|
> Resolving means the intent is **live**, not that leverage moved. Off-hub (spoke) origins are
|
|
218
224
|
> experimental and unverified on-chain; see each hook's JSDoc.
|
|
219
225
|
|
|
220
226
|
### DEX Hooks
|
|
221
227
|
|
|
222
|
-
- [`usePools()`](https://github.com/
|
|
223
|
-
- [`usePoolData()`](https://github.com/
|
|
224
|
-
- [`usePoolBalances()`](https://github.com/
|
|
225
|
-
- [`usePositionInfo()`](https://github.com/
|
|
226
|
-
- [`useDexDeposit()`](https://github.com/
|
|
227
|
-
- [`useDexWithdraw()`](https://github.com/
|
|
228
|
-
- [`useDexAllowance()`](https://github.com/
|
|
229
|
-
- [`useDexApprove()`](https://github.com/
|
|
230
|
-
- [`useLiquidityAmounts()`](https://github.com/
|
|
231
|
-
- [`useSupplyLiquidity()`](https://github.com/
|
|
232
|
-
- [`useDecreaseLiquidity()`](https://github.com/
|
|
233
|
-
- [`useClaimRewards()`](https://github.com/
|
|
234
|
-
- [`useCreateDepositParams()`](https://github.com/
|
|
235
|
-
- [`useCreateWithdrawParams()`](https://github.com/
|
|
236
|
-
- [`useCreateSupplyLiquidityParams()`](https://github.com/
|
|
237
|
-
- [`useCreateDecreaseLiquidityParams()`](https://github.com/
|
|
228
|
+
- [`usePools()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/dex/usePools.ts) — List available pools
|
|
229
|
+
- [`usePoolData()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/dex/usePoolData.ts) — Pool details (price, tick, liquidity)
|
|
230
|
+
- [`usePoolBalances()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/dex/usePoolBalances.ts) — User pool token balances
|
|
231
|
+
- [`usePositionInfo()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/dex/usePositionInfo.ts) — Position details by token ID
|
|
232
|
+
- [`useDexDeposit()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/dex/useDexDeposit.ts) — Deposit assets into pool tokens
|
|
233
|
+
- [`useDexWithdraw()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/dex/useDexWithdraw.ts) — Withdraw assets from pool tokens
|
|
234
|
+
- [`useDexAllowance()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/dex/useDexAllowance.ts) — Check approval for deposit
|
|
235
|
+
- [`useDexApprove()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/dex/useDexApprove.ts) — Approve token spending
|
|
236
|
+
- [`useLiquidityAmounts()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/dex/useLiquidityAmounts.ts) — Token amounts for a tick range
|
|
237
|
+
- [`useSupplyLiquidity()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/dex/useSupplyLiquidity.ts) — Supply liquidity to a position
|
|
238
|
+
- [`useDecreaseLiquidity()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/dex/useDecreaseLiquidity.ts) — Remove liquidity
|
|
239
|
+
- [`useClaimRewards()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/dex/useClaimRewards.ts) — Claim trading fees
|
|
240
|
+
- [`useCreateDepositParams()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/dex/useCreateDepositParams.ts) — Build deposit params with ERC-4626 conversion
|
|
241
|
+
- [`useCreateWithdrawParams()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/dex/useCreateWithdrawParams.ts) — Build withdraw params
|
|
242
|
+
- [`useCreateSupplyLiquidityParams()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/dex/useCreateSupplyLiquidityParams.ts) — Build tick range + liquidity params
|
|
243
|
+
- [`useCreateDecreaseLiquidityParams()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/dex/useCreateDecreaseLiquidityParams.ts) — Build decrease params from position state
|
|
238
244
|
|
|
239
245
|
### Leverage Yield Hooks
|
|
240
246
|
|
|
241
|
-
- [`useLeverageYieldEffectiveApr()`](https://github.com/
|
|
242
|
-
- [`useLeverageYieldPosition()`](https://github.com/
|
|
243
|
-
- [`useLeverageYieldTotalAssets()`](https://github.com/
|
|
244
|
-
- [`useLeverageYieldPreviewRedeem()`](https://github.com/
|
|
245
|
-
- [`useLeverageYieldShareBalances()`](https://github.com/
|
|
246
|
-
- [`useLeverageYieldDeposit()`](https://github.com/
|
|
247
|
-
- [`useLeverageYieldWithdraw()`](https://github.com/
|
|
248
|
-
- [`useLeverageYieldVaultSwap()`](https://github.com/
|
|
249
|
-
- [`
|
|
250
|
-
- [`
|
|
247
|
+
- [`useLeverageYieldEffectiveApr()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/leverageYield/useLeverageYieldEffectiveApr.ts) — Vault effective APR (AAVE rates + LSD yield, leverage-adjusted; refreshes 60s)
|
|
248
|
+
- [`useLeverageYieldPosition()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/leverageYield/useLeverageYieldPosition.ts) — Live position snapshot: collateral, debt, LTV, health factor, idle assets (refreshes 30s)
|
|
249
|
+
- [`useLeverageYieldTotalAssets()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/leverageYield/useLeverageYieldTotalAssets.ts) — Vault total underlying assets (TVL)
|
|
250
|
+
- [`useLeverageYieldPreviewRedeem()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/leverageYield/useLeverageYieldPreviewRedeem.ts) — Assets received for redeeming shares (ERC-4626 `previewRedeem`)
|
|
251
|
+
- [`useLeverageYieldShareBalances()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/leverageYield/useLeverageYieldShareBalances.ts) — User `lsoda*` share balances across every chain they may hold a position under
|
|
252
|
+
- [`useLeverageYieldDeposit()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/leverageYield/useLeverageYieldDeposit.ts) — Build the deposit payload (any token → `lsoda*` shares) for `useLeverageYieldVaultSwap`
|
|
253
|
+
- [`useLeverageYieldWithdraw()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/leverageYield/useLeverageYieldWithdraw.ts) — Build the withdraw payload (`lsoda*` shares → any token) for `useLeverageYieldVaultSwap`
|
|
254
|
+
- [`useLeverageYieldVaultSwap()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/leverageYield/useLeverageYieldVaultSwap.ts) — Execute an end-to-end vault swap (deposit or withdraw); backend 2-step by default, with the client-side fallback
|
|
255
|
+
- [`useLeverageYieldVaultSwapWithApproval()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/leverageYield/useLeverageYieldVaultSwapWithApproval.ts) — `useLeverageYieldVaultSwap` with a deposit's approval folded in: one signature on an EIP-5792 wallet
|
|
256
|
+
- [`useLeverageYieldApprovalStrategy()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/leverageYield/useLeverageYieldApprovalStrategy.ts) — Which approval path `useLeverageYieldVaultSwapWithApproval` would take
|
|
257
|
+
- [`useLeverageYieldDetailedStatus()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/leverageYield/useLeverageYieldDetailedStatus.ts) — Track a vault swap from its source tx, whichever completion path ran
|
|
258
|
+
- [`useLeverageYieldNotifySolver()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/leverageYield/useLeverageYieldNotifySolver.ts) — Notify the solver that a vault intent landed on the hub (standalone step for manual relay flows)
|
|
251
259
|
|
|
252
260
|
### Migration Hooks
|
|
253
261
|
|
|
254
|
-
- [`useMigrateIcxToSoda()`](https://github.com/
|
|
255
|
-
- [`useRevertMigrateSodaToIcx()`](https://github.com/
|
|
256
|
-
- [`useMigratebnUSD()`](https://github.com/
|
|
257
|
-
- [`useMigrateBaln()`](https://github.com/
|
|
258
|
-
- [`useMigrationApprove()`](https://github.com/
|
|
259
|
-
- [`useMigrationAllowance()`](https://github.com/
|
|
262
|
+
- [`useMigrateIcxToSoda()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/migrate/useMigrateIcxToSoda.ts) — ICX/wICX (ICON) → SODA (Sonic)
|
|
263
|
+
- [`useRevertMigrateSodaToIcx()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/migrate/useRevertMigrateSodaToIcx.ts) — SODA (Sonic) → wICX (ICON)
|
|
264
|
+
- [`useMigratebnUSD()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/migrate/useMigratebnUSD.ts) — Legacy bnUSD ↔ new bnUSD (bidirectional)
|
|
265
|
+
- [`useMigrateBaln()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/migrate/useMigrateBaln.ts) — BALN (ICON) → SODA with optional lock period
|
|
266
|
+
- [`useMigrationApprove()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/migrate/useMigrationApprove.ts) — Approve token spending before migration
|
|
267
|
+
- [`useMigrationAllowance()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/migrate/useMigrationAllowance.ts) — Check if approval is needed
|
|
260
268
|
|
|
261
269
|
### Bitcoin (Bound Exchange) Hooks
|
|
262
270
|
|
|
263
|
-
- [`useRadfiSession()`](https://github.com/
|
|
264
|
-
- [`useRadfiAuth()`](https://github.com/
|
|
265
|
-
- [`useEnsureRadfiAccessToken()`](https://github.com/
|
|
266
|
-
- [`useTradingWallet()`](https://github.com/
|
|
267
|
-
- [`useBitcoinBalance()`](https://github.com/
|
|
268
|
-
- [`useTradingWalletBalance()`](https://github.com/
|
|
269
|
-
- [`useBitcoinTradingSetup()`](https://github.com/
|
|
270
|
-
- [`useFundTradingWallet()`](https://github.com/
|
|
271
|
-
- [`useRadfiWithdraw()`](https://github.com/
|
|
272
|
-
- [`useExpiredUtxos()`](https://github.com/
|
|
273
|
-
- [`useRenewUtxos()`](https://github.com/
|
|
271
|
+
- [`useRadfiSession()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/bitcoin/useRadfiSession.ts) — Manage Bound Exchange session (login, auto-refresh)
|
|
272
|
+
- [`useRadfiAuth()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/bitcoin/useRadfiAuth.ts) — Authenticate with Bound Exchange via BIP322 signing
|
|
273
|
+
- [`useEnsureRadfiAccessToken()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/bitcoin/useEnsureRadfiAccessToken.ts) — Ensure a valid Bound Exchange access token (refresh, or full re-auth), returning it for a Bitcoin-source createIntent
|
|
274
|
+
- [`useTradingWallet()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/bitcoin/useTradingWallet.ts) — Get trading wallet address from persisted session
|
|
275
|
+
- [`useBitcoinBalance()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/bitcoin/useBitcoinBalance.ts) — BTC balance for any address
|
|
276
|
+
- [`useTradingWalletBalance()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/bitcoin/useTradingWalletBalance.ts) — Trading wallet balance from Bound Exchange API
|
|
277
|
+
- [`useBitcoinTradingSetup()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/bitcoin/useBitcoinTradingSetup.ts) — Bitcoin trading-wallet setup for one side of a cross-chain flow (inert unless the chain is Bitcoin)
|
|
278
|
+
- [`useFundTradingWallet()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/bitcoin/useFundTradingWallet.ts) — Fund trading wallet from personal wallet
|
|
279
|
+
- [`useRadfiWithdraw()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/bitcoin/useRadfiWithdraw.ts) — Withdraw from trading wallet
|
|
280
|
+
- [`useExpiredUtxos()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/bitcoin/useExpiredUtxos.ts) — Fetch expired UTXOs (polls every 60s)
|
|
281
|
+
- [`useRenewUtxos()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/bitcoin/useRenewUtxos.ts) — Renew expired UTXOs
|
|
274
282
|
|
|
275
283
|
### Partner Hooks
|
|
276
284
|
|
|
277
|
-
- [`useFetchAssetsBalances()`](https://github.com/
|
|
278
|
-
- [`useGetAutoSwapPreferences()`](https://github.com/
|
|
279
|
-
- [`useIsTokenApproved()`](https://github.com/
|
|
280
|
-
- [`useApproveToken()`](https://github.com/
|
|
281
|
-
- [`useSetSwapPreference()`](https://github.com/
|
|
282
|
-
- [`useFeeClaimSwap()`](https://github.com/
|
|
283
|
-
- [`useFeeClaimWithdraw()`](https://github.com/
|
|
284
|
-
- [`usePartnerCancelIntent()`](https://github.com/
|
|
285
|
-
- [`useGetUserIntent()`](https://github.com/
|
|
286
|
-
- [`useGetIntentDetails()`](https://github.com/
|
|
285
|
+
- [`useFetchAssetsBalances()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/partner/useFetchAssetsBalances.ts) — Fetch partner asset balances
|
|
286
|
+
- [`useGetAutoSwapPreferences()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/partner/useGetAutoSwapPreferences.ts) — Get auto-swap preferences
|
|
287
|
+
- [`useIsTokenApproved()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/partner/useIsTokenApproved.ts) — Check token approval
|
|
288
|
+
- [`useApproveToken()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/partner/useApproveToken.ts) — Approve token
|
|
289
|
+
- [`useSetSwapPreference()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/partner/useSetSwapPreference.ts) — Set swap preference
|
|
290
|
+
- [`useFeeClaimSwap()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/partner/useFeeClaimSwap.ts) — Claim partner fees via swap
|
|
291
|
+
- [`useFeeClaimWithdraw()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/partner/useFeeClaimWithdraw.ts) — Withdraw a partner fee balance via a Sonic-sourced bridge to the destination chain
|
|
292
|
+
- [`usePartnerCancelIntent()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/partner/usePartnerCancelIntent.ts) — Cancel a stuck partner fee-claim auto-swap intent and recover the locked tokens
|
|
293
|
+
- [`useGetUserIntent()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/partner/useGetUserIntent.ts) — Look up the stored intent hash for a partner `(user, fromToken, toToken)` pair
|
|
294
|
+
- [`useGetIntentDetails()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/partner/useGetIntentDetails.ts) — Fetch the full intent details for a ProtocolIntents intent hash
|
|
287
295
|
|
|
288
296
|
### Recovery Hooks
|
|
289
297
|
|
|
290
|
-
- [`useHubAssetBalances()`](https://github.com/
|
|
291
|
-
- [`useWithdrawHubAsset()`](https://github.com/
|
|
298
|
+
- [`useHubAssetBalances()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/recovery/useHubAssetBalances.ts) — Get hub asset balances
|
|
299
|
+
- [`useWithdrawHubAsset()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/recovery/useWithdrawHubAsset.ts) — Withdraw hub asset
|
|
292
300
|
|
|
293
301
|
### Shared Hooks
|
|
294
302
|
|
|
295
|
-
- [`useSodaxContext()`](https://github.com/
|
|
296
|
-
- [`useHubProvider()`](https://github.com/
|
|
297
|
-
- [`
|
|
298
|
-
- [`
|
|
299
|
-
- [`
|
|
300
|
-
- [`
|
|
301
|
-
- [`
|
|
302
|
-
- [`
|
|
303
|
-
- [`
|
|
304
|
-
- [`
|
|
305
|
-
- [`
|
|
306
|
-
- [`
|
|
307
|
-
- [`
|
|
303
|
+
- [`useSodaxContext()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/shared/useSodaxContext.ts) — Access the `Sodax` SDK instance
|
|
304
|
+
- [`useHubProvider()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/provider/useHubProvider.ts) — Access the hub chain (Sonic) provider
|
|
305
|
+
- [`useBalances()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/shared/useBalances.ts) — A user's own wallet balances for a list of tokens on one chain, read through the core SDK (`sodax.spoke.getWalletBalances`); see [Read wallet balances](https://docs.sodax.com/developers/how-to/wallet-balances)
|
|
306
|
+
- [`useXBalances()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/shared/useXBalances.ts) — Cross-chain token balances for an address
|
|
307
|
+
- [`useDeriveUserWalletAddress()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/shared/useDeriveUserWalletAddress.ts) — Derive hub wallet address (CREATE3)
|
|
308
|
+
- [`useGetUserHubWalletAddress()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/shared/useGetUserHubWalletAddress.ts) — Derive hub wallet address (wallet router)
|
|
309
|
+
- [`useEstimateGas()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/shared/useEstimateGas.ts) — Estimate gas for transactions
|
|
310
|
+
- [`useStellarTrustlineCheck()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/shared/useStellarTrustlineCheck.ts) — Check Stellar trustline
|
|
311
|
+
- [`useEstablishTrustline()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/shared/useEstablishTrustline.ts) — Request Stellar trustline
|
|
312
|
+
- [`useRequestTrustline()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/shared/useRequestTrustline.ts) — **Deprecated**, use `useEstablishTrustline()`
|
|
313
|
+
- [`useStellarGate()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/shared/useStellarGate.ts) — Sequences the Stellar destination prerequisites (activation → funding → trustline)
|
|
314
|
+
- [`useNearStorageCheck()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/shared/useNearStorageCheck.ts) — Check NEP-141 storage registration for a token on NEAR (NEAR's analogue of a Stellar trustline)
|
|
315
|
+
- [`useRegisterNearStorage()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/shared/useRegisterNearStorage.ts) — Submit a NEP-141 `storage_deposit` so a NEAR account can receive a token
|
|
316
|
+
- [`useNearStorageGate()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/shared/useNearStorageGate.ts) — Derive the NEP-141 storage-registration UI gate state for a NEAR delivery
|
|
308
317
|
|
|
309
318
|
### Sponsoring Hooks
|
|
310
319
|
|
|
311
320
|
Stellar accounts must exist on-chain before they can hold or receive anything, and a new user holds 0 XLM.
|
|
312
321
|
These drive sponsored activation, where the SODAX sponsor pays the account's base reserve.
|
|
313
322
|
|
|
314
|
-
- [`useStellarAccountActive()`](https://github.com/
|
|
315
|
-
- [`useStellarAccountStatus()`](https://github.com/
|
|
316
|
-
- [`useSponsorConfig()`](https://github.com/
|
|
317
|
-
- [`useActivateStellarAccount()`](https://github.com/
|
|
323
|
+
- [`useStellarAccountActive()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/sponsoring/useStellarAccountActive.ts) — Whether a Stellar account exists on-chain
|
|
324
|
+
- [`useStellarAccountStatus()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/sponsoring/useStellarAccountStatus.ts) — Existence plus whether the account can afford a trustline
|
|
325
|
+
- [`useSponsorConfig()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/sponsoring/useSponsorConfig.ts) — Sponsor account, network, fee band, max time bounds
|
|
326
|
+
- [`useActivateStellarAccount()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/sponsoring/useActivateStellarAccount.ts) — Activate a Stellar account via the sponsor
|
|
318
327
|
|
|
319
328
|
### Backend Query Hooks
|
|
320
329
|
|
|
321
|
-
- [`useBackendIntentByTxHash()`](https://github.com/
|
|
322
|
-
- [`useBackendIntentByHash()`](https://github.com/
|
|
323
|
-
- [`useBackendUserIntents()`](https://github.com/
|
|
324
|
-
- [`useBackendOrderbook()`](https://github.com/
|
|
325
|
-
- [`useBackendMoneyMarketPosition()`](https://github.com/
|
|
326
|
-
- [`useBackendAllMoneyMarketAssets()`](https://github.com/
|
|
327
|
-
- [`useBackendMoneyMarketAsset()`](https://github.com/
|
|
328
|
-
- [`useBackendMoneyMarketAssetBorrowers()`](https://github.com/
|
|
329
|
-
- [`useBackendMoneyMarketAssetSuppliers()`](https://github.com/
|
|
330
|
-
- [`useBackendAllMoneyMarketBorrowers()`](https://github.com/
|
|
331
|
-
- [`useBackendOracleMarkets()`](https://github.com/
|
|
332
|
-
- [`useBackendOracleCandles()`](https://github.com/
|
|
330
|
+
- [`useBackendIntentByTxHash()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/backend/useBackendIntentByTxHash.ts) — Get intent by hub tx hash (polls 1s)
|
|
331
|
+
- [`useBackendIntentByHash()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/backend/useBackendIntentByHash.ts) — Get intent by intent hash
|
|
332
|
+
- [`useBackendUserIntents()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/backend/useBackendUserIntents.ts) — All intents for a user with date filtering
|
|
333
|
+
- [`useBackendOrderbook()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/backend/useBackendOrderbook.ts) — Solver orderbook (cached 30s, no auto-refetch)
|
|
334
|
+
- [`useBackendMoneyMarketPosition()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/backend/useBackendMoneyMarketPosition.ts) — User money market position
|
|
335
|
+
- [`useBackendAllMoneyMarketAssets()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/backend/useBackendAllMoneyMarketAssets.ts) — All MM assets
|
|
336
|
+
- [`useBackendMoneyMarketAsset()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/backend/useBackendMoneyMarketAsset.ts) — Single MM asset details
|
|
337
|
+
- [`useBackendMoneyMarketAssetBorrowers()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/backend/useBackendMoneyMarketAssetBorrowers.ts) — Asset borrowers
|
|
338
|
+
- [`useBackendMoneyMarketAssetSuppliers()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/backend/useBackendMoneyMarketAssetSuppliers.ts) — Asset suppliers
|
|
339
|
+
- [`useBackendAllMoneyMarketBorrowers()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/backend/useBackendAllMoneyMarketBorrowers.ts) — All borrowers
|
|
340
|
+
- [`useBackendOracleMarkets()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/backend/useBackendOracleMarkets.ts) — Oracle candle discovery: quote, intervals, symbols (cached 60s)
|
|
341
|
+
- [`useBackendOracleCandles()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/backend/useBackendOracleCandles.ts) — USD OHLC candles for a symbol over `[from, to)` (cached 10s)
|
|
333
342
|
|
|
334
343
|
### Swaps API Hooks (`sodax.api.swaps`)
|
|
335
344
|
|
|
336
345
|
Typed wrappers over the backend Swaps API — one `useSwapsApi*` hook per endpoint (21 total). Highlights:
|
|
337
346
|
|
|
338
|
-
- [`useSwapsApiQuote()`](https://github.com/
|
|
339
|
-
- [`useSwapsApiCreateIntent()`](https://github.com/
|
|
340
|
-
- [`
|
|
341
|
-
- [`
|
|
347
|
+
- [`useSwapsApiQuote()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/swapsApi/useSwapsApiQuote.ts) — Solver quote for a cross-chain swap
|
|
348
|
+
- [`useSwapsApiCreateIntent()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/swapsApi/useSwapsApiCreateIntent.ts) — Build an unsigned create-intent tx
|
|
349
|
+
- [`useSwapsApiBroadcastWithApproval()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/swapsApi/useSwapsApiBroadcastWithApproval.ts) — Approve and broadcast the intent tx in one signature on an EIP-5792 wallet (EVM sources)
|
|
350
|
+
- [`useSwapsApiSubmitTx()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/swapsApi/useSwapsApiSubmitTx.ts) — Submit swap tx to backend
|
|
351
|
+
- [`useSwapsApiSubmitTxStatus()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/swapsApi/useSwapsApiSubmitTxStatus.ts) — Check submitted swap status
|
|
342
352
|
|
|
343
|
-
See [`src/hooks/swapsApi/`](https://github.com/
|
|
353
|
+
See [`src/hooks/swapsApi/`](https://github.com/gosodax/sodax-sdks/tree/main/packages/dapp-kit/src/hooks/swapsApi) for the full set (tokens, deadline, allowance, approve, submit/cancel intent, status, hash, packet, extra-data, intent lookups, limit orders, gas, fees).
|
|
344
354
|
|
|
345
355
|
### Bridge API Hooks (`sodax.api.bridge`)
|
|
346
356
|
|
|
347
357
|
Typed wrappers over the backend Bridge API v2 — one `useBridgeApi*` hook per endpoint. Highlights:
|
|
348
358
|
|
|
349
|
-
- [`useBridgeApiSubmitTx()`](https://github.com/
|
|
350
|
-
- [`useBridgeApiSubmitTxStatus()`](https://github.com/
|
|
359
|
+
- [`useBridgeApiSubmitTx()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/bridgeApi/useBridgeApiSubmitTx.ts) — Hand a broadcast spoke-deposit tx to the backend relay pipeline
|
|
360
|
+
- [`useBridgeApiSubmitTxStatus()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/bridgeApi/useBridgeApiSubmitTxStatus.ts) — Poll a submitted bridge tx by `(txHash, srcChainKey)`
|
|
351
361
|
|
|
352
|
-
See [`src/hooks/bridgeApi/`](https://github.com/
|
|
362
|
+
See [`src/hooks/bridgeApi/`](https://github.com/gosodax/sodax-sdks/tree/main/packages/dapp-kit/src/hooks/bridgeApi) for the full set (tokens, allowance, approve, create intent, fee, bridgeable amount, bridgeable pair).
|
|
353
363
|
|
|
354
364
|
### API-key failures are terminal
|
|
355
365
|
|
|
356
|
-
Every retrying `useSwapsApi*`, `useLeverageYieldApi*` and `useBridgeApi*` hook defaults `retry` to [`retryUnlessAuthFailure()`](https://github.com/
|
|
366
|
+
Every retrying `useSwapsApi*`, `useLeverageYieldApi*` and `useBridgeApi*` hook defaults `retry` to [`retryUnlessAuthFailure()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/shared/retryUnlessAuthFailure.ts): transport blips retry up to 3 times, a `401`/`403` never replays. `useSwapsApiStatus`, `useSwapsApiSubmitTxStatus`, `useLeverageYieldApiSubmitTxStatus` and `useBridgeApiSubmitTxStatus` stop their 1s poll on a rejected key too, since `retry` bounds attempts within a tick rather than the interval — so a bad key surfaces once, on `error`, instead of re-requesting forever. Override either through `queryOptions` / `mutationOptions`.
|
|
357
367
|
|
|
358
368
|
`useDetailedStatus` and `useBridgeDetailedStatus` stop on a rejected key as well, but by a different route: the SDK hands them the `401`/`403` inside a `Result` rather than throwing, so React Query never sees an error and `retry` has nothing to withhold. Their poll interval checks `isAuthFailure(data.error)` instead. It has to — a rejected key leaves the backend unanswered, so a relay miss behind it is never tagged `DETAILED_STATUS_NOT_DELIVERED`, and the not-delivered budget that stops every other unresolved read would never advance.
|
|
359
369
|
|
|
@@ -361,14 +371,14 @@ Every retrying `useSwapsApi*`, `useLeverageYieldApi*` and `useBridgeApi*` hook d
|
|
|
361
371
|
|
|
362
372
|
DEX param builders:
|
|
363
373
|
|
|
364
|
-
- [`createDepositParamsProps()`](https://github.com/
|
|
365
|
-
- [`createWithdrawParamsProps()`](https://github.com/
|
|
366
|
-
- [`createSupplyLiquidityParamsProps()`](https://github.com/
|
|
367
|
-
- [`createDecreaseLiquidityParamsProps()`](https://github.com/
|
|
374
|
+
- [`createDepositParamsProps()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/utils/dex-utils.ts) — Build deposit params from pool data and spoke asset info
|
|
375
|
+
- [`createWithdrawParamsProps()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/utils/dex-utils.ts) — Build withdraw params with optional destination info
|
|
376
|
+
- [`createSupplyLiquidityParamsProps()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/utils/dex-utils.ts) — Build concentrated liquidity supply params
|
|
377
|
+
- [`createDecreaseLiquidityParamsProps()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/utils/dex-utils.ts) — Build decrease liquidity params
|
|
368
378
|
|
|
369
379
|
NEAR storage gate:
|
|
370
380
|
|
|
371
|
-
- [`resolveNearStorageGate()`](https://github.com/
|
|
381
|
+
- [`resolveNearStorageGate()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/utils/nearStorageGate.ts) — Derive the NEP-141 storage-registration UI gate state (hook-free counterpart of `useNearStorageGate`)
|
|
372
382
|
|
|
373
383
|
## Development
|
|
374
384
|
|
|
@@ -384,12 +394,12 @@ pnpm lint # Lint code
|
|
|
384
394
|
|
|
385
395
|
## AI agent docs
|
|
386
396
|
|
|
387
|
-
AI-readable docs for `@sodax/dapp-kit` (and the other `@sodax/*` packages) are shipped via [`@sodax/skills`](https://github.com/
|
|
397
|
+
AI-readable docs for `@sodax/dapp-kit` (and the other `@sodax/*` packages) are shipped via [`@sodax/skills`](https://github.com/gosodax/sodax-sdks/tree/main/packages/skills) — a separate npm package bundling Claude-Code SKILL.md files and a long-form knowledge tree.
|
|
388
398
|
|
|
389
399
|
**Recommended: [`skills` CLI](https://github.com/vercel-labs/skills)** — from your project root:
|
|
390
400
|
|
|
391
401
|
```bash
|
|
392
|
-
npx skills@latest add
|
|
402
|
+
npx skills@latest add gosodax/sodax-sdks/packages/skills
|
|
393
403
|
```
|
|
394
404
|
|
|
395
405
|
**npm + `AGENTS.md` pointer** (fallback for web chats, or when you prefer a devDependency over the CLI):
|
|
@@ -398,13 +408,13 @@ npx skills@latest add icon-project/sodax-sdks/packages/skills
|
|
|
398
408
|
pnpm add -D @sodax/skills
|
|
399
409
|
```
|
|
400
410
|
|
|
401
|
-
Then point your agent at `node_modules/@sodax/skills/AGENTS.md`. See [docs/ai-integration-guide.md](https://github.com/
|
|
411
|
+
Then point your agent at `node_modules/@sodax/skills/AGENTS.md`. See [docs/ai-integration-guide.md](https://github.com/gosodax/sodax-sdks/blob/main/docs/ai-integration-guide.md) for all install modes and per-tool wiring.
|
|
402
412
|
|
|
403
413
|
## License
|
|
404
414
|
|
|
405
|
-
[MIT](https://github.com/
|
|
415
|
+
[MIT](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/LICENSE)
|
|
406
416
|
|
|
407
417
|
## Support
|
|
408
418
|
|
|
409
|
-
- [GitHub Issues](https://github.com/
|
|
419
|
+
- [GitHub Issues](https://github.com/gosodax/sodax-sdks/issues)
|
|
410
420
|
- [Discord Community](https://discord.gg/sodax-formerly-icon-880651922682560582)
|