use-ink / contracts-ui

Web application for deploying wasm smart contracts on Substrate chains that include the FRAME contracts pallet
https://contracts-ui.substrate.io/
GNU General Public License v3.0
61 stars 45 forks source link

Allow users to change metadata when instantiating from hash #457

Closed statictype closed 1 year ago

statictype commented 1 year ago

Right now when instantiating from hash or re-instantiating we pre-fill the file input with the stored metadata associated with the hash.

Screenshot 2023-03-29 at 12 39 54

Would be nice to allow users to add a different metadata file. Similar to how the update metadata case is handled, we could display an x that removes the contents of the file input.

Screenshot 2023-03-29 at 12 40 17

Note: the metadata here will be associated with the new contract instance. the code "bundle" stays associated with metadata it was first instantiated with.

CharliePops commented 1 year ago

Hey @statictype , I've playing around with the UI and I agree that this would be a nice UX improvement. I can address this issue though I have one question.

What would be the expected behavior if the user removes the file(click the x button)? shoud we revert the metadata information to the previous state(the original code hash) or just remove completely any metadata and force the user to select a new file or hash?

I can make a pull request for this, let me know.

CharliePops commented 1 year ago

I created a pull request using the 'revert' behavior since it what it makes more sense to me, but if that's not the expected behavior I can change it 😉 .

statictype commented 1 year ago

just removing it completely is perfectly fine. 👍🏻

CharliePops commented 1 year ago

No problem, I'll update the PR.

statictype commented 1 year ago

@CharliePops I think I misunderstood, the behaviour in the PR is what we want. no need for changes

CharliePops commented 1 year ago

Awesome 👍🏼