yearn / yearn-sdk

🦧 SDK for the yearn.finance platform. WIP
https://npm.im/@yfi/sdk
MIT License
53 stars 56 forks source link

Attempts to connect to http://localhost:8545 even when providing a remote ETH node. #261

Closed theoboldfrazier closed 2 years ago

theoboldfrazier commented 2 years ago

When instantiating the yearn sdk and passing in a JsonRpcProvider to a remote node, the sdk is still attempting to connect to a node at localhost:8545.

zannis commented 2 years ago

Could you please post the code of how you are instantiating the Yearn SDK object?

theoboldfrazier commented 2 years ago

We instantiate it in a few of our packages, but each time follows this pattern.

const network = 1 // 1 for mainnet const provider = new JsonRpcProvider(process.env.REACT_APP_ETHEREUM_NODE_URL) export const yearnSdk = new Yearn(network, { provider, disableAllowlist: true })

REACT_APP_ETHEREUM_NODE_URL is defined and a correct URL to our eth node.

We instantiate it in this repo https://github.com/shapeshift/lib, which has packages used in our web repo here: https://github.com/shapeshift/web

When we deploy it to the cloud here https://app.shapeshift.com, you can see in the console there are CSP errors of trying to connect to localhost:8545 (not seen locally because localhost is part of self in local dev). The best we've tracked it down is in the yearn sdk something is trying to connect to a node on localhost.

theoboldfrazier commented 2 years ago

Found an issue in our libraries where env was injected to our dependencies during local development, but not on the production build. Closing this issue as it was not an issue in the yearn-sdk.