@sodax/dapp-kit

dApp Kit is a collection of React components, hooks, and utilities designed to streamline dApp development within the Sodax ecosystem. It provides seamless integration with Sodax smart contracts, enabling easy data querying and transaction execution. Additionally, it offers built-in wallet connectivity for all supported wallets in the Sodax network, simplifying the user onboarding experience. Under the hood, dApp Kit leverages @sodax/wallet-kit and @sodax/sdk for seamless functionality.

Features

  • Money Market

    • Supply tokens to the money market (useSupply)

    • Withdraw tokens from the money market (useWithdraw)

    • Borrow tokens from the money market (useBorrow)

    • Repay borrowed tokens (useRepay)

    • Check token allowance (useMMAllowance)

    • Approve token spending (useMMApprove)

    • Get user reserves data (useUserReservesData)

    • Get reserves data (useReservesData)

    • Get humanized reserves data (useReservesHumanized)

    • Get list of reserves (useReservesList)

    • Get USD formatted reserves data (useReservesUsdFormat)

    • Get formatted user portfolio summary (useUserFormattedSummary)

  • Swap/Intent

    • Get quote for an intent order (useQuote)

    • Create and submit an swap intent order (useSwap)

    • Get status of an intent order (useStatus)

    • Check token allowance (useSwapAllowance)

    • Approve token spending (useSwapApprove)

    • Cancel a swap intent order (useCancelSwap)

  • Provider

    • Get hub chain provider (useHubProvider)

    • Get spoke chain provider (useSpokeProvider)

    • Get wallet provider (useWalletProvider)

  • Bridge

    • Bridge tokens between chains (useBridge)

    • Check token allowance for bridging (useBridgeAllowance)

    • Approve source token for bridging (useBridgeApprove)

    • Get max amount available to be bridged (useGetBridgeableAmount)

    • Get available destination tokens based on provided source token (useGetBridgeableTokens)

  • Shared

    • Derive user wallet address for hub abstraction (useDeriveUserWalletAddress)

    • Check if Stellar trustline is established for an asset (useStellarTrustlineCheck)

    • Request creation of Stellar trustline line for an asset (useRequestTrustline)

  • Staking

    • Stake SODA tokens to receive xSODA shares (useStake)

    • Unstake xSODA shares (useUnstake)

    • Instant unstake xSODA shares with penalty (useInstantUnstake)

    • Claim unstaked SODA tokens after unstaking period (useClaim)

    • Cancel unstake request (useCancelUnstake)

    • Check SODA token allowance for staking (useStakeAllowance)

    • Approve SODA token spending for staking (useStakeApprove)

    • Check xSODA token allowance for unstaking (useUnstakeAllowance)

    • Approve xSODA token spending for unstaking (useUnstakeApprove)

    • Check xSODA token allowance for instant unstaking (useInstantUnstakeAllowance)

    • Approve xSODA token spending for instant unstaking (useInstantUnstakeApprove)

    • Get comprehensive staking information (useStakingInfo)

    • Get unstaking information with penalty details (useUnstakingInfoWithPenalty)

    • Get unstaking information (useUnstakingInfo)

    • Get staking configuration (useStakingConfig)

    • Get stake ratio (SODA to xSODA conversion rate) (useStakeRatio)

    • Get instant unstake ratio (xSODA to SODA conversion rate with penalty) (useInstantUnstakeRatio)

    • Get converted assets amount for xSODA shares (useConvertedAssets)

Installation

Quick Start

  1. First, install the required dependencies:

  1. Set up the providers in your app:

  1. Use the hooks in your components:

Requirements

  • Node.js >= 18.0.0

  • React >= 19

  • TypeScript

API Reference

Components

Hooks

Money Market Hooks

Swap Hooks

Shared Hooks

Bridge Hooks

Contributing

We welcome contributions! Please see our Contributing Guidearrow-up-right for details.

Development

License

MITarrow-up-right

Support

Last updated