修改mint方法调用的接口
This commit is contained in:
parent
164d68a484
commit
66a8fc4852
@ -1,6 +1,6 @@
|
||||
|
||||
import { ethers } from 'ethers'
|
||||
import { apiUnlockOrMint } from '@/utils/marketplace'
|
||||
import { apiUnlockOrMint, apiMintNft } from '@/utils/marketplace'
|
||||
|
||||
const lockAbi = [
|
||||
'function lock(address nft, address to, uint256[] tokenIds) external',
|
||||
@ -78,17 +78,15 @@ export class Locker {
|
||||
}
|
||||
// 游戏内资产上链, 只用于mint
|
||||
// 该方法会显示一个确认弹窗, 由用户选择mint到哪个地址
|
||||
async mintNft(nft, tokenIds) {
|
||||
console.log('mint nft', nft, tokenIds)
|
||||
const { provider, address } = await this.bc.selectAddress()
|
||||
async mintNft(tokenIds) {
|
||||
console.log('mint hero', tokenIds)
|
||||
const { provider, address } = await this.bc.selectAddress({})
|
||||
const preDatas = {
|
||||
net_id: import.meta.env.VUE_APP_NET_ID,
|
||||
to: address,
|
||||
contract_address: nft,
|
||||
tokens: tokenIds.map(tokenId => {return { tokenId }}),
|
||||
hero_uniids: tokenIds,
|
||||
}
|
||||
const passportToken = await this.bc.passportToken()
|
||||
const { errcode, errmsg, trans_req } = await apiUnlockOrMint(preDatas, passportToken)
|
||||
const { errcode, errmsg, trans_req } = await apiMintNft(preDatas, passportToken)
|
||||
if (errcode) {
|
||||
throw new Error(errmsg)
|
||||
}
|
||||
|
@ -129,3 +129,9 @@ export const apiUnlockOrMint = async (data, token) => {
|
||||
const url = `${API_BASE}/api/nft/stacking/unlock`
|
||||
return httpPost(url, data, token)
|
||||
}
|
||||
|
||||
|
||||
export const apiMintNft = async (data, token) => {
|
||||
const url = `${API_BASE}/api/ingame/asset/hero/mint`
|
||||
return httpPost(url, data, token)
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user