Decent has built a tailored solution to accomplish this goal that we call the Onboarding Modal. Please find key links here:
The Onboarding Modal enables users to connect their primary wallet, browse token balances, and fill their application wallet with any token on any chain. Developers can specify the destination token, write custom tool tips to explain the onboarding flow, and create entirely custom themes to fit the modal to their existing interface.
Decent’s components are not compatible with React Native applications currently. We recommend developers re-create the Onboarding Modal via the following steps.
Decent is compatible with any wallet client. This example uses Viem. This repository, web3-react-native-dapp-viem
(link) is a solid starter reference.
This example references **React Native’s Fetch API** to send API requests and a swap + transfer Decent API request, which you can run in the Developer Console here.
The txConfig
object contains all of the logic for your onboarding flow. For example, if your application requires ETH on Base and app-scoped accounts:
dstToken
and dstChainId
should be set to the USDC address on BasereceiverAddress
should be the user’s account address within your appsrcToken
and srcChainId
will be selected by the user. We will address this selection when describing how to build out the modal interface.slippage
fixed at 1. For most swaps, slippage will be significantly less than 1%. The difference will be refunded to the user as the transaction completes.sender
address will be the connected wallet initiating the transaction.actionType
should be 'swap-action'
and swapDirection
should be 'exact-amount-in
.<aside>
📓 If you would like to use Decent’s React hooks package versus direct HTTP requests, please see the useBoxAction
documentation here & ****the useDecentScan
documentation to track transactions here.
</aside>