From ca0252359d0c3c4b26676af0dc629cd2f51fe0e2 Mon Sep 17 00:00:00 2001 From: aelf-lxy Date: Tue, 23 Jul 2024 14:23:52 +0800 Subject: [PATCH] fix: Automatically reconnect after logging out of the app --- packages/base/package.json | 2 +- packages/bridge/package.json | 2 +- packages/bridge/src/bridge.ts | 7 ++++++- packages/bridge/src/ui.css | 1 + packages/react/package.json | 2 +- packages/starter/src/Demo/demo.tsx | 4 ++-- packages/utils/package.json | 2 +- packages/wallets/night-elf/package.json | 2 +- packages/wallets/portkey-aa/package.json | 2 +- packages/wallets/portkey-aa/src/index.ts | 15 +++++++++++---- packages/wallets/portkey-discover/package.json | 2 +- 11 files changed, 27 insertions(+), 14 deletions(-) diff --git a/packages/base/package.json b/packages/base/package.json index 68dd467b..4c8a6cb7 100644 --- a/packages/base/package.json +++ b/packages/base/package.json @@ -1,6 +1,6 @@ { "name": "@aelf-web-login/wallet-adapter-base", - "version": "0.1.3-alpha.5", + "version": "0.1.3-alpha.7", "type": "module", "main": "dist/esm/index.js", "module": "dist/esm/index.js", diff --git a/packages/bridge/package.json b/packages/bridge/package.json index 5a275cdf..177f6382 100755 --- a/packages/bridge/package.json +++ b/packages/bridge/package.json @@ -1,6 +1,6 @@ { "name": "@aelf-web-login/wallet-adapter-bridge", - "version": "0.1.3-alpha.5", + "version": "0.1.3-alpha.7", "type": "module", "main": "dist/esm/index.js", "module": "dist/esm/index.js", diff --git a/packages/bridge/src/bridge.ts b/packages/bridge/src/bridge.ts index a4120e86..88be2ff0 100644 --- a/packages/bridge/src/bridge.ts +++ b/packages/bridge/src/bridge.ts @@ -81,7 +81,12 @@ class Bridge { return new Promise((resolve, reject) => { this._loginResolve = resolve; this._loginReject = reject; - this.openLoginPanel(); + if (isPortkeyApp()) { + console.log('begin to execute onUniqueWalletClick in PortkeyApp'); + this.onUniqueWalletClick('PortkeyDiscover'); + } else { + this.openLoginPanel(); + } }); }; diff --git a/packages/bridge/src/ui.css b/packages/bridge/src/ui.css index 4b9b15d3..37d1ad97 100644 --- a/packages/bridge/src/ui.css +++ b/packages/bridge/src/ui.css @@ -64,6 +64,7 @@ display: flex; height: 20px; gap: 12px; + justify-content: flex-end; } .crypto-extra-image-arrow { width: 12px; diff --git a/packages/react/package.json b/packages/react/package.json index f44bf1ef..89414619 100755 --- a/packages/react/package.json +++ b/packages/react/package.json @@ -1,6 +1,6 @@ { "name": "@aelf-web-login/wallet-adapter-react", - "version": "0.1.3-alpha.5", + "version": "0.1.3-alpha.7", "type": "module", "main": "dist/esm/index.js", "module": "dist/esm/index.js", diff --git a/packages/starter/src/Demo/demo.tsx b/packages/starter/src/Demo/demo.tsx index 7db98997..bdd9aa6d 100644 --- a/packages/starter/src/Demo/demo.tsx +++ b/packages/starter/src/Demo/demo.tsx @@ -58,13 +58,13 @@ const baseConfig = { // ConfirmLogoutDialog: CustomizedConfirmLogoutDialog, // SignInComponent: SignInProxy, PortkeyProviderProps: { - theme: 'dark' as any, + theme: 'light' as any, }, showVconsole: true, networkType: NETWORK_TYPE, chainId: CHAIN_ID, keyboard: true, - // noCommonBaseModal: true, + noCommonBaseModal: false, design: SignInDesignEnum.CryptoDesign, // "SocialDesign" | "CryptoDesign" | "Web2Design" titleForSocialDesign: 'Crypto wallet', iconSrcForSocialDesign: diff --git a/packages/utils/package.json b/packages/utils/package.json index c1618fce..bdbd8b21 100755 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -1,6 +1,6 @@ { "name": "@aelf-web-login/utils", - "version": "0.1.3-alpha.5", + "version": "0.1.3-alpha.7", "type": "module", "main": "dist/esm/index.js", "module": "dist/esm/index.js", diff --git a/packages/wallets/night-elf/package.json b/packages/wallets/night-elf/package.json index 75f8ce8f..1b22750e 100755 --- a/packages/wallets/night-elf/package.json +++ b/packages/wallets/night-elf/package.json @@ -1,6 +1,6 @@ { "name": "@aelf-web-login/wallet-adapter-night-elf", - "version": "0.1.3-alpha.5", + "version": "0.1.3-alpha.7", "type": "module", "main": "dist/esm/index.js", "module": "dist/esm/index.js", diff --git a/packages/wallets/portkey-aa/package.json b/packages/wallets/portkey-aa/package.json index 7b3fd47e..c5f23c12 100755 --- a/packages/wallets/portkey-aa/package.json +++ b/packages/wallets/portkey-aa/package.json @@ -1,6 +1,6 @@ { "name": "@aelf-web-login/wallet-adapter-portkey-aa", - "version": "0.1.3-alpha.5", + "version": "0.1.3-alpha.7", "type": "module", "main": "dist/esm/index.js", "module": "dist/esm/index.js", diff --git a/packages/wallets/portkey-aa/src/index.ts b/packages/wallets/portkey-aa/src/index.ts index 53863613..5ae69598 100644 --- a/packages/wallets/portkey-aa/src/index.ts +++ b/packages/wallets/portkey-aa/src/index.ts @@ -92,11 +92,18 @@ export class PortkeyAAWallet extends BaseWalletAdapter { } let nickName = 'Wallet 01'; + try { + const holderInfo = await did.getCAHolderInfo(didWalletInfo.chainId); + nickName = holderInfo.nickName; + } catch (error) { + console.log('portkeyAA login and execute did.getCAHolderInfo. nickName:', nickName, error); + } - const holderInfo = await did.getCAHolderInfo(didWalletInfo.chainId); - nickName = holderInfo.nickName; - - await did.save(didWalletInfo.pin, this.appName); + try { + await did.save(didWalletInfo.pin, this.appName); + } catch (e) { + console.log('portkeyAA login and execute did.save.', e); + } const portkeyInfo = { ...didWalletInfo, diff --git a/packages/wallets/portkey-discover/package.json b/packages/wallets/portkey-discover/package.json index 63d77bd1..92b4d483 100755 --- a/packages/wallets/portkey-discover/package.json +++ b/packages/wallets/portkey-discover/package.json @@ -1,6 +1,6 @@ { "name": "@aelf-web-login/wallet-adapter-portkey-discover", - "version": "0.1.3-alpha.5", + "version": "0.1.3-alpha.7", "type": "module", "main": "dist/esm/index.js", "module": "dist/esm/index.js",