trufflesuite / truffle

:warning: The Truffle Suite is being sunset. For information on ongoing support, migration options and FAQs, visit the Consensys blog. Thank you for all the support over the years.
https://consensys.io/blog/consensys-announces-the-sunset-of-truffle-and-ganache-and-new-hardhat?utm_source=github&utm_medium=referral&utm_campaign=2023_Sep_truffle-sunset-2023_announcement_
MIT License
14.02k stars 2.31k forks source link

add "networkType": "quorum" for non migrated contract in kaleido quorum network #2903

Open EmanHerawy opened 4 years ago

EmanHerawy commented 4 years ago

Issue

Hi all, I'm developing a react native app using ( kaleido quorum network , truffle and truffle-contract & web3js) but it doesn't work well with non migrated contract in the front end , if i'm calling any migrated contract , it works fine .

What the issue is, in broad strokes. I'm using factory contract to create new contract " these contract are not migrated " whenever I try to call them , I found this issue

image

How I could solve it

I have updated the contract artifacts by adding "networkType": "quorum" , and it works fine now

Environment

I'm not sure what is the best way to solve the issue, I was thinking of forcing compilation when migration and adjust the artifacts based on the migration network config but I found that this is not the best solution as we sometimes we need to migrate the files to multiple networks . this issue is just to save other developers time , if anyone has encountered the same problem

nubiaprince commented 4 years ago

Good job @EmanHerawy Keep going 👍🏼

gnidan commented 4 years ago

Interesting problem, thanks for bringing to our attention!

I think the solution here is non-trivial, since that networkType field shouldn't necessarily live in that location - for instance, the same contract could be used for both quorum and ethereum network types, so networkType should theoretically be a property per-network.

I think we should wait to add this field to the artifacts until we can move it to the right place. In the meantime, you might be stuck with the workaround of manually putting it there (sorry!).

Putting this on our backlog to revisit in the near/mid future. Thanks again!

EmanHerawy commented 4 years ago

Interesting problem, thanks for bringing to our attention!

I think the solution here is non-trivial, since that networkType field shouldn't necessarily live in that location - for instance, the same contract could be used for both quorum and ethereum network types, so networkType should theoretically be a property per-network.

I think we should wait to add this field to the artifacts until we can move it to the right place. In the meantime, you might be stuck with the workaround of manually putting it there (sorry!).

Putting this on our backlog to revisit in the near/mid future. Thanks again!

Thanks for your decent reply! I Would love to help in fixing this if someone just guide me & I'm thinking of two ways of fixing : 1- fix it in truffle-contract ( something like add the network type with the provider) , in my opnion this is better and easier 2- fix it in contract artifacts , by adding networkType in each network deploy and force compile with each migration ( because we might need to deploy the same contract to different networks )and that require adjusting the truffle-contract as well to get this value from this nested object .