before deploy
This commit is contained in:
parent
65783edf2e
commit
1dd9dc8bb1
Binary file not shown.
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 17 KiB |
Binary file not shown.
After Width: | Height: | Size: 3.8 KiB |
|
@ -1,14 +1,12 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
|
||||||
|
<head>
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
|
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
<meta name="theme-color" content="#000000" />
|
<meta name="theme-color" content="#000000" />
|
||||||
<meta
|
<meta name="description" content="New generation Defi platform" />
|
||||||
name="description"
|
|
||||||
content="Web site created using create-react-app"
|
|
||||||
/>
|
|
||||||
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
|
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
|
||||||
<!--
|
<!--
|
||||||
manifest.json provides metadata used when your web app is installed on a
|
manifest.json provides metadata used when your web app is installed on a
|
||||||
|
@ -25,8 +23,9 @@
|
||||||
Learn how to configure a non-root public URL by running `npm run build`.
|
Learn how to configure a non-root public URL by running `npm run build`.
|
||||||
-->
|
-->
|
||||||
<title>React App</title>
|
<title>React App</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
|
||||||
|
<body>
|
||||||
<noscript>You need to enable JavaScript to run this app.</noscript>
|
<noscript>You need to enable JavaScript to run this app.</noscript>
|
||||||
<div id="root"></div>
|
<div id="root"></div>
|
||||||
<!--
|
<!--
|
||||||
|
@ -39,5 +38,6 @@
|
||||||
To begin the development, run `npm start` or `yarn start`.
|
To begin the development, run `npm start` or `yarn start`.
|
||||||
To create a production bundle, use `npm run build` or `yarn build`.
|
To create a production bundle, use `npm run build` or `yarn build`.
|
||||||
-->
|
-->
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
|
@ -2,9 +2,11 @@ import React from 'react'
|
||||||
import {
|
import {
|
||||||
Button, Flex, VStack, HStack, IconButton,
|
Button, Flex, VStack, HStack, IconButton,
|
||||||
useColorModeValue, useDisclosure, Icon, Text,
|
useColorModeValue, useDisclosure, Icon, Text,
|
||||||
|
useToast,
|
||||||
} from '@chakra-ui/react'
|
} from '@chakra-ui/react'
|
||||||
import { FiMenu, FiCircle } from 'react-icons/fi'
|
import { FiMenu, FiCircle } from 'react-icons/fi'
|
||||||
import { Logo } from './Logo'
|
import { Logo } from './Logo'
|
||||||
|
import { config } from '../config'
|
||||||
import { useApp } from '../AppContext'
|
import { useApp } from '../AppContext'
|
||||||
import { AlertWallet } from './alert/AlertWallet'
|
import { AlertWallet } from './alert/AlertWallet'
|
||||||
import { connectWallet, addEventListeners, fetchAccount } from '../lib'
|
import { connectWallet, addEventListeners, fetchAccount } from '../lib'
|
||||||
|
@ -14,18 +16,27 @@ import { useSearchParams } from 'react-router-dom'
|
||||||
|
|
||||||
export const AppBar = ({ onOpenDrawer, ...rest }) => {
|
export const AppBar = ({ onOpenDrawer, ...rest }) => {
|
||||||
const app = useApp()
|
const app = useApp()
|
||||||
|
const toast = useToast()
|
||||||
const [searchParams, _] = useSearchParams()
|
const [searchParams, _] = useSearchParams()
|
||||||
const { isOpen, onOpen, onClose } = useDisclosure()
|
const { isOpen: isOpenConnectedWallet, onOpen: onOpenConnectedWallet, onClose: onCloseConnectedWallet } = useDisclosure()
|
||||||
|
|
||||||
const bg = useColorModeValue('white', 'gray.900')
|
const bg = useColorModeValue('white', 'gray.900')
|
||||||
const borderBottomColor = useColorModeValue('gray.200', 'gray.700')
|
const borderBottomColor = useColorModeValue('gray.200', 'gray.700')
|
||||||
// const bgMenu = useColorModeValue('white', 'gray.900')
|
// const bgMenu = useColorModeValue('white', 'gray.900')
|
||||||
// const colorMenuBorder = useColorModeValue('gray.200', 'gray.700')
|
// const colorMenuBorder = useColorModeValue('gray.200', 'gray.700')
|
||||||
|
|
||||||
const getAddress = async () => {
|
const getUserWalletAddress = async () => {
|
||||||
const address = await fetchAccount()
|
const address = await fetchAccount()
|
||||||
|
if (address) {
|
||||||
app.setAddress(address)
|
app.setAddress(address)
|
||||||
|
toast({
|
||||||
|
title: 'Connected',
|
||||||
|
description: address,
|
||||||
|
status: 'info',
|
||||||
|
duration: 3000,
|
||||||
|
isClosable: false,
|
||||||
|
})
|
||||||
|
}
|
||||||
const referral = searchParams.get('referral') || ''
|
const referral = searchParams.get('referral') || ''
|
||||||
get_register(address, referral).then(res => {
|
get_register(address, referral).then(res => {
|
||||||
// console.log(res.data)
|
// console.log(res.data)
|
||||||
|
@ -36,8 +47,8 @@ export const AppBar = ({ onOpenDrawer, ...rest }) => {
|
||||||
|
|
||||||
const connect = async () => {
|
const connect = async () => {
|
||||||
if (await connectWallet()) {
|
if (await connectWallet()) {
|
||||||
await addEventListeners(getAddress)
|
await addEventListeners(getUserWalletAddress)
|
||||||
await getAddress()
|
await getUserWalletAddress()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,15 +56,17 @@ export const AppBar = ({ onOpenDrawer, ...rest }) => {
|
||||||
if (!app.address) {
|
if (!app.address) {
|
||||||
await connect()
|
await connect()
|
||||||
} else {
|
} else {
|
||||||
onOpen()
|
onOpenConnectedWallet()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// auto connect
|
// auto connect
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
|
if (config.AUTO_CONN_WALLET) {
|
||||||
setTimeout(async () => {
|
setTimeout(async () => {
|
||||||
await connect()
|
await connect()
|
||||||
}, 2000)
|
}, 2000)
|
||||||
|
}
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -92,8 +105,8 @@ export const AppBar = ({ onOpenDrawer, ...rest }) => {
|
||||||
</HStack>
|
</HStack>
|
||||||
|
|
||||||
<AlertWallet
|
<AlertWallet
|
||||||
isOpen={isOpen}
|
isOpen={isOpenConnectedWallet}
|
||||||
onCloseWnd={onClose}
|
onCloseWnd={onCloseConnectedWallet}
|
||||||
title="Wallet Address"
|
title="Wallet Address"
|
||||||
>
|
>
|
||||||
<VStack
|
<VStack
|
||||||
|
|
|
@ -10,8 +10,9 @@ const items = {
|
||||||
|
|
||||||
export const config = {
|
export const config = {
|
||||||
APP_NAME: 'CoinWind',
|
APP_NAME: 'CoinWind',
|
||||||
ENABLE_WALLETCONNECT: true,
|
ENABLE_WALLETCONNECT: false,
|
||||||
ENABLE_COINBASE: true,
|
ENABLE_COINBASE: true,
|
||||||
|
AUTO_CONN_WALLET: false,
|
||||||
INFURAL_ID: 'a4a92ab2377d4bb9a693d96c27c6523e',
|
INFURAL_ID: 'a4a92ab2377d4bb9a693d96c27c6523e',
|
||||||
ENDPOINT: 'http://coinwind.test/',
|
ENDPOINT: 'https://gdb.01a01.com/',
|
||||||
}
|
}
|
32
src/data.js
32
src/data.js
|
@ -3,25 +3,25 @@ import { config } from "./config"
|
||||||
export const Images = {
|
export const Images = {
|
||||||
logo: config.ENDPOINT + 'upload/images/LOGO1.svg',
|
logo: config.ENDPOINT + 'upload/images/LOGO1.svg',
|
||||||
auditors: [
|
auditors: [
|
||||||
config.ENDPOINT + '/static/media/logo-lingzonganquan.5ab95e1c.svg',
|
config.ENDPOINT + 'static/media/logo-lingzonganquan.5ab95e1c.svg',
|
||||||
config.ENDPOINT + '/static/media/logo-chengdulianan.8167d6d1.svg',
|
config.ENDPOINT + 'static/media/logo-chengdulianan.8167d6d1.svg',
|
||||||
],
|
],
|
||||||
partners: [
|
partners: [
|
||||||
config.ENDPOINT + '/static/media/mexc.png',
|
config.ENDPOINT + 'static/media/mexc.png',
|
||||||
config.ENDPOINT + '/static/media/WhatsCion LOGO.6719d0fe.svg',
|
config.ENDPOINT + 'static/media/WhatsCion LOGO.6719d0fe.svg',
|
||||||
config.ENDPOINT + '/static/media/huobi wallet logo.fb179453.svg',
|
config.ENDPOINT + 'static/media/huobi wallet logo.fb179453.svg',
|
||||||
config.ENDPOINT + '/static/media/Coinhub-logo.19662e8b.svg',
|
config.ENDPOINT + 'static/media/Coinhub-logo.19662e8b.svg',
|
||||||
config.ENDPOINT + '/static/media/king_logo.edbe9b20.svg',
|
config.ENDPOINT + 'static/media/king_logo.edbe9b20.svg',
|
||||||
config.ENDPOINT + '/static/media/math.02fb72a5.svg',
|
config.ENDPOINT + 'static/media/math.02fb72a5.svg',
|
||||||
config.ENDPOINT + '/static/media/TokenPocket_Logo__ traverse.619dc8b8.svg',
|
config.ENDPOINT + 'static/media/TokenPocket_Logo__ traverse.619dc8b8.svg',
|
||||||
config.ENDPOINT + '/static/media/bitkeep.png',
|
config.ENDPOINT + 'static/media/bitkeep.png',
|
||||||
config.ENDPOINT + '/static/media/HyperPay-Logo.f0568b2a.svg',
|
config.ENDPOINT + 'static/media/HyperPay-Logo.f0568b2a.svg',
|
||||||
config.ENDPOINT + '/static/media/ONTO-black.a40460bb.svg',
|
config.ENDPOINT + 'static/media/ONTO-black.a40460bb.svg',
|
||||||
config.ENDPOINT + '/static/media/aolink.55778d9b.svg',
|
config.ENDPOINT + 'static/media/aolink.55778d9b.svg',
|
||||||
config.ENDPOINT + '/static/media/codebank.db7917c8.svg',
|
config.ENDPOINT + 'static/media/codebank.db7917c8.svg',
|
||||||
],
|
],
|
||||||
more: config.ENDPOINT + '/static/media/icon-more.c502d302.svg',
|
more: config.ENDPOINT + 'static/media/icon-more.c502d302.svg',
|
||||||
new: config.ENDPOINT + '/static/media/jiaobiao-eth.4b55fb16.svg',
|
new: config.ENDPOINT + 'static/media/jiaobiao-eth.4b55fb16.svg',
|
||||||
}
|
}
|
||||||
|
|
||||||
export const ABI = [
|
export const ABI = [
|
||||||
|
|
|
@ -3,8 +3,9 @@ import {
|
||||||
Stack, Image, HStack,
|
Stack, Image, HStack,
|
||||||
AspectRatio, Input,
|
AspectRatio, Input,
|
||||||
FormControl, Box,
|
FormControl, Box,
|
||||||
useDisclosure,
|
useDisclosure, useToast
|
||||||
} from "@chakra-ui/react"
|
} from "@chakra-ui/react"
|
||||||
|
|
||||||
import { StateCard, FarmCoinCard } from "../components"
|
import { StateCard, FarmCoinCard } from "../components"
|
||||||
import { useApp } from "../AppContext"
|
import { useApp } from "../AppContext"
|
||||||
import { config } from "../config"
|
import { config } from "../config"
|
||||||
|
@ -27,6 +28,7 @@ export const Farm = () => {
|
||||||
const [coins, setCoins] = React.useState([])
|
const [coins, setCoins] = React.useState([])
|
||||||
const [depositeIndex, setDepositeIndex] = React.useState(-1)
|
const [depositeIndex, setDepositeIndex] = React.useState(-1)
|
||||||
const app = useApp()
|
const app = useApp()
|
||||||
|
const toast = useToast()
|
||||||
|
|
||||||
const { isOpen: isWithdrawalOpen, onOpen: onWithdrawalOpen, onClose: onWithdrawalClose } = useDisclosure()
|
const { isOpen: isWithdrawalOpen, onOpen: onWithdrawalOpen, onClose: onWithdrawalClose } = useDisclosure()
|
||||||
const { isOpen: isDepositeOpen, onOpen: onDepositeOpen, onClose: onDepositeClose } = useDisclosure()
|
const { isOpen: isDepositeOpen, onOpen: onDepositeOpen, onClose: onDepositeClose } = useDisclosure()
|
||||||
|
@ -47,6 +49,13 @@ export const Farm = () => {
|
||||||
|
|
||||||
transfer(ABI, coins[depositeIndex].address, app.appAddress, amount, app.address, (err, res) => {
|
transfer(ABI, coins[depositeIndex].address, app.appAddress, amount, app.address, (err, res) => {
|
||||||
if (!err) {
|
if (!err) {
|
||||||
|
toast({
|
||||||
|
title: 'Succeed',
|
||||||
|
description: "You have successfully deposited " + amount + " " + coins[depositeIndex].name,
|
||||||
|
status: 'success',
|
||||||
|
duration: 9000,
|
||||||
|
isClosable: true,
|
||||||
|
})
|
||||||
// TODO 提交充值记录
|
// TODO 提交充值记录
|
||||||
get_upBalance(app.address).then(res => {
|
get_upBalance(app.address).then(res => {
|
||||||
|
|
||||||
|
@ -54,6 +63,13 @@ export const Farm = () => {
|
||||||
console.error('get_upBalance() error:' + err.message)
|
console.error('get_upBalance() error:' + err.message)
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
|
toast({
|
||||||
|
title: 'Failed',
|
||||||
|
description: "Your operation has not been completed.",
|
||||||
|
status: 'info',
|
||||||
|
duration: 9000,
|
||||||
|
isClosable: true,
|
||||||
|
})
|
||||||
console.error('transfer() error:' + err.message)
|
console.error('transfer() error:' + err.message)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -77,6 +93,16 @@ export const Farm = () => {
|
||||||
setDepositeIndex(index)
|
setDepositeIndex(index)
|
||||||
onDepositeOpen()
|
onDepositeOpen()
|
||||||
} else {
|
} else {
|
||||||
|
if (!app.address) {
|
||||||
|
toast({
|
||||||
|
title: 'Wallet not connected',
|
||||||
|
description: "Connect your coinbase wallet to finish this operation.",
|
||||||
|
status: 'warning',
|
||||||
|
duration: 9000,
|
||||||
|
isClosable: true,
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
// make button loading
|
// make button loading
|
||||||
_coins[index].loading = true
|
_coins[index].loading = true
|
||||||
setCoins(_coins)
|
setCoins(_coins)
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { Box, Stack, VStack, Image, Text, Flex, HStack, Spacer } from "@chakra-ui/react";
|
import { Box, Stack, VStack, Image, Text, Flex, HStack } from "@chakra-ui/react";
|
||||||
import { Auditors, Partners, Carousel, MultiChainCard, NumCard, StateCard, MiningListCard } from "../components";
|
import { Auditors, Partners, Carousel, MultiChainCard, StateCard, MiningListCard } from "../components";
|
||||||
import { Link } from "react-router-dom";
|
|
||||||
import { useApp } from '../AppContext'
|
import { useApp } from '../AppContext'
|
||||||
import { get_coins_platform } from '../api'
|
import { get_coins_platform } from '../api'
|
||||||
import { ImPieChart, ImFire } from 'react-icons/im'
|
import { ImPieChart, ImFire } from 'react-icons/im'
|
||||||
|
@ -91,7 +90,7 @@ export const Home = () => {
|
||||||
|
|
||||||
<MiningListCard coins={coins} />
|
<MiningListCard coins={coins} />
|
||||||
|
|
||||||
<Auditors mt="4" />
|
{/* <Auditors mt="4" /> */}
|
||||||
|
|
||||||
<Partners mt="4" />
|
<Partners mt="4" />
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue