1.0.0 • Published 1 year ago

hashconnect-provider v1.0.0

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

Hashconnect-Provider

This package provides a react context for connecting to HashConnect easily.

Install

npm install hashconnect-provider

Setup

wrap your app in HashConnectContextProvider

import { HashConnect } from "hashconnect/dist/hashconnect";
import HashConnectContextProvider from 'hashconnect-provider'

export default function App({ Component, pageProps }: AppProps) {
  return <>
    <HashConnectContextProvider hashConnect={new HashConnect(true)} network="testnet" singleAccount={true} metaData={{
            name: "dApp Example",
            description: "An example hedera dApp",
            icon: "https://www.hashpack.app/img/logo.svg",
            url: "http://localhost:3000"
        }}
    >
        <Component {...pageProps} />
      </HashConnectContextProvider>
  </>

}

Usage

    const { 
        hcData, // hashConnect data state
        hashConnect, // hashConnect instance
        topic, //  topic state
        setTopic,
        pairingString, 
        pairingData,
        availableExtension,
        state, // state of the connection
        connectToExtension,
        clearPairings,
        disconnect,
        sendTransaction,
        network,
        getProvider,
        getSigner,
        accountId // first accountId in the paringData
    } = useHashConnectContext();
1.0.0

1 year ago

0.3.4

1 year ago

0.3.3

1 year ago

0.3.2

1 year ago

0.3.1

1 year ago

0.3.0

1 year ago

0.2.9

1 year ago

0.2.8

1 year ago

0.2.7

1 year ago

0.2.6

1 year ago

0.2.5

1 year ago

0.2.4

1 year ago

0.2.3

1 year ago

0.2.2

1 year ago

0.2.1

1 year ago

0.2.0

1 year ago

0.1.8

1 year ago

0.1.7

1 year ago

0.1.6

1 year ago

0.1.5

1 year ago

0.1.4

1 year ago

0.1.3

1 year ago

0.1.2

1 year ago

0.1.1

1 year ago

0.1.0

1 year ago