Skip to content

Commit

Permalink
Removing check for wrapped matic in wallet
Browse files Browse the repository at this point in the history
  • Loading branch information
jamiehewitt15 committed Oct 19, 2023
1 parent 6c3bb11 commit 0f330a3
Showing 1 changed file with 3 additions and 21 deletions.
24 changes: 3 additions & 21 deletions src/components/WrapMatic/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ interface WrapMaticProps {
export default function WrapMatic(props: WrapMaticProps) {
const [hideButton] = useState(false)
const [error, setError] = useState(false)
const [wmatic, setWmatic] = useState(false)
const [errorMessage, setErrorMessage] = useState('')
const { chain } = useNetwork()
const { address } = useAccount()
Expand All @@ -33,16 +32,6 @@ export default function WrapMatic(props: WrapMaticProps) {
address: address
})

const { data: wmaticBalanceData } = useContractRead({
address:
chain?.id === 80001
? '0x9c3C9283D3e44854697Cd22D3Faa240Cfb032889'
: '0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270',
abi: wMaticAbi,
functionName: 'balanceOf',
args: [address]
})

const { config } = usePrepareContractWrite({
address:
chain?.id === 80001
Expand All @@ -68,14 +57,9 @@ export default function WrapMatic(props: WrapMaticProps) {
if (isSuccess) {
console.log('isSuccess', isSuccess)
console.log('isPending', isPending)
console.log('Check if user has wrapped matic in their wallet')
const wmaticBalance = BigInt((wmaticBalanceData as number) || 0)
if (wmaticBalance >= props.amount) {
setWmatic(true)
props.setStep('upload')
}
props.setStep('upload')
}
}, [isSuccess, wmaticBalanceData])
}, [isSuccess])

useEffect(() => {
if (!balanceWallet?.value || balanceWallet.value < props.amount) {
Expand All @@ -90,7 +74,7 @@ export default function WrapMatic(props: WrapMaticProps) {

return (
<>
{!hideButton && !wmatic && (
{!hideButton && !isSuccess && (
<Button
style="primary"
size="small"
Expand All @@ -106,8 +90,6 @@ export default function WrapMatic(props: WrapMaticProps) {
? 'Check Wallet...'
: isPending
? 'TX Pending...'
: isSuccess
? '...'
: 'Wrap Matic'}
</Button>
)}
Expand Down

0 comments on commit 0f330a3

Please sign in to comment.