Summary
Dynamic Send Balance Widget allows users to send their funds to another wallet when using an embedded wallet. Users using embedded wallets will automatically have a send button in the dynamic widget, or you can trigger the same UI from your website using ouruseSendBalance
hook.
DynamicWidget usage
If your website is using the Dynamic Widget, the send button will be automatically available for users using embedded wallets. When a user opens the Dynamic Widget and selects an email based wallet, for example, theSend
button will appear for them.
useSendBalance hook
In case you need to programmatically open the send balance widget, you can use our useSendBalance hook to request the UI and optionally prepopulate the form for the user.How it works
The useSendBalance hook depends on the DynamicContextProvider, so it has to be used as a child of the Dynamic context. When you use the hook, you will get a function namedopen
. That method accepts the follow options:
Parameter | Type | Description |
---|---|---|
recipientAddress | String | The initial recipient address |
value | ethers.BigNumber | The initial transaction amount |
open
function will return a promise; If successful, the promise will be resolved with the transaction; if not successful, the promise will be rejected accompanied by the error collected from the provider.
Here is an example of a custom Send button