Skip to content

Commit ebf9e73

Browse files
authored
Fix UtilsAPI javadocs per feedback from SW DAO (#109)
1 parent 8e9aee6 commit ebf9e73

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

src/api/UtilsAPI.ts

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,12 @@ export default class UtilsAPI {
6969
*
7070
* @param fromToken Address of token being sold
7171
* @param toToken Address of token being bought
72-
* @param rawAmount String quantity of token to sell (ex: "0.5")
72+
* @param rawAmount String quantity of token to sell in token decimals (ex: "5000000" = 5 USDC)
7373
* @param useBuyAmount When true, amount is `buyAmount` of `toToken`,
7474
* When false, amount is `sellAmount` of `fromToken`
7575
* @param fromAddress SetToken address which holds the buy / sell components
7676
* @param setToken SetTokenAPI instance
77-
* @param gasPrice (Optional) gasPrice to calculate gas costs with (Default: fetched from EthGasStation)
77+
* @param gasPrice gasPrice to calculate gas costs with
7878
* @param slippagePercentage (Optional) maximum slippage, determines min receive quantity. (Default: 2%)
7979
* @param isFirmQuote (Optional) Whether quote request is indicative or firm
8080
* @param feePercentage (Optional) Default: 0
@@ -127,28 +127,27 @@ export default class UtilsAPI {
127127
}
128128

129129
/**
130-
* Call 0x API to generate a trade quote for two SetToken components. By default, swap quotes
130+
* Batch multiple calls to 0x API to generate trade quotes SetToken component pairs. By default, swap quotes
131131
* are fetched for 0x's public endpoints using their `https://api.0x.org`, `https://<network>/api.0x.org`
132132
* url scheme. These open endpoints are rate limited at ~3 req/sec
133133
*
134134
* It's also possible to make calls from non-browser context with an API key using the `https://gated.api.0x.org`
135135
* url scheme.
136136
*
137-
* 0x rate-limits calls per API key as follows:
137+
* Officially 0x rate-limits calls *per API key* as follows (mileage may vary):
138138
*
139139
* > Ethereum: 10 requests per second/200 requests per minute.
140140
* > Other networks: 30 requests per second.
141141
*
142-
* They also permit parallelization and allow making up to 50 requests in parallel. In testing (March 2022)
143-
* we found this worked on Optimism and Ethereum but consistently 429'd (too many reqs) on Polygon. A
144-
* delay step parameter option is available to stagger parallelized requests and is set to 25ms by default.
142+
* The `delayStep` parameter option allows you to stagger parallelized requests to stay within rate limits
143+
* and is set to 25ms by default.
145144
*
146145
* @param orderPairs SwapOrderPairs array
147146
* @param useBuyAmount When true, amount is `buyAmount` of `toToken`,
148147
* When false, amount is `sellAmount` of `fromToken`
149148
* @param fromAddress SetToken address which holds the buy / sell components
150149
* @param setToken SetTokenAPI instance
151-
* @param gasPrice (Optional) gasPrice to calculate gas costs with (Default: fetched from EthGasStation)
150+
* @param gasPrice gasPrice to calculate gas costs with
152151
* @param slippagePercentage (Optional) maximum slippage, determines min receive quantity. (Default: 2%)
153152
* @param isFirmQuote (Optional) Whether quote request is indicative or firm
154153
* @param feePercentage (Optional) Default: 0

0 commit comments

Comments
 (0)