Skip to content

Commit b3ea83d

Browse files
committed
more refactoring and cleaning
1 parent f179098 commit b3ea83d

File tree

9 files changed

+342
-97
lines changed

9 files changed

+342
-97
lines changed

.env.example

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
NEXT_PUBLIC_INFURA_ID=460f40a260564ac4a4f4b3fffb032dad
2+
3+
14
ETHERSCAN_API_KEY=ABC123ABC123ABC123ABC123ABC123ABC1
25
ROPSTEN_URL=https://eth-ropsten.alchemyapi.io/v2/<YOUR ALCHEMY KEY>
36
PRIVATE_KEY=0xabc123abc123abc123abc123abc123abc123abc123abc123abc123abc123abc1

components/ConnectWallet.tsx

+6-6
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,16 @@ import { providers, ethers } from 'ethers'
22
import Head from 'next/head'
33
import { useCallback, useEffect, useReducer } from 'react'
44
import ConnectWalletButton from '@components/primitives/ConnectWalletButton';
5-
import { ellipseAddress, getChainData } from '@libraries/blockchain/utilities'
65
import { web3Modal, initialState, reducer } from '@libraries/blockchain/walletConnector'
7-
import WalletConnectProvider from '@walletconnect/web3-provider'
8-
import WalletLink from 'walletlink'
9-
import Web3Modal from 'web3modal'
106
import { signMessage } from '@libraries/blockchain/signatures'
117

128

139

1410
export const ConnectWallet = (): JSX.Element => {
1511
const [state, dispatch] = useReducer(reducer, initialState)
16-
const { provider, web3Provider, address, chainId } = state
12+
const { provider, web3Provider } = state
13+
14+
1715

1816
const connect = useCallback(async function() {
1917
// This is the initial `provider` that is returned when
@@ -30,12 +28,14 @@ export const ConnectWallet = (): JSX.Element => {
3028

3129
const network = await web3Provider.getNetwork()
3230

31+
console.log(network.chainId);
32+
3333
dispatch({
3434
type: 'SET_WEB3_PROVIDER',
3535
provider,
3636
web3Provider,
3737
address,
38-
chainId: network.chainId,
38+
// chainId: network.chainId,
3939
})
4040
}, [])
4141

components/Nav.tsx

+13-45
Original file line numberDiff line numberDiff line change
@@ -5,77 +5,45 @@ import navStyles from '@styles/Nav.module.css';
55
const Nav = () => {
66
return (
77
<div className={navStyles.navbar}>
8-
<div className={navStyles.menu}>
98
<ul className={navStyles.menu}>
109
<li>
11-
<Link href="/">
12-
13-
Home
14-
</Link>
10+
<Link href="/">Home</Link>
1511
</li>
1612
<li>
17-
<Link href="/about">
18-
19-
About
20-
</Link>
13+
<Link href="/about">About</Link>
2114
</li>
2215
<li>
23-
<Link href="/featured">
24-
25-
Featured
26-
</Link>
16+
<Link href="/featured">Featured</Link>
2717
</li>
2818
<li>
29-
<Link href="/market">
30-
31-
Marketplace
32-
</Link>
19+
<Link href="/market">Marketplace</Link>
3320
</li>
3421
<li>
35-
<Link href="/mint">
36-
37-
Mint NFTs
38-
</Link>
22+
<Link href="/mint">Mint NFTs</Link>
3923
</li>
4024
<li>
4125
<Link href="/community">Community</Link>
4226
</li>
4327
<li>
44-
<Link href="/stake">
45-
46-
Stake
47-
</Link>
28+
<Link href="/stake">Stake</Link>
4829
</li>
4930
<li>
5031
{/*here they vote on proposals, they get a share of the fees for participasting */}
51-
<Link href="/vote">
52-
53-
Vote
54-
</Link>
32+
<Link href="/vote">Vote</Link>
5533
</li>
5634
<li>
5735
{/* where they go to make proposals such as delisting, adding new creators, etc, they get comissions for accepted proposals */}
58-
<Link href="/propose">
59-
60-
Propose
61-
</Link>
36+
<Link href="/propose">Propose</Link>
6237
</li>
6338
<li>
64-
<Link href="/launchpad">
65-
66-
Launchpad
67-
</Link>
39+
<Link href="/launchpad">Launchpad</Link>
6840
</li>
69-
<li>
70-
<ConnectWallet></ConnectWallet>
71-
72-
</li>
7341
</ul>
74-
</div>
75-
76-
42+
<ul className="flex items-center mr-8">
43+
<ConnectWallet></ConnectWallet>
44+
</ul>
7745
</div>
7846
);
7947
};
8048

81-
export default Nav
49+
export default Nav;

components/primitives/ConnectWalletButton.tsx

-23
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,6 @@ function ConnectWalletButton(props) {
1414
)}
1515

1616
<style jsx>{`
17-
main {
18-
padding: 5rem 0;
19-
text-align: center;
20-
}
21-
p {
22-
margin-top: 0;
23-
}
24-
.container {
25-
padding: 2rem;
26-
margin: 0 auto;
27-
max-width: 1200px;
28-
}
29-
.grid {
30-
display: grid;
31-
grid-template-columns: auto auto;
32-
justify-content: space-between;
33-
}
3417
.button {
3518
padding: 1rem 1.5rem;
3619
background: ${props.web3Provider ? 'red' : 'green'};
@@ -39,12 +22,6 @@ function ConnectWalletButton(props) {
3922
color: #fff;
4023
font-size: 1.2rem;
4124
}
42-
.mb-0 {
43-
margin-bottom: 0;
44-
}
45-
.mb-1 {
46-
margin-bottom: 0.25rem;
47-
}
4825
`}</style>
4926
</>
5027
);

libraries/blockchain/walletConnector.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const providerOptions = {
2121
options: {
2222
appName: 'Coinbase', // Your app name
2323
networkUrl: `https://mainnet.infura.io/v3/${INFURA_ID}`,
24-
chainId: 1,
24+
// chainId: 1,
2525
},
2626
package: WalletLink,
2727
connector: async (_, options) => {
@@ -75,8 +75,8 @@ export type ActionType =
7575
export const initialState: StateType = {
7676
provider: null,
7777
web3Provider: null,
78-
address: null,
79-
chainId: null,
78+
address: undefined,
79+
chainId: 1,
8080
}
8181

8282
export function reducer(state: StateType, action: ActionType): StateType {

0 commit comments

Comments
 (0)