fundWallet
method documented belowuseFundWallet
hook from the Privy SDK as follows:
fundWallet
.fundWallet
method will open a modal that contains a list of funding options the user can take. If only one funding method was enabled for your app, Privy will navigate the user directly to that specific flow.You can pass additional configurations to the funding flow in the second, optional parameter to fundWallet
.fundWallet
to override your Dashboard configuration.To do so, as the second, optional parameter to fundWallet
, pass an object with the following fields:Parameter | Type | Description |
---|---|---|
cluster | {name: Cluster} | Optional. An object for the Cluster on which users should fund their accounts. Defaults to mainnet-beta . |
amount | string | Required if asset is set, optional otherwise. The amount of the asset to fund as a decimal string. Defaults to the amount you configured in the Privy Dashboard. |
defaultFundingMethod | 'card' | 'exchange' | 'wallet' | 'manual' | Optional. Specifying the default funding method will send the user directly to the card / exchange provider, directly open the wallet transfer, or directly open the manual QR wallet transfer screen. Additional configured payment options will be shown after the default funding method. |
card.preferredProvider | 'coinbase' | 'moonpay' | Optional. The preferred card provider to use for funding. If not specified, users will be directed to one of these providers initially and given an option to navigate to a different later. |
uiConfig.receiveFundsTitle | string | Optional. Configure the title of the “Receive funds” screen. |
uiConfig.receiveFundsSubtitle | string | Optional. Configure the subtitle of the “Receive funds” screen. |
onUserExited
callback that can be provided to the useFundWallet
hook. The address
, chain
, fundingMethod
, and balance
(value of the wallet being funded) are available via the callback, which fires when users exit the funding flow.For example, if you want to prompt a user to fund their wallet upon logging in for the first time as a part of your onboarding flow:uiConfig
options in the fundWallet
method. You can set the receiveFundsTitle
and receiveFundsSubtitle
to customize the title and subtitle of the screen.You can then call fundWallet
like so to customize the UI: