Skip to content

Commit 9f91e8e

Browse files
authored
Merge pull request #10 from plottables/main
Adding support for multiple contracts
2 parents 7d73edd + ad00f73 commit 9f91e8e

File tree

69 files changed

+11431
-2761
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+11431
-2761
lines changed

README.md

Lines changed: 53 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
# Art Blocks Engine (React Template)
22
[![GitPOAPs](https://public-api.gitpoap.io/v1/repo/ArtBlocks/artblocks-engine-react/badge)](https://www.gitpoap.io/gh/ArtBlocks/artblocks-engine-react)
33

4-
This project is meant to be used as a template to build Art Blocks Engine web apps. It contains all of the pages and views necessary for users to browse projects, tokens and be able to purchase mints. This repository serves as a prototype or template.
4+
This project is meant to be used as a template to build Art Blocks Engine web apps. It contains all pages and views
5+
necessary for users to browse projects, tokens and be able to purchase mints. This repository serves as a prototype or
6+
template.
57

6-
It assumes your core contract is `GenArt721CoreV3` and your minting contract is `MinterDAExpV4` with all sales priced in ETH.
8+
It assumes your core contracts are either `GenArt721CoreV2` or `GenArt721CoreV3`, and supports the following minters:
9+
`GenArt721Minter`, `MinterSetPriceV4`, `MinterSetPriceERC20V4`, `MinterMerkleV5`, and `MinterHolderV4`.
710

8-
It is NOT intended for production use as-is. Please modify for your needs and test extensively before using.
11+
It is NOT intended for production use as-is. Please modify for your needs and test extensively before using.
912

1013
Absolutely no warranty of any kind is provided. Please review from The MIT License:
1114

@@ -23,50 +26,75 @@ SOFTWARE.**
2326

2427
Run `npm install` or `yarn` to install dependencies.
2528

26-
To run the project locally you will need to create a `.env` configuration file. You can get started by copying `sample.env` and renaming it as `.env`.
27-
28-
**Important note:** if you are planning to run/host this template via Vercel, you will populate these environment variables in the Vercel "Environment Variables" settings rather than defining them in your local `.env` file.
29+
To run the project locally you will need to create a `.env` configuration file. You can get started by copying
30+
`sample.env` and renaming it as `.env`.
2931

3032
Run `npm start` or `yarn start` to run the project locally.
3133

3234
After making any changes to the `.env` file, you will need to restart the app.
3335

34-
The default values specified in the provided `sample.env` file are reflected in the demo hosting found at: https://artblocks-engine-react.vercel.app/
36+
The default values specified in the provided `sample.env` file are reflected in the demo hosting found at:
37+
https://artblocks-engine-react.vercel.app/
38+
39+
**Important note:** if you are planning to run/host this template via Vercel, you will populate these environment
40+
variables in the Vercel "Environment Variables" settings rather than defining them in your local `.env` file.
41+
42+
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2FArtBlocks%2Fartblocks-engine-react&env=REACT_APP_EXPECTED_CHAIN_ID,REACT_APP_GRAPHQL_URL,REACT_APP_INFURA_KEY&envDescription=Required%20environment%20variables%20for%20deployment&envLink=https%3A%2F%2Fgithub.com%2FArtBlocks%2Fartblocks-engine-react%2Fblob%2Fmain%2Fsample.env)
3543

3644
## Customizing your configuration
3745

38-
In order to customize your specific implementation, you will need to edit the default configuration provided on the `sample.env` file. First of all, you will need to replace the contract addresses with your own.
46+
In order to customize your specific implementation, you will need to edit the default configuration provided on the
47+
`sample.env` file.
48+
49+
You must specify an API key from [Infura](https://www.infura.io/) as well as a chain id in your environment file. Use
50+
`1` for mainnet or `5` for goerli. Alternative providers can be used by modifying the `src/components/Providers.tsx`
51+
file. Use multiple `.env` fiels to set up `development` or `staging` environments on `testnet` if you wish to do so.
3952

40-
You must specify an API key from [Infura](https://www.infura.io/) as well as a chain id in your environment file. Use `1` for mainnet or `5` for goerli. Alternative providers can be used by modifying the `src/components/Providers.tsx` file. Use multiple `.env` fiels to set up `development` or `staging` environments on `testnet` if you wish to do so.
53+
Additionally, you will need to edit the default configuration in the `src/contractConfig.ts` file -
54+
here you will find arrays for your mainnet and testnet contracts. Further configuration values like the number of
55+
projects per page, tokens per page, etc. can be found in `src/config.ts`.
4156

42-
There are additional configuration values you could customize like the number of projects per page, or tokens per page. You will find those parameters in `src/config.ts`.
57+
**Important note:** if you intend to support either of the `MinterMerkleV5` or `MinterHolderV4` minters there are a few
58+
extra necessary requirements and configurations.
59+
60+
Support for the `MinterMerkleV5` minter requires a custom API endpoint that is responsible for calculating the merkle
61+
root for a given wallet address - the url for this endpoint must be configured in the `.env` file with the
62+
`REACT_APP_MERKLE_PROOF_API_URL` key. It is assumed that this endpoint takes the following url parameters:
63+
`?contractAddress={}&projectId={}&walletAddress={}` - this can be customized in the
64+
`src/components/MinterInterfaces/MinterMerkleV5Interface.tsx` file. For an example of this endpoint please see
65+
[here](https://github.com/plottables/media/blob/main/pages/api/getMerkleProof.tsx).
66+
67+
Support for the `MinterHolderV4` minter requires a custom API endpoint that is responsible for determining the holder
68+
proof for a given wallet address - the url for this endpoint must be configured in the `.env` file with the
69+
`REACT_APP_HOLDER_PROOF_API_URL` key. It is assumed that this endpoint takes the following url parameters:
70+
`?contractAddress={}&projectId={}&walletAddress={}&isMainnet={}` - this can be customized in the
71+
`src/components/MinterInterfaces/MinterHolderV4Interface.tsx` file. For an example of this endpoint please see
72+
[here](https://github.com/plottables/media/blob/main/pages/api/getHolderProof.tsx).
4373

4474
# Sections and Features
4575

46-
This project includes wallet connection with [RainbowKit](https://www.rainbowkit.com/) and [wagmi.js](https://wagmi.sh/).
76+
This project includes wallet connection with [RainbowKit](https://www.rainbowkit.com/) and
77+
[wagmi.js](https://wagmi.sh/).
4778

4879
## Lander
4980
- An empty landing page
5081

5182
## Projects
5283
- Header/subheader
53-
- Hero area with most recent project featured
5484
- Title/artist name/description blurb
55-
- Masonry grid of recent projects
85+
- Grid of recent projects
5686

57-
## Project
87+
## Project
5888
- Breadcrumb nav
59-
- Status/date launched
89+
- Status
6090
- Cover image
6191
- Link to token shown as cover
6292
- Title/artist
6393
- Number of invocations
6494
- Mint button
6595
- Description
6696
- License/library
67-
- Display notes (optional field)
68-
- Code notes (optional field)
69-
- Masonry token grid
97+
- Token grid
7098
- Sort (by date)
7199
- Pagination
72100

@@ -80,9 +108,15 @@ This project includes wallet connection with [RainbowKit](https://www.rainbowkit
80108
- Etherscan and OpenSea links
81109

82110
## Project list
83-
- Masonry grid of projects
111+
- Grid of projects
84112
- Cover images
85113
- Link to token shown as cover
86114
- Title/artist name
87115
- Description blurb
88116
- Pagination
117+
118+
## Owned Tokens
119+
- List of projects with tokens owned by wallet
120+
- Title/artist name with link to project page
121+
- Images/Links to owned tokens with pagination
122+
- Pagination

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"@mui/icons-material": "^5.8.4",
1111
"@mui/lab": "^5.0.0-alpha.86",
1212
"@mui/material": "^5.8.2",
13-
"@rainbow-me/rainbowkit": "^0.8.0",
13+
"@rainbow-me/rainbowkit": "^0.12.4",
1414
"@testing-library/jest-dom": "^5.16.4",
1515
"@testing-library/react": "^13.3.0",
1616
"@testing-library/user-event": "^13.5.0",
@@ -25,14 +25,15 @@
2525
"moment-timezone": "^0.5.39",
2626
"react": "^18.1.0",
2727
"react-dom": "^18.1.0",
28+
"react-markdown": "^8.0.7",
2829
"react-query": "^3.39.1",
2930
"react-router-dom": "^6.3.0",
3031
"react-scripts": "5.0.1",
3132
"react-toastify": "^9.0.5",
3233
"typescript": "^4.7.3",
3334
"usehooks-ts": "^2.9.1",
3435
"util": "^0.12.4",
35-
"wagmi": "^0.8.10"
36+
"wagmi": "^0.12.6"
3637
},
3738
"scripts": {
3839
"start": "GENERATE_SOURCEMAP=false react-scripts start",

sample.env

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1-
REACT_APP_EXPECTED_CHAIN_ID=5
2-
REACT_APP_INFURA_KEY=
1+
# MAINNET
2+
#REACT_APP_EXPECTED_CHAIN_ID=1
3+
#REACT_APP_GRAPHQL_URL=https://api.thegraph.com/subgraphs/name/artblocks/art-blocks
4+
5+
# TESTNET
6+
REACT_APP_EXPECTED_CHAIN_ID=3
37
REACT_APP_GRAPHQL_URL=https://api.thegraph.com/subgraphs/name/artblocks/art-blocks-artist-staging-goerli
4-
REACT_APP_CORE_CONTRACT_ADDRESS=0x6200437235E9AB363e83A53666871d745BfE52F3
5-
REACT_APP_MINT_CONTRACT_ADDRESS=0xF470012b134262C5Ec679F5b9Fc1107018DE7cd4
6-
REACT_APP_MEDIA_URL=https://media-proxy-staging.artblocks.io
7-
REACT_APP_TOKEN_URL=https://token.staging.artblocks.io
8-
REACT_APP_GENERATOR_URL=https://generator-staging-goerli.artblocks.io
8+
9+
REACT_APP_INFURA_KEY=abc123
10+
REACT_APP_MERKLE_PROOF_API_URL=https://media.plottables.io/api/getMerkleProof
11+
REACT_APP_HOLDER_PROOF_API_URL=https://media.plottables.io/api/getHolderProof

src/App.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import LandingPage from "pages/LandingPage"
55
import ProjectsPage from "pages/ProjectsPage"
66
import ProjectPage from "pages/ProjectPage"
77
import TokenPage from "pages/TokenPage"
8+
import UserPage from "pages/UserPage"
89
import Providers from "components/Providers"
910

1011
function App() {
@@ -14,8 +15,9 @@ function App() {
1415
<Routes>
1516
<Route index element={<LandingPage/>}/>
1617
<Route path="projects" element={<ProjectsPage/>}/>
17-
<Route path="project/:projectId" element={<ProjectPage/>}/>
18-
<Route path="token/:id" element={<TokenPage/>}/>
18+
<Route path="project/:contractAddress/:projectId" element={<ProjectPage/>}/>
19+
<Route path="token/:contractAddress/:id" element={<TokenPage/>}/>
20+
<Route path="user/:walletAddress" element={<UserPage/>}/>
1921
</Routes>
2022
</Router>
2123
<ToastContainer

0 commit comments

Comments
 (0)