build-onchain-apps icon indicating copy to clipboard operation
build-onchain-apps copied to clipboard

Feature Request: Automatic contracts and UI abi syncing

Open kyhyco opened this issue 1 year ago • 6 comments

Describe the solution you'd like

Currently, it's a manual process to update abi generated from a smart contract and to copy-pasta to UI

Once a contract has been deployed, we need to update which chain and the new address as well.

There are several ways to do this... let's discuss!

Describe alternatives you've considered.

No response

kyhyco avatar Feb 12 '24 22:02 kyhyco

cc @Sneh1999

kyhyco avatar Feb 12 '24 22:02 kyhyco

There are several ways to do this... let's discuss!

Tell me more.

Was it a wagmi tool for that also we could reuse?

Zizzamia avatar Feb 13 '24 00:02 Zizzamia

Yes wagmi/cli can do it: https://wagmi.sh/cli/getting-started

Yuripetusko avatar Feb 13 '24 08:02 Yuripetusko

Ahh yes, the wagmi/cli integration is something I started working on, I can try to add this capability as well

Sneh1999 avatar Feb 13 '24 19:02 Sneh1999

There are two integrations steps.

Contract Build

User runs forge build and generates a new abi. User copies the abi from contracts/out/$Name.sol/$Name.json to web/src/contract/$Name.json

This is what wagmi/cli is handle by knowing the deployed contract address.

Contract Deploy

User runs forge script ... and copies the contract address to web/src/hooks/contracts.ts

Does forge script ... outputs the deployed address somewhere?

Perhaps we want a "contract configuration file" that lives at the root of the web folder where either user inputs the address or somehow we do that for the user.

kyhyco avatar Feb 15 '24 18:02 kyhyco

Another thing that would be cool is to deploy your own contract instance for the example apps.

kyhyco avatar Feb 16 '24 02:02 kyhyco