Skip to content
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

[WEB-1304-205] When calling deposit() tx throws a status 400 error #205

Open
carlomigueldy opened this issue Feb 2, 2022 · 6 comments
Open

Comments

@carlomigueldy
Copy link

carlomigueldy commented Feb 2, 2022

@yearn-linear-gh-sync yearn-linear-gh-sync bot changed the title When calling deposit() tx throws a status 400 error [WEB-1304-205] When calling deposit() tx throws a status 400 error Feb 2, 2022
@yearn-linear-gh-sync yearn-linear-gh-sync bot changed the title [WEB-1304-205] When calling deposit() tx throws a status 400 error [WEB-1304-205] When calling deposit() tx throws a status 400 error Feb 2, 2022
@jstashh
Copy link
Contributor

jstashh commented Feb 2, 2022

@carlomigueldy It looks like you're trying to send a transaction using alchemy as the provider, I think this should be something you're able to sign with, e.g. the write provider should be from a wallet

@carlomigueldy
Copy link
Author

@carlomigueldy It looks like you're trying to send a transaction using alchemy as the provider, I think this should be something you're able to sign with, e.g. the write provider should be from a wallet

Oh, that makes more sense. Thank you @jstashh !

@carlomigueldy
Copy link
Author

I wasn't able to do it successfully, are you able to show me a Write provider example? I tried Signer but that doesn't work @jstashh

@jstashh
Copy link
Contributor

jstashh commented Feb 4, 2022

@carlomigueldy you'll probably need to pass in metamask (there should be examples of how to connect ethers to Metamask) or a ethers Wallet object:
https://www.npmjs.com/package/@ethersproject/wallet
https://docs.ethers.io/v5/api/signer/#Wallet

@carlomigueldy
Copy link
Author

carlomigueldy commented Feb 6, 2022

@jstashh

I am struggling to find an example for that unfortunately, and I am looking at yearn-finance-v3 repo on how it provider was being passed down and of what type but from my understanding it's still a JsonRpcProvider type, so right now I am clueless

This is what I have in my code, and I couldn't get depost() transaction to work or make it prompt by MetaMask

export const yearnSDKClient = new Yearn(chainId, {
  provider: new JsonRpcProvider(env.ALCHEMY_API_ETHEREUM_MAINNET_HTTPS_URL),
  disableAllowlist: true,
})

Then I tried what you suggested, to pass in MetaMask

export const yearnSDKClient = new Yearn(chainId, {
  provider: window.ethereum as any,
  disableAllowlist: true,
})

But still couldn't get it to work and this is the exception I am getting

image

Tried this one but didn't work and it throws the same exception

const web3Provider = new ethers.providers.Web3Provider(window.ethereum as any)

export const yearnSDKClient = new Yearn(chainId, {
  provider: web3Provider.provider as any,
  disableAllowlist: true,
})

cc @xgambitox

@carlomigueldy
Copy link
Author

Hi, still need help on this -- Would appreciate guidance with code snippets 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants