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
useContract returns undefined
#288
Comments
hello @account4sO8sF3 , are you on the latest version of both the TypeScript and React SDK? also not 100% sure but it might be that we haven't made a release yet to be able to pass ABI as second parameter of useContract, in that case, you would need to install @thirdweb-dev/react@nightly and @thirdweb-dev/sdk@nightly for the time being. Hope that helps! |
Hi Nacho, thanks for the help!
Seems like it does not work, tried both 3.2.1 and 3.2.2-nightly-25a4773.
Also tried without the ABI argument, I assume I need to specify the ABI if
the contract is not deployed through the dashboard, right?
Also worth mentioning that this is a clean project created to test this
weird behavior, no extra deps or pages.
Appreciate your time.
…On Tue, Oct 11, 2022 at 3:30 PM Nacho Iacovino ***@***.***> wrote:
hello @account4sO8sF3 <https://github.com/account4sO8sF3> , are you on
the latest version of both the TypeScript and React SDK?
also not 100% sure but it might be that we haven't made a release yet to
be able to pass ABI as second parameter of useContract, in that case, you
would need to install @***@***.*** and
@***@***.*** for the time being.
Hope that helps!
—
Reply to this email directly, view it on GitHub
<#288 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AUPKFVSB3WGQQH3GPLXMXH3WCVMURANCNFSM6AAAAAARCHFJKA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Hey @account4sO8sF3 I just tested in the nightly version of the SDK and I'm getting the contract back, one thing I did notice is that you're getting the ABI incorrectly, because USDC it's actually a proxy contract you need to get it from the implementation contract, you can see how in this video: https://www.youtube.com/watch?v=gChC3Wiz1Cw Tell me if by changing the ABI it works correctly or you still get |
Please share a repo or the exact ABI you are using for the address, would
help a lot!
Also, how can the library know if the ABI is correct or not?
In ethers or web3 it just takes the ABI and fails on the transaction part,
not the contract initialization part.
Thanks for your answers!
…On Tue, Oct 11, 2022 at 3:57 PM Nacho Iacovino ***@***.***> wrote:
Hey @account4sO8sF3 <https://github.com/account4sO8sF3> I just tested in
the nightly version of the SDK and I'm getting the contract back, one thing
I did notice is that you're getting the ABI incorrectly, because USDC it's
actually a proxy contract you need to get it from the implementation
contract, you can see how in this video:
https://www.youtube.com/watch?v=gChC3Wiz1Cw
Tell me if by changing the ABI it works correctly or you still get
undefined back because I wasn't able to replicate that, otherwise I can
share a repo with my working version.
—
Reply to this email directly, view it on GitHub
<#288 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AUPKFVXKOLCQKXFR6USLTMTWCVP45ANCNFSM6AAAAAARCHFJKA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
here's the repo, tell me if this helps @account4sO8sF3 https://github.com/nachoiacovino/useContract-USDC |
Very helpful, seems like I was missing |
Initializing a contract through the useContract hook almost always results in
undefined
.index.js
App.js
Home.js
myABI.json
I am connected using the ConnectWallet button, and the network is the same as the one the contract is on (mainnet, the contract is the address of the USDC token).
Tried it with different ABIs and contract addresses, as well as without any ABI, just the address. Why does this happen? Does the hook work ONLY for contracts deployed using the Thirdweb Dashboard, or what's the case here?
The text was updated successfully, but these errors were encountered: