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

0.1.0 • Public • Published

use-midnight

A React hook to use Midnight in the browser

NPM JavaScript Style Guide

Install

npm install use-midnight

Usage

import React from "react";

import { useMidnight, MidnightButton } from "use-midnight";
import type { MidnightAPI } from "use-midnight";

function App() {
  const subscribe = (mn: MidnightAPI) => {
    console.log(md);
  };

  return <MidnightButton subscribe={subscribe} />;
}

The hook has 2 exports:
1- a useMidnight function that performs different checks and returns values injected by the Lace wallet into the browser
2- a MidnightButton with a customizable appearance that shows the status of the dapp and user connection to the Lace wallet

License

MIT © claudebarde

Package Sidebar

Install

npm i use-midnight

Weekly Downloads

2

Version

0.1.0

License

MIT

Unpacked Size

13.9 kB

Total Files

7

Last publish

Collaborators

  • claudebarde