8000 GitHub - i1101111000/useDApp: Framework for rapid Dapp development. Simple. Robust. Extendable. Testable
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

i1101111000/useDApp

 
 

Repository files navigation

useDapp

Ethereum 🤝 React

Framework for rapid Dapp development.
Simple. Robust. Extendable. Testable.

Problem

A Dapp is a bit different animal than a typical web application.

A Dapp designed with user experience in mind will:

  • 🔄 refresh after a new block arrives
  • 📺 work in view mode before connecting a wallet
  • ✅ show the status of the current transactions
  • 🛅 and more :)

A Dapp designed with developer experience in mind will:

  • 🧪 work on both mainnet and testnets
  • 🛡️ be error proof and easy to test
  • 🍼 be easy to develop and extend
  • 🧰 and much more...

These requirements used to make writing quality DApps somewhat challenging, but no more with useDapp.

Solution

useDapp combines the best practices of React, Ethereum and programming in general:

  • 🧱 uses react hooks as your primary building ingredient
  • 🚅 refreshes components automatically on each block if needed
  • 🛒 combines multiple blockchain calls into a single multicall
  • 📚 extends easily with custom hooks
  • 🎚️ tests integration of UI and blockchain easily

Example

const config: Config = {
  readOnlyChain: ChainId.Mainnet,
  readOnlyUrls: {
    [ChainId.Mainnet]: 'https://mainnet.infura.io/v3/62687d1a985d4508b2b7a24827551934',
  },
}

ReactDOM.render(
  <React.StrictMode>
    <DAppProvider config={config}>
      <App />
    </DAppProvider>
  </React.StrictMode>,
  document.getElementById('root')
)

export function App() {
  const { activateBrowserWallet, account } = useEthers()
  return (
      <div>
        <button onClick={() => activateBrowserWallet()}>Connect</button>
      </div>
      {account && <p>Account: {account}</p>}
    </div>
  )
}

Example application is available here.

Documentation

For detailed feature walkthrough checkout documentation.

Contributing

Contributions are always welcome, no matter how large or small. Before contributing, please read the code of conduct and contribution policy.

Before you issue pull request:

  • Make sure all tests pass.
  • Make sure linter passes.
  • Make sure you have test coverage for any new features.

To run tests type:

yarn test

To run linter type:

yarn lint

Building documentation

Install Sphinx to build documentation:

cd docs
make html

Before building documentation for the first time you may have to install required python packages:

pip3 install -r docs/requirements.txt

License

useDapp is released under the MIT License.

About

Framework for rapid Dapp development. Simple. Robust. Extendable. Testable

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 96.7%
  • JavaScript 1.8%
  • HTML 1.5%
0