useFunding
Hook to open the funding interface using the Wallet Services plugin.
info
Please note that this hook doesn't work for external wallet logins. It only works for social login embedded wallets.
Import
import { useFunding } from '@web3auth/modal/react'
Usage
import { useFunding } from '@web3auth/modal/react'
function FundingButton() {
const { showFunding, loading, error } = useFunding()
return (
<div>
<button onClick={() => showFunding()} disabled={loading}>
{loading ? 'Opening...' : 'Open Funding'}
</button>
{error && <div>Error: {error.message}</div>}
</div>
)
}
Return type
import { type IUseFunding } from '@web3auth/modal/react'
loading
boolean
Whether the funding interface is being opened.
error
Web3AuthError | null
Error that occurred while opening the funding interface.
showFunding
(showFundingParams?: BaseEmbedControllerState["showFunding"]) => Promise<void>
Function to open the funding interface. Accepts optional parameters for customizing the view.