turbulent
TypeScript icon, indicating that this package has built-in type declarations

1.0.4 • Public • Published

Turbulent

turbulent is a React.js/Next.js hook library for blockchain interface, it is a wrapper around web3Modal library to provide a shared gloabl hook for sharing the connection status, addresses, providers and much more.

Installation

Use the package manager npm to install turbulent.

npm install turbulent

Usage

# Importing the hooks
import { web3Modal, useContract } from 'turbulent';

# Extracting the features from the 'useWeb3Modal' hook
const { connect, connected, address, balance, chainId } = useWeb3Modal('Infura key');

# Use 'connect' function
<button onClick={connect}> Connect </button>

# use 'useContract' hook to call methods from the contract
const Contract = useContract(contractAddress, contractABI, 'Infura key');
const balance = await Contract.methods.balanceOf(address).call();

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

MIT

Dependents (0)

Package Sidebar

Install

npm i turbulent

Weekly Downloads

11

Version

1.0.4

License

MIT

Unpacked Size

28.5 kB

Total Files

26

Last publish

Collaborators

  • lklsquare