@@ -69,12 +69,12 @@ export default class UtilsAPI {
69
69
*
70
70
* @param fromToken Address of token being sold
71
71
* @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 )
73
73
* @param useBuyAmount When true, amount is `buyAmount` of `toToken`,
74
74
* When false, amount is `sellAmount` of `fromToken`
75
75
* @param fromAddress SetToken address which holds the buy / sell components
76
76
* @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
78
78
* @param slippagePercentage (Optional) maximum slippage, determines min receive quantity. (Default: 2%)
79
79
* @param isFirmQuote (Optional) Whether quote request is indicative or firm
80
80
* @param feePercentage (Optional) Default: 0
@@ -127,28 +127,27 @@ export default class UtilsAPI {
127
127
}
128
128
129
129
/**
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
131
131
* are fetched for 0x's public endpoints using their `https://api.0x.org`, `https://<network>/api.0x.org`
132
132
* url scheme. These open endpoints are rate limited at ~3 req/sec
133
133
*
134
134
* It's also possible to make calls from non-browser context with an API key using the `https://gated.api.0x.org`
135
135
* url scheme.
136
136
*
137
- * 0x rate-limits calls per API key as follows:
137
+ * Officially 0x rate-limits calls * per API key* as follows (mileage may vary) :
138
138
*
139
139
* > Ethereum: 10 requests per second/200 requests per minute.
140
140
* > Other networks: 30 requests per second.
141
141
*
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.
145
144
*
146
145
* @param orderPairs SwapOrderPairs array
147
146
* @param useBuyAmount When true, amount is `buyAmount` of `toToken`,
148
147
* When false, amount is `sellAmount` of `fromToken`
149
148
* @param fromAddress SetToken address which holds the buy / sell components
150
149
* @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
152
151
* @param slippagePercentage (Optional) maximum slippage, determines min receive quantity. (Default: 2%)
153
152
* @param isFirmQuote (Optional) Whether quote request is indicative or firm
154
153
* @param feePercentage (Optional) Default: 0
0 commit comments