last update

This commit is contained in:
huangjinming 2023-12-27 14:14:28 +08:00
parent 8e0e139475
commit d22e76c3f0
48 changed files with 537 additions and 396 deletions

View File

@ -1,2 +1,2 @@
VUE_APP_BASE_API='https://game2006api-test.kingsome.cn'
VUE_APP_BASE_API='https://market.cebg.games'
VUE_APP_GPAL_API='http://192.168.100.83:4000/sns'

View File

@ -1 +1 @@
VUE_APP_BASE_API='https://game2006api-test.kingsome.cn'
VUE_APP_BASE_API='https://market.cebg.games'

Binary file not shown.

View File

@ -2,9 +2,38 @@
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" href="/favicon.ico" />
<link rel="icon" href="/logo.png" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>CEBG - Anime PUBG on fire!</title>
<title>Counter Fire</title>
<meta property="og:title" content="Counter Fire" />
<meta
property="og:description"
content="CounterFire.games"
/>
<meta
name="description"
content="CounterFire.games"
/>
<meta
name="keywords"
content="CounterFireCFGamefiWeb3web3gaming; Cf game;Cf mobile; CounterFire googleplay; CounterFire Appstore;
battle royale;token;airdrop;p2e; play to earn, free to play, blockchain game;Arbitrum game;Arbitrum. Cryptocurrency; Cryptoanime gameanime web3 gameTwo-dimensional gameshooting gameAnime shooting mobile game"
/>
<meta property="og:type" content="website" />
<meta property="og:url" content="https://m.counterfire.games/" />
<!-- <meta
property="og:image"
content="https://m.counterfire.games/counter.png"
/> -->
<!-- <meta property="og:site_name" content="Counter Fire" /> -->
<meta property="twitter:card" content="summary_large_image" />
<meta property="twitter:title" content="Counter Fire" />
<!-- <meta
property="twitter:image"
content="https://m.counterfire.games/counter.png"
/> -->
</head>
<script type="module">
import {Buffer} from 'buffer';

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

BIN
mobile/public/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.9 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 MiB

After

Width:  |  Height:  |  Size: 1.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 510 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 110 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 337 KiB

After

Width:  |  Height:  |  Size: 626 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 MiB

After

Width:  |  Height:  |  Size: 504 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 MiB

After

Width:  |  Height:  |  Size: 598 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 8.6 KiB

View File

@ -66,6 +66,7 @@ export default class ChainManager {
await this.bc.connect(true)
await this.checkNance()
} catch (err) {
this.bc.walletType = 0
message.error(err.message, 5)
await Promise.reject(err)
}
@ -93,6 +94,7 @@ export default class ChainManager {
AppModule.updateStep(1)
} catch (err) {
console.log(err)
this.bc.walletType = 0
await Promise.reject(err)
}
}

View File

@ -1,28 +1,26 @@
import WalletConnectProvider from '@walletconnect/web3-provider'
import { useAppStore } from '@/store/app'
import Web3 from 'web3'
import {
AVAILABLE_CHAINS,
CONTRACT_ADDRESS,
} from '@/configs/configchain'
import { useUserStore } from '@/store/user'
import { isMobile } from '@/utils/resize'
import { hasMetamask, toHexChainId } from '@/utils/chain.util'
import { AllChains } from '@/configs/allchain'
import { ERC20ABI } from '@/configs/contracts'
import { TransactionReceipt } from 'web3-core'
import { useEventBus } from '@vueuse/core';
import * as bus_event from '@/bus/event';
import pinia from '@/store';
import WalletConnectProvider from "@walletconnect/web3-provider";
import { useAppStore } from "@/store/app";
import Web3 from "web3";
import { AVAILABLE_CHAINS, CONTRACT_ADDRESS } from "@/configs/configchain";
import { useUserStore } from "@/store/user";
import { isMobile } from "@/utils/resize";
import { hasMetamask, toHexChainId, hasOKExWallet } from "@/utils/chain.util";
import { AllChains } from "@/configs/allchain";
import { ERC20ABI } from "@/configs/contracts";
import { TransactionReceipt } from "web3-core";
import { useEventBus } from "@vueuse/core";
import * as bus_event from "@/bus/event";
import pinia from "@/store";
import { message } from "ant-design-vue";
const EIP721_DOMAIN_DATA = [
{ name: 'name', type: 'string' },
{ name: 'version', type: 'string' },
{ name: 'chainId', type: 'uint256' },
{ name: 'verifyingContract', type: 'address' }
]
{ name: "name", type: "string" },
{ name: "version", type: "string" },
{ name: "chainId", type: "uint256" },
{ name: "verifyingContract", type: "address" },
];
const CACHE_KEY = 'cebg_chain_cache_key'
const CACHE_KEY = "cebg_chain_cache_key";
const busShowChainModal = useEventBus(bus_event.SHOW_CHAIN_MODAL);
const busNeedChangeChain = useEventBus(bus_event.NEED_CHANGE_CHAIN);
@ -33,87 +31,99 @@ const AppModule = useAppStore(pinia);
const UserModule = useUserStore(pinia);
export class Blockchain {
provider:any
web3: Web3
currentChain = 0
provider: any;
web3: Web3;
currentChain = 0;
// 0: null, 1: metamask, 2: walletconnect
walletType = 0
dataCached = false
instanceCacheMap: Map<string, any>
public chainMap: Map<number, any> = new Map()
public rpc: any = {}
walletType = 0;
dataCached = false;
instanceCacheMap: Map<string, any>;
public chainMap: Map<number, any> = new Map();
public rpc: any = {};
constructor() {
const allChainMap: Map<number, any> = new Map()
const allChainMap: Map<number, any> = new Map();
for (const d of AllChains) {
const id = d.id
this.rpc[id] = d.rpc
allChainMap.set(id, d)
const id = d.id;
this.rpc[id] = d.rpc;
allChainMap.set(id, d);
}
for (const id of AVAILABLE_CHAINS) {
this.chainMap.set(id, allChainMap.get(id)!)
this.chainMap.set(id, allChainMap.get(id)!);
}
this.loadCachedProvider()
this.instanceCacheMap = new Map()
this.loadCachedProvider();
this.instanceCacheMap = new Map();
// AppModule.updateChainID(chainId)
busNeedLogin.on(this.connect.bind(this));
}
get isWalletConnect() {
return !!this.walletType && !!this.currentChain
return !!this.walletType && !!this.currentChain;
}
get mallAddress() {
return CONTRACT_ADDRESS[this.currentChain]?.mall
return CONTRACT_ADDRESS[this.currentChain]?.mall;
}
public get hexChainId() {
return toHexChainId(this.currentChain)
return toHexChainId(this.currentChain);
}
public async chainSelected(id: number) {
if (!this.chainMap.has(id)) {
return
return;
}
this.currentChain = id
this.currentChain = id;
if (this.provider) {
await this.switchEthereumChain()
await this.switchEthereumChain();
} else {
await this.connectWallet(true)
await this.connectWallet(true);
}
}
public async connectWallet(isManual: boolean) {
console.log('begin connect to wallet: ', this.walletType, this.currentChain)
console.log(
"begin connect to wallet: ",
this.walletType,
this.currentChain
);
if (this.walletType === 1) {
this.provider = await this.connectMetaMask()
this.provider = await this.connectMetaMask();
} else if (this.walletType === 2) {
this.provider = await this.connectWalletConnect()
this.provider = await this.connectokxwallet();
}
if (!this.provider) {
return
return;
}
this.web3 = new Web3(this.provider)
const chainId = await this.web3.eth.getChainId()
await this.checkChain(chainId)
this.web3 = new Web3(this.provider);
const chainId = await this.web3.eth.getChainId();
await this.checkChain(chainId);
this.subscribeToEvents()
const accounts = await this.web3.eth.getAccounts()
if (accounts && accounts.length > 0) {
AppModule.updateAccount(accounts[0])
this.subscribeToEvents();
///const accounts = await this.web3.eth.getAccounts()
let accounts;
if (this.walletType === 1) {
accounts = await this.web3.eth.getAccounts();
} else {
accounts = await this.provider.request({
method: "eth_requestAccounts",
});
}
if (!this.currentChain) this.currentChain = chainId
this.saveProvider()
AppModule.updateChainID(chainId)
AppModule.updateWalletStatus(true)
console.log('current login chain: ', chainId)
console.log('accountsLogin: ', accounts, AppModule.accountId)
if (accounts && accounts.length > 0) {
AppModule.updateAccount(accounts[0]);
}
if (!this.currentChain) this.currentChain = chainId;
this.saveProvider();
AppModule.updateChainID(chainId);
AppModule.updateWalletStatus(true);
console.log("current login chain: ", chainId);
console.log("accountsLogin: ", accounts, AppModule.accountId);
if (isManual) {
busNeedNonce.emit(busNeedNonce);
} else {
AppModule.updateStep(1)
AppModule.updateStep(1);
}
return { account: accounts[0], chainId }
return { account: accounts[0], chainId };
}
/**
@ -127,11 +137,11 @@ export class Blockchain {
private async checkChain(chainId: number) {
if (!this.chainMap.has(chainId)) {
// if (this.walletType === 1) {
try {
await this.selectChain()
} catch (err) {
await this.disconnect()
}
try {
await this.selectChain();
} catch (err) {
await this.disconnect();
}
// } else if (this.walletType === 2) {
// await this.disconnect()
// this.walletType = 2
@ -147,22 +157,19 @@ export class Blockchain {
}
public async connect(isManual = false) {
if (isMobile()) {
if (hasMetamask()) {
this.walletType = 1
} else {
this.walletType = 2
if (hasMetamask() || hasOKExWallet()) {
if (isManual && !this.walletType) {
this.walletType = await this.selectWallet();
}
} else {
if (hasMetamask()) {
if (isManual && !this.walletType) {
this.walletType = await this.selectWallet()
}
} else {
this.walletType = 2
if (isManual) {
this.walletType = await this.selectWallet();
}
}
if (isManual || this.isWalletConnect) { await this.connectWallet(isManual) }
if (isManual && this.walletType) {
await this.connectWallet(isManual);
}
}
/**
@ -174,15 +181,36 @@ export class Blockchain {
return new Promise((resolve, reject) => {
busShowChainModal.emit({
confirm: (id: number) => {
console.log('select wallet: ', id)
resolve && resolve(id)
console.log("select wallet: ", id);
if (id == 1) {
if (!hasMetamask()) {
var next = window.location.href;
var url = `https://metamask.app.link/dapp/${next}`;
location.href = url;
} else {
resolve && resolve(id);
}
} else if (id == 2) {
const ua = navigator.userAgent;
const isIOS = /iphone|ipad|ipod|ios/i.test(ua);
const isAndroid = /android|XiaoMi|MiuiBrowser/i.test(ua);
const isMobile = isIOS || isAndroid;
const isOKApp = /OKApp/i.test(ua);
if (isMobile && isOKApp) {
resolve && resolve(id);
} else {
var next = window.location.href;
window.open(`okx://wallet/dapp/details?dappUrl=${next}`);
}
}
},
cancel: (reason: any) => {
console.log('cancel select wallet: ', reason)
reject && reject(reason)
}
})
})
console.log("cancel select wallet: ", reason);
reject && reject(reason);
},
});
});
}
/**
@ -193,28 +221,28 @@ export class Blockchain {
private selectChain(): Promise<number> {
return new Promise((resolve, reject) => {
busNeedChangeChain.emit({
confirm: async(id: number) => {
console.log('select chain: ', id)
this.currentChain = id
confirm: async (id: number) => {
console.log("select chain: ", id);
this.currentChain = id;
if (this.provider) {
await this.switchEthereumChain()
await this.switchEthereumChain();
}
resolve && resolve(id)
resolve && resolve(id);
},
cancel: (reason: any) => {
console.log('cancel select chain: ', reason)
reject && reject(reason)
}
})
})
console.log("cancel select chain: ", reason);
reject && reject(reason);
},
});
});
}
public async connectMetaMask() {
let provider = null
if (typeof window.ethereum !== 'undefined') {
provider = window.ethereum
let provider = null;
if (typeof window.ethereum !== "undefined") {
provider = window.ethereum;
try {
await provider.request({ method: 'eth_requestAccounts' })
await provider.request({ method: "eth_requestAccounts" });
} catch (error: any) {
if (error.code === -32002) {
// const hexChainId = toHexChainId(this.currentChain)
@ -222,65 +250,91 @@ export class Blockchain {
// method: 'wallet_switchEthereumChain',
// params: [{ chainId: hexChainId }]
// })
throw new Error('MeatMask not login, Open MeatMask and login first')
throw new Error("MeatMask not login, Open MeatMask and login first");
} else {
throw new Error('User Rejected')
throw new Error("User Rejected");
}
}
} else if (window.web3) {
provider = window.web3.currentProvider
provider = window.web3.currentProvider;
} else if (window.celo) {
provider = window.celo
provider = window.celo;
} else {
throw new Error('No Web3 Provider found')
this.walletType = 0;
// message.error('No Web3 Provider found');
throw new Error("No Web3 Provider found");
}
return provider
return provider;
}
public async connectokxwallet() {
let provider = null;
if (typeof window.okxwallet !== "undefined") {
provider = window.okxwallet;
try {
await provider.request({ method: "eth_requestAccounts" });
} catch (error: any) {
if (error.code === -32002) {
// const hexChainId = toHexChainId(this.currentChain)
// await provider.request({
// method: 'wallet_switchEthereumChain',
// params: [{ chainId: hexChainId }]
// })
throw new Error("OKX Wallet not login, Open OKX Wallet and login first");
} else {
this.walletType = 0;
throw new Error("User Rejected");
}
}
} else {
this.walletType = 0;
// message.error('No Web3 Provider found');
throw new Error("No Web3 Provider found");
}
return provider;
}
public async connectWalletConnect() {
const provider = new WalletConnectProvider({
infuraId: import.meta.env.VUE_APP_WALLET_INFURAID,
rpc: this.rpc
})
rpc: this.rpc,
});
try {
await provider.enable()
await provider.enable();
} catch (err) {
console.log('connect to wallet connect error: ', err)
await Promise.reject(err)
console.log("connect to wallet connect error: ", err);
await Promise.reject(err);
}
return provider
return provider;
}
public async getContractInstance(address: string, abi: any = ERC20ABI) {
if (!this.instanceCacheMap.has(address)) {
const instance = new this.web3.eth.Contract(
abi,
address,
{ from: AppModule.accountId }
)
this.instanceCacheMap.set(address, instance)
const instance = new this.web3.eth.Contract(abi, address, {
from: AppModule.accountId,
});
this.instanceCacheMap.set(address, instance);
}
return this.instanceCacheMap.get(address)
return this.instanceCacheMap.get(address);
}
public clearCachedProvider() {
console.log('clear cached provider')
localStorage.removeItem(CACHE_KEY)
console.log("clear cached provider");
localStorage.removeItem(CACHE_KEY);
}
public loadCachedProvider() {
const dataStr = localStorage.getItem(CACHE_KEY)
const dataStr = localStorage.getItem(CACHE_KEY);
if (dataStr) {
try {
const data = JSON.parse(dataStr)
this.walletType = data.walletType
const data = JSON.parse(dataStr);
this.walletType = data.walletType;
if (this.chainMap.has(data.chainId)) {
this.currentChain = data.chainId
this.currentChain = data.chainId;
}
} catch (err) {
console.log('err parse cached json')
this.clearCachedProvider()
console.log("err parse cached json");
this.clearCachedProvider();
}
}
}
@ -288,55 +342,54 @@ export class Blockchain {
public saveProvider() {
const data = {
walletType: this.walletType,
chainId: this.currentChain
}
localStorage.setItem(CACHE_KEY, JSON.stringify(data))
chainId: this.currentChain,
};
localStorage.setItem(CACHE_KEY, JSON.stringify(data));
}
public async disconnect() {
try {
await UserModule.Logout()
await this.provider?.disconnect()
} catch (err) {
}
this.currentChain = 0
this.walletType = 0
this.instanceCacheMap.clear()
this.clearCachedProvider()
AppModule.updateStep(0)
AppModule.updateChainID(0)
AppModule.updateNonce('')
AppModule.updateAccount('')
AppModule.updateWalletStatus(false)
await UserModule.Logout();
await this.provider?.disconnect();
} catch (err) {}
this.currentChain = 0;
this.walletType = 0;
this.instanceCacheMap.clear();
this.clearCachedProvider();
AppModule.updateStep(0);
AppModule.updateChainID(0);
AppModule.updateNonce("");
AppModule.updateAccount("");
AppModule.updateWalletStatus(false);
}
public subscribeToEvents = () => {
// Subscribe to accounts change
this.provider.on('accountsChanged', async(accounts: string[]) => {
console.log('accountsChanged: ', accounts)
this.provider.on("accountsChanged", async (accounts: string[]) => {
console.log("accountsChanged: ", accounts);
if (accounts && accounts.length > 0) {
if (AppModule.accountId !== accounts[0]) {
await UserModule.Logout()
location.reload()
await UserModule.Logout();
location.reload();
}
}
})
});
// Subscribe to chainId change
this.provider.on('chainChanged', async(chainId: string) => {
const chainIdNum = parseInt(chainId)
console.log('chainChanged', chainId, chainIdNum)
await this.checkChain(chainIdNum)
this.currentChain = chainIdNum
this.saveProvider()
AppModule.updateChainID(this.currentChain)
})
this.provider.on("chainChanged", async (chainId: string) => {
const chainIdNum = parseInt(chainId);
console.log("chainChanged", chainId, chainIdNum);
await this.checkChain(chainIdNum);
this.currentChain = chainIdNum;
this.saveProvider();
AppModule.updateChainID(this.currentChain);
});
// Subscribe to session disconnection
this.provider.on('disconnect', (err: any) => {
console.log('disconnect', err)
})
}
this.provider.on("disconnect", (err: any) => {
console.log("disconnect", err);
});
};
/**
* change chain of metamask
@ -345,27 +398,27 @@ export class Blockchain {
* @return {Promise<void>}
*/
async switchEthereumChain(chainId?: number, cb?: () => void) {
chainId = chainId || this.currentChain
const hexChainId = toHexChainId(chainId)
chainId = chainId || this.currentChain;
const hexChainId = toHexChainId(chainId);
const onChainChange = (chainId: string) => {
console.log('switchEthereumChain: ', chainId)
this.provider.removeListener('chainChanged', onChainChange)
cb && cb()
}
this.provider.on('chainChanged', onChainChange)
console.log("switchEthereumChain: ", chainId);
this.provider.removeListener("chainChanged", onChainChange);
cb && cb();
};
this.provider.on("chainChanged", onChainChange);
try {
await this.provider.request({
method: 'wallet_switchEthereumChain',
params: [{ chainId: hexChainId }]
})
console.log('switch chain success')
method: "wallet_switchEthereumChain",
params: [{ chainId: hexChainId }],
});
console.log("switch chain success");
} catch (e: any) {
console.log('switch chain error: ', e)
if (e.code === 4902 || e.message.indexOf('Unrecognized chain ID') >= 0) {
console.log("switch chain error: ", e);
if (e.code === 4902 || e.message.indexOf("Unrecognized chain ID") >= 0) {
try {
const data = this.chainMap.get(chainId)!
const data = this.chainMap.get(chainId)!;
await this.provider.request({
method: 'wallet_addEthereumChain',
method: "wallet_addEthereumChain",
params: [
{
chainId: hexChainId,
@ -373,17 +426,17 @@ export class Blockchain {
nativeCurrency: {
name: data.symbol,
symbol: data.symbol,
decimals: data.decimals || 18
decimals: data.decimals || 18,
},
blockExplorerUrls: [data.explorerurl],
rpcUrls: [data.rpc]
}
]
})
console.log('add chain success')
rpcUrls: [data.rpc],
},
],
});
console.log("add chain success");
} catch (addError) {
console.error('add chain error: ', addError)
this.provider.removeListener('chainChanged', onChainChange)
console.error("add chain error: ", addError);
this.provider.removeListener("chainChanged", onChainChange);
}
}
// console.error(e)
@ -391,59 +444,68 @@ export class Blockchain {
}
public async getTransactionReceipt(txHash: string) {
return this.web3.eth.getTransactionReceipt(txHash)
return this.web3.eth.getTransactionReceipt(txHash);
}
public async getTxConfirms(txhash: string) {
const receipt: TransactionReceipt = await this.getTransactionReceipt(txhash)
const latest = await this.web3.eth.getBlockNumber()
return latest - receipt.blockNumber + 1
const receipt: TransactionReceipt = await this.getTransactionReceipt(
txhash
);
const latest = await this.web3.eth.getBlockNumber();
return latest - receipt.blockNumber + 1;
}
public async signPresale({ type, paymentTokenAddress, price, buyerAddress, netId }:
{
type: number | string
paymentTokenAddress: string
price: any
buyerAddress: string
netId?: any
public async signPresale({
type,
paymentTokenAddress,
price,
buyerAddress,
netId,
}: {
type: number | string;
paymentTokenAddress: string;
price: any;
buyerAddress: string;
netId?: any;
}) {
const nonce = Math.random() * 100000 | 0
const nonce = (Math.random() * 100000) | 0;
const signMsg = {
item: type,
token: paymentTokenAddress,
price: price,
salt: nonce
}
netId = netId || await this.web3.eth.getChainId()
salt: nonce,
};
netId = netId || (await this.web3.eth.getChainId());
const signObj = {
types: {
EIP712Domain: EIP721_DOMAIN_DATA,
set: [
{ name: 'item', type: 'uint256' },
{ name: 'token', type: 'address' },
{ name: 'price', type: 'uint256' },
{ name: 'salt', type: 'uint256' }
]
{ name: "item", type: "uint256" },
{ name: "token", type: "address" },
{ name: "price", type: "uint256" },
{ name: "salt", type: "uint256" },
],
},
primaryType: 'set',
primaryType: "set",
domain: {
name: 'BEBoxMall',
version: '1',
name: "BEBoxMall",
version: "1",
chainId: netId,
verifyingContract: this.mallAddress
verifyingContract: this.mallAddress,
},
message: signMsg
}
const signature = await this.signData(signObj, buyerAddress)
return { nonce, signature }
message: signMsg,
};
const signature = await this.signData(signObj, buyerAddress);
return { nonce, signature };
}
public async increaseAllowance(address: string, price: string) {
const coinInstance: any = await this.getContractInstance(address)
const res = await coinInstance.methods.increaseAllowance(this.mallAddress, price).send({ gas: 1000000 })
console.log('increaseAllowance: ', res)
const coinInstance: any = await this.getContractInstance(address);
const res = await coinInstance.methods
.increaseAllowance(this.mallAddress, price)
.send({ gas: 1000000 });
console.log("increaseAllowance: ", res);
}
/**
@ -452,48 +514,55 @@ export class Blockchain {
* @return {Promise<any>}
*/
public async getBalance(address: string, account: string | null) {
account = account || AppModule.accountId
const coinInstance: any = await this.getContractInstance(address)
return await coinInstance.methods.balanceOf(account).call()
account = account || AppModule.accountId;
const coinInstance: any = await this.getContractInstance(address);
return await coinInstance.methods.balanceOf(account).call();
}
public async transferToAccount(account: string, amount: number, address: string) {
const amountBN = this.web3.utils.toBN(this.web3.utils.toWei(amount + ''))
const coinInstance: any = await this.getContractInstance(address)
public async transferToAccount(
account: string,
amount: number,
address: string
) {
const amountBN = this.web3.utils.toBN(this.web3.utils.toWei(amount + ""));
const coinInstance: any = await this.getContractInstance(address);
return coinInstance.methods
.transfer(account, amountBN)
.send({ gas: 1000000 })
.send({ gas: 1000000 });
}
public async signData(signObj: any, signer: string) {
const msgParams = JSON.stringify(signObj)
const from = signer
console.log('clicked, sending personal sign req', 'from', from, msgParams)
const params = [from, msgParams]
const msgParams = JSON.stringify(signObj);
const from = signer;
console.log("clicked, sending personal sign req", "from", from, msgParams);
const params = [from, msgParams];
const result: any = await this.sendCmd({
method: 'eth_signTypedData_v4',
method: "eth_signTypedData_v4",
params,
from
})
console.log(result)
return result.result
from,
});
console.log(result);
return result.result;
}
public async sendCmd({ method, params, from }: any) {
return new Promise((resolve, reject) => {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
this.web3.currentProvider.sendAsync({
method,
params,
from
}, async function(err: any, result: any) {
if (err) {
reject && reject(err)
return
this.web3.currentProvider.sendAsync(
{
method,
params,
from,
},
async function (err: any, result: any) {
if (err) {
reject && reject(err);
return;
}
resolve && resolve(result);
}
resolve && resolve(result)
})
})
);
});
}
}

View File

@ -8,7 +8,7 @@
</div>
<div class="slogan">
<div class="cebg-stands">
CEBG stands for Crypto Elite's: BATTLEGROUNDS, the first
Counter Fire stands for Crypto Elite's: BATTLEGROUNDS, the first
blockchain-based game consisting of Moba, and Battle royal. It's
funded by more than 7 institutional investors.
</div>

View File

@ -93,7 +93,7 @@ const HistoryList = reactive([
time: "2022.11",
content: [
"3D TPS-Hero Version upgrade",
"CEBG in-app wallet",
"Counter Fire in-app wallet",
"Social System",
"Free-to-Play NFT mode",
],

View File

@ -25,7 +25,6 @@
:modules="modules"
:loop="true"
:slides-per-view="1"
:autoplay="{ delay: 4000, disableOnInteraction: false }"
:pagination="{ clickable: true }"
>
<!-- loop可循环轮播autoplay可自动播放 -->
@ -39,7 +38,35 @@
<img src="../../assets/img/about/roadmap-time-top.png" alt="" />
</div>
<div class="time-content-content">
<div class="text" v-html="item.content"></div>
<div class="text" v-show="index == 0">
<div class="text-item">Ops Manager in Shanda Group</div>
<div class="text-item">
Co-Founder of Giant Interactive(NYSE:GA)
</div>
<div class="text-item">
Founder of FH Capital, investing in ThinkingData, 91ACT,
Inke(HK:03700), etc
</div>
<div class="text-item">
Founder of Bubble Candy Studio to build Counter Fire
</div>
</div>
<!-- <div class="text" v-show="index == 1">
<div class="text-item">Gaming data expert in Giant Interactive</div>
<div class="text-item">Core data officer of Foxconn Group (TPE:2354)</div>
<div class="text-item">Gaming Economist in Bubble Candy Studio</div>
</div> -->
<div class="text" v-show="index == 1">
<div class="text-item">4 million-player games in Shanda Group</div>
<div class="text-item"> Producer in RobTop Games to build "Geometry Battle Royale" with 20m gamers</div>
<div class="text-item"> Porducer of Counter Fire</div>
</div>
<div class="text" v-show="index == 2">
<div class="text-item"> Tech Director in Shanda Group</div>
<div class="text-item"> In charge of Legends of the world, The Romance of Legends, etc</div>
<div class="text-item">Expert in Crypto Tech, developing all decentralized products in Counter Fire</div>
</div>
</div>
</div>
</swiper-slide>
@ -67,27 +94,22 @@ const positionY1 = ref(0); //背景Y轴偏移量
const HistoryList = reactive([
{
title: "FOUNDER",
time: "MICHEAL YUE",
title: "Michael",
time: "Founder/CEO",
content:
"Co-Founder of Giant Interactive(NYSE:GA)<br />Ops Manager in ShandaGroup",
"- Ops Manager in Shanda &nbsp;&nbsp; Group <br /> - Co-Founder of Giant<br /> &nbsp;&nbsp;Interactive(NYSE:GA) <br /> - Founder of FH Capital,<br /> investing in ThinkingData,<br /> 91ACT,Inke(HK:03700), etc <br />- Founder of Bubble &nbsp;&nbsp;Candy Studio to build &nbsp;&nbsp;CEBG",
},
{
title: "GAMING ECONOMIST",
time: "YODA",
title: "Super G",
time: "Producer",
content:
"Core data officer of Foxconn GroupGaming data expert in Giant Interactive",
'- 4 million-player games &nbsp;&nbsp;in Shanda Group<br /> - Producer in RobTop &nbsp;&nbsp;Games to build<br /> "Geometry Battle Royale"<br/>&nbsp;&nbsp; with 20m gamers<br /> - Porducer of CEBG',
},
{
title: "PRODUCER",
time: "SUPER G",
content: "Worked in Shanda Group with 4 million-player games",
},
{
title: "CTO",
time: "XIN",
title: "Xin",
time: "CTO",
content:
"In charge of Legend, Legends of the world, The Romance of Legends, etc",
" - Tech Director in Shanda &nbsp;&nbsp;&nbsp;Group<br /> - In charge of Legends of &nbsp;&nbsp;the world, The<br />&nbsp;&nbsp; Romance of Legends, &nbsp;&nbsp;&nbsp;etc<br /> - Expert in Crypto Tech,<br />&nbsp;&nbsp; developing all &nbsp;&nbsp;&nbsp;decentralized products &nbsp;&nbsp; in CEBG",
},
]);
onMounted(() => {
@ -109,7 +131,7 @@ function handleScroll() {
.roadmap {
position: relative;
// background: #1e393d;
// padding-bottom: 256px;
// padding-bottom: 256px;
.roadmap-bg {
position: absolute;
left: 0;
@ -175,7 +197,7 @@ function handleScroll() {
width: 405px;
// margin: 0 auto;
padding-left: 50px;
// height: 8px;
// height: 8px;
padding-bottom: 64px;
}
.title-boder-time {
@ -198,41 +220,52 @@ function handleScroll() {
.time-content-title {
text-align: center;
font-size: 40px;
font-family: 'Big John';
font-family: "Big John";
font-weight: 400;
color: #000000;
line-height: 60px;
}
.time-content-time {
text-align: center;
font-size: 40px;
font-family: 'Big John';
text-align: center;
font-size: 40px;
font-family: "Big John";
font-weight: 400;
color: #000000;
line-height: 60px;
}
.time-content-content {
width: 336px;
width: 376px;
margin: 0 auto;
height: 436px;
height: 486px;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
background: url("@/assets/img/about/roadmap-time-bg.png") no-repeat;
background-size: 100% 100%;
font-size: 24px;
font-size: 14px;
font-family: "Poppins";
font-weight: 500;
color: #ffffff;
line-height: 62px;
line-height: 41px;
.text {
width: 90%;
text-align: center;
text-align: left;
// margin-left: 45px;
position: relative;
margin-bottom: 17px;
}
.text-item {
width: 100%;
padding-left: 15px;
overflow-wrap: normal;
position: relative;
}
.text-item::before {
position: absolute;
content: "-";
left: 0px;
}
// .text::after {
// content: " ";
// position: absolute;

View File

@ -1,7 +1,7 @@
<template>
<div class="chain-modal" v-if="modalShow" :class="{ mobile: 'mobile' }">
<div class="chain-modal mobile" v-if="modalShow">
<div class="modal-bg" @click="cancelSelect"></div>
<div class="modal-content" :class="{ mobile: 'mobile' }">
<div class="modal-content mobile">
<div class="modal-title">You need to connect to supported network</div>
<div
class="chain-modal-card"
@ -22,6 +22,7 @@
import { ref, computed, onMounted, onUnmounted } from "vue";
import { ALL_PROVIDERS } from "@/configs/configchain";
import { useChainStore } from "@/store/chain";
import { isMobile } from "@/utils/resize";
import { useEventBus } from "@vueuse/core";
import * as bus_event from "@/bus/event";
@ -30,8 +31,8 @@ const busNeedChangeChain = useEventBus(bus_event.NEED_CHANGE_CHAIN);
const chain = useChainStore();
const modalShow = ref(false);
const isMobile = ref(false);
const dataType = ref(1);
const isMobileScreen = ref(isMobile());
const chainDatas = computed(() => {
// console.log([...chain.chainManager.availableChains.values()]);
return [...chain.chainManager.availableChains.values()];
@ -48,7 +49,6 @@ const chainDatas = computed(() => {
// return [];
// }
// });
const currentDatas = computed(() => {
return (
{
@ -64,13 +64,12 @@ let cancelFun = (reason) => {};
onMounted(() => {
busShowChainModal.on(showSelectWallet);
busNeedChangeChain.on(showChangeChain);
if (/Mobi/.test(navigator.userAgent)) {
isMobile.value = true;
}
// window.addEventListener("resize", handleResize);
});
onUnmounted(() => {
busShowChainModal.off(showSelectWallet);
busNeedChangeChain.off(showChangeChain);
// window.removeEventListener("resize", handleResize);
});
function showSelectWallet({ confirm, cancel }) {
@ -79,11 +78,15 @@ function showSelectWallet({ confirm, cancel }) {
showModal(0);
}
function handleResize() {
isMobileScreen.value = isMobile();
}
function showChangeChain({ confirm, cancel }) {
confirmFun = confirm;
cancelFun = cancel;
// showModal(0);
cancelSelect();
showModal(1);
}
function cardClicked(id) {
@ -93,7 +96,7 @@ function cardClicked(id) {
}
function cancelSelect() {
cancelFun && cancelFun("User cancel");
cancelFun();
hideModal();
}
@ -121,7 +124,7 @@ function hideModal() {
left: 0;
overflow: auto;
margin: 0;
z-index: 10;
z-index: 999;
.modal-bg {
position: absolute;
top: 0;

View File

@ -119,8 +119,8 @@
.logo-img {
position: relative;
width: 174px;
height: 170px;
width: 132px;
height: 44px;
filter: grayscale(100%);
}

View File

@ -4,22 +4,27 @@
<div class="title">
<img src="@/assets/img/mobile-home/banner-slogan.gif" alt="" />
</div>
<div class="download-btns">
<div class="andriod">
<a href="https://www.cebg.games/release/cebg.apk">
<img src="@/assets/img/mobile-home/andriod.png" alt=""
<!-- <div class="download-btns">
<div class="download-btns-top">
<div class="andriod">
<a href="https://m.counterfire.games/release/counterfire.apk">
<img src="@/assets/img/mobile-home/andriod.png" alt=""
/></a>
</div>
<div class="apple">
<a href="https://apps.apple.com/app/counter%20fire/id6444462915">
<img src="@/assets/img/mobile-home/app.png" alt=""
/></a>
</div>
<!-- <div class="apple">
<img src="@/assets/img/mobile-home/apple.png" alt="" />
</div> -->
<div class="google">
<a
href="https://play.google.com/store/apps/details?id=com.cege.games.release"
><img src="@/assets/img/mobile-home/google.png" alt=""
/></a>
</div>
</div>
<div class="google">
<a href="https://play.google.com/store/apps/details?id=com.cege.games.release"
><img src="@/assets/img/mobile-home/google.png" alt=""
/></a>
</div>
</div>
</div> -->
</div>
<div class="posters">
<div class="poster poster-one"></div>
@ -83,19 +88,26 @@
}
.download-btns {
position: absolute;
bottom: 190px;
bottom: 160px;
left: 50%;
transform: translate(-50%, -50%);
display: flex;
flex-direction: column;
width: 82%;
justify-content: space-between;
.download-btns-top {
display: flex;
justify-content: space-between;
margin-bottom: 10px;
}
.andriod {
width: 265px;
height: 79px;
}
.apple {
width: 216px;
height: 66px;
width: 265px;
height: 79px;
// margin: 0 auto;
}
.google {
width: 265px;

View File

@ -58,7 +58,7 @@ const box = ref(null);
const myRef = ref(null);
const { tilt, roll, source } = useParallax(box);
const imageList = reactive([
{ imgSrc: new URL("@/assets/img/mobile-home/game-swiper-card/01.png", import.meta.url).href },
{ imgSrc: new URL("@/assets/img/mobile-home/game-swiper-card/01.jpg", import.meta.url).href },
{ imgSrc: new URL("@/assets/img/mobile-home/game-swiper-card/02.png", import.meta.url).href },
{ imgSrc: new URL("@/assets/img/mobile-home/game-swiper-card/03.png", import.meta.url).href },
{ imgSrc: new URL("@/assets/img/mobile-home/game-swiper-card/04.png", import.meta.url).href },

View File

@ -26,7 +26,7 @@
<div class="slogan">
<div class="slogan-title">
Embark on an epic journey as a commander in the captivating 3D world
of CEBG and engage in thrilling battles against other skilled
of Counter Fire and engage in thrilling battles against other skilled
players. Are you ready to rise up and claim victory?
</div>
<!-- <div class="slogan-text">fight against other players!</div> -->
@ -46,8 +46,8 @@
<swiper-slide >
<div class="gallery-banner-img">
<YoutubeVideo
id="ecC6FAg5N7k"
src="https://www.youtube.com/watch?v=ecC6FAg5N7k"
id="ptJPhouPUlE"
src="https://www.youtube.com/watch?v=ptJPhouPUlE"
:width="720"
:height="435"
>
@ -57,8 +57,8 @@
<swiper-slide >
<div class="gallery-banner-img">
<YoutubeVideo
id="QRXWmEXfU7E"
src="https://www.youtube.com/watch?v=QRXWmEXfU7E"
id="kxix94VzQKA"
src="https://www.youtube.com/watch?v=kxix94VzQKA"
:width="720"
:height="435"
>
@ -68,25 +68,15 @@
<swiper-slide >
<div class="gallery-banner-img">
<YoutubeVideo
id="sUQbFj8h4Wo"
src="https://www.youtube.com/watch?v=sUQbFj8h4Wo"
:width="720"
:height="435"
>
</YoutubeVideo>
</div>
</swiper-slide>
<swiper-slide >
<div class="gallery-banner-img">
<YoutubeVideo
id="yOoJXogfQs0"
src="https://www.youtube.com/watch?v=yOoJXogfQs0"
id="LyaYGm3FtiU"
src="https://www.youtube.com/watch?v=LyaYGm3FtiU"
:width="720"
:height="435"
>
</YoutubeVideo>
</div>
</swiper-slide>
</swiper>
</div>

View File

@ -20,7 +20,7 @@
</div>
<div class="slogan">
<div>
CEBG is the highly-anticipated first blockchain-based game to offer a
Counter Fire is the highly-anticipated first blockchain-based game to offer a
unique combination of MOBA and Battle Royale gameplay.
</div>
<div>

View File

@ -44,11 +44,10 @@
<!-- <img src="@/assets/svg/discord.svg" alt=""
/> -->
</a>
<a href="https://t.me/CEBG_official" class="telegram">
<!-- <img src="@/assets/svg/telegram.svg" alt=""
/> -->
</a>
<a href="https://twitter.com/CEBG_GAME" class="twiter">
<!-- <a href="https://t.me/CEBG_official" class="telegram">
</a> -->
<a href="https://twitter.com/_CounterFire" class="twiter">
<!-- <img src="@/assets/svg/twitter.svg" alt=""
/> -->
</a>
@ -140,7 +139,7 @@ onUnmounted(() => {
.follow {
display: flex;
padding-top: 49px;
width: 296px;
width: 206px;
margin: 0 auto;
justify-content: space-between;
padding-bottom: 76px;
@ -312,8 +311,8 @@ onUnmounted(() => {
justify-content: center;
align-items: center;
img {
width: 128px;
height: 127px;
width: 188px;
height: 84px;
}
padding-bottom: 51px;
}

View File

@ -1,7 +1,7 @@
<template>
<div class="nav">
<div class="nav-logo">
<a href="/home"> <img src="../../assets/img/home/nav-logo.png" alt="" /></a>
<a href="/"> <img src="../../assets/img/home/nav-logo.png" alt="" /></a>
</div>
<div class="nav-right">
<div class="avatar-icon" v-if="!chain.logined" @click="login">
@ -43,7 +43,7 @@
</div>
</a-drawer>
</div>
<ChainModel></ChainModel>
<ChainModel />
</template>
<script setup>
@ -53,10 +53,12 @@ import { useRouter, useRoute } from "vue-router";
import ChainModel from "../../components/global/ChainModel.vue";
import { useChainStore } from "@/store/chain";
import { useAppStore } from "@/store/app";
import { hasMetamask } from "@/utils/chain.util";
const router = useRouter();
const route = useRoute();
const navShow = ref(false);
const activeIndex = ref(0);
const isModalVisible = ref(false);
const chain = useChainStore();
onMounted(async () => {
navShow.value = true;
@ -73,36 +75,20 @@ provide("navShow", navShow);
function switchNav(event) {
navShow.value = !navShow.value;
}
const navList = reactive([
{ id: 0, name: "BETA TEST II", path: "/" },
{ id: 1, name: "HOME", path: "/home" },
{ id: 2, name: "ABOUT", path: "/about" },
// {
// id: 2,
// name: "MARKETPLACE",
// path: "/marketpalce",
// submenu: [{ label: "Coming soon", link: "/products/1" }],
// },
// {
// id: 3,
// name: "COMMUNITY",
// path: "/contact",
// submenu: [
// { label: "Twitter", link: "/products/1" },
// { label: "Youtube", link: "/products/2" },
// { label: "Facebook", link: "/products/3" },
// { label: "Medium", link: "/products/3" },
// { label: "Telegram", link: "/products/3" },
// ],
// },
const navList = reactive([
{ id: 0, name: "HOME", path: "/" },
{ id: 1, name: "ABOUT", path: "/about" },
{ id: 2, name: "GACHA", path: "https://m.gacha.counterfire.games/" },
{ id: 3, name: "BADGE", path: "https://m.badge.counterfire.games/" },
]);
async function login(event) {
var next = window.location.href;
if (!chain.logined) {
//
//
await chain.chainManager.login();
console.log("logined:", chain.chainManager.isLogined);
// console.log("logined:", chain.chainManager.isLogined);
chain.logined = chain.chainManager.isLogined;
}
}
@ -110,11 +96,16 @@ const logout = async () => {
await chain.chainManager.logout();
console.log("logined:", chain.chainManager.isLogined);
chain.logined = chain.chainManager.isLogined;
window.location.reload();
};
function onLinkTo(item, index) {
activeIndex.value = index;
router.push(item.path);
navShow.value = false;
if (index < 2) {
router.push(item.path);
navShow.value = false;
} else {
window.location.href = item.path;
}
}
watchEffect(() => {
@ -132,16 +123,16 @@ watchEffect(() => {
position: fixed;
left: 0;
top: 0;
z-index: 2000;
z-index: 200;
justify-content: space-between;
align-items: center;
.nav-logo {
width: 91px;
height: 89px;
width: 162px;
height: 64px;
margin-left: 25px;
img {
width: 91px;
height: 89px;
width: 162px;
height: 64px;
}
}
.nav-right {
@ -167,7 +158,7 @@ watchEffect(() => {
width: 36px;
height: 36px;
}
background: url('../../assets/img/mobile-home/nav-btn-bg.png') no-repeat;
background: url("../../assets/img/mobile-home/nav-btn-bg.png") no-repeat;
background-size: contain;
}
.nav-btn-active {
@ -183,7 +174,8 @@ watchEffect(() => {
width: 36px;
height: 36px;
}
background: url('../../assets/img/mobile-home/nav-btn-bg-active.png') no-repeat;
background: url("../../assets/img/mobile-home/nav-btn-bg-active.png")
no-repeat;
background-size: contain;
}
}
@ -199,7 +191,7 @@ watchEffect(() => {
font-family: "Big John";
font-weight: 400;
position: relative;
color: #FFBA00;
color: #ffba00;
}
// .nav-item-active a::after {
@ -230,6 +222,6 @@ watchEffect(() => {
font-family: "Big John";
font-weight: 400;
// position: relative;
color: #FFBA00;
color: #ffba00;
}
</style>

View File

@ -1,7 +1,7 @@
<template>
<LogoAnimation v-if="!appLoaded"></LogoAnimation>
<div v-else class="layout">
<NavBarVue v-if="currentRoute.path !== '/'"></NavBarVue>
<NavBarVue ></NavBarVue>
<main class="content">
<slot></slot>
</main>

View File

@ -215,6 +215,7 @@ export const AllChains = [
name: 'Arbitrum Mainnet RPC',
type: 'Mainnet',
rpc: 'https://rpc.ankr.com/arbitrum',
logo: 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDI0LjAuMCwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPgo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d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",
desc: "Connect to your OKX Wallet",
},
];
export const AVAILABLE_CHAINS = env === "production" ? [321] : [322];
export const AVAILABLE_CHAINS = env === "production" ? [42161] : [42161];
export const OFFICE_ACCOUNT =
env === "production"

View File

@ -1,18 +1,11 @@
import { createRouter, createWebHistory } from "vue-router";
const Beta = () => import('../views/GamePromotionEvent.vue')
const Home = () => import('../views/HomeView.vue')
const About = () => import('../views/AboutView.vue')
const Beta = () => import("../views/GamePromotionEvent.vue");
///const Home = () => import("../views/HomeView.vue");
import Home from '../views/HomeView.vue'
const About = () => import("../views/AboutView.vue");
const routes = [
{
path: "/",
name: "beta",
component: Beta,
meta: {
showInMenu: true,
},
},
{
path: "/home",
name: "home",
component: Home,
meta: {
@ -60,7 +53,7 @@ const routes = [
const router = createRouter({
history: createWebHistory(),
routes
routes,
});
router.afterEach((to, from) => {
let bodySrcollTop = document.body.scrollTop;
@ -74,18 +67,20 @@ router.afterEach((to, from) => {
}
});
function isMobileDevice(userAgent) {
return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(userAgent);
return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(
userAgent
);
}
router.beforeEach((to, from, next) => {
const isMobile = isMobileDevice(window.navigator.userAgent);
// 对于移动端官网项目:
if (isMobile) {
if (to.query.code) {
window.location.href = `https://m.gacha.counterfire.games/?code=${to.query.code}`;
} else if (isMobile) {
next(); // 如果是移动设备,继续导航
} else {
window.location.href = 'https://desktop.cebg.games';
window.location.href = "https://www.counterfire.games";
}
});

View File

@ -6,7 +6,7 @@ export const useChainStore = defineStore('chain', ()=> {
const logined = ref(false);
const chainManager = ref(new ChainManager());
chainManager.value.init().then(()=> {
console.log("chain init:", {chainManager})
// console.log("chain init:", {chainManager})
logined.value = chainManager.value.isLogined;
});

View File

@ -7,6 +7,14 @@ export function verifyInjectedProvider(check: string): boolean {
window.web3.currentProvider[check]
}
export function verifyInjectedProviderok(check: string): boolean {
return window.okxwallet
? window.okxwallet[check]
: window.web3 &&
window.web3.currentProvider &&
window.web3.currentProvider[check]
}
/**
* check if there have metamask
* @return {boolean}
@ -19,6 +27,14 @@ export function hasMetamask(): boolean {
}
}
export function hasOKExWallet(): boolean {
if (!!window.okxwallet || !!window.web3) {
return verifyInjectedProviderok('isokxwallet')
} else {
return false
}
}
/**
* change price with customer decimals to bigNum with 18 decimals
* @param {number} price

View File

@ -3,9 +3,9 @@ import { message } from 'ant-design-vue'
import glodata from '@/store/user_global';
const VUE_APP_BASE_API='https://market.cebg.games'
const service = axios.create({
baseURL: import.meta.env.VUE_APP_BASE_API,
baseURL: VUE_APP_BASE_API,
timeout: 5000
})

View File

@ -31,6 +31,7 @@ export default defineConfig({
outDir: 'dist',
// 打包文件名
assetsDir: 'static',
sourcemap: false, // 禁用源映射
// 静态资源引用路径
assetsPublicPath: '/',
// 是否开启压缩
@ -41,7 +42,6 @@ export default defineConfig({
env: {
BASE_URL: process.env.VITE_API_BASE_URL
},
sourcemap: true,
rollupOptions: {
plugins: [nodePolyfills()],
},