When to use:
- User needs a specific token for a purchase
- Pre-transaction funding when balance is insufficient
- Helping users get the right currency for your game
Installation
- npm
- yarn
Quick Start
Parameters
| Parameter | Type | Description |
|---|---|---|
flow | 'ADD_TOKENS' | Required. Specifies the fund flow |
toTokenAddress | string | Target token to acquire |
toAmount | string | Amount of target token needed |
showBackButton | boolean | Show back button |
How It Works
The Fund flow analyzes the user’s current balances and presents the best options:Events
| Event | Description | Payload |
|---|---|---|
SUCCESS | Tokens acquired | { method, token, amount } |
FAILURE | Acquisition failed | { error } |
CLOSE | User closed widget | — |
method field indicates how tokens were acquired: 'swap', 'bridge', or 'onramp'.
Use Case: Insufficient Balance
A common pattern is triggering the Fund flow when a user tries to make a purchase but lacks sufficient tokens. See thePurchaseWithFunding component in the code snippets above.