Coder Social home page Coder Social logo

michaelzalla / usedapp Goto Github PK

View Code? Open in Web Editor NEW

This project forked from truefieng/usedapp

1.0 1.0 0.0 31.1 MB

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

Home Page: https://usedapp.io

License: MIT License

Shell 0.05% JavaScript 17.47% TypeScript 71.89% CSS 5.25% HTML 2.78% Sass 2.56%

usedapp's Introduction

useDapp

CI Npm package version Discord

Ethereum ๐Ÿค React

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

About

Introduces great features:

  • ๐Ÿ—๏ธ React hooks - Uses React hooks as your primary building ingredient
  • ๐Ÿš… Auto refresh - Refreshes on a new block, wallet change or network change
  • ๐Ÿ›’ Multicall - Combines multiple blockchain calls into a single multicall

Combines the best practices:

  • ๐Ÿ”ง Modern stack - Employs ethers.js, multicall & waffle
  • ๐Ÿ“š Extendability - Extends easily with custom hooks
  • ๐Ÿ’ก Testability - Simple integration tests for UI and blockchain

Example

import { Mainnet } from '@usedapp/core/modal/chain/ethereum'
import { useEthers, useEtherBalance } from '@usedapp/core'

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

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

const STAKING_CONTRACT = '0x00000000219ab540356cBB839Cbe05303d7705Fa'

export function App() {
  const { activateBrowserWallet, deactivate, account } = useEthers()
  const userBalance = useEtherBalance(account)
  const stakingBalance = useEtherBalance(STAKING_CONTRACT)

  return (
    <div>
      {!account && <button onClick={activateBrowserWallet}> Connect </button>}
      {account && <button onClick={deactivate}> Disconnect </button>}
      {stakingBalance && <p>ETH2 staking balance: {formatEther(stakingBalance)} ETH </p>}
      {account && <p>Account: {account}</p>}
      {userBalance && <p>Ether balance: {formatEther(userBalance)} ETH </p>}
    </div>
  )
}

See application 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 install dependencies type:

npm i -g pnpm
pnpm install

To build project:

yarn build

To run tests type:

yarn test

To run linter type:

yarn lint

License

useDapp is released under the MIT License.

usedapp's People

Contributors

rzadp avatar github-actions[bot] avatar mj426382 avatar nezouse avatar dmaretskyi avatar yivlad avatar szymx95 avatar marekkirejczyk avatar truefi-bot avatar gasolin avatar truefibot avatar jakvbs avatar justynabroniszewska avatar vanruch avatar hubertnastaly avatar quagliero avatar tt-marek avatar miziet avatar devanoneth avatar sz-piotr avatar itsshadowl avatar marcin-trust avatar doubleotheven avatar tylerether avatar clumsyvlad avatar kacperkurek avatar perski6 avatar m00nbeans avatar dylankilkenny avatar t4t5 avatar

Stargazers

Roman avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.