修改初始化passprod

This commit is contained in:
yuyongdong 2024-06-21 10:45:50 +08:00
parent 1d63826bb5
commit 7face64d01
2 changed files with 13 additions and 7 deletions

View File

@ -282,6 +282,12 @@ watch(() => route.path,(newPath, oldPath) => {
} }
}) })
onMounted( async () => {
if( immutableStore.accessToken) {
await new PassportWallet().connect()
}
})
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

@ -55,7 +55,7 @@ class LPassportWallet {
connect.mount('wallet'); connect.mount('wallet');
} }
async connect() { async connect() {
const profile = await this.passportInstance.login(); // const profile = await this.passportInstance.login();
// console.log(profile,'-----------------------------------------------------------------') // console.log(profile,'-----------------------------------------------------------------')
const passportProvider = this.passportInstance.connectEvm(); const passportProvider = this.passportInstance.connectEvm();
this.web3Provider = new providers.Web3Provider(passportProvider); this.web3Provider = new providers.Web3Provider(passportProvider);
@ -65,7 +65,7 @@ class LPassportWallet {
// console.log('accessToken:', accessToken) // console.log('accessToken:', accessToken)
// const idToken = await passportInstance.getIdToken(); // const idToken = await passportInstance.getIdToken();
// console.log('idToken:', idToken) // console.log('idToken:', idToken)
return {profile, accounts, accessToken} return { accounts, accessToken}
} }
async logout() { async logout() {
@ -179,8 +179,8 @@ class LPassportWallet {
* @param {*} listingId * @param {*} listingId
*/ */
async beginBuy(listingId) { async beginBuy(listingId) {
// const fulfiller = await this.signer.getAddress(); const fulfiller = await this.signer.getAddress();
const fulfiller = marketAddress // const fulfiller = marketAddress
console.log(listingId,fulfiller) console.log(listingId,fulfiller)
const { actions, expiration, order } = await this.client.fulfillOrder( const { actions, expiration, order } = await this.client.fulfillOrder(
listingId, listingId,
@ -202,8 +202,8 @@ class LPassportWallet {
* @param { string[] } listingIds: listingId列表 * @param { string[] } listingIds: listingId列表
*/ */
async batchBuy(listingIds) { async batchBuy(listingIds) {
// const fulfiller = await this.signer.getAddress(); const fulfiller = await this.signer.getAddress();
console.log(listingIds, marketAddress,'---') // console.log(listingIds, marketAddress,'---')
// return // return
try { try {
const fulfillResponse = await this.client.fulfillBulkOrders( const fulfillResponse = await this.client.fulfillBulkOrders(
@ -212,7 +212,7 @@ class LPassportWallet {
// you could have up to 2 marketplace fees // you could have up to 2 marketplace fees
takerFees: [], takerFees: [],
})), })),
marketAddress fulfiller
); );
if (fulfillResponse.sufficientBalance) { if (fulfillResponse.sufficientBalance) {