-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Suggestion: make @truffle/contract more strict when interacting with its methods #1455
Comments
UpdateAfter doing more investigation, I now understand that truffle-contract was developed in the first place to have a promise-based version of the old callback-based Contract class found in the 0.20.6 version of the web3 library. As web3 ^1.0.0 implemented Promises and PromiEvents, wouldn't it make sense to nuke out truffle-contract? At least for me, the process of upgrading to truffle ^5.0.0 has been highly problematic specifically because of this inconsistency. Practically speaking, I posit that there would be much less confusion if Truffle injects |
This makes a lot of sense, I'll try to bring this up with the team. |
Thank you for raising this issue! It has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. If you would like to keep this issue open, please respond with information about the current state of this problem. |
not stale |
Thanks for your response! This issue is no longer considered stale and someone from the Truffle team will try to respond as soon as they can. |
(I'm calling this a documentation issue only. The docs should be more clear on |
Extracting the We don't have an official recommentation on this at the moment, but I'd like to note that if you want the extra consistency, you can use
I would avoid using the |
Hey @PaulRBerg, we're doing issue maintenance and wanted to see if there was anything left to be done here. Or can we close this? Let us know your thoughts on this! |
Nah, @haltman-at brought the issue home. |
Guess we can close then :) Thanks @PaulRBerg! |
Scenario
Let's say we have a contract instance
myContractInstance
and methodsmyPureMethod
andmyStateMethod
.Using truffle
5.0.0.beta.2
, I can do the following in my test files:And also:
What is the recommended way to interact with the contract? According to the docs, the latter seems to be the newest api of web3 1.0.0. If that's so, why can we still do the former? Backwards compatibility?
It's confusing because there are many examples on StackExchange and on many other websites showing a ton of different ways to achieve the same thing. More often than not, standardisation is a good thing.
Related Issues
getData
orencodeABI()
in truffle v5 #1230Environment
The text was updated successfully, but these errors were encountered: