Initial commit
8
.env
Normal file
@ -0,0 +1,8 @@
|
||||
# API
|
||||
VUE_APP_API_URL = 'https://nftmint.counterfire.games/api'
|
||||
# 活动ID
|
||||
VUE_APP_TOKENID_ID = '11155111'
|
||||
# NFT合约
|
||||
VUE_APP_NFT_URL = '0x59e751c2037B710090035B6ea928e0cce80aC03f'
|
||||
# BEB合约
|
||||
VUE_APP_BEB_URL = '0x1304E6AA241eE3C9ea44Db9e593e85Ae76eC41F1'
|
12
.env.development
Normal file
@ -0,0 +1,12 @@
|
||||
# API
|
||||
VUE_APP_API_URL = 'https://nftmint.counterfire.games/api'
|
||||
VUE_APP_WL_URL = 'https://nftwl.counterfire.games/wl_test'
|
||||
VUE_APP_CONFIG_URL = 'https://sepolia.infura.io/v3/b6bf7d3508c941499b10025c0776eaf8'
|
||||
|
||||
# 活动ID
|
||||
VUE_APP_TOKENID_ID = '0xaa36a7'
|
||||
VUE_APP_AES_PASS = 'f0cbc08f7afcaa3baeae386860141d072b6840e1'
|
||||
# NFT合约
|
||||
VUE_APP_NFT_URL = '0x59e751c2037B710090035B6ea928e0cce80aC03f'
|
||||
# BEB合约
|
||||
VUE_APP_BEB_URL = '0x1304E6AA241eE3C9ea44Db9e593e85Ae76eC41F1'
|
11
.env.production
Normal file
@ -0,0 +1,11 @@
|
||||
# API
|
||||
VUE_APP_API_URL = 'https://nftmint.counterfire.games/api'
|
||||
VUE_APP_WL_URL = 'https://nftwl.counterfire.games/wl'
|
||||
VUE_APP_CONFIG_URL = 'https://mainnet.infura.io/v3/b6bf7d3508c941499b10025c0776eaf8'
|
||||
# 活动ID
|
||||
VUE_APP_TOKENID_ID = '0x1'
|
||||
VUE_APP_AES_PASS = 'f0cbc08f7afcaa3baeae386860141d072b6840e1'
|
||||
# NFT合约
|
||||
VUE_APP_NFT_URL = '0x20c095fb98b7F353b859c42589f2322248Ea8A23'
|
||||
# BEB合约
|
||||
VUE_APP_BEB_URL = '0xEC23679653337d4c6390d0eeBa682246a6067777'
|
23
.gitignore
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
.DS_Store
|
||||
node_modules
|
||||
/dist
|
||||
|
||||
|
||||
# local env files
|
||||
.env.local
|
||||
.env.*.local
|
||||
|
||||
# Log files
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
pnpm-debug.log*
|
||||
|
||||
# Editor directories and files
|
||||
.idea
|
||||
.vscode
|
||||
*.suo
|
||||
*.ntvs*
|
||||
*.njsproj
|
||||
*.sln
|
||||
*.sw?
|
24
README.md
Normal file
@ -0,0 +1,24 @@
|
||||
# mintpage
|
||||
|
||||
## Project setup
|
||||
```
|
||||
npm install
|
||||
```
|
||||
|
||||
### Compiles and hot-reloads for development
|
||||
```
|
||||
npm run serve
|
||||
```
|
||||
|
||||
### Compiles and minifies for production
|
||||
```
|
||||
npm run build
|
||||
```
|
||||
|
||||
### Lints and fixes files
|
||||
```
|
||||
npm run lint
|
||||
```
|
||||
|
||||
### Customize configuration
|
||||
See [Configuration Reference](https://cli.vuejs.org/config/).
|
5
babel.config.js
Normal file
@ -0,0 +1,5 @@
|
||||
module.exports = {
|
||||
presets: [
|
||||
'@vue/cli-plugin-babel/preset'
|
||||
]
|
||||
}
|
19
jsconfig.json
Normal file
@ -0,0 +1,19 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "es5",
|
||||
"module": "esnext",
|
||||
"baseUrl": "./",
|
||||
"moduleResolution": "node",
|
||||
"paths": {
|
||||
"@/*": [
|
||||
"src/*"
|
||||
]
|
||||
},
|
||||
"lib": [
|
||||
"esnext",
|
||||
"dom",
|
||||
"dom.iterable",
|
||||
"scripthost"
|
||||
]
|
||||
}
|
||||
}
|
14212
package-lock.json
generated
Normal file
56
package.json
Normal file
@ -0,0 +1,56 @@
|
||||
{
|
||||
"name": "COUNTERFIRE",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"serve": "vue-cli-service serve",
|
||||
"serve_prod": "vue-cli-service serve --mode production",
|
||||
"build": "vue-cli-service build --mode development",
|
||||
"build_prod": "vue-cli-service build --mode production",
|
||||
"lint": "vue-cli-service lint"
|
||||
},
|
||||
"dependencies": {
|
||||
"@walletconnect/ethereum-provider": "^2.11.2",
|
||||
"@walletconnect/modal": "^2.6.2",
|
||||
"axios": "^1.6.7",
|
||||
"core-js": "^3.8.3",
|
||||
"crypto-js": "^4.2.0",
|
||||
"element-ui": "^2.15.14",
|
||||
"moment": "^2.30.1",
|
||||
"moment-timezone": "^0.5.45",
|
||||
"postcss-px-to-viewport": "^1.1.1",
|
||||
"sass": "^1.71.0",
|
||||
"sass-loader": "^14.1.0",
|
||||
"vue": "^2.6.14",
|
||||
"web3": "^4.5.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.12.16",
|
||||
"@babel/eslint-parser": "^7.12.16",
|
||||
"@vue/cli-plugin-babel": "~5.0.0",
|
||||
"@vue/cli-plugin-eslint": "~5.0.0",
|
||||
"@vue/cli-service": "~5.0.0",
|
||||
"eslint": "^7.32.0",
|
||||
"eslint-plugin-vue": "^8.0.3",
|
||||
"vue-template-compiler": "^2.6.14"
|
||||
},
|
||||
"eslintConfig": {
|
||||
"root": true,
|
||||
"env": {
|
||||
"node": true
|
||||
},
|
||||
"extends": [
|
||||
"plugin:vue/essential",
|
||||
"eslint:recommended"
|
||||
],
|
||||
"parserOptions": {
|
||||
"parser": "@babel/eslint-parser"
|
||||
},
|
||||
"rules": {}
|
||||
},
|
||||
"browserslist": [
|
||||
"> 1%",
|
||||
"last 2 versions",
|
||||
"not dead"
|
||||
]
|
||||
}
|
24
postcss.config.cjs
Normal file
@ -0,0 +1,24 @@
|
||||
|
||||
module.exports = {
|
||||
plugins: {
|
||||
'postcss-px-to-viewport': {
|
||||
unitToConvert: 'px', // 需要转换的单位,默认为"px"
|
||||
viewportWidth: 1920, // 设计稿的视口宽度
|
||||
unitPrecision: 5, // 单位转换后保留的精度
|
||||
propList: ['*'], // 能转化为vw的属性列表
|
||||
viewportUnit: 'vw', // 希望使用的视口单位
|
||||
fontViewportUnit: 'vw', // 字体使用的视口单位
|
||||
selectorBlackList: [], // 需要忽略的CSS选择器,不会转为视口单位,使用原有的px等单位。
|
||||
minPixelValue: 1, // 设置最小的转换数值,如果为1的话,只有大于1的值会被转换
|
||||
mediaQuery: false, // 媒体查询里的单位是否需要转换单位
|
||||
replace: true, // 是否直接更换属性值,而不添加备用属性
|
||||
exclude: undefined, // 忽略某些文件夹下的文件或特定文件,例如 'node_modules' 下的文件
|
||||
include: undefined, // 如果设置了include,那将只有匹配到的文件才会被转换
|
||||
landscape: false, // 是否添加根据 landscapeWidth 生成的媒体查询条件 @media (orientation: landscape)
|
||||
landscapeUnit: 'vw', // 横屏时使用的单位
|
||||
landscapeWidth: 1920 // 横屏时使用的视口宽度
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
BIN
public/favicon.ico
Normal file
After Width: | Height: | Size: 4.2 KiB |
29
public/index.html
Normal file
@ -0,0 +1,29 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1.0">
|
||||
<link rel="icon" href="/logo.png">
|
||||
<title>COUNTERFIRE | Founder's Tag</title>
|
||||
<meta
|
||||
name="description"
|
||||
content="Heroes Assemble: MOBA Battles Beyond Imagination"
|
||||
/>
|
||||
<meta
|
||||
property="og:image"
|
||||
content="https://mint.counterfire.games/mint.png"
|
||||
/>
|
||||
<meta
|
||||
property="twitter:image"
|
||||
content="https://gacha.counterfire.games/images/counter.png"
|
||||
/>
|
||||
</head>
|
||||
<body>
|
||||
<noscript>
|
||||
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
|
||||
</noscript>
|
||||
<div id="app"></div>
|
||||
<!-- built files will be auto injected -->
|
||||
</body>
|
||||
</html>
|
BIN
public/logo.png
Normal file
After Width: | Height: | Size: 6.2 KiB |
BIN
public/mint.png
Normal file
After Width: | Height: | Size: 5.0 KiB |
120
src/App.vue
Normal file
@ -0,0 +1,120 @@
|
||||
<template>
|
||||
<div id="app">
|
||||
<!-- <img alt="Vue logo" src="./assets/logo.png">
|
||||
<HelloWorld msg="Welcome to Your Vue.js App"/> -->
|
||||
<Home />
|
||||
<Footer />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
// import HelloWorld from './components/HelloWorld.vue'
|
||||
import Home from './views/home/indexView.vue'
|
||||
import Footer from "./components/footerView.vue";
|
||||
|
||||
export default {
|
||||
name: 'App',
|
||||
components: {
|
||||
// HelloWorld,
|
||||
Home,
|
||||
Footer
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
#app {
|
||||
font-family: Avenir, Helvetica, Arial, sans-serif;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
text-align: center;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
html,
|
||||
body,
|
||||
div,
|
||||
span,
|
||||
object,
|
||||
iframe,
|
||||
h1,
|
||||
h2,
|
||||
h3,
|
||||
h4,
|
||||
h5,
|
||||
h6,
|
||||
p,
|
||||
blockquote,
|
||||
pre,
|
||||
abbr,
|
||||
address,
|
||||
cite,
|
||||
code,
|
||||
del,
|
||||
dfn,
|
||||
em,
|
||||
img,
|
||||
ins,
|
||||
kbd,
|
||||
q,
|
||||
samp,
|
||||
small,
|
||||
strong,
|
||||
sub,
|
||||
sup,
|
||||
var,
|
||||
b,
|
||||
i,
|
||||
dl,
|
||||
dt,
|
||||
dd,
|
||||
ol,
|
||||
ul,
|
||||
li,
|
||||
fieldset,
|
||||
form,
|
||||
label,
|
||||
legend,
|
||||
table,
|
||||
caption,
|
||||
tbody,
|
||||
tfoot,
|
||||
thead,
|
||||
tr,
|
||||
th,
|
||||
td,
|
||||
article,
|
||||
aside,
|
||||
canvas,
|
||||
details,
|
||||
figcaption,
|
||||
figure,
|
||||
footer,
|
||||
header,
|
||||
hgroup,
|
||||
menu,
|
||||
nav,
|
||||
section,
|
||||
summary,
|
||||
time,
|
||||
mark,
|
||||
audio,
|
||||
video {
|
||||
margin: 0;
|
||||
|
||||
padding: 0;
|
||||
|
||||
border: 0;
|
||||
|
||||
outline: 0;
|
||||
|
||||
font-size: 100%;
|
||||
|
||||
vertical-align: baseline;
|
||||
|
||||
background: transparent;
|
||||
|
||||
list-style: none;
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
20834
src/abi/BEBadgeV2.json
Normal file
14184
src/abi/NFTClaimer.json
Normal file
BIN
src/assets/home/Apple_logo.png
Normal file
After Width: | Height: | Size: 556 B |
BIN
src/assets/home/Arrow2.png
Normal file
After Width: | Height: | Size: 376 B |
BIN
src/assets/home/Arrow3.png
Normal file
After Width: | Height: | Size: 443 B |
BIN
src/assets/home/Connect Menu1.png
Normal file
After Width: | Height: | Size: 6.3 KiB |
BIN
src/assets/home/Connect Menu2.png
Normal file
After Width: | Height: | Size: 6.3 KiB |
BIN
src/assets/home/Counter Fire Logo.png
Normal file
After Width: | Height: | Size: 4.9 KiB |
BIN
src/assets/home/Discord.png
Normal file
After Width: | Height: | Size: 900 B |
BIN
src/assets/home/Fight Adapt_character.png
Normal file
After Width: | Height: | Size: 55 KiB |
BIN
src/assets/home/Fight Adapt_slg.png
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
src/assets/home/Golden_GIF.gif
Normal file
After Width: | Height: | Size: 6.6 MiB |
BIN
src/assets/home/Google icon.png
Normal file
After Width: | Height: | Size: 672 B |
BIN
src/assets/home/KeyVisual.png
Normal file
After Width: | Height: | Size: 1.1 MiB |
BIN
src/assets/home/Links web icon.png
Normal file
After Width: | Height: | Size: 442 B |
BIN
src/assets/home/Mint Button_Ash.png
Normal file
After Width: | Height: | Size: 17 KiB |
BIN
src/assets/home/Mint Button_Shape1.png
Normal file
After Width: | Height: | Size: 15 KiB |
BIN
src/assets/home/Mint Button_Shape2.png
Normal file
After Width: | Height: | Size: 15 KiB |
BIN
src/assets/home/Nav bar_character.png
Normal file
After Width: | Height: | Size: 8.2 KiB |
BIN
src/assets/home/Normal_GIF_1.gif
Normal file
After Width: | Height: | Size: 6.3 MiB |
BIN
src/assets/home/Purple_GIF.gif
Normal file
After Width: | Height: | Size: 6.3 MiB |
BIN
src/assets/home/SmileIcon.png
Normal file
After Width: | Height: | Size: 5.3 KiB |
BIN
src/assets/home/Title concept.png
Normal file
After Width: | Height: | Size: 36 KiB |
BIN
src/assets/home/X.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
src/assets/home/arrow1.png
Normal file
After Width: | Height: | Size: 333 B |
BIN
src/assets/home/blur.png
Normal file
After Width: | Height: | Size: 2.3 KiB |
BIN
src/assets/home/close.png
Normal file
After Width: | Height: | Size: 8.5 KiB |
BIN
src/assets/home/close_btn.png
Normal file
After Width: | Height: | Size: 731 B |
BIN
src/assets/home/com_Discord_icon.png
Normal file
After Width: | Height: | Size: 1005 B |
BIN
src/assets/home/com_X_icon.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
src/assets/home/com_Youtube_icon.png
Normal file
After Width: | Height: | Size: 695 B |
BIN
src/assets/home/common_bg.png
Normal file
After Width: | Height: | Size: 8.6 KiB |
BIN
src/assets/home/icon_ConnectWallet.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
src/assets/home/icon_OKXwallet.png
Normal file
After Width: | Height: | Size: 1.6 KiB |
BIN
src/assets/home/icon_metaMask.png
Normal file
After Width: | Height: | Size: 2.4 KiB |
BIN
src/assets/home/icon_star.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
src/assets/home/legendary.png
Normal file
After Width: | Height: | Size: 8.3 KiB |
BIN
src/assets/home/login_icon_Meta.png
Normal file
After Width: | Height: | Size: 5.3 KiB |
BIN
src/assets/home/login_icon_OKX.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
src/assets/home/logo.png
Normal file
After Width: | Height: | Size: 6.2 KiB |
BIN
src/assets/home/mint bg.png
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
src/assets/home/mint_Logo1.png
Normal file
After Width: | Height: | Size: 20 KiB |
BIN
src/assets/home/mint_Logo2.png
Normal file
After Width: | Height: | Size: 21 KiB |
BIN
src/assets/home/nav bg.png
Normal file
After Width: | Height: | Size: 2.7 KiB |
BIN
src/assets/home/nav.png
Normal file
After Width: | Height: | Size: 6.6 KiB |
BIN
src/assets/home/okx.png
Normal file
After Width: | Height: | Size: 1002 B |
BIN
src/assets/home/open sea.png
Normal file
After Width: | Height: | Size: 1.8 KiB |
BIN
src/assets/home/playBtn.png
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
src/assets/home/rare_bg.png
Normal file
After Width: | Height: | Size: 9.3 KiB |
BIN
src/assets/logo.png
Normal file
After Width: | Height: | Size: 6.2 KiB |
BIN
src/assets/text/Anton-Regular.ttf
Normal file
6
src/assets/text/text.css
Normal file
@ -0,0 +1,6 @@
|
||||
@font-face {
|
||||
font-family: 'Anton';
|
||||
font-style: normal;
|
||||
font-weight: 600;
|
||||
src: url('./Anton-Regular.ttf') format('truetype');
|
||||
}
|
57
src/components/footerView.vue
Normal file
@ -0,0 +1,57 @@
|
||||
<template>
|
||||
<div class="footer">
|
||||
<div class="footer-left">© 2024 Counter Fire | All rights reserved.</div>
|
||||
<!-- <div class="footer-right">
|
||||
<li>
|
||||
<a href="https://discord.com/invite/counterfire" target="_blank">
|
||||
<img src="./../assets/home/com_Discord_icon.png" alt="">
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="https://twitter.com/@playCounterFire" target="_blank">
|
||||
<img src="./../assets/home/com_X_icon.png" alt="">
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="https://youtube.com/@_CounterFire" target="_blank">
|
||||
<img src="./../assets/home/com_Youtube_icon.png" alt="">
|
||||
</a>
|
||||
</li>
|
||||
</div> -->
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.footer {
|
||||
width: 100%;
|
||||
height: 60px;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 0 45px;
|
||||
box-sizing: border-box;
|
||||
border-top: 2px solid #1A1821;
|
||||
background: #0f1013;
|
||||
.footer-left {
|
||||
color: #877E98;
|
||||
font-size: 18px;
|
||||
}
|
||||
.footer-right {
|
||||
display: flex;
|
||||
li {
|
||||
width: 31px;
|
||||
height: 24px;
|
||||
margin-left: 20px;
|
||||
cursor: pointer;
|
||||
img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
20
src/main.js
Normal file
@ -0,0 +1,20 @@
|
||||
import Vue from 'vue'
|
||||
import App from './App.vue'
|
||||
import './assets/text/text.css'
|
||||
import ElementUI from 'element-ui'
|
||||
import 'element-ui/lib/theme-chalk/index.css'
|
||||
|
||||
|
||||
Vue.use(ElementUI)
|
||||
import {Message} from 'element-ui'
|
||||
Vue.prototype.$message = Message
|
||||
|
||||
import axios from 'axios'
|
||||
Vue.prototype.$axios = axios
|
||||
|
||||
|
||||
Vue.config.productionTip = false
|
||||
|
||||
new Vue({
|
||||
render: h => h(App),
|
||||
}).$mount('#app')
|
1843
src/views/home/indexView.vue
Normal file
314
src/wallet/index.js
Normal file
@ -0,0 +1,314 @@
|
||||
import Web3 from 'web3'
|
||||
import axios from 'axios'
|
||||
|
||||
import BEB_abi from './../abi/BEBadgeV2.json'
|
||||
import NFT_abi from './../abi/NFTClaimer.json'
|
||||
var abis = {
|
||||
"BEB": BEB_abi,
|
||||
"NFT": NFT_abi,
|
||||
}
|
||||
var BEBAddress = process.env.VUE_APP_BEB_URL
|
||||
var NFTAddress = process.env.VUE_APP_NFT_URL
|
||||
var chainId = process.env.VUE_APP_TOKENID_ID
|
||||
var connectUrl = process.env.VUE_APP_CONFIG_URL
|
||||
|
||||
|
||||
|
||||
// Wallet Connect初始化
|
||||
import { EthereumProvider } from '@walletconnect/ethereum-provider'
|
||||
const provider = await EthereumProvider.init({
|
||||
projectId: 'e7743d46923911fa8850619b7a7f6d9d', // required
|
||||
chains: ['1'], // required
|
||||
showQrModal: true, // requires @walletconnect/modal
|
||||
optionalChains: ['1'],
|
||||
// optionalMethods: ['eth_signTypedData', 'eth_signTypedData_v4'],
|
||||
metadata: {
|
||||
name: 'Counter Fire',
|
||||
description: 'Counter Fire',
|
||||
url: 'https://mint.counterfire.games/',
|
||||
icons: ['https://www.counterfire.games/favicon.ico'],
|
||||
},
|
||||
});
|
||||
// 链接Wallet Connect钱包
|
||||
export async function getConnect() {
|
||||
await provider.connect()
|
||||
let result = await provider.request({ method: 'eth_requestAccounts' })
|
||||
return result
|
||||
}
|
||||
|
||||
// 断开链接
|
||||
export async function disconnectLink(name) {
|
||||
if(name == 'ethereum') {
|
||||
await window.ethereum.request({
|
||||
"method": "wallet_revokePermissions",
|
||||
"params": [
|
||||
{
|
||||
"eth_accounts": {}
|
||||
}
|
||||
]
|
||||
});
|
||||
} else if(name == 'okxwallet') {
|
||||
await okxwallet.request({
|
||||
"method": "wallet_disconnect",
|
||||
})
|
||||
} else if(name == 'connect') {
|
||||
await provider.request({method: 'eth_requestDisconnect'})
|
||||
}
|
||||
}
|
||||
|
||||
// 获取钱包地址
|
||||
export async function getWalletAddress() {
|
||||
const web3js = window.ethereum
|
||||
const web3 = await web3js.request({
|
||||
method: 'eth_accounts'
|
||||
})
|
||||
if (web3 !== 'undefined') {
|
||||
if (web3[0] == '') {
|
||||
return false
|
||||
} else {
|
||||
return await web3[0]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 查看钱包是否链接
|
||||
export async function isWalletConnected() {
|
||||
const ethereum = window.web3;
|
||||
if (typeof ethereum !== 'undefined') {
|
||||
let res = await ethereum.request({ method: "eth_accounts" })
|
||||
// await okxwallet.request({ method: "eth_accounts" });
|
||||
// console.log(res,'279-----')
|
||||
if(res[0] == '') {
|
||||
return false
|
||||
} else {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// 检查是否有arbitrum-sepolia网络
|
||||
export async function isSepoliNetwork(name) {
|
||||
let res
|
||||
if(name == 'ethereum') {
|
||||
res = await window.ethereum.request({
|
||||
method: "wallet_switchEthereumChain",
|
||||
params: [
|
||||
{
|
||||
chainId: chainId
|
||||
}
|
||||
]
|
||||
});
|
||||
return false
|
||||
} else if(name == 'okxwallet') {
|
||||
res =
|
||||
await window.ethereum.request({
|
||||
method: "wallet_switchEthereumChain",
|
||||
params: [
|
||||
{
|
||||
chainId: chainId
|
||||
}
|
||||
]
|
||||
});
|
||||
return false
|
||||
} else if(name == 'connect') {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
// 添加arbitrum-sepolia网络
|
||||
export async function addNetwork(name) {
|
||||
if(name == 'ethereum') {
|
||||
try{
|
||||
let res = await window.ethereum.request({
|
||||
method: 'wallet_addEthereumChain',
|
||||
params: [{
|
||||
chainId: '0xaa36a7',
|
||||
chainName: 'Sepolia Testnet Explorer',
|
||||
rpcUrls: ['https://sepolia.infura.io/v3'],
|
||||
iconUrls: ['https://xdaichain.com/fake/example/url/xdai.png'],
|
||||
blockExplorerUrls: ['https://sepolia.etherscan.io'],
|
||||
nativeCurrency: {
|
||||
name: "xDAI",
|
||||
symbol: "xDAI",
|
||||
decimals: 18
|
||||
},
|
||||
},]
|
||||
})
|
||||
return await res
|
||||
} catch(e) {
|
||||
return false
|
||||
}
|
||||
} else if(name == 'okxwallet') {
|
||||
try{
|
||||
let res = await okxwallet.request({
|
||||
method: 'wallet_addEthereumChain',
|
||||
params: [{
|
||||
chainId: '11155111',
|
||||
chainName: 'Sepolia Testnet Explorer',
|
||||
rpcUrls: ['https://sepolia.infura.io/v3'],
|
||||
iconUrls: ['https://xdaichain.com/fake/example/url/xdai.png'],
|
||||
blockExplorerUrls: ['https://sepolia.etherscan.io'],
|
||||
nativeCurrency: {
|
||||
name: "xDAI",
|
||||
symbol: "xDAI",
|
||||
decimals: 18
|
||||
},
|
||||
}]
|
||||
})
|
||||
return await res
|
||||
} catch(e) {
|
||||
return false
|
||||
}
|
||||
} else if(name == 'connect') {
|
||||
try{
|
||||
let res = await window.provider.request({
|
||||
method: 'wallet_addEthereumChain',
|
||||
params: [{
|
||||
chainId: '0xaa36a7',
|
||||
chainName: 'Sepolia Testnet Explorer',
|
||||
rpcUrls: ['https://sepolia.infura.io/v3'],
|
||||
iconUrls: ['https://xdaichain.com/fake/example/url/xdai.png'],
|
||||
blockExplorerUrls: ['https://sepolia.etherscan.io'],
|
||||
nativeCurrency: {
|
||||
name: "xDAI",
|
||||
symbol: "xDAI",
|
||||
decimals: 18
|
||||
},
|
||||
}]
|
||||
})
|
||||
return await res
|
||||
} catch(e) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 获取总数
|
||||
export async function getSupplyLimit(name,address) {
|
||||
let web3
|
||||
if(name == 'ethereum') {
|
||||
web3 = new Web3(window.ethereum);
|
||||
} else if(name == 'okxwallet') {
|
||||
web3 = new Web3(window.okxwallet)
|
||||
} else if(name == 'connect') {
|
||||
web3 = new Web3(provider)
|
||||
}
|
||||
let contract = new web3.eth.Contract(abis['BEB'].abi, BEBAddress, { from: address})
|
||||
let time = await contract.methods.supplyLimit().call()
|
||||
return Number(time)
|
||||
}
|
||||
|
||||
// 获取已Mint数量
|
||||
export async function getTotalLimit(name,address) {
|
||||
let web3
|
||||
if(name == 'ethereum') {
|
||||
web3 = new Web3(window.ethereum);
|
||||
} else if(name == 'okxwallet') {
|
||||
web3 = new Web3(okxwallet)
|
||||
} else if(name == 'connect') {
|
||||
web3 = new Web3(provider)
|
||||
}
|
||||
let contract = new web3.eth.Contract(abis['BEB'].abi, BEBAddress, { from: address})
|
||||
let time = await contract.methods.totalSupply().call()
|
||||
return Number(time)
|
||||
}
|
||||
|
||||
// 开始时间
|
||||
export async function getStartTime(name,address) {
|
||||
let web3
|
||||
if(name == 'ethereum') {
|
||||
web3 = new Web3(window.ethereum);
|
||||
} else if(name == 'okxwallet') {
|
||||
web3 = new Web3(okxwallet)
|
||||
} else if(name == 'connect') {
|
||||
web3 = new Web3(provider)
|
||||
}
|
||||
let contract = new web3.eth.Contract(abis['NFT'].abi, NFTAddress, { from: address})
|
||||
let startTime = await contract.methods.startTime().call()
|
||||
return Number(startTime)
|
||||
}
|
||||
|
||||
// 结束时间
|
||||
export async function getEndTime(name,address) {
|
||||
let web3
|
||||
if(name == 'ethereum') {
|
||||
web3 = new Web3(window.ethereum);
|
||||
} else if(name == 'okxwallet') {
|
||||
web3 = new Web3(okxwallet)
|
||||
} else if(name == 'connect') {
|
||||
web3 = new Web3(provider)
|
||||
}
|
||||
let contract = new web3.eth.Contract(abis['NFT'].abi, NFTAddress, { from: address})
|
||||
let endTime = await contract.methods.endTime().call()
|
||||
return Number(endTime)
|
||||
}
|
||||
|
||||
// 开启NFT
|
||||
export async function testClaim(name,data,address) {
|
||||
let web3
|
||||
if(name == 'ethereum') {
|
||||
web3 = new Web3(window.ethereum);
|
||||
} else if(name == 'okxwallet') {
|
||||
web3 = new Web3(okxwallet)
|
||||
} else if(name == 'connect') {
|
||||
web3 = new Web3(provider)
|
||||
}
|
||||
const gasPrice = await web3.eth.getGasPrice();
|
||||
let contract = new web3.eth.Contract(abis['NFT'].abi, NFTAddress, { from: address})
|
||||
let gas = await contract.methods.claim(...data).estimateGas();
|
||||
gas = (Number(gas) * 1) | 0;
|
||||
const receipt = await contract.methods.claim(...data).send({ gas, gasPrice });
|
||||
return receipt
|
||||
}
|
||||
|
||||
// 查看已Mint的tokenId
|
||||
export async function inquireClaimHistory(name, address) {
|
||||
let web3
|
||||
if(name == 'ethereum') {
|
||||
web3 = new Web3(window.ethereum);
|
||||
} else if(name == 'okxwallet') {
|
||||
web3 = new Web3(okxwallet)
|
||||
} else if(name == 'connect') {
|
||||
web3 = new Web3(provider)
|
||||
}
|
||||
let contract = new web3.eth.Contract(abis['NFT'].abi, NFTAddress, { from: address})
|
||||
const tokenId = await contract.methods.claimHistory(address).call();
|
||||
return tokenId
|
||||
}
|
||||
|
||||
// 初始化数据
|
||||
export async function makeBatchRequestList(name,address) {
|
||||
const [supplyLimit, totalLimit, startTime, endTime] = [
|
||||
await getSupplyLimit(name,address),
|
||||
await getTotalLimit(name,address),
|
||||
await getStartTime(name,address),
|
||||
await getEndTime(name,address)
|
||||
]
|
||||
return [supplyLimit, totalLimit, startTime, endTime]
|
||||
}
|
||||
|
||||
|
||||
// 获取数据
|
||||
export async function getReqConnect(dataID, contract, address) {
|
||||
const data = {
|
||||
id: (Date.now() / 1000) | 0,
|
||||
jsonrpc: '2.0',
|
||||
method: 'eth_call',
|
||||
params: [
|
||||
{
|
||||
data: dataID,
|
||||
from: address,
|
||||
to: contract,
|
||||
},
|
||||
'latest',
|
||||
]
|
||||
}
|
||||
let res = await axios.post(connectUrl, data)
|
||||
if(res.data.result) {
|
||||
return res.data.result
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
31
vue.config.js
Normal file
@ -0,0 +1,31 @@
|
||||
module.exports = {
|
||||
// transpileDependencies: true,
|
||||
lintOnSave: false,
|
||||
productionSourceMap: false,
|
||||
devServer: {
|
||||
open: false,
|
||||
// host: '0.0.0.0', // 允许外部ip访问
|
||||
port: 8030, // 端口
|
||||
https: false, // 启用https
|
||||
// overlay: {
|
||||
// warnings: true,
|
||||
// errors: true
|
||||
// }, // 错误、警告在页面弹出
|
||||
proxy: {
|
||||
'/api': {
|
||||
target: 'https://nftmint.counterfire.games/api',
|
||||
changeOrigin: true, // 允许websockets跨域
|
||||
pathRewrite: {
|
||||
'^/api': ''
|
||||
}
|
||||
},
|
||||
'/asin': {
|
||||
target: process.env.VUE_APP_WL_URL,
|
||||
changeOrigin: true, // 允许websockets跨域
|
||||
pathRewrite: {
|
||||
'^/asin': ''
|
||||
}
|
||||
}
|
||||
}, // 代理转发配置,用于调试环境
|
||||
},
|
||||
}
|