Skip to main content

Withdrawal Widget

For apps that define an account for the user, like an embedded wallet or smart contract wallet, the withdraw widget allows the user to move assets out of their account. The destination of a withdrawal can be any valid address like the user’s EOA or a centralized exchange account deposit address. The destination also can be a different asset on a different chain from the origin. E.g. withdraw pUSD from a user’s prediction market account on Polygon to an EOA on MegaETH as USDC, executed in one user interaction. In practice, the withdrawal widget (openWithdrawal) is opened by a different button in the app user interface than the standard deposit. For complete example implementations of opening the Halliday SDK withdrawal widget, see the Payments SDK Example Apps page. Before the withdraw button is clicked, the withdraw configuration must be set.

Configuring the Withdrawal options

Withdrawal configuration options are part of the Halliday config which is documented on the widget documentation page.

React

With the React SDK, the constant withdraw options can be defined in the properties of a HallidayPaymentsProvider.
A connected wallet funder object can be passed using the updateWallets function after a user connects their wallet to the app.

JavaScript

Constant withdraw options can be passed to the constructor of a HallidayPayments object or passed later using the updateConfig function. Partial configurations are valid for either function.

Opening the Withdrawal widget

To display the withdrawal widget, use the openWithdrawal function.
copy