0.0.5 • Published 9 months ago

use-bsv-wasm v0.0.5

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

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]);
0.0.5

9 months ago

0.0.4

9 months ago

0.0.3

9 months ago

0.0.2

9 months ago

0.0.1

9 months ago