• Stars
    star
    854
  • Rank 53,194 (Top 2 %)
  • Language
    TypeScript
  • License
    MIT License
  • Created almost 4 years ago
  • Updated over 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

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

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.

More Repositories

1

ethereum.rb

Ethereum library for the Ruby language
Ruby
728
star
2

Waffle

Library for writing and testing smart contracts.
TypeScript
728
star
3

Mars

Mars is an infrastructure-as-code tool for Ethereum
TypeScript
77
star
4

Doppelganger

Smart contract mocking tool
TypeScript
59
star
5

AllSporter-TGE

AllSporter Crowdsale and Allsporter Token
JavaScript
27
star
6

ENSBuilder

A mock ENS system builder for developing and testing applications using ENS
JavaScript
20
star
7

reactive-properties

Simple reactive property system
TypeScript
19
star
8

bn-chai

BN chai extends Chai with bn.js operations.
JavaScript
14
star
9

ethworks-solidity

Library with common Solidity smart contracts
JavaScript
14
star
10

bem-components-react

A factory to create react components that follow BEM methodology with first-class typescript support.
TypeScript
13
star
11

dapp-boilerplate

A boilerplate for your DApp needs
TypeScript
12
star
12

truffle-zeppelin-boilerplate

Minimalistic boilerplate for using open zeppelin with truffle
JavaScript
12
star
13

hackathons

4
star
14

PingPongPairProgrammingDojo

JavaScript
3
star
15

ethereumjs-vm-benchmarks

JavaScript
3
star
16

ThinkCoinCrowdsaleContract

ThinCoin Token and Crowdsale Contract
JavaScript
3
star
17

zksync-spike

TypeScript
2
star
18

ts-esnure

TypeScript
2
star
19

statemine-asset-creator

TypeScript
2
star
20

status-waku

HTML
1
star
21

tech-talk-10

TypeScript
1
star
22

html-css-starter

Sass
1
star
23

0xstudents-homework

1
star
24

status-waku-voting

TypeScript
1
star
25

bootcamp

TypeScript
1
star
26

pair-programming-dojo

JavaScript
1
star
27

LiveCoding

TypeScript
1
star
28

react-boilerplate

TypeScript
1
star
29

external_call_bug_hunt

JavaScript
1
star
30

react-template

JavaScript
1
star
31

mimuw-zajecia

1
star
32

pair-programming

JavaScript
1
star
33

mini2018Z_workshop2

Materials for workshop 2 (MINI 2018Z edition)
JavaScript
1
star
34

useDot

TypeScript
1
star
35

restless-website

HTML
1
star
36

status-DApp-connect

HTML
1
star
37

circom-hello-world

Template to quickly learn circom
TypeScript
1
star
38

status-vac

HTML
1
star