- CSS: styled-components, polished
- Wallet connection: web3-react, ethers.js
- Wallet connection RPC: alchemy api
- Router: React router dom
- Configuration: Babel, Webpack, Typescript, Prettier, Eslint
- To go through the repo, you can start from
- App.tsx ->
- pages/Home ->
- Home/OrderSideBar ->
- Three parts of the Order SideBar
- Home/OptionInfoCard: Buy & Sell button with Option Info
- Home/MarletLimitTab: Market & limit tab, includes Order(4 types), Tx Action Card, Tx Summary Card
- Home/OrderAction: Order Action Card, including buttons & functions for Wallet Connection, Approve Tx
- Then start to look into the components...etc
-
Components:
- Wallet
- There are Intall Metamask / Connect to Metamask / Wallet Connection Error / Switch Network status, 4 different steps(status)
- Install Metamask Button: will show up when browser is not detected with metamask extension
- Connect to Metamask Button: If users are not connected to Metamask, Connect to Metamask Button will show up
- Connection Error Box: If users connect to unsupported network(Networks not listed in the src/connectors enum ChainId), or user reject connection request...etc(Listed in src/libs getErrorMesg()), then the Wallet Connection Error Box will show up
- Wrong Network Button: If users are currently connected to non-mainnet networks, Wrong Network Button will show up, user can click it to switch to mainnet
- If webpage is already connected to Metamask, it will jump to second step automatically.
- There are Intall Metamask / Connect to Metamask / Wallet Connection Error / Switch Network status, 4 different steps(status)
- Button:
- Normal Button
- Icon Button
- Buy & Sell Button
- Connect Wallet Button
- Approve Button
- Wrong Network Button
- Install Metamask Button
- Max value Button
- Input: 1.Normal Input 2. Input Elements for actions/icon inside input field 3. Input Group: for Normal Input & Input Elements bundling 4. Input with Max Value Button: with functionality as well 5. Input with Plus and Minus icon Buttons: with functionality as well
- Order:
- Four Orders(buy-limit / sell-limit / sell-market / buy-market)
- Other elements showed up in four orders
- SideBar
- Wrapper for Order SideBar also wrapper for other types of sidebar content since I found there were multiple types of sidebar content in Opyn V2
- Slider:
- Basic Slider: with Critical value as reminder label
- Slider Label: with the requested amount of sections out of 100%
- Collateral Slider: custom style slider
- Tab:
- Tabs: Tabs as Tab Wrapper, wrap the title and the content
- Tab: Tab Header Button
- Card:
- Normal Card
- Tx Action Card on Sidebar
- Tx Summary Card on Sidebar
- Dropdown: Custom style Dropdown
- Page
- Main page wrapper
- Page title
- Page subtitle
- InfoWrap
- Wallet
-
Connectors / Constants: constants, settings for wallet connection
-
Data: tx and action button descriptions for each tx step
-
Pages:
- Home page: and also custom components that only used in Home page
- OrderAction: if want to test other three types of tx flow just switch the enable/disabled button on the left side of the page, other 3 types of tx approve button will be available
- Main States
- Order
- Order type: BUY / SELL
- Price type: MARKET / LIMIT
- Current Tx step: number
- isLoading: for fake loading
- disable: to decide whether you can see other three order flows
- Order
- Not found page: to redirect to if there is an incorrect path requests
- Home page: and also custom components that only used in Home page
-
Hooks: Hook-like functions for wallet connections
-
Types: Types for typescript, using both type and enum
-
Libs: functions for wallet connections
-
Styles: styles.tsx create basic setting and color variables, and use normalize of polished.js to normalize abnormalities across browsers
npm install
npm start
npm run build
npm run lint