-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathindex.tsx
More file actions
52 lines (47 loc) · 1.91 KB
/
Copy pathindex.tsx
File metadata and controls
52 lines (47 loc) · 1.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import { Flex } from '@chakra-ui/react'
import { useState } from 'react'
import { sepolia } from 'wagmi/chains'
import { OptionsDropdown } from '@/src/components/pageComponents/home/Examples/demos/OptionsDropdown'
import ERC20ApproveAndTransferButton from '@/src/components/pageComponents/home/Examples/demos/TransactionButton/ERC20ApproveAndTransferButton'
import Icon from '@/src/components/pageComponents/home/Examples/demos/TransactionButton/Icon'
import NativeToken from '@/src/components/pageComponents/home/Examples/demos/TransactionButton/NativeToken'
import { WalletStatusVerifier } from '@/src/components/sharedComponents/WalletStatusVerifier'
type Options = 'erc20' | 'native'
const TransactionButton = () => {
const [currentTokenInput, setCurrentTokenInput] = useState<Options>('erc20')
const items = [
{ label: 'ERC20 token (USDC)', onClick: () => setCurrentTokenInput('erc20') },
{ label: 'ETH (Native)', onClick: () => setCurrentTokenInput('native') },
]
return (
<WalletStatusVerifier chainId={sepolia.id}>
<>
<OptionsDropdown items={items} />
<Flex
alignItems="center"
display="flex"
flexDirection="column"
justifyContent="center"
paddingTop={{ base: 2, lg: 6 }}
width="100%"
>
{currentTokenInput === 'erc20' && <ERC20ApproveAndTransferButton />}
{currentTokenInput === 'native' && <NativeToken />}
</Flex>
</>
</WalletStatusVerifier>
)
}
const transactionButton = {
demo: <TransactionButton />,
href: 'https://bootnodedev.github.io/dAppBooster/variables/components_sharedComponents_TransactionButton.TransactionButton.html',
icon: <Icon />,
text: (
<>
Transfer native cryptocurrency to your own address, or check ERC20 allowance, approve ERC20
use, and execute a demo transaction.
</>
),
title: 'Transaction button',
}
export default transactionButton