Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@forta/usemetamask

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@forta/usemetamask

Utility React hook to handle Metamask's browser API

  • 0.2.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
decreased by-84.62%
Maintainers
1
Weekly downloads
 
Created
Source

useMetamask 🦍

An utility React hook to handle Metamask's browser API

Install

npm i @forta/usemetamask

Get Started

import { useMetamask } from "@forta/usemetamask"

function App() {
  const { account, connect, balance } = useMetamask()
  return (
    <div>
      <p>Address: {account}</p>
      <p>BALANCE: {balance}ETH</p>
      <button onClick={connect}>CONNECT</button>
    </div>
  )
}

Send Ether

import { parse, useMetamask } from "@forta/usemetamask"
// ..

const { send } = useMetamask()
send({
  to: "0x3c0e20fCA6d2E084127D056377a5f35294503447",
  value: parse.toTxWei(0.5),
  /* 0.5 in ETH. Request expects wei in HEX value.
  .toTxWei parses a number to wei & then to HEX */
})

READ THE DOCS 🌟 | FOLLOW ME 🐦

Keywords

FAQs

Package last updated on 21 Jun 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc