@sodax/dapp-kit 2.2.0-rc.5 → 2.2.0-rc.7
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 +77 -7
- package/dist/index.d.ts +382 -14
- package/dist/index.mjs +336 -38
- package/package.json +4 -4
- package/src/hooks/_mutationContract.test.ts +4 -0
- package/src/hooks/bridge/getBridgeDetailedStatusRefetchInterval.test.ts +144 -0
- package/src/hooks/bridge/getBridgeDetailedStatusRefetchInterval.ts +52 -0
- package/src/hooks/bridge/index.ts +2 -0
- package/src/hooks/bridge/useBridgeDetailedStatus.test.ts +93 -0
- package/src/hooks/bridge/useBridgeDetailedStatus.ts +79 -0
- package/src/hooks/bridgeApi/getBridgeSubmitTxStatusRefetchInterval.test.ts +81 -0
- package/src/hooks/bridgeApi/getBridgeSubmitTxStatusRefetchInterval.ts +25 -0
- package/src/hooks/bridgeApi/useBridgeApiAllowance.ts +2 -1
- package/src/hooks/bridgeApi/useBridgeApiApprove.ts +2 -1
- package/src/hooks/bridgeApi/useBridgeApiBridgeableAmount.ts +2 -1
- package/src/hooks/bridgeApi/useBridgeApiCreateBridgeIntent.ts +2 -1
- package/src/hooks/bridgeApi/useBridgeApiFee.ts +2 -1
- package/src/hooks/bridgeApi/useBridgeApiIsBridgeable.ts +2 -1
- package/src/hooks/bridgeApi/useBridgeApiSubmitTx.ts +5 -3
- package/src/hooks/bridgeApi/useBridgeApiSubmitTxStatus.test.ts +63 -0
- package/src/hooks/bridgeApi/useBridgeApiSubmitTxStatus.ts +7 -10
- package/src/hooks/bridgeApi/useBridgeApiTokens.ts +2 -1
- package/src/hooks/bridgeApi/useBridgeApiTokensByChain.ts +2 -1
- package/src/hooks/leverageYield/index.ts +13 -0
- package/src/hooks/leverageYield/useApproveLeveragePositionFunding.ts +48 -0
- package/src/hooks/leverageYield/useLeveragePositionAccount.ts +45 -0
- package/src/hooks/leverageYield/useLeveragePositionCollateral.ts +47 -0
- package/src/hooks/leverageYield/useLeveragePositionFundingAllowance.ts +51 -0
- package/src/hooks/leverageYield/useLeveragePositionInfo.ts +39 -0
- package/src/hooks/leverageYield/useLeveragePositionPayoutAddress.ts +36 -0
- package/src/hooks/leverageYield/useLeveragePositionPending.ts +48 -0
- package/src/hooks/leverageYield/useLeveragePositions.ts +41 -0
- package/src/hooks/leverageYield/useLeveragePositionsForUser.ts +45 -0
- package/src/hooks/leverageYield/useLeverageYieldDetailedStatus.test.ts +131 -0
- package/src/hooks/leverageYield/useLeverageYieldDetailedStatus.ts +83 -0
- package/src/hooks/leverageYield/useLeverageYieldVaultSwap.ts +13 -3
- package/src/hooks/leverageYield/useOpenLeveragePosition.ts +59 -0
- package/src/hooks/leverageYield/useRunLeveragePositionOperation.ts +63 -0
- package/src/hooks/leverageYield/useSubmitLeveragePositionIntent.ts +55 -0
- package/src/hooks/leverageYieldApi/index.ts +2 -2
- package/src/hooks/mm/index.ts +1 -0
- package/src/hooks/mm/useEModes.ts +31 -0
- package/src/hooks/shared/notFoundStreak.ts +59 -0
- package/src/hooks/shared/retryUnlessAuthFailure.ts +1 -1
- package/src/hooks/{swap/getSwapStatusRefetchInterval.test.ts → shared/solverStatusPolicy.test.ts} +25 -25
- package/src/hooks/shared/solverStatusPolicy.ts +117 -0
- package/src/hooks/swap/useDetailedStatus.test.ts +65 -21
- package/src/hooks/swap/useDetailedStatus.ts +9 -9
- package/src/hooks/swap/useStatus.ts +4 -7
- package/src/hooks/swapsApi/index.ts +2 -2
- package/src/hooks/swapsApi/useSwapsApiSubmitTxStatus.ts +2 -2
- package/src/hooks/swap/getSwapStatusRefetchInterval.ts +0 -126
package/README.md
CHANGED
|
@@ -5,16 +5,17 @@ High-level React hooks library for dApp developers. Wraps `@sodax/sdk` with Reac
|
|
|
5
5
|
## Features
|
|
6
6
|
|
|
7
7
|
- **Swap/Intent** — `useQuote`, `useSwap`, `useSwapAllowance`, `useSwapApprove`, `useCancelSwap`, `useCreateLimitOrder`, `useCancelLimitOrder`, `useStatus`
|
|
8
|
-
- **Bridge** — `useBridge`, `useBridgeAllowance`, `useBridgeApprove`, `useGetBridgeableAmount`, `useGetBridgeableTokens`
|
|
8
|
+
- **Bridge** — `useBridge`, `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
13
|
- **Migration** — `useMigrateIcxToSoda`, `useRevertMigrateSodaToIcx`, `useMigratebnUSD`, `useMigrateBaln`, `useMigrationApprove`, `useMigrationAllowance`
|
|
13
|
-
- **Bitcoin (Bound Exchange)** — `useRadfiAuth`, `useRadfiSession`, `useTradingWallet`, `useTradingWalletBalance`, `useBitcoinBalance`, `useFundTradingWallet`, `useRadfiWithdraw`, `useExpiredUtxos`, `useRenewUtxos`
|
|
14
|
-
- **Partner** — `useFetchAssetsBalances`, `useGetAutoSwapPreferences`, `useIsTokenApproved`, `useApproveToken`, `useSetSwapPreference`, `useFeeClaimSwap`
|
|
14
|
+
- **Bitcoin (Bound Exchange)** — `useRadfiAuth`, `useEnsureRadfiAccessToken`, `useRadfiSession`, `useTradingWallet`, `useTradingWalletBalance`, `useBitcoinBalance`, `useBitcoinTradingSetup`, `useFundTradingWallet`, `useRadfiWithdraw`, `useExpiredUtxos`, `useRenewUtxos`
|
|
15
|
+
- **Partner** — `useFetchAssetsBalances`, `useGetAutoSwapPreferences`, `useIsTokenApproved`, `useApproveToken`, `useSetSwapPreference`, `useFeeClaimSwap`, `useFeeClaimWithdraw`, `usePartnerCancelIntent`, `useGetUserIntent`, `useGetIntentDetails`
|
|
15
16
|
- **Recovery** — `useHubAssetBalances`, `useWithdrawHubAsset`
|
|
16
17
|
- **Backend Queries** — Intent tracking, swap-tx submission + status, orderbook, money market position queries
|
|
17
|
-
- **Shared** — `useXBalances`, `useDeriveUserWalletAddress`, `useGetUserHubWalletAddress`, `useStellarTrustlineCheck`, `useEstablishTrustline`, `useStellarGate`, `useEstimateGas`
|
|
18
|
+
- **Shared** — `useXBalances`, `useDeriveUserWalletAddress`, `useGetUserHubWalletAddress`, `useStellarTrustlineCheck`, `useEstablishTrustline`, `useStellarGate`, `useNearStorageCheck`, `useRegisterNearStorage`, `useNearStorageGate`, `useEstimateGas`
|
|
18
19
|
- **Sponsoring** — `useStellarAccountActive`, `useStellarAccountStatus`, `useSponsorConfig`, `useActivateStellarAccount`
|
|
19
20
|
|
|
20
21
|
## Installation
|
|
@@ -118,7 +119,7 @@ function SwapButton({ intentParams }: { intentParams: CreateIntentParams }) {
|
|
|
118
119
|
|
|
119
120
|
## Requirements
|
|
120
121
|
|
|
121
|
-
- Node.js >=
|
|
122
|
+
- Node.js >= 22.12.0
|
|
122
123
|
- React >= 18
|
|
123
124
|
- TypeScript
|
|
124
125
|
|
|
@@ -160,6 +161,7 @@ function SwapButton({ intentParams }: { intentParams: CreateIntentParams }) {
|
|
|
160
161
|
### Bridge Hooks
|
|
161
162
|
|
|
162
163
|
- [`useBridge()`](https://github.com/icon-project/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/bridge/useBridge.ts) — Execute a cross-chain bridge transfer
|
|
164
|
+
- [`useBridgeDetailedStatus()`](https://github.com/icon-project/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/bridge/useBridgeDetailedStatus.ts) — Track a bridge from its source tx, whichever completion path ran
|
|
163
165
|
- [`useBridgeAllowance()`](https://github.com/icon-project/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/bridge/useBridgeAllowance.ts) — Check token approval
|
|
164
166
|
- [`useBridgeApprove()`](https://github.com/icon-project/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/bridge/useBridgeApprove.ts) — Approve token spending
|
|
165
167
|
- [`useGetBridgeableAmount()`](https://github.com/icon-project/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/bridge/useGetBridgeableAmount.ts) — Max bridgeable amount between two tokens
|
|
@@ -186,6 +188,31 @@ function SwapButton({ intentParams }: { intentParams: CreateIntentParams }) {
|
|
|
186
188
|
- [`useInstantUnstakeRatio()`](https://github.com/icon-project/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/staking/useInstantUnstakeRatio.ts) — Instant unstake rate
|
|
187
189
|
- [`useConvertedAssets()`](https://github.com/icon-project/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/staking/useConvertedAssets.ts) — xSODA to SODA conversion
|
|
188
190
|
|
|
191
|
+
### Leverage Position Hooks
|
|
192
|
+
|
|
193
|
+
A position is one Aave account owned by the user's **hub wallet**, never their signing address — pass
|
|
194
|
+
the signer as `params.srcAddress` and the SDK resolves the owner.
|
|
195
|
+
|
|
196
|
+
Which write hook to use is decided by the operation, not by preference. `increaseLeverage` and
|
|
197
|
+
`decreaseLeverage` only **post** a solver intent, and an intent the solver was never told about
|
|
198
|
+
expires unfilled, so those go through `useSubmitLeveragePositionIntent()`, which reports it.
|
|
199
|
+
`withdraw`, `settle` and `cancel` are synchronous on the hub and need no notification.
|
|
200
|
+
|
|
201
|
+
- [`useOpenLeveragePosition()`](https://github.com/icon-project/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/leverageYield/useOpenLeveragePosition.ts) — Open a position (`side: 'collateral' | 'debt'`) and report its intent
|
|
202
|
+
- [`useSubmitLeveragePositionIntent()`](https://github.com/icon-project/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/leverageYield/useSubmitLeveragePositionIntent.ts) — Run `increaseLeverage` / `decreaseLeverage` and report the intent
|
|
203
|
+
- [`useRunLeveragePositionOperation()`](https://github.com/icon-project/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/leverageYield/useRunLeveragePositionOperation.ts) — Run `withdraw` / `settle` / `cancel`; no intent, nothing to report
|
|
204
|
+
- [`useLeveragePositionPayoutAddress()`](https://github.com/icon-project/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
|
|
205
|
+
- [`useLeveragePositionFundingAllowance()`](https://github.com/icon-project/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/leverageYield/useLeveragePositionFundingAllowance.ts) — Whether the funding token is approved; the spender is chain-dependent
|
|
206
|
+
- [`useApproveLeveragePositionFunding()`](https://github.com/icon-project/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/leverageYield/useApproveLeveragePositionFunding.ts) — Approve it, against the spender the SDK resolves
|
|
207
|
+
- [`useLeveragePositionsForUser()`](https://github.com/icon-project/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/leverageYield/useLeveragePositionsForUser.ts) — A user's positions, discovered through their hub wallet
|
|
208
|
+
- [`useLeveragePositionAccount()`](https://github.com/icon-project/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/leverageYield/useLeveragePositionAccount.ts) — Collateral, debt, LTV and health factor
|
|
209
|
+
- [`useLeveragePositionInfo()`](https://github.com/icon-project/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/leverageYield/useLeveragePositionInfo.ts) — The position's collateral and borrow reserves
|
|
210
|
+
- [`useLeveragePositionCollateral()`](https://github.com/icon-project/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/leverageYield/useLeveragePositionCollateral.ts) — Collateral balance held
|
|
211
|
+
- [`useLeveragePositionPending()`](https://github.com/icon-project/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/leverageYield/useLeveragePositionPending.ts) — The pending-operation slot; a position permits one at a time
|
|
212
|
+
|
|
213
|
+
> Resolving means the intent is **live**, not that leverage moved. Off-hub (spoke) origins are
|
|
214
|
+
> experimental and unverified on-chain; see each hook's JSDoc.
|
|
215
|
+
|
|
189
216
|
### DEX Hooks
|
|
190
217
|
|
|
191
218
|
- [`usePools()`](https://github.com/icon-project/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/dex/usePools.ts) — List available pools
|
|
@@ -205,6 +232,19 @@ function SwapButton({ intentParams }: { intentParams: CreateIntentParams }) {
|
|
|
205
232
|
- [`useCreateSupplyLiquidityParams()`](https://github.com/icon-project/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/dex/useCreateSupplyLiquidityParams.ts) — Build tick range + liquidity params
|
|
206
233
|
- [`useCreateDecreaseLiquidityParams()`](https://github.com/icon-project/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/dex/useCreateDecreaseLiquidityParams.ts) — Build decrease params from position state
|
|
207
234
|
|
|
235
|
+
### Leverage Yield Hooks
|
|
236
|
+
|
|
237
|
+
- [`useLeverageYieldEffectiveApr()`](https://github.com/icon-project/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/leverageYield/useLeverageYieldEffectiveApr.ts) — Vault effective APR (AAVE rates + LSD yield, leverage-adjusted; refreshes 60s)
|
|
238
|
+
- [`useLeverageYieldPosition()`](https://github.com/icon-project/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/leverageYield/useLeverageYieldPosition.ts) — Live position snapshot: collateral, debt, LTV, health factor, idle assets (refreshes 30s)
|
|
239
|
+
- [`useLeverageYieldTotalAssets()`](https://github.com/icon-project/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/leverageYield/useLeverageYieldTotalAssets.ts) — Vault total underlying assets (TVL)
|
|
240
|
+
- [`useLeverageYieldPreviewRedeem()`](https://github.com/icon-project/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/leverageYield/useLeverageYieldPreviewRedeem.ts) — Assets received for redeeming shares (ERC-4626 `previewRedeem`)
|
|
241
|
+
- [`useLeverageYieldShareBalances()`](https://github.com/icon-project/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
|
|
242
|
+
- [`useLeverageYieldDeposit()`](https://github.com/icon-project/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/leverageYield/useLeverageYieldDeposit.ts) — Build the deposit payload (any token → `lsoda*` shares) for `useLeverageYieldVaultSwap`
|
|
243
|
+
- [`useLeverageYieldWithdraw()`](https://github.com/icon-project/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/leverageYield/useLeverageYieldWithdraw.ts) — Build the withdraw payload (`lsoda*` shares → any token) for `useLeverageYieldVaultSwap`
|
|
244
|
+
- [`useLeverageYieldVaultSwap()`](https://github.com/icon-project/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
|
|
245
|
+
- [`useLeverageYieldDetailedStatus()`](https://github.com/icon-project/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/leverageYield/useLeverageYieldDetailedStatus.ts) — Track a vault swap from its source tx, whichever completion path ran
|
|
246
|
+
- [`useLeverageYieldNotifySolver()`](https://github.com/icon-project/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)
|
|
247
|
+
|
|
208
248
|
### Migration Hooks
|
|
209
249
|
|
|
210
250
|
- [`useMigrateIcxToSoda()`](https://github.com/icon-project/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/migrate/useMigrateIcxToSoda.ts) — ICX/wICX (ICON) → SODA (Sonic)
|
|
@@ -218,9 +258,11 @@ function SwapButton({ intentParams }: { intentParams: CreateIntentParams }) {
|
|
|
218
258
|
|
|
219
259
|
- [`useRadfiSession()`](https://github.com/icon-project/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/bitcoin/useRadfiSession.ts) — Manage Bound Exchange session (login, auto-refresh)
|
|
220
260
|
- [`useRadfiAuth()`](https://github.com/icon-project/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/bitcoin/useRadfiAuth.ts) — Authenticate with Bound Exchange via BIP322 signing
|
|
261
|
+
- [`useEnsureRadfiAccessToken()`](https://github.com/icon-project/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
|
|
221
262
|
- [`useTradingWallet()`](https://github.com/icon-project/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/bitcoin/useTradingWallet.ts) — Get trading wallet address from persisted session
|
|
222
263
|
- [`useBitcoinBalance()`](https://github.com/icon-project/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/bitcoin/useBitcoinBalance.ts) — BTC balance for any address
|
|
223
264
|
- [`useTradingWalletBalance()`](https://github.com/icon-project/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/bitcoin/useTradingWalletBalance.ts) — Trading wallet balance from Bound Exchange API
|
|
265
|
+
- [`useBitcoinTradingSetup()`](https://github.com/icon-project/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)
|
|
224
266
|
- [`useFundTradingWallet()`](https://github.com/icon-project/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/bitcoin/useFundTradingWallet.ts) — Fund trading wallet from personal wallet
|
|
225
267
|
- [`useRadfiWithdraw()`](https://github.com/icon-project/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/bitcoin/useRadfiWithdraw.ts) — Withdraw from trading wallet
|
|
226
268
|
- [`useExpiredUtxos()`](https://github.com/icon-project/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/bitcoin/useExpiredUtxos.ts) — Fetch expired UTXOs (polls every 60s)
|
|
@@ -234,6 +276,10 @@ function SwapButton({ intentParams }: { intentParams: CreateIntentParams }) {
|
|
|
234
276
|
- [`useApproveToken()`](https://github.com/icon-project/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/partner/useApproveToken.ts) — Approve token
|
|
235
277
|
- [`useSetSwapPreference()`](https://github.com/icon-project/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/partner/useSetSwapPreference.ts) — Set swap preference
|
|
236
278
|
- [`useFeeClaimSwap()`](https://github.com/icon-project/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/partner/useFeeClaimSwap.ts) — Claim partner fees via swap
|
|
279
|
+
- [`useFeeClaimWithdraw()`](https://github.com/icon-project/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
|
|
280
|
+
- [`usePartnerCancelIntent()`](https://github.com/icon-project/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
|
|
281
|
+
- [`useGetUserIntent()`](https://github.com/icon-project/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
|
|
282
|
+
- [`useGetIntentDetails()`](https://github.com/icon-project/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/partner/useGetIntentDetails.ts) — Fetch the full intent details for a ProtocolIntents intent hash
|
|
237
283
|
|
|
238
284
|
### Recovery Hooks
|
|
239
285
|
|
|
@@ -252,6 +298,9 @@ function SwapButton({ intentParams }: { intentParams: CreateIntentParams }) {
|
|
|
252
298
|
- [`useEstablishTrustline()`](https://github.com/icon-project/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/shared/useEstablishTrustline.ts) — Request Stellar trustline
|
|
253
299
|
- [`useRequestTrustline()`](https://github.com/icon-project/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/shared/useRequestTrustline.ts) — **Deprecated**, use `useEstablishTrustline()`
|
|
254
300
|
- [`useStellarGate()`](https://github.com/icon-project/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/shared/useStellarGate.ts) — Sequences the Stellar destination prerequisites (activation → funding → trustline)
|
|
301
|
+
- [`useNearStorageCheck()`](https://github.com/icon-project/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)
|
|
302
|
+
- [`useRegisterNearStorage()`](https://github.com/icon-project/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
|
|
303
|
+
- [`useNearStorageGate()`](https://github.com/icon-project/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
|
|
255
304
|
|
|
256
305
|
### Sponsoring Hooks
|
|
257
306
|
|
|
@@ -280,7 +329,7 @@ These drive sponsored activation, where the SODAX sponsor pays the account's bas
|
|
|
280
329
|
|
|
281
330
|
### Swaps API Hooks (`sodax.api.swaps`)
|
|
282
331
|
|
|
283
|
-
Typed wrappers over the backend Swaps API
|
|
332
|
+
Typed wrappers over the backend Swaps API — one `useSwapsApi*` hook per endpoint (21 total). Highlights:
|
|
284
333
|
|
|
285
334
|
- [`useSwapsApiQuote()`](https://github.com/icon-project/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/swapsApi/useSwapsApiQuote.ts) — Solver quote for a cross-chain swap
|
|
286
335
|
- [`useSwapsApiCreateIntent()`](https://github.com/icon-project/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/swapsApi/useSwapsApiCreateIntent.ts) — Build an unsigned create-intent tx
|
|
@@ -289,13 +338,34 @@ Typed wrappers over the backend Swaps API v2 — one `useSwapsApi*` hook per end
|
|
|
289
338
|
|
|
290
339
|
See [`src/hooks/swapsApi/`](https://github.com/icon-project/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).
|
|
291
340
|
|
|
292
|
-
###
|
|
341
|
+
### Bridge API Hooks (`sodax.api.bridge`)
|
|
342
|
+
|
|
343
|
+
Typed wrappers over the backend Bridge API v2 — one `useBridgeApi*` hook per endpoint. Highlights:
|
|
344
|
+
|
|
345
|
+
- [`useBridgeApiSubmitTx()`](https://github.com/icon-project/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/bridgeApi/useBridgeApiSubmitTx.ts) — Hand a broadcast spoke-deposit tx to the backend relay pipeline
|
|
346
|
+
- [`useBridgeApiSubmitTxStatus()`](https://github.com/icon-project/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/bridgeApi/useBridgeApiSubmitTxStatus.ts) — Poll a submitted bridge tx by `(txHash, srcChainKey)`
|
|
347
|
+
|
|
348
|
+
See [`src/hooks/bridgeApi/`](https://github.com/icon-project/sodax-sdks/tree/main/packages/dapp-kit/src/hooks/bridgeApi) for the full set (tokens, allowance, approve, create intent, fee, bridgeable amount, bridgeable pair).
|
|
349
|
+
|
|
350
|
+
### API-key failures are terminal
|
|
351
|
+
|
|
352
|
+
Every retrying `useSwapsApi*`, `useLeverageYieldApi*` and `useBridgeApi*` hook defaults `retry` to [`retryUnlessAuthFailure()`](https://github.com/icon-project/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`.
|
|
353
|
+
|
|
354
|
+
`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.
|
|
355
|
+
|
|
356
|
+
### Utils
|
|
357
|
+
|
|
358
|
+
DEX param builders:
|
|
293
359
|
|
|
294
360
|
- [`createDepositParamsProps()`](https://github.com/icon-project/sodax-sdks/blob/main/packages/dapp-kit/src/utils/dex-utils.ts) — Build deposit params from pool data and spoke asset info
|
|
295
361
|
- [`createWithdrawParamsProps()`](https://github.com/icon-project/sodax-sdks/blob/main/packages/dapp-kit/src/utils/dex-utils.ts) — Build withdraw params with optional destination info
|
|
296
362
|
- [`createSupplyLiquidityParamsProps()`](https://github.com/icon-project/sodax-sdks/blob/main/packages/dapp-kit/src/utils/dex-utils.ts) — Build concentrated liquidity supply params
|
|
297
363
|
- [`createDecreaseLiquidityParamsProps()`](https://github.com/icon-project/sodax-sdks/blob/main/packages/dapp-kit/src/utils/dex-utils.ts) — Build decrease liquidity params
|
|
298
364
|
|
|
365
|
+
NEAR storage gate:
|
|
366
|
+
|
|
367
|
+
- [`resolveNearStorageGate()`](https://github.com/icon-project/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`)
|
|
368
|
+
|
|
299
369
|
## Development
|
|
300
370
|
|
|
301
371
|
```bash
|