import { CheckCircleIcon, LockIcon } from '@chakra-ui/icons' import { AccordionButton, AccordionIcon, AccordionItem, AccordionPanel, Box, Button, Text } from '@chakra-ui/react' import React, { useEffect } from 'react' import Lottie from 'react-lottie' import { TokenApproval } from '.' import { TermsAnimation } from '../../../constants' import useTokenAllowance from '../../../hooks/useTokenAllowance' import Loading from '../Loading' interface IApprovalTokenProps { allowanceKey: number tokenApproval: TokenApproval setApprovalList: (value: number, index: number) => void step: number oldAllowance: number } const ApprovalToken: React.FunctionComponent = (props) => { const { setApprovalList, tokenApproval, allowanceKey, step, oldAllowance } = props const defaultOptions = { loop: true, autoplay: true, animationData: TermsAnimation, rendererSettings: { preserveAspectRatio: 'xMidYMid slice', }, } const { allowance, increaseAllowance, loadingGetAllowance, loadingIncreaseAllowance } = useTokenAllowance( tokenApproval.token, tokenApproval.spenderAddress, ) useEffect(() => { if (oldAllowance !== allowance) { setApprovalList(allowance, step) } }, [allowance, oldAllowance, setApprovalList, step]) return ( 0 || step < allowanceKey}>

{allowanceKey + 1}. Approve {tokenApproval.token.tokenSymbol} 0 || step > allowanceKey ? 'green.300' : 'gray.300'} mr={'10px'} />

{loadingGetAllowance && } {!loadingGetAllowance && ( <> We’ll ask your approval for the marketplace to access your token. This is a one-time only operation. {' '} )}
) } export default ApprovalToken