1.0.5 • Published 1 year ago

idriss-react v1.0.5

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

idriss-react

IDriss React hooks

Install

npm install idriss-react

Features

This is a simple wrapper around idriss-crypto and wagmi that offers React-style hook abstractions. The following functionality is available:

IDriss Book - decentralized mapping of emails, phone numbers and Twitter usernames to wallet addresses

  1. Resolving TODO (available in idriss-crypto)
  2. Reverse resolving
  3. Registering new records TODO (available in idriss-crypto)

IDriss Send - mass web3 onboarding & asset distribution tool

  1. Sending crypto & NFTs to emails, phone numbers, and Twitter usernames TODO (available in idriss-crypto)

useTwitterHandle

We use wagmi to automatically return the connected wallet address to a twitter handle, if the user has signed up with IDriss. If the user has not signed up, accountTwitterHandle will be null.

import { WagmiConfig, createClient } from 'wagmi';
import { getDefaultProvider } from 'ethers';

const client = createClient({
  autoConnect: true,
  provider: getDefaultProvider(),
})

function App() {
  return (
    <WagmiConfig client={client}>
      <Profile />
    </WagmiConfig>
  )
}
import { useAccountTwitterHandle } from 'idriss-react';
import { useAccount } from 'wagmi';

function Profile() {
  const { address } = useAccount();
  const { accountTwitterHandle, isSuccess, isError } = useTwitterHandle();

  if (address)
    return (
      <div>
        {isSuccess && (
          <p>
            Welcome, {accountTwitterHandle}
          </p>
        )}
        Connected to {address}
      </div>
    )
}
1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago