Closed miguelmota closed 2 years ago
Hi @miguelmota,
How often are you instantiating the SDK? It fetches assets on initialization so if it's done a lot then there could be some rate limiting - here's the service - https://github.com/yearn/yearn-sdk/blob/master/src/services/assets.ts. We had this problem in our caching api - it has background threads running periodic jobs which can't share state, so a new instance of the SDK has to be used every time they're run.
To fix it I added the ability to pass in the asset service state on initialization - https://github.com/yearn/yearn-sdk/blob/master/src/yearn.ts#L94. You can get it from the asset service by calling yearn.services.asset. makeSerializedState
- here's how we do it in our caching api - https://github.com/yearn/yearn-caching-api/blob/0f50dab9076f08f60e9359de2f5ea46e3462d580/plugins/sdk.mjs#L47-L80
Please let me know if you have any other questions/issues
@jstashh thanks! We're using the sdk on the backend so there's no need for asset service so sounds like a good fix to pass it in. Will check it out
Closing issue but i'll let you know if anything else comes up
Hi, awesome sdk
Is there a way to remove this console log or handle the error appropriately? It happens on sdk initialization
console log is coming from here
https://github.com/yearn/yearn-sdk/blob/f53b76bfdb5e80f7bd2debe27cb4ba97f9e54aeb/src/services/assets.ts#L78