增加配置,在正式发布前隐藏部分功能

This commit is contained in:
cebgcontract 2022-04-18 08:54:36 +08:00
parent daa29fd0d9
commit a31df6534d
8 changed files with 54 additions and 59 deletions

View File

@ -1,9 +1,3 @@
VUE_APP_WALLET_INFURAID='e7743d46923911fa8850619b7a7f6d9d'
VUE_APP_BASE_API='https://game2006api-test.kingsome.cn'
VUE_APP_CHAIN_ID=322
VUE_APP_CHAIN_RPC='https://rpc-testnet.kcc.network'
VUE_APP_CHAIN_NAME='KCC-TESTNET'
VUE_APP_CHAIN_EXPLORERURL='https://scan-testnet.kcc.network
VUE_APP_CHAIN_CURRENCY_NAME='name'
VUE_APP_CHAIN_CURRENCY_SYMBOL='KCS'
VUE_APP_CHAIN_CURRENCY_DECIMALS=18
VUE_APP_PART_CLOSE=0

View File

@ -1,9 +0,0 @@
VUE_APP_WALLET_INFURAID='e7743d46923911fa8850619b7a7f6d9d'
VUE_APP_BASE_API='https://market-test.kingsome.cn'
VUE_APP_CHAIN_ID=1338
VUE_APP_CHAIN_RPC='http://192.168.100.22:8545'
VUE_APP_CHAIN_NAME='22'
VUE_APP_CHAIN_EXPLORERURL=''
VUE_APP_CHAIN_CURRENCY_NAME='name'
VUE_APP_CHAIN_CURRENCY_SYMBOL='BEC'
VUE_APP_CHAIN_CURRENCY_DECIMALS=18

View File

@ -1,9 +1,3 @@
VUE_APP_WALLET_INFURAID='e7743d46923911fa8850619b7a7f6d9d'
VUE_APP_BASE_API='https://market.cebg.games'
VUE_APP_CHAIN_ID=321
VUE_APP_CHAIN_RPC='https://rpc-mainnet.kcc.network'
VUE_APP_CHAIN_NAME='KCC-MAINNET'
VUE_APP_CHAIN_EXPLORERURL='https://explorer.kcc.io'
VUE_APP_CHAIN_CURRENCY_NAME='name'
VUE_APP_CHAIN_CURRENCY_SYMBOL='KCS'
VUE_APP_CHAIN_CURRENCY_DECIMALS=18
VUE_APP_PART_CLOSE=1

View File

@ -1,9 +1,2 @@
VUE_APP_WALLET_INFURAID='e7743d46923911fa8850619b7a7f6d9d'
VUE_APP_BASE_API='https://game2006api-test.kingsome.cn'
VUE_APP_CHAIN_ID=322
VUE_APP_CHAIN_RPC='https://rpc-testnet.kcc.network'
VUE_APP_CHAIN_NAME='KCC-TESTNET'
VUE_APP_CHAIN_EXPLORERURL='https://scan-testnet.kcc.network
VUE_APP_CHAIN_CURRENCY_NAME='name'
VUE_APP_CHAIN_CURRENCY_SYMBOL='KCS'
VUE_APP_CHAIN_CURRENCY_DECIMALS=18

View File

@ -2,8 +2,18 @@ import { singleton } from '@/decorators/singleton.decorator'
import WalletConnectProvider from '@walletconnect/web3-provider'
import { AppModule } from '@/store/modules/app'
import Web3 from 'web3'
import { AVAILABLE_CHAINS, IChainData, MALL_ADDRESS } from '@/configs/config_chain'
import { EventBus, NEED_CHANGE_CHAIN, NEED_LOGIN, NEED_NONCE, SHOW_CHAIN_MODAL } from '@/utils/event-bus'
import {
AVAILABLE_CHAINS,
CONTRACT_ADDRESS,
IChainData
} from '@/configs/config_chain'
import {
EventBus,
NEED_CHANGE_CHAIN,
NEED_LOGIN,
NEED_NONCE,
SHOW_CHAIN_MODAL
} from '@/utils/event-bus'
import { UserModule } from '@/store/modules/user'
import { isMobile } from '@/utils/resize'
import { hasMetamask } from '@/utils/chain.util'
@ -57,6 +67,10 @@ export class Blockchain {
return !!this.walletType && !!this.currentChain
}
get mallAddress() {
return CONTRACT_ADDRESS[this.currentChain]?.mall
}
public get hexChainId() {
return this.toHexChainId(this.currentChain)
}
@ -117,7 +131,10 @@ export class Blockchain {
} else if (this.walletType === 2) {
await this.disconnect()
this.walletType = 2
await MessageBox.alert('You need to connect to supported network', 'Wrong Network', {
await MessageBox.alert(
'You need to connect to supported network',
'Wrong Network',
{
confirmButtonText: 'Confirm'
})
await this.connectWallet(true)
@ -208,7 +225,8 @@ export class Blockchain {
return provider
}
private async initInstance({ abi, address, account }: {abi: any, address: string, account: string}) {
private async initInstance({ abi, address, account }:
{abi: any, address: string, account: string}) {
return new this.web3.eth.Contract(
abi,
address,
@ -218,7 +236,8 @@ export class Blockchain {
public async getCoinInstance(address: string) {
if (!this.coinInstanceMap.has(address)) {
const coinInstance = await this.initInstance({ abi: ERC20ABI, address, account: AppModule.accountId })
const coinInstance = await this.initInstance(
{ abi: ERC20ABI, address, account: AppModule.accountId })
this.coinInstanceMap.set(address, coinInstance)
}
return this.coinInstanceMap.get(address)
@ -375,7 +394,7 @@ export class Blockchain {
name: 'BEBoxMall',
version: '1',
chainId: netId,
verifyingContract: MALL_ADDRESS
verifyingContract: this.mallAddress
},
message: signMsg
}
@ -385,7 +404,7 @@ export class Blockchain {
public async increaseAllowance(address: string, price: string) {
const coinInstance: any = await this.getCoinInstance(address)
const res = await coinInstance.methods.increaseAllowance(MALL_ADDRESS, price).send({ gas: 1000000 })
const res = await coinInstance.methods.increaseAllowance(this.mallAddress, price).send({ gas: 1000000 })
console.log('increaseAllowance: ', res)
}

View File

@ -257,19 +257,21 @@ export default class extends Vue {
]
get currentFilterData(): IFilterCfg[] {
// TODO:: open it
// switch (this.nftType) {
// case 0:
// return this.heroFilterData
// case 1:
// return this.weaponFilterData
// case 2:
// return this.chipFilterData
// default:
// return this.heroFilterData
// }
if (!process.env.VUE_APP_PART_CLOSE) {
switch (this.nftType) {
case 0:
return this.heroFilterData
case 1:
return this.weaponFilterData
case 2:
return this.chipFilterData
default:
return this.heroFilterData
}
} else {
return []
}
}
onClickClearAll() {
const currentDatas = this.currentFilterData

View File

@ -12,9 +12,9 @@ const env = process.env.NODE_ENV || 'development'
export const AVAILABLE_CHAINS = env === 'development' ? [322, 97] : [321]
export const MALL_ADDRESS = '0x8a6023bdc23dd1708b88717403Fc8395aA9d0dFE'
export const OFFICE_ACCOUNT = '0x565edA4ef351EB78F03B8AfCb6dCF02E29cAD62e'
export const OFFICE_ACCOUNT = env === 'development'
? '0x50A8e60041A206AcaA5F844a1104896224be6F39'
: '0x565edA4ef351EB78F03B8AfCb6dCF02E29cAD62e'
export const CONTRACT_ADDRESS:{[key: number]: any} = {
322: {
@ -30,10 +30,10 @@ export const CONTRACT_ADDRESS:{[key: number]: any} = {
mall: '0xF278ff771F9E24968083B0bA54Cb42eb4B23C2d7'
},
321: {
cec: '0xcaA011E902103752435AC98657B046B282E36509',
ceg: '0x6ae1Db01ab189f88ae7947a47a6CB24E174A2501',
cec: '0x4446Fc4eb47f2f6586f9fAAb68B3498F86C07521',
ceg: '0x4446Fc4eb47f2f6586f9fAAb68B3498F86C07521',
eth: '0x4446Fc4eb47f2f6586f9fAAb68B3498F86C07521',
mall: '0x8a6023bdc23dd1708b88717403Fc8395aA9d0dFE'
mall: '0x4446Fc4eb47f2f6586f9fAAb68B3498F86C07521'
},
32: {
cec: '0xfeFc3aab779863c1624eE008aba485c53805dCeb',

View File

@ -28,7 +28,7 @@
<div class="box-list" v-if="boxDatas.length>0">
<one-box v-for="data in boxDatas" :key="data.id" :pre-sale="false" :box-data="data"></one-box>
</div>
<result-no v-if="boxDatas.length === 0"></result-no>
<result-no v-if="boxDatas.length === 0" title="no record"></result-no>
<pagination
v-if="totalPage>1"
:total="totalPage"
@ -92,7 +92,9 @@ export default class Official extends Vue {
private currentPage = 1
created() {
if (!process.env.VUE_APP_PART_CLOSE) {
this.fetchData()
}
this.subscribeToEvents()
this.chainManger.init()
}