-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GetRates params seems not work in @ton-api/client
#221
Comments
@ton-api/client
Yes, the issue is present and reproducible. I found that it is caused by the current version of the SDK incorrectly handling the passing of multiple tokens as an array. The Current WorkaroundAs a temporary solution, you can pass a single string where tokens are listed separated by commas, even within the array. Here's the corrected code: const rates = await client.rates.getRates({
tokens: ['ton,EQC98_qAmNEptUtPc7W6xdHh_ZHrBUFpw5Ft_IzNU20QAJav'], // Comma-separated in one string
currencies: ['USD'],
});
console.log(rates); Notes:
I will fix this behavior in future SDK versions. Thank you for bringing it to my attention! |
@mois-ilya Thank you for the support. 🤟 Also, I found another problem based on this. If I call getRates in SDK as following: const rates = await client.rates.getRates({
tokens: ['ton,EQC98_qAmNEptUtPc7W6xdHh_ZHrBUFpw5Ft_IzNU20QAJav'], // Comma-separated in one string
currencies: ['USD'],
});
console.log(rates); Then I will get the results: {
rates: {
TON: {
prices: [Object],
diff24h: [Object],
diff7d: [Object],
diff30d: [Object]
},
EQC98QAmNEptUtPc7W6xdHhZHrBUFpw5FtIzNU20QAJav: {
prices: [Object],
diff24h: [Object],
diff7d: [Object],
diff30d: [Object]
}
}
} Let's focus on the address key of the result object, and that is different from the original address:
The underlines are missing, so I use raw address as key to skip this. |
Reproduction steps
Install
@ton-api/[email protected]
,@ton/[email protected]
use it to get rates of tsTON, TON
Actual result
Expected result
However, if I change code to the below:
It works but I think it's not what we expect.
The text was updated successfully, but these errors were encountered: