1
0
mirror of https://github.com/kremalicious/blog.git synced 2024-12-22 09:13:35 +01:00

Add display of transaction status link and

explorer name in Success component
This commit is contained in:
Matthias Kretschmann 2023-11-05 18:52:40 +00:00
parent 73d966e3be
commit e6d5e504b0
Signed by: m
GPG Key ID: 606EEEF3C479A91F
2 changed files with 28 additions and 9 deletions

View File

@ -6,3 +6,18 @@
.title {
font-size: var(--font-size-h3);
}
.actions {
display: flex;
justify-content: center;
}
.actions button {
width: 115px;
height: 45px;
padding: 0;
}
.success code {
font-size: var(--font-size-small);
}

View File

@ -1,27 +1,31 @@
import { $txHash, $isInitSend } from '@features/Web3/stores'
import { useStore } from '@nanostores/react'
import styles from './Success.module.css'
import { useNetwork } from 'wagmi'
export function Success() {
const { chain } = useNetwork()
const txHash = useStore($txHash)
console.log(chain)
const explorerName = chain?.blockExplorers?.default.name
const explorerLink = `${chain?.blockExplorers?.default.url}/tx/${txHash}`
return (
<div className={styles.success}>
<h5 className={styles.title}>You're amazing!</h5>
<h5 className={styles.title}>You're amazing, thanks!</h5>
<p>
Your transaction has been sent. You can check the status on{' '}
<a
href={`https://etherscan.io/tx/${txHash}`}
target="_blank"
rel="noopener noreferrer"
>
Etherscan
Your transaction is on its way. You can check the status on{' '}
<a href={explorerLink} target="_blank" rel="noopener noreferrer">
{explorerName}
</a>
.
</p>
<p>
<code>0xxxx{txHash}</code>
<a href={explorerLink} target="_blank" rel="noopener noreferrer">
<code>{txHash}</code>
</a>
</p>
<footer className={styles.actions}>