In order to use these methods, you must have external wallet funding enabled
under the “Funding” section of
the dashboard.
- A connected
fromWallet - The
amountto send - The
tokento send
fund method.
fund method
Given a connected wallet, the amount and the token, the fund method will trigger a transaction to the primary wallet.
This is the only method that is 100% headless, meaning it does not require any user interaction and shows no UI.
It takes a single object with the following properties:
Props
Wallet
The wallet that will be used to send the transaction.
{ address: string; decimals?: number } | undefined
The token of the transaction. When undefined, uses the wallet’s connected
chain’s native token.
number
The amount of the token to send.
Return value
Thefund method returns a Promise that resolves to the transaction hash.
Example
connectWalletForFunding method
This method will prompt the user to connect a wallet by opening a wallet list modal.
It doesn’t add the connected wallet to userWallets.
This method takes no arguments.
Return value
It returns a Promise that resolves to the wallet that the user connected.Example
promptAmountAndFund method
Given a connected wallet, the promptAmountAndFund method will prompt the user to enter an amount and token,
and then trigger a transaction to the primary wallet.
This method takes a single object with the following properties:
Props
Wallet
The wallet that will be used to send the transaction.
{ value: number; rule: 'exact' | 'recommended' | 'minimum' }
Allows you to specify the amount that the user will fund their wallet with.
The options for rule are as follows:
exact: The user will not be able to change the amount.recommended: Set initial amount, but user will be able to change it.minimum: Set initial amount, and user will be able to change it, but not below the minimum amount.
{ value: string; rule: 'exact' | 'recommended' | 'exact-with-amount' } | undefined
Allows you to specify the token that the user will fund their wallet with.
The options for rule are as follows:
exact: The user will not be able to change the selected token.recommended: Set initial selected token, but user will be able to change it.exact-with-amount: Same asexact, and also treats theamountparam as relative to the selected token rather than USD.
number[] | { token: string; values: number[] }
Allows you to define the initial quick suggestions that show up until first user interaction.If an array is passed directly, uses $ (
USD) as the token.If a token is provided, but doesn’t correspond to the selected token, quick suggestions will NOT be shown.Return value
void