Skip to content

Implement watch command to support Dapps for contracts on user's Ganache #4

@john-osullivan

Description

@john-osullivan

Update

The final compromise here was to have dappbot truffle handle autoparsing deployed Truffle artifacts to create dapps with minimal user interaction. It does not, however, attempt to watch files as they build. Until we can connect to local blockchains thru a websocket API, there isn't much point in watching files as they build -- we can only interact with them once they're deployed to a public chain. However, once we can talk to local blockchains, then we have the capability of creating dapps for local contracts while they're still under development.

Therefore, this issue now corresponds to that new command which we are still blocked on.

Original Spec

This is the beginning of dappbot-cli's core unique feature. In order to act as a dev tool, this needs to fit seamlessly into the development cycle. We're going to do that by adding a dappbot watch command which expects to be run in a Truffle project and follows steps something like:

  1. Look for the build/contracts directory
  2. Go through each file in that directory
  3. Check if the build content shows that it's been deployed to a recognized network
  4. If so, automatically create a Dapp for it
  5. If that file updates to reflect a new ABI or deployed address, update the existing Dapp

This is the smaller version of our end-goal, which is creating Dapps for contracts which are still under development. The key wrinkle here is that in-progress contracts are deployed on local Truffle instances. If we created the Dapp with a web3URL pointed at localhost:8000, then it would work from the same machine but not for anybody else.

In order to make these in-dev dapps work for everybody, the web3URL would represent a connection to the developer's Ganache instance. We could do that with websockets, where dappbot watch opens a websocket session with DappBot. The dapp's web3URL would be something like api.dapp.bot/v1/public/unique-fish-name. Sending a request to it would forward a message to the corresponding session, so the dappbot-cli would be acting like a transaction executor for the user's Ganache.

Metadata

Metadata

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions