diff --git a/.env.development b/.env.development index 0af32e2..94a57e1 100644 --- a/.env.development +++ b/.env.development @@ -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 diff --git a/.env.development_bak b/.env.development_bak deleted file mode 100644 index af4b9bb..0000000 --- a/.env.development_bak +++ /dev/null @@ -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 diff --git a/.env.production b/.env.production index 4d6be27..3ca7df9 100644 --- a/.env.production +++ b/.env.production @@ -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 diff --git a/.env.test b/.env.test index 0af32e2..fd7aa9e 100644 --- a/.env.test +++ b/.env.test @@ -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 diff --git a/src/chain/blockchain.ts b/src/chain/blockchain.ts index bb9e59c..d95e4e7 100644 --- a/src/chain/blockchain.ts +++ b/src/chain/blockchain.ts @@ -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,9 +131,12 @@ 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', { - confirmButtonText: 'Confirm' - }) + 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) } diff --git a/src/components/market/SearchPanel.vue b/src/components/market/SearchPanel.vue index 55c5ad5..7d0b7e5 100644 --- a/src/components/market/SearchPanel.vue +++ b/src/components/market/SearchPanel.vue @@ -257,18 +257,20 @@ 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 - // } - return [] + 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() { diff --git a/src/configs/config_chain.ts b/src/configs/config_chain.ts index 6c9c059..f14f400 100644 --- a/src/configs/config_chain.ts +++ b/src/configs/config_chain.ts @@ -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', diff --git a/src/views/desktop/Mall.vue b/src/views/desktop/Mall.vue index c040f65..95be813 100644 --- a/src/views/desktop/Mall.vue +++ b/src/views/desktop/Mall.vue @@ -28,7 +28,7 @@