You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
opts.includeTokens: (optional) Whether to fetch pool tokens as well. If set to false, you MUST provide a pair of token objects to the function using the param below
opts.tokens: (optional) Pool Tokens. Required when includeTokens is “true”
First it says, if includeTokens is false, then tokens is required.
Then the next line says the complete opposite, if includeTokens is true, then tokens is required.
Which is it? It's the former.
Next, the function should default includeTokens to true. It currently defaults to falsy, which is surprising behavior because that now means the tokens param must be passed or else the function fails. So tokens isn't really optional anymore.
The function should "just work" with the minimal params, that means it should fetch tokens by default. If the user chooses to provide tokens, they should opt into that feature by passing includeTokens=false.
Lastly, if the user chooses to provide tokens, how should the 2 tokens be ordered in the array? Order matters because it affects the swap quote. If you pass the wrong order, you get the wrong quote.
Even better, have the sdk ensure the token order is correct so the user doesn't have to worry about it. It knows the IDs of tokenA and tokenB, so it can easily sort the tokens param if its out of order. It can also do some basic validation, like if the passed tokens have the wrong ID.
The text was updated successfully, but these errors were encountered:
Thanks for pointing out the documentation errors. We introduced the includeTokens parameter specifically to limit requests, because there were complaints that the SDK made too many requests. We will take your very helpful suggestions into account as we work on the next release.
Please let me know if you have any other concerns. Cheers!
So I tried out the
includeTokens
andtokens
params and ended up thoroughly confused.First off, the docs are contradictory.
https://reach-sh.github.io/humble-sdk/LIQUIDITY-POOLS.html#fetchliquiditypool-parameters
First it says, if
includeTokens
isfalse
, thentokens
is required.Then the next line says the complete opposite, if
includeTokens
istrue
, thentokens
is required.Which is it? It's the former.
Next, the function should default
includeTokens
totrue
. It currently defaults to falsy, which is surprising behavior because that now means thetokens
param must be passed or else the function fails. Sotokens
isn't really optional anymore.The function should "just work" with the minimal params, that means it should fetch tokens by default. If the user chooses to provide tokens, they should opt into that feature by passing
includeTokens=false
.Lastly, if the user chooses to provide
tokens
, how should the 2 tokens be ordered in the array? Order matters because it affects the swap quote. If you pass the wrong order, you get the wrong quote.Even better, have the sdk ensure the token order is correct so the user doesn't have to worry about it. It knows the IDs of
tokenA
andtokenB
, so it can easily sort thetokens
param if its out of order. It can also do some basic validation, like if the passed tokens have the wrong ID.The text was updated successfully, but these errors were encountered: