haha-connect
v0.0.14
Published
Haha button to connect to walletconnect
Downloads
29
Readme
haha-connect
Installation:
npm i haha-connect
or
yarn add haha-connect
Usage:
'use client'
import { HahaModal, HahaButton, connect, disconnect, initialize } from 'haha-connect'
import { useMemo } from 'react'
export default function Home() {
const hahaConnector = useMemo(() => {
return initialize('walletconnect_project_id')
}, [])
const isActive = hahaConnector.hooks.useIsActive()
return (
<main className='flex min-h-screen flex-col items-center justify-between p-24'>
<div>
{isActive ? (
<HahaButton
onClick={() => {
disconnect(hahaConnector)
}}
label='Disconnect'
style={{ backgroundColor: '#000', color: '#fff' }}
/>
) : (
<HahaButton
onClick={(e) => {
connect(hahaConnector, 1)
e.preventDefault()
}}
label='Connect with HaHa'
style={{ backgroundColor: '#000', color: '#fff' }}
/>
)}
<HahaModal hahaConnector={hahaConnector} />
</div>
</main>
)
}
Limitation :
Currently supports ethereum mainnet (chain id: 1) and polygon (chain id: 137)