mirror of
https://github.com/kremalicious/blog.git
synced 2024-11-22 01:46:51 +01:00
fixes
This commit is contained in:
parent
feee0c678b
commit
8c63ec0c47
@ -12,7 +12,7 @@ export function Preview() {
|
||||
const { ens } = siteConfig.author.ether
|
||||
const { data: to } = useEnsAddress({ name: ens, chainId: 1 })
|
||||
const { data: ensResolved } = useEnsName({
|
||||
address: to as `0x${string}` | undefined,
|
||||
address: to as `0x${string}`,
|
||||
chainId: 1
|
||||
})
|
||||
|
||||
|
@ -10,6 +10,7 @@
|
||||
.actions {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
margin-top: 2rem;
|
||||
}
|
||||
|
||||
.actions button {
|
||||
@ -17,7 +18,3 @@
|
||||
height: 45px;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.success code {
|
||||
font-size: var(--font-size-small);
|
||||
}
|
||||
|
@ -1,5 +1,4 @@
|
||||
import { $txHash, $isInitSend } from '@features/Web3/stores'
|
||||
import { useStore } from '@nanostores/react'
|
||||
import { $isInitSend } from '@features/Web3/stores'
|
||||
import styles from './Success.module.css'
|
||||
import { useAccount } from 'wagmi'
|
||||
import { ExplorerLink } from './ExplorerLink'
|
||||
@ -9,7 +8,6 @@ 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
|
||||
@ -22,18 +20,13 @@ export function Success() {
|
||||
{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
|
||||
Close
|
||||
</button>
|
||||
</footer>
|
||||
</div>
|
||||
|
@ -8,7 +8,7 @@ export async function send(
|
||||
config: UseConfigReturnType,
|
||||
selectedToken: GetToken | undefined,
|
||||
amount: string | undefined,
|
||||
to: `0x${string}` | undefined,
|
||||
to: `0x${string}` | null | undefined,
|
||||
chainId: number | undefined
|
||||
) {
|
||||
if (!selectedToken?.decimals || !amount || !to) return
|
||||
|
@ -3,13 +3,16 @@ import { useStore } from '@nanostores/react'
|
||||
import { useState } from 'react'
|
||||
import { send } from './send'
|
||||
import { isUnhelpfulErrorMessage } from './isUnhelpfulErrorMessage'
|
||||
import { useAccount, useConfig } from 'wagmi'
|
||||
import { useAccount, useConfig, useEnsAddress } from 'wagmi'
|
||||
import siteConfig from '@config/blog.config'
|
||||
|
||||
export function useSend() {
|
||||
const selectedToken = useStore($selectedToken)
|
||||
const amount = useStore($amount)
|
||||
const config = useConfig()
|
||||
const { address, chainId } = useAccount()
|
||||
const { chainId } = useAccount()
|
||||
const { ens } = siteConfig.author.ether
|
||||
const { data: to } = useEnsAddress({ name: ens, chainId: 1 })
|
||||
|
||||
const [isLoading, setIsLoading] = useState(false)
|
||||
const [isError, setIsError] = useState(false)
|
||||
@ -20,7 +23,7 @@ export function useSend() {
|
||||
setIsError(false)
|
||||
setError(undefined)
|
||||
setIsLoading(true)
|
||||
const hash = await send(config, selectedToken, amount, address, chainId)
|
||||
const hash = await send(config, selectedToken, amount, to, chainId)
|
||||
if (hash) $txHash.set(hash)
|
||||
} catch (error: unknown) {
|
||||
const errorMessage = (error as Error).message
|
||||
|
Loading…
Reference in New Issue
Block a user