1.2.13 • Published 5 months ago

@usedapp/core v1.2.13

Weekly downloads
174
License
MIT
Repository
github
Last release
5 months ago

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.

1.2.13-dev.3c2c07a

5 months ago

1.2.10-dev.062ab0b

10 months ago

1.2.10-dev.c1a8d11

10 months ago

1.2.11-dev.b4b7b94

9 months ago

1.2.10-dev.01ed172

10 months ago

1.2.10-dev.3f02a75

10 months ago

1.2.10-dev.735f2a4

10 months ago

1.2.10-dev.8ab479a

10 months ago

1.2.12-dev.252541e

8 months ago

1.2.12

8 months ago

1.2.13

8 months ago

1.2.11

9 months ago

1.2.10-dev.8adf05d

10 months ago

1.2.12-dev.179f853

8 months ago

1.2.11-dev.54f7e26

9 months ago

1.2.10-dev.871dc2c

10 months ago

1.2.13-dev.0aeb599

8 months ago

1.2.10-dev.ed7e166

10 months ago

1.2.11-dev.9686190

9 months ago

1.2.10-dev.b135d16

10 months ago

1.2.13-dev.cd70dbe

8 months ago

1.2.13-dev.9bfca72

7 months ago

1.2.10-dev.2ef6b88

10 months ago

1.2.10-dev.3e5442e

12 months ago

1.2.10

12 months ago

1.2.10-dev.065365e

12 months ago

1.2.8

1 year ago

1.2.7

1 year ago

1.2.6

1 year ago

1.2.5

1 year ago

1.2.4

1 year ago

1.2.9

1 year ago

1.2.0

2 years ago

1.2.2

1 year ago

1.2.1

1 year ago

1.1.5

2 years ago

1.1.4

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.1.3

2 years ago

1.1.2

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.9-dev.600742

2 years ago

1.0.11

2 years ago

1.0.10

2 years ago

1.0.15

2 years ago

1.0.14

2 years ago

1.0.12

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago

1.0.3

2 years ago

0.12.9

2 years ago

0.12.7

2 years ago

0.12.8

2 years ago

0.12.1

2 years ago

0.12.2

2 years ago

0.12.3

2 years ago

0.12.4

2 years ago

0.12.5

2 years ago

0.12.6

2 years ago

0.11.0

2 years ago

0.9.0

2 years ago

0.7.2

2 years ago

0.7.1

2 years ago

0.9.1

2 years ago

0.7.3

2 years ago

0.10.1

2 years ago

0.10.0

2 years ago

0.8.0

2 years ago

0.5.6

2 years ago

0.5.5

2 years ago

0.7.0

2 years ago

0.6.3

2 years ago

0.6.2

2 years ago

0.6.1

2 years ago

0.6.0

2 years ago

0.5.4

3 years ago

0.5.3

3 years ago

0.5.2

3 years ago

0.5.1

3 years ago

0.5.0

3 years ago

0.4.8

3 years ago

0.4.7

3 years ago

0.4.5

3 years ago

0.4.6

3 years ago

0.4.4

3 years ago

0.4.3

3 years ago

0.4.2

3 years ago

0.4.1

3 years ago

0.4.0

3 years ago

0.3.24

3 years ago

0.3.23

3 years ago

0.3.22

3 years ago

0.3.20

3 years ago

0.3.17

3 years ago

0.3.16

3 years ago

0.3.19

3 years ago

0.3.18

3 years ago

0.3.15

3 years ago

0.3.14

3 years ago

0.3.13

3 years ago

0.3.12

3 years ago

0.3.11

3 years ago

0.3.10

3 years ago

0.3.9

3 years ago

0.3.7

3 years ago

0.3.6

3 years ago

0.3.5

3 years ago

0.3.4

3 years ago

0.3.2

3 years ago

0.3.3

3 years ago

0.3.0

3 years ago

0.3.1

3 years ago

0.2.2

3 years ago

0.2.1

3 years ago

0.2.0

3 years ago

0.1.7

3 years ago

0.1.6

3 years ago

0.1.4

3 years ago

0.1.5

3 years ago

0.1.2

3 years ago

0.1.3

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago