mirror of
https://github.com/kremalicious/blog.git
synced 2024-11-22 09:56:51 +01:00
Add display of transaction status link and
explorer name in Success component
This commit is contained in:
parent
73d966e3be
commit
e6d5e504b0
@ -6,3 +6,18 @@
|
|||||||
.title {
|
.title {
|
||||||
font-size: var(--font-size-h3);
|
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);
|
||||||
|
}
|
||||||
|
@ -1,27 +1,31 @@
|
|||||||
import { $txHash, $isInitSend } from '@features/Web3/stores'
|
import { $txHash, $isInitSend } from '@features/Web3/stores'
|
||||||
import { useStore } from '@nanostores/react'
|
import { useStore } from '@nanostores/react'
|
||||||
import styles from './Success.module.css'
|
import styles from './Success.module.css'
|
||||||
|
import { useNetwork } from 'wagmi'
|
||||||
|
|
||||||
export function Success() {
|
export function Success() {
|
||||||
|
const { chain } = useNetwork()
|
||||||
const txHash = useStore($txHash)
|
const txHash = useStore($txHash)
|
||||||
|
console.log(chain)
|
||||||
|
|
||||||
|
const explorerName = chain?.blockExplorers?.default.name
|
||||||
|
const explorerLink = `${chain?.blockExplorers?.default.url}/tx/${txHash}`
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={styles.success}>
|
<div className={styles.success}>
|
||||||
<h5 className={styles.title}>You're amazing!</h5>
|
<h5 className={styles.title}>You're amazing, thanks!</h5>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
Your transaction has been sent. You can check the status on{' '}
|
Your transaction is on its way. You can check the status on{' '}
|
||||||
<a
|
<a href={explorerLink} target="_blank" rel="noopener noreferrer">
|
||||||
href={`https://etherscan.io/tx/${txHash}`}
|
{explorerName}
|
||||||
target="_blank"
|
|
||||||
rel="noopener noreferrer"
|
|
||||||
>
|
|
||||||
Etherscan
|
|
||||||
</a>
|
</a>
|
||||||
.
|
.
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<code>0xxxx{txHash}</code>
|
<a href={explorerLink} target="_blank" rel="noopener noreferrer">
|
||||||
|
<code>{txHash}</code>
|
||||||
|
</a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<footer className={styles.actions}>
|
<footer className={styles.actions}>
|
||||||
|
Loading…
Reference in New Issue
Block a user