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

0.0.5 • Public • Published

use-bsv-wasm

Hook for using bsv-wasm in react apps.

Usage

Import the useBsvWasm hook

import { useBsvWasm } from "use-bsv-wasm";

Add to your AppContext:

import React, { ReactNode } from "react";
import { BsvWasmProvider } from "use-bsv-wasm";

interface Props {
  children: ReactNode;
}

const AppContext: React.FC<Props> = ({ children }) => {
  return <BsvWasmProvider>{children}</BsvWasmProvider>;
};

export default AppContext;

Use in your component.

import { useBsvWasm } from "use-bsv-wasm";

const { initialized } = useBsvWasm();

useEffect(() => {
  if (initialialized) {
    // Doesn't throw an error
    const address = P2PKHAddress.from_string(
      "1FVYXV4QnBv6XxqJZVjTb5HhXZV3z2kqjy"
    );
  }
}, [initialialized]);

Readme

Keywords

none

Package Sidebar

Install

npm i use-bsv-wasm

Weekly Downloads

0

Version

0.0.5

License

MIT

Unpacked Size

6.87 kB

Total Files

7

Last publish

Collaborators

  • wildsatchmo