Usage
The SwapFlow component handles the entire swap process. It takes in various props like inAmount, outAmount, inToken, and outToken, as well as custom content to display during different steps of the process.
Props:
inAmount
: The amount of the input token.outAmount
: The amount of the output token.inToken
: An object representing the input token (e.g., symbol, logo).outToken
: An object representing the output token (e.g., symbol, logo).mainContent
: The main content displayed during the swap.failedContent
: The content shown if the swap fails.successContent
: The content shown if the swap succeeds.swapStatus
: The current status of the swap (loading, success, or failed).
the SwapFlow.Swap component is a built-in component that displays the swap steps. It takes in the next props:
inUsd
: The amount of the input token in USD.outUsd
: The amount of the output token in USD.steps
: An array of steps in the swap process.currentStep
: The current step in the swap process.
the steps array is an array of objects representing the steps in the swap process. Each object has the next properties:
id
: The step ID.title
: The title of the step.image
: The URL of the image for the step.timeout
: The timeout for the step (optional).
the SwapFlow.FailedContent component is a built-in component that displays the failed content. It takes in the next props:
error
: The error message.
the SwapFlow.SuccessContent component is a built-in component that displays the success content. It takes in the next props:
title
: The title of the success message.explorerUrl
: The URL to the transaction explorer.
Last updated