diff --git a/README.md b/README.md index 6ba59b1b..a647bb7f 100644 --- a/README.md +++ b/README.md @@ -27,20 +27,21 @@ # Install ```sh -yarn add @aelf-web-login/wallet-adapter-night-elf @aelf-web-login/wallet-adapter-portkey-aa @aelf-web-login/wallet-adapter-portkey-discover @aelf-web-login/wallet-adapter-react @aelf-web-login/wallet-adapter-base @aelf-web-login/wallet-adapter-bridge @aelf-web-login/utils +yarn add @aelf-web-login/wallet-adapter-night-elf @aelf-web-login/wallet-adapter-portkey-aa @aelf-web-login/wallet-adapter-portkey-discover @aelf-web-login/wallet-adapter-react @aelf-web-login/wallet-adapter-base @aelf-web-login/wallet-adapter-bridge @aelf-web-login/utils @portkey/did-ui-react ``` Then the `package.json` will be like this ```json "dependencies": { - "@aelf-web-login/wallet-adapter-night-elf": "^0.1.0", - "@aelf-web-login/wallet-adapter-portkey-aa": "^0.1.0", - "@aelf-web-login/wallet-adapter-portkey-discover": "^0.1.0", - "@aelf-web-login/wallet-adapter-react": "^0.1.0", - "@aelf-web-login/wallet-adapter-base": "^0.1.0", - "@aelf-web-login/wallet-adapter-bridge": "^0.1.0", - "@aelf-web-login/utils": "^0.1.0", + "@aelf-web-login/wallet-adapter-night-elf": "^0.1.7", + "@aelf-web-login/wallet-adapter-portkey-aa": "^0.1.7", + "@aelf-web-login/wallet-adapter-portkey-discover": "^0.1.7", + "@aelf-web-login/wallet-adapter-react": "^0.1.7", + "@aelf-web-login/wallet-adapter-base": "^0.1.7", + "@aelf-web-login/wallet-adapter-bridge": "^0.1.7", + "@aelf-web-login/utils": "^0.1.7", + "@portkey/did-ui-react": "^2.13.2", } ``` @@ -67,7 +68,7 @@ const RPC_SERVER_AELF = 'https://aelf-test-node.aelf.io'; const RPC_SERVER_TDVV = 'https://tdvv-public-node.aelf.io'; const RPC_SERVER_TDVW = 'https://tdvw-test-node.aelf.io'; const GRAPHQL_SERVER = - 'https://dapp-aa-portkey-test.portkey.finance/Portkey_DID/PortKeyIndexerCASchema/graphql'; + 'https://dapp-aa-portkey-test.portkey.finance/aefinder-v2/api/app/graphql/portkey'; const CONNECT_SERVER = 'https://auth-aa-portkey-test.portkey.finance'; const SERVICE_SERVER = 'https://aa-portkey-test.portkey.finance'; const TELEGRAM_BOT_ID = 'xx'; @@ -103,7 +104,7 @@ const baseConfig = { // }, // omitTelegramScript: false, // cancelAutoLoginInTelegram: false, - enableAcceleration: true, + enableAcceleration: false, networkType: NETWORK_TYPE, showVconsole: false, chainId: CHAIN_ID, diff --git a/packages/base/package.json b/packages/base/package.json index 54d19dde..264b56ec 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.17", + "version": "0.1.18", "type": "module", "main": "dist/esm/index.js", "module": "dist/esm/index.js", @@ -33,8 +33,8 @@ "@babel/core": "^7.24.7", "@babel/preset-env": "^7.24.7", "@babel/preset-typescript": "^7.24.7", - "@portkey/did-ui-react": "^2.11.0", - "@portkey/types": "^2.11.0", + "@portkey/did-ui-react": "^2.13.2", + "@portkey/types": "^2.13.2", "@types/jest": "^29.5.12", "babel-jest": "^29.7.0", "jest": "^29.7.0", @@ -44,7 +44,7 @@ "typescript": "^5.3.3" }, "peerDependencies": { - "@portkey/did-ui-react": "^2.11.0" + "@portkey/did-ui-react": "^2.13.2" }, "publishConfig": { "registry": "https://registry.npmjs.org", diff --git a/packages/base/src/adapter.ts b/packages/base/src/adapter.ts index 8829b27d..00f30243 100644 --- a/packages/base/src/adapter.ts +++ b/packages/base/src/adapter.ts @@ -32,7 +32,7 @@ export interface IWalletAdapter { noNeedForConfirm?: boolean; login(arg?: DIDWalletInfo): Promise; - logout(): Promise; + logout(isForgetPin?: boolean): Promise; loginEagerly(type?: string): Promise; // getAccounts(chainId: TChainId): Promise; // callContract(params: ICallContractParams): Promise; @@ -67,7 +67,7 @@ export abstract class BaseWalletAdapter abstract wallet: TWalletInfo; abstract login(arg?: DIDWalletInfo): Promise; - abstract logout(): Promise; + abstract logout(isForgetPin?: boolean): Promise; abstract loginEagerly(type?: string): Promise; // abstract getAccounts(chainId: TChainId): Promise; // abstract callContract(params: ICallContractParams): Promise; diff --git a/packages/bridge/package.json b/packages/bridge/package.json index e2edf4e4..4a15a269 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.17", + "version": "0.1.18", "type": "module", "main": "dist/esm/index.js", "module": "dist/esm/index.js", @@ -29,13 +29,13 @@ }, "dependencies": { "@aelf-web-login/wallet-adapter-base": "workspace:*", - "@portkey/services": "^2.11.0", + "@portkey/services": "^2.13.2", "@reduxjs/toolkit": "^2.2.3", "react": "^18.0.0", "react-dom": "^18.0.0" }, "devDependencies": { - "@portkey/did-ui-react": "^2.11.0", + "@portkey/did-ui-react": "^2.13.2", "@types/react": "^18.3.1", "@types/react-dom": "^18.3.0", "antd": "4.24.14", @@ -43,7 +43,7 @@ "typescript": "^5.3.3" }, "peerDependencies": { - "@portkey/did-ui-react": "^2.11.0" + "@portkey/did-ui-react": "^2.13.2" }, "publishConfig": { "registry": "https://registry.npmjs.org", diff --git a/packages/bridge/src/bridge.ts b/packages/bridge/src/bridge.ts index 0b36b2b7..0717596c 100644 --- a/packages/bridge/src/bridge.ts +++ b/packages/bridge/src/bridge.ts @@ -99,19 +99,19 @@ class Bridge { }); }; - doubleCheckDisconnect = async () => { + doubleCheckDisconnect = async (isForgetPin?: boolean) => { if (isDisconnectClicked) { return; } isDisconnectClicked = true; - await this.activeWallet?.logout(); + await this.activeWallet?.logout(isForgetPin); this.closeConfirmLogoutPanel(); this.closeLockPanel(); isDisconnectClicked = false; this._logoutResolve(true); }; - disConnect = async (): Promise => { + disConnect = async (isForgetPin?: boolean): Promise => { return new Promise((resolve, reject) => { this._logoutResolve = resolve; this._logoutReject = reject; @@ -121,7 +121,7 @@ class Bridge { try { if (this.isAAWallet) { if (this.activeWallet!.noNeedForConfirm) { - await this.doubleCheckDisconnect(); + await this.doubleCheckDisconnect(isForgetPin); } else { this.openConfirmLogoutPanel(); } @@ -228,6 +228,7 @@ class Bridge { dispatch(clearWalletInfo()); dispatch(clearWalletType()); dispatch(clearLoginError()); + dispatch(setLocking(false)); }; onLockHandler = () => { diff --git a/packages/bridge/src/ui.css b/packages/bridge/src/ui.css index 37d1ad97..e4448612 100644 --- a/packages/bridge/src/ui.css +++ b/packages/bridge/src/ui.css @@ -152,3 +152,17 @@ justify-content: space-between; align-items: center; } +.unlock-footer-text{ + color: #55585E; + font-size: 14px; + font-weight: 400; + text-align: center; + line-height: 20px; + margin-left: 14px; + margin-right: 14px; + .unlock-footer-text-href{ + color: #5D42FF; + padding: 0 4px; + cursor: pointer; + } +} diff --git a/packages/bridge/src/ui.tsx b/packages/bridge/src/ui.tsx index e723ba0a..6d57943c 100644 --- a/packages/bridge/src/ui.tsx +++ b/packages/bridge/src/ui.tsx @@ -270,7 +270,7 @@ const SignInModal: React.FC = (props: ISignInModalProps) => { await bridgeInstance.doubleCheckDisconnect(); TelegramPlatform.close(); }; - TelegramPlatform.initializeTelegramWebApp({ handleLogout }); + TelegramPlatform.initializeTelegramWebApp({ tgUserChanged: handleLogout }); }; console.log('begin to init and execute handleTelegram', TelegramPlatform.isTelegramPlatform()); @@ -464,6 +464,26 @@ const SignInModal: React.FC = (props: ISignInModalProps) => { isShowNestedModal, ]); + const onForgetPinHandler = useCallback(async () => { + // await bridgeInstance.onPortkeyAAUnLock(defaultPin); + await bridgeInstance.disConnect(true); + if (TelegramPlatform.isTelegramPlatform()) { + TelegramPlatform.close(); + } + }, [bridgeInstance]); + + const forgetPinElement = useMemo(() => { + return ( +
+ Forgot your PIN? Click + + here + + to log back in. +
+ ); + }, [onForgetPinHandler]); + return ( //
@@ -477,6 +497,7 @@ const SignInModal: React.FC = (props: ISignInModalProps) => { onChange={setPassword} onCancel={onCloseWrapperInternal} onUnlock={onUnlockInternal} + footer={forgetPinElement} /> ) : (