import { useOcean } from '@oceanprotocol/react'
import { toDataUrl } from 'ethereum-blockies'
import React, { FormEvent } from 'react'
import { ReactComponent as Caret } from '../../../images/caret.svg'
import { accountTruncate } from '../../../utils/wallet'
import Status from '../../atoms/Status'
import styles from './Account.module.css'
const Blockies = ({ account }: { account: string | undefined }) => {
if (!account) return null
const blockies = toDataUrl(account)
return (
)
}
// Forward ref for Tippy.js
// eslint-disable-next-line
const Account = React.forwardRef((props, ref: any) => {
const { accountId, status, connect, networkId } = useOcean()
const hasSuccess = status === 1 && networkId === 1
async function handleActivation(e: FormEvent) {
// prevent accidentially submitting a form the button might be in
e.preventDefault()
await connect()
}
// prevent accidentially submitting a form the button might be in
function handleButton(e: FormEvent) {
e.preventDefault()
}
return accountId ? (
) : (
)
})
export default Account