修改初始化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>
<style lang="scss" scoped>

View File

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