diff --git a/src/api/User.ts b/src/api/User.ts index 44c0e74..4c0a9b9 100644 --- a/src/api/User.ts +++ b/src/api/User.ts @@ -21,7 +21,6 @@ export const defaultUser: IUser = { account: '' } /** - * 获取用户信息 * @param data {account: string, token: string} */ export const getUserInfo = (data: any) => diff --git a/src/chain/ChainManager.ts b/src/chain/ChainManager.ts index f53c96d..0b00727 100644 --- a/src/chain/ChainManager.ts +++ b/src/chain/ChainManager.ts @@ -139,6 +139,13 @@ export default class ChainManager { return balance } + /** + * get amount of mystery boxes + * this method can get amount of general erc721 also + * @param {string} address + * @param {number} chainId + * @return {Promise} + */ public async getNftBalance(address: string, chainId: number) { const coinInstance = await this.getInstance(address, chainId, MYSTERY_BOX_ABI) const balance = await coinInstance.methods.balanceOf(AppModule.accountId).call() @@ -172,6 +179,15 @@ export default class ChainManager { return nftId } + /** + * Open one mystery box + * @param {string} address address of mystery box contract on current chain + * @param {string} boxId nftid of mystery box + * @param {number[]} tokenIds + * @param {string} nonce + * @param {string} signature + * @return {Promise} + */ public async openMysteryBox( address: string, boxId: string, @@ -184,7 +200,6 @@ export default class ChainManager { return proxyInstance.methods.openBox(boxId, tokenIds, nonce, signature).send({ gas: 1000000 }) } - // 转账 public async transferToAccount({ to, amount, chainId, address } : { to: string amount: number diff --git a/src/chain/blockchain.ts b/src/chain/blockchain.ts index 59489e8..4806655 100644 --- a/src/chain/blockchain.ts +++ b/src/chain/blockchain.ts @@ -409,7 +409,6 @@ export class Blockchain { } /** - * 获取某种币的余额 * @param {string} address * @param {string | null} account * @return {Promise} @@ -420,7 +419,6 @@ export class Blockchain { 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) diff --git a/src/components/market/PricePickerModal.vue b/src/components/market/PricePickerModal.vue index 2ccb16b..1de7c5f 100644 --- a/src/components/market/PricePickerModal.vue +++ b/src/components/market/PricePickerModal.vue @@ -14,8 +14,8 @@ diff --git a/src/components/market/wallet/WalletPanel.vue b/src/components/market/wallet/WalletPanel.vue index beb85d4..5d247aa 100644 --- a/src/components/market/wallet/WalletPanel.vue +++ b/src/components/market/wallet/WalletPanel.vue @@ -337,7 +337,6 @@ export default class WalletPanel extends Vue { } /** - * 获取用户选择的币的数量 * @param data * @return {Promise} */ @@ -356,7 +355,7 @@ export default class WalletPanel extends Vue { } /** - * 查询token->game的订单 + * query token->game * @param {string} txhash * @return {Promise} */ @@ -387,7 +386,7 @@ export default class WalletPanel extends Vue { } /** - * 查询token->game的订单 + * query token->game * @param {string} seqId * @return {Promise} */ diff --git a/src/types/Nft.ts b/src/types/Nft.ts index 614ad3d..2a9aa7e 100644 --- a/src/types/Nft.ts +++ b/src/types/Nft.ts @@ -5,7 +5,7 @@ export enum NftType{ } /** - * 0:正常状态 1:出售中 2:出租中 + * 0:Normal 1:Sell 2:Rent */ export enum NftState { NORMAL = 0, @@ -34,7 +34,6 @@ export interface INftData{ level: number job?: string quality: number - // 所有者地址 owner?: string state: NftState mintTime: number diff --git a/src/views/desktop/Mystery.vue b/src/views/desktop/Mystery.vue index 54e8881..fcacd9e 100644 --- a/src/views/desktop/Mystery.vue +++ b/src/views/desktop/Mystery.vue @@ -118,7 +118,7 @@ export default class Official extends Vue { mounted() { this.checkOrderHistory() // if (process.env.NODE_ENV === 'development') { - window.showModal = this.showTestModal + // window.showModal = this.showTestModal // } } @@ -320,102 +320,102 @@ export default class Official extends Vue { this.rewardModal.show() } - showTestModal() { - const nftList = [{ - token_id: '501007316659010037', - owner_address: '0x42448c6a38c08637218d8327b748f213fc2c0231', - owner_name: '', - item_id: '30600', - type: '1', - state: '0', - hide_attr: 1, - is_genesis: false, - image: 'https://www.cebg.games/res/avatars/30600.png', - currency_list: [], - transaction_recrod: [], - info: - { - name: 'Canoe', - attr: [], - job: 1, - level: 1, - quality: 1, - hp: 200, - speed: 6, - atk: 32, - def: 7, - advanced_count: 0, - lucky: 0, - success_rate: 0 - }, - mint_time: '1650529475' - }, - { - token_id: '501007316776010040', - owner_address: '0x42448c6a38c08637218d8327b748f213fc2c0231', - owner_name: '', - item_id: '30100', - type: '1', - state: '0', - hide_attr: 1, - is_genesis: false, - image: 'https://www.cebg.games/res/avatars/30100.png', - currency_list: [], - transaction_recrod: [], - info: - { - name: 'Hill', - attr: [], - job: 1, - level: 1, - quality: 1, - hp: 195, - speed: 6, - atk: 35, - def: 6, - advanced_count: 0, - lucky: 0, - success_rate: 0 - }, - mint_time: '1650529592' - }, - { - token_id: '501007319181010046', - owner_address: '0x42448c6a38c08637218d8327b748f213fc2c0231', - owner_name: '', - item_id: '30300', - type: '1', - state: '0', - hide_attr: 1, - is_genesis: true, - image: 'https://www.cebg.games/res/avatars/30300_1.png', - currency_list: [], - transaction_recrod: [], - info: - { - name: 'Aoi', - attr: [], - job: 3, - level: 1, - quality: 1, - hp: 120, - speed: 5, - atk: 20, - def: 10, - advanced_count: 0, - lucky: 0, - success_rate: 0 - }, - mint_time: '1650531993' - }] - const cardList: INftData[] = [] - nftList.forEach(o => cardList.push(parseNftData(o))) - const data = { - title: 'Test data', - cardList - } - this.showRewardModal(data) - } + // showTestModal() { + // const nftList = [{ + // token_id: '501007316659010037', + // owner_address: '0x42448c6a38c08637218d8327b748f213fc2c0231', + // owner_name: '', + // item_id: '30600', + // type: '1', + // state: '0', + // hide_attr: 1, + // is_genesis: false, + // image: 'https://www.cebg.games/res/avatars/30600.png', + // currency_list: [], + // transaction_recrod: [], + // info: + // { + // name: 'Canoe', + // attr: [], + // job: 1, + // level: 1, + // quality: 1, + // hp: 200, + // speed: 6, + // atk: 32, + // def: 7, + // advanced_count: 0, + // lucky: 0, + // success_rate: 0 + // }, + // mint_time: '1650529475' + // }, + // { + // token_id: '501007316776010040', + // owner_address: '0x42448c6a38c08637218d8327b748f213fc2c0231', + // owner_name: '', + // item_id: '30100', + // type: '1', + // state: '0', + // hide_attr: 1, + // is_genesis: false, + // image: 'https://www.cebg.games/res/avatars/30100.png', + // currency_list: [], + // transaction_recrod: [], + // info: + // { + // name: 'Hill', + // attr: [], + // job: 1, + // level: 1, + // quality: 1, + // hp: 195, + // speed: 6, + // atk: 35, + // def: 6, + // advanced_count: 0, + // lucky: 0, + // success_rate: 0 + // }, + // mint_time: '1650529592' + // }, + // { + // token_id: '501007319181010046', + // owner_address: '0x42448c6a38c08637218d8327b748f213fc2c0231', + // owner_name: '', + // item_id: '30300', + // type: '1', + // state: '0', + // hide_attr: 1, + // is_genesis: true, + // image: 'https://www.cebg.games/res/avatars/30300_1.png', + // currency_list: [], + // transaction_recrod: [], + // info: + // { + // name: 'Aoi', + // attr: [], + // job: 3, + // level: 1, + // quality: 1, + // hp: 120, + // speed: 5, + // atk: 20, + // def: 10, + // advanced_count: 0, + // lucky: 0, + // success_rate: 0 + // }, + // mint_time: '1650531993' + // }] + // const cardList: INftData[] = [] + // nftList.forEach(o => cardList.push(parseNftData(o))) + // const data = { + // title: 'Test data', + // cardList + // } + // this.showRewardModal(data) + // } toPage(pageNo: number) { console.log('to page: ', pageNo)