1.0.1 • Published 3 months ago

iso-filecoin-react v1.0.1

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

iso-filecoin-react

NPM Version License: MIT License Adapter

React hooks for Filecoin.

Installation

pnpm install iso-filecoin-react

Usage

import { WalletProvider } from 'iso-filecoin-react'

const wallets = []

function Main() {
  return (
    <WalletProvider wallets={wallets}>
      <App />
    </WalletProvider>
  )
}
import { useFilsnap } from 'filsnap-adapter-react'

function App() {
  const { isLoading, hasSnaps, isConnected, connect, account, error } =
    useFilsnap()

  if (isLoading) {
    return <div>Loading...</div>
  }

  if (!isConnected) {
    return <button onClick={() => connect()}>Connect to Filecoin Snap</button>
  }

  return <div>Connected to {account.address}</div>
}

Check out the demo for a working example and the API for more details.

Docs

Check the docs website

Contributing

Read contributing guidelines here.

Open in GitHub Codespaces

License

MIT © Hugo Dias

1.0.1

3 months ago

1.0.0

4 months ago

0.0.1

4 months ago