1.0.0 • Published 1 year ago

@eztools-core/web3context v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

@eztools-core/web3context

A simple React context wrapper to access web3 functions and integrate smart contracts.

Install

npm install --save @eztools-core/web3context

Usage

Initialize the provider at the root of your project (App/index.tsx)

import React, { Component } from 'react'
import { Web3Provider } from 'Web3Context'

const App = () => {
  return <Web3Provider>// App Code goes here</Web3Provider>
}

Use the context anywhere in your app

import { useWeb3Context } from 'Web3Context'

const Component = () => {
  const { account, connectWallet, contractObjects } = useWeb3Context()
  return (
    <>
      <div>Connected Address: {account}</div>
      <br />
      <button onClick={connectWallet}>Connect Wallet</button>
    </>
  )
}

License

MIT © mysteriousacadia

1.0.0

1 year ago

0.1.1

1 year ago

0.1.0

1 year ago