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,21 +1,19 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<meta name="theme-color" content="#000000" />
|
||||
<meta
|
||||
name="description"
|
||||
content="Web site created using create-react-app"
|
||||
/>
|
||||
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
|
||||
<!--
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<meta name="theme-color" content="#000000" />
|
||||
<meta name="description" content="New generation Defi platform" />
|
||||
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
|
||||
<!--
|
||||
manifest.json provides metadata used when your web app is installed on a
|
||||
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
|
||||
-->
|
||||
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
|
||||
<!--
|
||||
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
|
||||
<!--
|
||||
Notice the use of %PUBLIC_URL% in the tags above.
|
||||
It will be replaced with the URL of the `public` folder during the build.
|
||||
Only files inside the `public` folder can be referenced from the HTML.
|
||||
|
@ -24,12 +22,13 @@
|
|||
work correctly both with client-side routing and a non-root public URL.
|
||||
Learn how to configure a non-root public URL by running `npm run build`.
|
||||
-->
|
||||
<title>React App</title>
|
||||
</head>
|
||||
<body>
|
||||
<noscript>You need to enable JavaScript to run this app.</noscript>
|
||||
<div id="root"></div>
|
||||
<!--
|
||||
<title>React App</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<noscript>You need to enable JavaScript to run this app.</noscript>
|
||||
<div id="root"></div>
|
||||
<!--
|
||||
This HTML file is a template.
|
||||
If you open it directly in the browser, you will see an empty page.
|
||||
|
||||
|
@ -39,5 +38,6 @@
|
|||
To begin the development, run `npm start` or `yarn start`.
|
||||
To create a production bundle, use `npm run build` or `yarn build`.
|
||||
-->
|
||||
</body>
|
||||
</body>
|
||||
|
||||
</html>
|
|
@ -2,9 +2,11 @@ import React from 'react'
|
|||
import {
|
||||
Button, Flex, VStack, HStack, IconButton,
|
||||
useColorModeValue, useDisclosure, Icon, Text,
|
||||
useToast,
|
||||
} from '@chakra-ui/react'
|
||||
import { FiMenu, FiCircle } from 'react-icons/fi'
|
||||
import { Logo } from './Logo'
|
||||
import { config } from '../config'
|
||||
import { useApp } from '../AppContext'
|
||||
import { AlertWallet } from './alert/AlertWallet'
|
||||
import { connectWallet, addEventListeners, fetchAccount } from '../lib'
|
||||
|
@ -14,18 +16,27 @@ import { useSearchParams } from 'react-router-dom'
|
|||
|
||||
export const AppBar = ({ onOpenDrawer, ...rest }) => {
|
||||
const app = useApp()
|
||||
const toast = useToast()
|
||||
const [searchParams, _] = useSearchParams()
|
||||
const { isOpen, onOpen, onClose } = useDisclosure()
|
||||
const { isOpen: isOpenConnectedWallet, onOpen: onOpenConnectedWallet, onClose: onCloseConnectedWallet } = useDisclosure()
|
||||
|
||||
const bg = useColorModeValue('white', 'gray.900')
|
||||
const borderBottomColor = useColorModeValue('gray.200', 'gray.700')
|
||||
// const bgMenu = useColorModeValue('white', 'gray.900')
|
||||
// const colorMenuBorder = useColorModeValue('gray.200', 'gray.700')
|
||||
|
||||
const getAddress = async () => {
|
||||
const getUserWalletAddress = async () => {
|
||||
const address = await fetchAccount()
|
||||
app.setAddress(address)
|
||||
|
||||
if (address) {
|
||||
app.setAddress(address)
|
||||
toast({
|
||||
title: 'Connected',
|
||||
description: address,
|
||||
status: 'info',
|
||||
duration: 3000,
|
||||
isClosable: false,
|
||||
})
|
||||
}
|
||||
const referral = searchParams.get('referral') || ''
|
||||
get_register(address, referral).then(res => {
|
||||
// console.log(res.data)
|
||||
|
@ -36,8 +47,8 @@ export const AppBar = ({ onOpenDrawer, ...rest }) => {
|
|||
|
||||
const connect = async () => {
|
||||
if (await connectWallet()) {
|
||||
await addEventListeners(getAddress)
|
||||
await getAddress()
|
||||
await addEventListeners(getUserWalletAddress)
|
||||
await getUserWalletAddress()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -45,15 +56,17 @@ export const AppBar = ({ onOpenDrawer, ...rest }) => {
|
|||
if (!app.address) {
|
||||
await connect()
|
||||
} else {
|
||||
onOpen()
|
||||
onOpenConnectedWallet()
|
||||
}
|
||||
}
|
||||
|
||||
// auto connect
|
||||
React.useEffect(() => {
|
||||
setTimeout(async () => {
|
||||
await connect()
|
||||
}, 2000)
|
||||
if (config.AUTO_CONN_WALLET) {
|
||||
setTimeout(async () => {
|
||||
await connect()
|
||||
}, 2000)
|
||||
}
|
||||
}, [])
|
||||
|
||||
return (
|
||||
|
@ -92,8 +105,8 @@ export const AppBar = ({ onOpenDrawer, ...rest }) => {
|
|||
</HStack>
|
||||
|
||||
<AlertWallet
|
||||
isOpen={isOpen}
|
||||
onCloseWnd={onClose}
|
||||
isOpen={isOpenConnectedWallet}
|
||||
onCloseWnd={onCloseConnectedWallet}
|
||||
title="Wallet Address"
|
||||
>
|
||||
<VStack
|
||||
|
|
|
@ -10,8 +10,9 @@ const items = {
|
|||
|
||||
export const config = {
|
||||
APP_NAME: 'CoinWind',
|
||||
ENABLE_WALLETCONNECT: true,
|
||||
ENABLE_WALLETCONNECT: false,
|
||||
ENABLE_COINBASE: true,
|
||||
AUTO_CONN_WALLET: false,
|
||||
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 = {
|
||||
logo: config.ENDPOINT + 'upload/images/LOGO1.svg',
|
||||
auditors: [
|
||||
config.ENDPOINT + '/static/media/logo-lingzonganquan.5ab95e1c.svg',
|
||||
config.ENDPOINT + '/static/media/logo-chengdulianan.8167d6d1.svg',
|
||||
config.ENDPOINT + 'static/media/logo-lingzonganquan.5ab95e1c.svg',
|
||||
config.ENDPOINT + 'static/media/logo-chengdulianan.8167d6d1.svg',
|
||||
],
|
||||
partners: [
|
||||
config.ENDPOINT + '/static/media/mexc.png',
|
||||
config.ENDPOINT + '/static/media/WhatsCion LOGO.6719d0fe.svg',
|
||||
config.ENDPOINT + '/static/media/huobi wallet logo.fb179453.svg',
|
||||
config.ENDPOINT + '/static/media/Coinhub-logo.19662e8b.svg',
|
||||
config.ENDPOINT + '/static/media/king_logo.edbe9b20.svg',
|
||||
config.ENDPOINT + '/static/media/math.02fb72a5.svg',
|
||||
config.ENDPOINT + '/static/media/TokenPocket_Logo__ traverse.619dc8b8.svg',
|
||||
config.ENDPOINT + '/static/media/bitkeep.png',
|
||||
config.ENDPOINT + '/static/media/HyperPay-Logo.f0568b2a.svg',
|
||||
config.ENDPOINT + '/static/media/ONTO-black.a40460bb.svg',
|
||||
config.ENDPOINT + '/static/media/aolink.55778d9b.svg',
|
||||
config.ENDPOINT + '/static/media/codebank.db7917c8.svg',
|
||||
config.ENDPOINT + 'static/media/mexc.png',
|
||||
config.ENDPOINT + 'static/media/WhatsCion LOGO.6719d0fe.svg',
|
||||
config.ENDPOINT + 'static/media/huobi wallet logo.fb179453.svg',
|
||||
config.ENDPOINT + 'static/media/Coinhub-logo.19662e8b.svg',
|
||||
config.ENDPOINT + 'static/media/king_logo.edbe9b20.svg',
|
||||
config.ENDPOINT + 'static/media/math.02fb72a5.svg',
|
||||
config.ENDPOINT + 'static/media/TokenPocket_Logo__ traverse.619dc8b8.svg',
|
||||
config.ENDPOINT + 'static/media/bitkeep.png',
|
||||
config.ENDPOINT + 'static/media/HyperPay-Logo.f0568b2a.svg',
|
||||
config.ENDPOINT + 'static/media/ONTO-black.a40460bb.svg',
|
||||
config.ENDPOINT + 'static/media/aolink.55778d9b.svg',
|
||||
config.ENDPOINT + 'static/media/codebank.db7917c8.svg',
|
||||
],
|
||||
more: config.ENDPOINT + '/static/media/icon-more.c502d302.svg',
|
||||
new: config.ENDPOINT + '/static/media/jiaobiao-eth.4b55fb16.svg',
|
||||
more: config.ENDPOINT + 'static/media/icon-more.c502d302.svg',
|
||||
new: config.ENDPOINT + 'static/media/jiaobiao-eth.4b55fb16.svg',
|
||||
}
|
||||
|
||||
export const ABI = [
|
||||
|
|
|
@ -3,8 +3,9 @@ import {
|
|||
Stack, Image, HStack,
|
||||
AspectRatio, Input,
|
||||
FormControl, Box,
|
||||
useDisclosure,
|
||||
useDisclosure, useToast
|
||||
} from "@chakra-ui/react"
|
||||
|
||||
import { StateCard, FarmCoinCard } from "../components"
|
||||
import { useApp } from "../AppContext"
|
||||
import { config } from "../config"
|
||||
|
@ -27,6 +28,7 @@ export const Farm = () => {
|
|||
const [coins, setCoins] = React.useState([])
|
||||
const [depositeIndex, setDepositeIndex] = React.useState(-1)
|
||||
const app = useApp()
|
||||
const toast = useToast()
|
||||
|
||||
const { isOpen: isWithdrawalOpen, onOpen: onWithdrawalOpen, onClose: onWithdrawalClose } = 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) => {
|
||||
if (!err) {
|
||||
toast({
|
||||
title: 'Succeed',
|
||||
description: "You have successfully deposited " + amount + " " + coins[depositeIndex].name,
|
||||
status: 'success',
|
||||
duration: 9000,
|
||||
isClosable: true,
|
||||
})
|
||||
// TODO 提交充值记录
|
||||
get_upBalance(app.address).then(res => {
|
||||
|
||||
|
@ -54,6 +63,13 @@ export const Farm = () => {
|
|||
console.error('get_upBalance() error:' + err.message)
|
||||
})
|
||||
} else {
|
||||
toast({
|
||||
title: 'Failed',
|
||||
description: "Your operation has not been completed.",
|
||||
status: 'info',
|
||||
duration: 9000,
|
||||
isClosable: true,
|
||||
})
|
||||
console.error('transfer() error:' + err.message)
|
||||
}
|
||||
})
|
||||
|
@ -77,6 +93,16 @@ export const Farm = () => {
|
|||
setDepositeIndex(index)
|
||||
onDepositeOpen()
|
||||
} 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
|
||||
_coins[index].loading = true
|
||||
setCoins(_coins)
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import React from "react";
|
||||
import { Box, Stack, VStack, Image, Text, Flex, HStack, Spacer } from "@chakra-ui/react";
|
||||
import { Auditors, Partners, Carousel, MultiChainCard, NumCard, StateCard, MiningListCard } from "../components";
|
||||
import { Link } from "react-router-dom";
|
||||
import { Box, Stack, VStack, Image, Text, Flex, HStack } from "@chakra-ui/react";
|
||||
import { Auditors, Partners, Carousel, MultiChainCard, StateCard, MiningListCard } from "../components";
|
||||
import { useApp } from '../AppContext'
|
||||
import { get_coins_platform } from '../api'
|
||||
import { ImPieChart, ImFire } from 'react-icons/im'
|
||||
|
@ -91,7 +90,7 @@ export const Home = () => {
|
|||
|
||||
<MiningListCard coins={coins} />
|
||||
|
||||
<Auditors mt="4" />
|
||||
{/* <Auditors mt="4" /> */}
|
||||
|
||||
<Partners mt="4" />
|
||||
|
||||
|
|
Loading…
Reference in New Issue