Skip to content

Commit

Permalink
Add display of transaction status link and
Browse files Browse the repository at this point in the history
explorer name in Success component
  • Loading branch information
kremalicious committed Nov 5, 2023
1 parent 73d966e commit e6d5e50
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 9 deletions.
15 changes: 15 additions & 0 deletions src/features/Web3/components/Success/Success.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
22 changes: 13 additions & 9 deletions src/features/Web3/components/Success/Success.tsx
Original file line number Diff line number Diff line change
@@ -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}>
Expand Down

0 comments on commit e6d5e50

Please sign in to comment.