@sodax/dapp-kit 1.3.1-beta-rc3 → 1.4.0-beta

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 (36) hide show
  1. package/README.md +36 -0
  2. package/dist/index.d.mts +581 -11
  3. package/dist/index.d.ts +581 -11
  4. package/dist/index.js +700 -62
  5. package/dist/index.js.map +1 -1
  6. package/dist/index.mjs +681 -62
  7. package/dist/index.mjs.map +1 -1
  8. package/package.json +3 -3
  9. package/src/hooks/bitcoin/index.ts +1 -0
  10. package/src/hooks/bitcoin/useRadfiAuth.ts +7 -25
  11. package/src/hooks/bitcoin/useRadfiSession.ts +25 -47
  12. package/src/hooks/bitcoin/useRadfiWithdraw.ts +85 -0
  13. package/src/hooks/bitcoin/useRenewUtxos.ts +1 -1
  14. package/src/hooks/dex/index.ts +16 -0
  15. package/src/hooks/dex/useClaimRewards.ts +68 -0
  16. package/src/hooks/dex/useCreateDecreaseLiquidityParams.ts +41 -0
  17. package/src/hooks/dex/useCreateDepositParams.ts +43 -0
  18. package/src/hooks/dex/useCreateSupplyLiquidityParams.ts +84 -0
  19. package/src/hooks/dex/useCreateWithdrawParams.ts +44 -0
  20. package/src/hooks/dex/useDecreaseLiquidity.ts +78 -0
  21. package/src/hooks/dex/useDexAllowance.ts +87 -0
  22. package/src/hooks/dex/useDexApprove.ts +55 -0
  23. package/src/hooks/dex/useDexDeposit.ts +64 -0
  24. package/src/hooks/dex/useDexWithdraw.ts +54 -0
  25. package/src/hooks/dex/useLiquidityAmounts.ts +187 -0
  26. package/src/hooks/dex/usePoolBalances.ts +90 -0
  27. package/src/hooks/dex/usePoolData.ts +57 -0
  28. package/src/hooks/dex/usePools.ts +48 -0
  29. package/src/hooks/dex/usePositionInfo.ts +88 -0
  30. package/src/hooks/dex/useSupplyLiquidity.ts +91 -0
  31. package/src/hooks/index.ts +1 -0
  32. package/src/hooks/provider/useSpokeProvider.ts +15 -0
  33. package/src/index.ts +1 -0
  34. package/src/utils/dex-utils.ts +177 -0
  35. package/src/utils/index.ts +1 -0
  36. package/src/hooks/bitcoin/radfiConstants.ts +0 -2
package/README.md CHANGED
@@ -64,6 +64,19 @@ dApp Kit is a collection of React components, hooks, and utilities designed to s
64
64
  - Get instant unstake ratio (xSODA to SODA conversion rate with penalty) (`useInstantUnstakeRatio`)
65
65
  - Get converted assets amount for xSODA shares (`useConvertedAssets`)
66
66
 
67
+ - DEX (Decentralized Exchange)
68
+ - Get available pools list (`usePools`)
69
+ - Get pool data for a selected pool (`usePoolData`)
70
+ - Get token balances for pool tokens (`usePoolBalances`)
71
+ - Get position information by token ID (`usePositionInfo`)
72
+ - Deposit tokens to a pool (`useDexDeposit`)
73
+ - Withdraw tokens from a pool (`useDexWithdraw`)
74
+ - Check token allowance for DEX operations (`useDexAllowance`)
75
+ - Approve token spending for DEX operations (`useDexApprove`)
76
+ - Calculate liquidity amounts based on price range (`useLiquidityAmounts`)
77
+ - Supply liquidity to a pool (`useSupplyLiquidity`)
78
+ - Decrease liquidity from a position (`useDecreaseLiquidity`)
79
+
67
80
  ## Installation
68
81
 
69
82
  ```bash
@@ -416,6 +429,29 @@ function BridgeComponent() {
416
429
  - [`useGetBridgeableAmount()`](https://github.com/icon-project/sodax-frontend/tree/main/packages/dapp-kit/src/hooks/bridge/useGetBridgeableAmount.ts) - Get maximum amount available to be bridged
417
430
  - [`useGetBridgeableTokens()`](https://github.com/icon-project/sodax-frontend/tree/main/packages/dapp-kit/src/hooks/bridge/useGetBridgeableTokens.ts) - Get available destination tokens for bridging
418
431
 
432
+ #### DEX Hooks
433
+ - [`usePools()`](https://github.com/icon-project/sodax-frontend/tree/main/packages/dapp-kit/src/hooks/dex/usePools.ts) - Get available pools list from the DEX service
434
+ - [`usePoolData()`](https://github.com/icon-project/sodax-frontend/tree/main/packages/dapp-kit/src/hooks/dex/usePoolData.ts) - Get pool data for a selected pool
435
+ - [`usePoolBalances()`](https://github.com/icon-project/sodax-frontend/tree/main/packages/dapp-kit/src/hooks/dex/usePoolBalances.ts) - Get token balances for pool tokens
436
+ - [`usePositionInfo()`](https://github.com/icon-project/sodax-frontend/tree/main/packages/dapp-kit/src/hooks/dex/usePositionInfo.ts) - Get position information by token ID
437
+ - [`useDexDeposit()`](https://github.com/icon-project/sodax-frontend/tree/main/packages/dapp-kit/src/hooks/dex/useDexDeposit.ts) - Deposit tokens to a pool
438
+ - [`useDexWithdraw()`](https://github.com/icon-project/sodax-frontend/tree/main/packages/dapp-kit/src/hooks/dex/useDexWithdraw.ts) - Withdraw tokens from a pool
439
+ - [`useDexAllowance()`](https://github.com/icon-project/sodax-frontend/tree/main/packages/dapp-kit/src/hooks/dex/useDexAllowance.ts) - Check token allowance for DEX operations
440
+ - [`useDexApprove()`](https://github.com/icon-project/sodax-frontend/tree/main/packages/dapp-kit/src/hooks/dex/useDexApprove.ts) - Approve token spending for DEX operations
441
+ - [`useLiquidityAmounts()`](https://github.com/icon-project/sodax-frontend/tree/main/packages/dapp-kit/src/hooks/dex/useLiquidityAmounts.ts) - Calculate liquidity amounts based on price range
442
+ - [`useSupplyLiquidity()`](https://github.com/icon-project/sodax-frontend/tree/main/packages/dapp-kit/src/hooks/dex/useSupplyLiquidity.ts) - Supply liquidity to a pool
443
+ - [`useDecreaseLiquidity()`](https://github.com/icon-project/sodax-frontend/tree/main/packages/dapp-kit/src/hooks/dex/useDecreaseLiquidity.ts) - Decrease liquidity from a position
444
+ - [`useCreateDepositParams()`](https://github.com/icon-project/sodax-frontend/tree/main/packages/dapp-kit/src/hooks/dex/useCreateDepositParams.ts) - Build and memoize pool deposit params with basic amount validation
445
+ - [`useCreateWithdrawParams()`](https://github.com/icon-project/sodax-frontend/tree/main/packages/dapp-kit/src/hooks/dex/useCreateWithdrawParams.ts) - Build and memoize pool withdrawal params with basic amount validation
446
+ - [`useCreateSupplyLiquidityParams()`](https://github.com/icon-project/sodax-frontend/tree/main/packages/dapp-kit/src/hooks/dex/useCreateSupplyLiquidityParams.ts) - Build and memoize supply liquidity params with price and slippage validation
447
+ - [`useCreateDecreaseLiquidityParams()`](https://github.com/icon-project/sodax-frontend/tree/main/packages/dapp-kit/src/hooks/dex/useCreateDecreaseLiquidityParams.ts) - Build and memoize decrease liquidity params with percentage and slippage validation
448
+
449
+ #### DEX Utils
450
+ - [`createDepositParamsProps()`](https://github.com/icon-project/sodax-frontend/tree/main/packages/dapp-kit/src/utils/dex-utils.ts) - Create deposit params for a pool token using pool data and spoke asset info
451
+ - [`createWithdrawParamsProps()`](https://github.com/icon-project/sodax-frontend/tree/main/packages/dapp-kit/src/utils/dex-utils.ts) - Create withdraw params for a pool token with optional destination info
452
+ - [`createSupplyLiquidityParamsProps()`](https://github.com/icon-project/sodax-frontend/tree/main/packages/dapp-kit/src/utils/dex-utils.ts) - Create concentrated liquidity supply params from price range, amounts, and slippage
453
+ - [`createDecreaseLiquidityParamsProps()`](https://github.com/icon-project/sodax-frontend/tree/main/packages/dapp-kit/src/utils/dex-utils.ts) - Create decrease liquidity params from position info, percentage, and slippage
454
+
419
455
  ## Contributing
420
456
 
421
457
  We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for details.