1.0.5 • Published 1 year ago
idriss-react v1.0.5
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
- Resolving TODO (available in idriss-crypto)
- Reverse resolving
- Registering new records TODO (available in idriss-crypto)
IDriss Send - mass web3 onboarding & asset distribution tool
- 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>
)
}