This function returns an array of TokenInfo objects, each containing detailed information about a supported swappable currency.
TokenInfo
objects representing the currencies available for swaps.Fetch the token info for a given token address.
The address of the token to fetch info for. e.g SP102V8P0F7JX67ARQ77WEA3D3CFB5XW39REDT0AM.token-alex
A promise that resolves to a TokenInfo
object or null
if the token is not found.
This function returns all possible routes for swapping between two specified currencies. It returns an array of AMMRoute, representing possible swap routes.
Get the amount of destination currency that will be received when swapping from one currency to another.
Get the amount of destination currency that will be received when swapping from one currency to another in the context of sponsor tx.
This function fetches the current balances of all supported tokens for a specified STX address. It returns an object where the keys are the currency identifiers (as defined in the Currency enum) and the values are the corresponding balances as bigint values.
The Stacks (STX) address to retrieve the balances for.
This function fetches the current price data for all supported tokens. It returns an object where the keys are the currency identifiers (as defined in the Currency enum) and the values are the corresponding prices in USD.
This function takes an AMMRoute and returns an array of TokenInfo objects representing the tokens involved in each step of the route, including the origin token.
The route to display.
Perform a swap between two currencies using the specified route and amount.
The Stacks (STX) address to execute the swap from.
The currency to swap from.
The currency to swap to.
The amount of the source currency to swap.
The minimum amount of the destination currency to receive.
Optional
customRoute: AMMRouteAn optional custom route for the swap.
Perform a swap between two currencies using the specified route and amount. Targetting sponsor tx.
The Stacks (STX) address to execute the swap from.
The currency to swap from.
The currency to swap to.
The amount of the source currency to swap.
The minimum amount of the destination currency to receive.
Optional
customRoute: AMMRouteAn optional custom route for the swap.
The AlexSDK class provides methods for interacting with a decentralized exchange (DEX) system, allowing users to fetch currency information, calculate routes for swaps, estimate fees and amounts, perform swaps, retrieve latest prices, and check balances.