-
Notifications
You must be signed in to change notification settings - Fork 920
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
make useScaffoldWriteContract
& useDeployedContractInfo
backward compatible
#1015
Conversation
useScaffoldWriteContract
& useDeployedContractInfo
backward compatible
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good stuff @technophile-04 this is great!
Left a tiny comment.
Shall we also console.warn("Warning: Using useScaffoldWriteContract with a string parameter is deprecated. Please use the object parameter version instead") log this warning in browser? if people use string param?
No strong opinion here. Up to you all.
P.S. I was trying to understand why we needed the explicit return type (introduced in #931) and not sure if we needed it there, but we definitely need it here because of the overloads (requires a function declaration syntax). So all good!
Ohh we didn't add any explicitly return type there, no? In https://github.com/scaffold-eth/scaffold-eth-2/pull/931/files#diff-9cc9e3c8fd6916932f4a4dd3a27f0147d2753318c962178abfa880cab12cc79e we just created a type for args obj |
@technophile-04 This is great!! The code looks good and it's working as expected.
I think the IDE messages are great, but it would be useful to give more visibility (and it's more annoying to see) by showing the warning log with the deprecated messages, too. |
Added the warning log feel free to suggest a better message! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@technophile-04 The console warn message looks good to me. Thanks!!
Description:
This allows developers to consume
useScaffoldWriteContract
anduseDeployedContractInfo
hook in both ways until we make breaking changes release :Example of
useScaffoldWriteContract
Old:
When using the Old way the IDE should give the warning :
New:
To test:
Copy this in page.tsx
Question:
Shall we also
console.warn("Warning: Using useScaffoldWriteContract with a string parameter is deprecated. Please use the object parameter version instead")
log this warning in browser? if people use string param?