From ccfa3b599ea99230c246a84bcd8cea656e15adda Mon Sep 17 00:00:00 2001 From: CounterFire2023 <136581895+CounterFire2023@users.noreply.github.com> Date: Mon, 24 Jun 2024 16:52:57 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BC=80=E5=A7=8B=E5=87=BA=E5=94=AE=E6=96=B9?= =?UTF-8?q?=E6=B3=95=E5=A2=9E=E5=8A=A0=E8=BF=87=E6=9C=9F=E6=97=B6=E9=97=B4?= =?UTF-8?q?=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.dev | 1 + src/components/common/card.vue | 2 +- src/wallet/passPort.js | 14 ++++++++++---- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/.env.dev b/.env.dev index d383a3b..74ba3b9 100644 --- a/.env.dev +++ b/.env.dev @@ -12,3 +12,4 @@ VUE_APP_PASSPORT_MARKET_ADDRESS=0x7d117aA8BD6D31c4fa91722f246388f38ab1942c VUE_APP_MKT_API='https://market-test.kingsome.cn' VUE_APP_NET_ID='13473' VUE_APP_MARKET_CURRENCY='0xFd42bfb03212dA7e1A4608a44d7658641D99CF34' +VUE_APP_MAKEFEE_ADDRESS='0x50A8e60041A206AcaA5F844a1104896224be6F39' \ No newline at end of file diff --git a/src/components/common/card.vue b/src/components/common/card.vue index 7b8983f..c8f56fd 100644 --- a/src/components/common/card.vue +++ b/src/components/common/card.vue @@ -74,7 +74,7 @@ const addCart = async (val) => { tokens: [ { token_id: val.nft.token_id, - token_type: val.nft.type, + contract_address: val.nft.contract_address, } ] } diff --git a/src/wallet/passPort.js b/src/wallet/passPort.js index aa1582d..1d0d62b 100644 --- a/src/wallet/passPort.js +++ b/src/wallet/passPort.js @@ -8,6 +8,7 @@ const clientId = import.meta.env.VUE_APP_PASSPORT_CLIENT_ID const redirectUri = import.meta.env.VUE_APP_PASSPORT_REDIRECT_URI const logoutRedirectUri = import.meta.env.VUE_APP_PASSPORT_LOGOUT_URI const marketAddress = import.meta.env.VUE_APP_PASSPORT_MARKET_ADDRESS +const makeFeeAddress = import.meta.env.VUE_APP_MAKEFEE_ADDRESS const NATIVE = 'NATIVE' const ERC20 = 'ERC20' @@ -63,6 +64,7 @@ class LPassportWallet { this.web3Provider = new providers.Web3Provider(passportProvider); this.signer = this.web3Provider.getSigner(); const accounts = await passportProvider.request({ method: "eth_requestAccounts" }) + console.log('address: ', accounts) const accessToken = await this.passportInstance.getAccessToken(); console.log('accessToken:', accessToken) // const idToken = await passportInstance.getIdToken(); @@ -91,7 +93,7 @@ class LPassportWallet { * 准备一个ERC721的挂单 * @returns */ - async _prepareERC721Listing({ contractAddress, tokenId, type = 'ERC721', currencyAddress, currencyAmount}){ + async _prepareERC721Listing({ contractAddress, tokenId, type = 'ERC721', currencyAddress, currencyAmount, orderExpiry}){ const offerer = await this.signer.getAddress(); const buyData = { amount: currencyAmount, @@ -110,6 +112,7 @@ class LPassportWallet { tokenId, type, }, + orderExpiry }); console.log(preparedListing.actions) let orderSignature = '' @@ -155,7 +158,7 @@ class LPassportWallet { // Optional maker marketplace fee makerFees: [{ amount, - recipientAddress: marketAddress, // Replace address with your own marketplace address + recipientAddress: makeFeeAddress, // Replace address with your own marketplace address }], }); console.log('order:', order); @@ -169,10 +172,11 @@ class LPassportWallet { * @param {string} tokenId NFT的tokenId * @param {string} currencyAddress NATIVE 或者 ERC20的合约地址 * @param {string} currencyAmount 出售价格, 单位 wei + * @param {Date} orderExpiry 过期时间 */ - async beginSellERC721({contractAddress, tokenId, currencyAddress, currencyAmount}) { + async beginSellERC721({contractAddress, tokenId, currencyAddress, currencyAmount, orderExpiry}) { const { preparedListing, orderSignature } = - await this._prepareERC721Listing({contractAddress, tokenId, currencyAddress, currencyAmount}); + await this._prepareERC721Listing({contractAddress, tokenId, currencyAddress, currencyAmount, orderExpiry}); const order = await this._createListing(preparedListing, orderSignature, currencyAmount); return order } @@ -233,6 +237,8 @@ class LPassportWallet { console.log( `Fulfilling listings ${fulfillableOrders}, transaction expiry ${expiration}` ); + } else { + throw new Error('insufficint balance') } } catch (e) { console.error(`Fulfill bulk orders request failed with ${e}`);