1
0
Fork 0
blog/src/features/Web3/components/Success/Success.tsx

42 lines
1.1 KiB
TypeScript

import { $txHash, $isInitSend } from '@features/Web3/stores'
import { useStore } from '@nanostores/react'
import styles from './Success.module.css'
import { useAccount } from 'wagmi'
import { ExplorerLink } from './ExplorerLink'
const title = `You're amazing, thanks!`
const description = `Your transaction is on its way. You can check the status on`
export function Success() {
const account = useAccount()
const txHash = useStore($txHash)
const explorerName = account?.chain?.blockExplorers?.default.name
const explorerUrl = account?.chain?.blockExplorers?.default.url
return (
<div className={styles.success}>
<h5 className={styles.title}>{title}</h5>
<p>
{description}{' '}
<ExplorerLink url={explorerUrl}>{explorerName}</ExplorerLink>.
</p>
<p>
<ExplorerLink url={explorerUrl}>
<code>{txHash}</code>
</ExplorerLink>
</p>
<footer className={styles.actions}>
<button
onClick={() => $isInitSend.set(false)}
className="btn btn-primary"
>
Reset
</button>
</footer>
</div>
)
}