diff --git a/README.md b/README.md index cac6b4f..29432f0 100644 --- a/README.md +++ b/README.md @@ -46,6 +46,13 @@ Get the swap fee (liquidity provider fee) between two currencies. ```javascript async function getFeeRate(from: Currency, to: Currency): Promise; ``` +Exceptions: +```javascript +- "Failed to fetch token mappings" +- "No AMM pools in route" +- "Too many AMM pools in route" +- "Error calling read-only function" +``` ### getRouter @@ -54,6 +61,11 @@ Get the router path for swapping between two currencies. ```javascript async function getRouter(from: Currency, to: Currency): Promise; ``` +Exceptions: +```javascript +- "Failed to fetch token mappings" +- "Can't find route" +``` ### getAmountTo @@ -62,6 +74,13 @@ Get the amount of destination currency that will be received when swapping from ```javascript async function getAmountTo(from: Currency, fromAmount: bigint, to: Currency): Promise; ``` +Exceptions: +```javascript +- "Failed to fetch token mappings" +- "No AMM pool found for the given route" +- "Too many AMM pools in route" +- "Error calling read-only function" +``` ### runSwap @@ -71,6 +90,13 @@ Perform a swap between two currencies using the specified route and amount. function runSwap(stxAddress: string, currencyX: Currency, currencyY: Currency, fromAmount: bigint, minDy: bigint, router: Currency[]): TxToBroadCast; ``` +Exceptions: +```javascript +- "Failed to fetch token mappings" +- "Can't find AMM route" +- "Token mapping not found" +- "Too many AMM pools in route" +``` **getLatestPrices** @@ -79,6 +105,10 @@ This function fetches the current price data for all supported tokens. It return ```javascript async function getLatestPrices(): Promise>; ``` +Exceptions: +```javascript +- "Failed to fetch token mappings" +``` **getBalances** @@ -87,6 +117,10 @@ This function fetches the current balances of all supported tokens for a specifi ```javascript async function getBalances(stxAddress: string): Promise>; ``` +Exceptions: +```javascript +- "Failed to fetch token mappings" +``` **fetchSwappableCurrency** @@ -95,6 +129,10 @@ This function returns an array of `TokenInfo` objects, each containing detailed ```javascript function fetchSwappableCurrency(): Promise; ``` +Exceptions: +```javascript +- "Failed to fetch token mappings" +``` ## Installation