bitdao-io / bitdao-governance

https://delegate.bitdaotools.io
2 stars 4 forks source link

[Feature] Separate significant js code from UI-related code #46

Open shahankhatch opened 2 years ago

shahankhatch commented 2 years ago

Feature Description

Web3 related code is sprinkled into the front end. This leads to challenges wrt testing and reuse. One way to resolve is to start separating the js code into its own file within the repo, towards the eventual goal of building a javascript helper library for the smart contract we implement.

Code looks like the following:

const receipt = contracts.methods.delegate(address).send({ from: accounts, gas: 300000 }).on("transactionHash", async (txhash: string) =>

https://github.com/bitdao-io/bitdao-governance/blob/302ae5f4833c77187bf6abf5c1795c6c42c793f3/src/pages/Governance/Governance.tsx#L140

Once the web3 code is separated, it'll be easier to work on issues like #45.

octavioamu commented 2 years ago

for the testing part I found this repo maybe once split is something we could use https://github.com/DePayFi/depay-web3-mock