From 61faf30a7f90c6a4a2537a5aecadd8f403c33590 Mon Sep 17 00:00:00 2001 From: AuroraHuang22 Date: Wed, 11 Sep 2024 11:13:38 +0800 Subject: [PATCH 1/7] =?UTF-8?q?=E2=9C=A8=20Add=20signMessageMemo=20to=20wa?= =?UTF-8?q?llet=20store?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- store/wallet.ts | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/store/wallet.ts b/store/wallet.ts index 72d17047..3d51da32 100644 --- a/store/wallet.ts +++ b/store/wallet.ts @@ -2,6 +2,7 @@ import { Module, VuexModule, Mutation, Action } from 'vuex-module-decorators' import axios from 'axios' import { OfflineSigner } from '@cosmjs/proto-signing' +import stringify from 'fast-json-stable-stringify'; import { catchAxiosError } from '~/utils/misc' import { LIKECOIN_WALLET_CONNECTOR_CONFIG } from '~/constant/network' import { getUserInfoMinByAddress } from '~/constant/api' @@ -220,6 +221,54 @@ export default class Wallet extends VuexModule { return connection; } + @Action + // eslint-disable-next-line class-methods-use-this + async signMessageMemo(action: string, permissions?: string[]) { + if (!this.signer || !this.address) { + await this.initIfNecessary() + } + if (!this.signer || !this.address) { + throw new Error('WALLET_NOT_INITED') + } + const ts = Date.now() + const payload = JSON.stringify({ + action, + permissions, + likeWallet: this.address, + ts, + }) + const signingPayload = { + chain_id: LIKECOIN_WALLET_CONNECTOR_CONFIG.chainId, + memo: payload, + msgs: [], + fee: { + gas: '0', + amount: [{ + denom: LIKECOIN_WALLET_CONNECTOR_CONFIG.coinDenom, + amount: '0', + }], + }, + sequence: '0', + account_number: '0', + } + if ('signAmino' in this.signer) { + const { signed, signature } = await this.signer.signAmino( + this.address, + signingPayload, + ) + return { + signature: signature.signature, + publicKey: signature.pub_key.value, + message: stringify(signed), + wallet: this.address, + signMethod: 'memo', + expiresIn: '1d', + } + } + throw new Error('SIGNER_NOT_SUPPORT_AMINO') + } + + @Action disconnectWallet() { connectorInstance.disconnect() From 57536164b1fb4926162d5bd4cef15c842a978204 Mon Sep 17 00:00:00 2001 From: AuroraHuang22 Date: Wed, 11 Sep 2024 11:15:01 +0800 Subject: [PATCH 2/7] =?UTF-8?q?=E2=9C=A8=20Add=20book-api-store=20to=20ret?= =?UTF-8?q?rieve=20token?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- constant/api.ts | 1 + store/book-api.ts | 93 +++++++++++++++++++++++++++++++++++++++++ utils/auth.ts | 34 +++++++++++++++ utils/store-accessor.ts | 4 ++ 4 files changed, 132 insertions(+) create mode 100644 store/book-api.ts create mode 100644 utils/auth.ts diff --git a/constant/api.ts b/constant/api.ts index 79af1abd..89223dfd 100644 --- a/constant/api.ts +++ b/constant/api.ts @@ -12,6 +12,7 @@ export const API_GET_ARWEAVE_V2_PUBLIC_KEY = `${LIKE_CO_API_ROOT}/arweave/v2/pub export const API_POST_ARWEAVE_V2_ESTIMATE = `${LIKE_CO_API_ROOT}/arweave/v2/estimate`; export const API_POST_ARWEAVE_V2_SIGN = `${LIKE_CO_API_ROOT}/arweave/v2/sign_payment_data`; export const API_POST_ARWEAVE_V2_REGISTER = `${LIKE_CO_API_ROOT}/arweave/v2/register`; +export const API_POST_AUTHORIZE = `${LIKE_CO_API_ROOT}/wallet/authorize` export const API_LIKER_NFT_MINT = `${LIKE_CO_API_ROOT}/likernft/mint`; export const API_LIKER_NFT_PURCHASE = `${LIKE_CO_API_ROOT}/likernft/purchase`; export const API_LIKER_NFT_HISTORY = `${LIKE_CO_API_ROOT}/likernft/history`; diff --git a/store/book-api.ts b/store/book-api.ts new file mode 100644 index 00000000..7865accc --- /dev/null +++ b/store/book-api.ts @@ -0,0 +1,93 @@ +/* eslint-disable import/no-extraneous-dependencies */ +import { Module, VuexModule,Mutation, Action } from 'vuex-module-decorators' + +import axios from 'axios' + +import { saveAuthSession, clearAuthSession, loadAuthSession} from '~/utils/auth' +import { API_POST_AUTHORIZE } from '~/constant/api' + +@Module({ + name: 'book-api', + stateFactory: true, + namespaced: true, +}) +export default class BookAPI extends VuexModule { + token = '' + sessionWallet = '' + isRestoringSession = false + + @Mutation + setToken(inputToken: string) { + this.token = inputToken + } + + @Mutation + setSessionWallet(inputWallet: string) { + this.sessionWallet = inputWallet + } + + @Mutation + setIsRestoringSession(inputIsRestoringSession: boolean) { + this.isRestoringSession = inputIsRestoringSession + } + + @Action + async authenticate({inputWallet = '', signature = {}}: {inputWallet?: string, signature?: any}) { + try { + const { data } = await axios.post( + API_POST_AUTHORIZE, + { + expiresIn: '7d', + ...signature, + }, + ) + const token = (data as any)?.token + if (!token) { + throw new Error('INVALID_SIGNATURE') + } + this.context.commit('setToken', token) + this.context.commit('setSessionWallet', inputWallet) + saveAuthSession({ wallet: inputWallet, token}) + } catch (error) { + // eslint-disable-next-line no-console + console.error(error) + throw new Error('AUTHENTICATION_FAILED') + } + } + + @Action + clearSession () { + this.context.commit('setToken','') + this.context.commit('setSessionWallet', '') + clearAuthSession() + } + + @Action + async restoreSession () { + try { + this.context.commit('setIsRestoringSession', true) + const session = loadAuthSession() + if (session) { + this.context.commit('setToken', session.token) + this.context.commit('setSessionWallet', session.wallet) + if (session.wallet) { + await this.context.dispatch('wallet/restoreSessionIfNecessary', null, { root: true }) + } + } + } finally { + this.context.commit('setIsRestoringSession', false) + } + } + + get getToken() { + return this.token + } + + get getSessionWallet() { + return this.sessionWallet + } + + get getIsRestoringSession() { + return this.isRestoringSession + } +} diff --git a/utils/auth.ts b/utils/auth.ts new file mode 100644 index 00000000..cc517a13 --- /dev/null +++ b/utils/auth.ts @@ -0,0 +1,34 @@ +const AUTH_SESSION_KEY = 'likecoin_nft_book_press_token' + +export function loadAuthSession () { + try { + if (window.localStorage) { + const data = window.localStorage.getItem(AUTH_SESSION_KEY) + if (data) { + const { wallet, token } = JSON.parse(data) + return { + wallet, + token, + } + } + } + } catch {} + + return null +} + +export function saveAuthSession (session: { wallet: string, token: string }) { + try { + if (!window.localStorage) { return } + + window.localStorage.setItem(AUTH_SESSION_KEY, JSON.stringify(session)) + } catch {} +} + +export function clearAuthSession () { + try { + if (!window.localStorage) { return } + + window.localStorage.removeItem(AUTH_SESSION_KEY) + } catch {} +} \ No newline at end of file diff --git a/utils/store-accessor.ts b/utils/store-accessor.ts index cb7203ae..35940638 100644 --- a/utils/store-accessor.ts +++ b/utils/store-accessor.ts @@ -6,17 +6,21 @@ import { getModule } from 'vuex-module-decorators' import WalletStore from '~/store/wallet' import IscnStore from '~/store/iscn' +import BookApiStore from '~/store/book-api' let walletStore: WalletStore let iscnStore: IscnStore +let bookApiStore: BookApiStore function initialiseStores(store: Store): void { walletStore = getModule(WalletStore, store) iscnStore = getModule(IscnStore, store) + bookApiStore= getModule(BookApiStore, store) } export { initialiseStores, walletStore, iscnStore, + bookApiStore, } From 8abb50e3488db6063d7482dc4c9762b724c0b9bb Mon Sep 17 00:00:00 2001 From: AuroraHuang22 Date: Wed, 11 Sep 2024 13:07:08 +0800 Subject: [PATCH 3/7] =?UTF-8?q?=F0=9F=8E=A8=20Restore=20book=20session=20i?= =?UTF-8?q?n=20layout?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/RootLayout.vue | 7 ++++--- layouts/wallet.vue | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/components/RootLayout.vue b/components/RootLayout.vue index e1fb6de8..95f3efd0 100644 --- a/components/RootLayout.vue +++ b/components/RootLayout.vue @@ -26,7 +26,8 @@ import { Vue, Component, Prop } from 'vue-property-decorator' import { namespace } from 'vuex-class' import { IS_CHAIN_UPGRADING } from '~/constant' -const walletModule = namespace('wallet') +const bookApiModule = namespace('book-api') + @Component({ head() { @@ -38,7 +39,7 @@ const walletModule = namespace('wallet') }, }) export default class RootLayout extends Vue { - @walletModule.Action('restoreSessionIfNecessary') restoreSessionIfNecessary!: () => Promise + @bookApiModule.Action('restoreSession') restoreSession!: () => void @Prop({ default: 'bg-light-gray' }) readonly bgClass!: string @@ -46,7 +47,7 @@ export default class RootLayout extends Vue { async mounted() { this.isOpenChainUpgradeBlockingDialog = !!IS_CHAIN_UPGRADING - await this.restoreSessionIfNecessary() + await this.restoreSession() } handleChainUpgradeBlockingDialogClose() { diff --git a/layouts/wallet.vue b/layouts/wallet.vue index 041946ab..dffef6be 100644 --- a/layouts/wallet.vue +++ b/layouts/wallet.vue @@ -17,14 +17,15 @@ import logTrackerEvent, { setLoggerUser } from '~/utils/logger' const walletModule = namespace('wallet') +const bookApiModule = namespace('book-api') + @Component export default class WalletLayout extends Vue { @walletModule.Getter('getWalletAddress') walletAddress!: string @walletModule.Action('openConnectWalletModal') openConnectWalletModal!: (params: { language: string, fullPath?: string }) => Promise @walletModule.Action('initWallet') initWallet!: (params: { method: any, accounts: any, offlineSigner?: any }) => Promise - @walletModule.Action('restoreSessionIfNecessary') restoreSessionIfNecessary!: () => Promise - + @bookApiModule.Action('restoreSession') restoreSession!: () => void @walletModule.Action toggleAlert!: ( isShow: boolean, @@ -37,7 +38,7 @@ export default class WalletLayout extends Vue { } async mounted() { - await this.restoreSessionIfNecessary() + await this.restoreSession() if (!this.walletAddress) { const connection = await this.openConnectWalletModal({ language: this.$i18n.locale.split('-')[0], From ee902c639b3d3d968d32df181e697b38d858b890 Mon Sep 17 00:00:00 2001 From: AuroraHuang22 Date: Wed, 11 Sep 2024 13:13:00 +0800 Subject: [PATCH 4/7] =?UTF-8?q?=E2=9C=A8Retrieve=20JWT=20token=20during=20?= =?UTF-8?q?wallet=20connection?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/AppHeader.vue | 30 ++++++++++++++++++--- layouts/wallet.vue | 57 +++++++++++++++++++++++++++++----------- pages/auth/redirect.vue | 19 ++++++++++++++ 3 files changed, 87 insertions(+), 19 deletions(-) diff --git a/components/AppHeader.vue b/components/AppHeader.vue index f3bb2d5c..ab89d082 100644 --- a/components/AppHeader.vue +++ b/components/AppHeader.vue @@ -157,6 +157,7 @@ import logTrackerEvent, { setLoggerUser } from '~/utils/logger' import { IS_TESTNET } from '~/constant' const walletModule = namespace('wallet') +const bookApiModule = namespace('book-api') @Component export default class AppHeader extends Vue { @@ -164,7 +165,13 @@ export default class AppHeader extends Vue { @walletModule.Action('disconnectWallet') disconnectWallet!: () => void @walletModule.Action('openConnectWalletModal') openConnectWalletModal!: (params: { language: string, fullPath?: string }) => Promise @walletModule.Action('initWallet') initWallet!: (params: { method: any, accounts: any, offlineSigner?: any }) => Promise + @walletModule.Action('signMessageMemo') signMessageMemo!: (action: string, permissions?: string[]) => Promise @walletModule.Getter('getWalletAddress') currentAddress!: string + @walletModule.Getter('getSigner') signer!: any + @bookApiModule.Action('authenticate') authenticate!: ({inputWallet = '', signature = {}}: {inputWallet?: string, signature?: any}) => Promise + @bookApiModule.Action('clearSession') clearSession!: () => void + + isLoading = false // eslint-disable-next-line class-methods-use-this get isTestnet() { @@ -184,11 +191,13 @@ export default class AppHeader extends Vue { } async handleConnectWalletButtonClick() { + this.isLoading = true const connection = await this.openConnectWalletModal({ language: this.$i18n.locale.split('-')[0], fullPath: this.$route.fullPath, }) - if (connection) { + try { + if (connection) { const { method, accounts } = connection logTrackerEvent( this, @@ -201,9 +210,24 @@ export default class AppHeader extends Vue { wallet: accounts[0].address, method, }) - return this.initWallet(connection) + await this.initWallet(connection) + if (!this.currentAddress || !this.signer) return + const signature = await this.signMessageMemo('authorize', [ + 'read:nftbook', + 'write:nftbook', + 'read:nftcollection', + 'write:nftcollection', + ]) + if (!signature) { return } + await this.authenticate({inputWallet:this.currentAddress, signature}) + } + } catch (error) { + this.disconnectWallet() + this.clearSession() + // eslint-disable-next-line no-console + console.error('handleConnectWalletButtonClick error', error) } - return false + this.isLoading = false } } diff --git a/layouts/wallet.vue b/layouts/wallet.vue index dffef6be..4cb42cf5 100644 --- a/layouts/wallet.vue +++ b/layouts/wallet.vue @@ -23,9 +23,14 @@ const bookApiModule = namespace('book-api') @Component export default class WalletLayout extends Vue { @walletModule.Getter('getWalletAddress') walletAddress!: string + @walletModule.Action('disconnectWallet') disconnectWallet!: () => void @walletModule.Action('openConnectWalletModal') openConnectWalletModal!: (params: { language: string, fullPath?: string }) => Promise @walletModule.Action('initWallet') initWallet!: (params: { method: any, accounts: any, offlineSigner?: any }) => Promise + @walletModule.Action('signMessageMemo') signMessageMemo!: (action: string, permissions?: string[]) => Promise + @walletModule.Getter('getSigner') signer!: any @bookApiModule.Action('restoreSession') restoreSession!: () => void + @bookApiModule.Action('authenticate') authenticate!: ({inputWallet = '', signature = {}}: {inputWallet?: string, signature?: any}) => Promise + @bookApiModule.Action('clearSession') clearSession!: () => void @walletModule.Action toggleAlert!: ( isShow: boolean, @@ -45,24 +50,44 @@ export default class WalletLayout extends Vue { fullPath: this.$route.fullPath, }) // Re-login - if (connection) { - const { method, accounts } = connection - logTrackerEvent( - this, - 'user', - `connected_wallet_${method}`, - 'connected_wallet', - 1, - ) - setLoggerUser(this, { - wallet: accounts[0].address, - method, - }) - return this.initWallet(connection) + try { + if (connection) { + const { method, accounts } = connection + logTrackerEvent( + this, + 'user', + `connected_wallet_${method}`, + 'connected_wallet', + 1, + ) + setLoggerUser(this, { + wallet: accounts[0].address, + method, + }) + await this.initWallet(connection) + if (!this.walletAddress || !this.signer) return + const signature = await this.signMessageMemo('authorize', [ + 'read:nftbook', + 'write:nftbook', + 'read:nftcollection', + 'write:nftcollection', + ]) + if (!signature) { + return + } + await this.authenticate({ + inputWallet: this.walletAddress, + signature, + }) + } + this.$router.go(-1) + } catch (error) { + this.disconnectWallet() + this.clearSession() + // eslint-disable-next-line no-console + console.error('handleConnectWalletButtonClick error', error) } - return this.$router.go(-1) } - return true } @Watch('walletAddress') diff --git a/pages/auth/redirect.vue b/pages/auth/redirect.vue index 81d32155..3092d7b1 100644 --- a/pages/auth/redirect.vue +++ b/pages/auth/redirect.vue @@ -13,11 +13,19 @@ import { namespace } from 'vuex-class' import logTrackerEvent, { setLoggerUser } from '~/utils/logger' const walletModule = namespace('wallet') +const bookApiModule = namespace('book-api') @Component export default class RedirectPage extends Vue { @walletModule.Action('initWallet') initWallet!: (params: { method: any; accounts: any; offlineSigner?: any }) => Promise + @walletModule.Action('disconnectWallet') disconnectWallet!: () => void @walletModule.Action('handleConnectorRedirect') handleConnectorRedirect!: (params: { method: string; params: any }) => Promise + @walletModule.Action('signMessageMemo') signMessageMemo!: (action: string, permissions?: string[]) => Promise + @walletModule.Getter('getSigner') signer!: any + @walletModule.Getter('getWalletAddress') currentAddress!: string + + @bookApiModule.Action('authenticate') authenticate!: ({inputWallet = '', signature = {}}: {inputWallet?: string, signature?: any}) => Promise + @bookApiModule.Action('clearSession') clearSession!: () => void async mounted() { const { error, method, code } = this.$route.query; @@ -41,6 +49,15 @@ export default class RedirectPage extends Vue { method: method as string, }) await this.initWallet(connection) + if (!this.currentAddress || !this.signer) return + const signature = await this.signMessageMemo('authorize', [ + 'read:nftbook', + 'write:nftbook', + 'read:nftcollection', + 'write:nftcollection', + ]) + if (!signature) { return } + await this.authenticate({inputWallet:this.currentAddress, signature}) } let postAuthRoute = '/'; if (window.sessionStorage) { @@ -58,6 +75,8 @@ export default class RedirectPage extends Vue { statusCode: 400, message: (err as Error).toString(), }); + this.disconnectWallet() + this.clearSession() } } else { if (window.sessionStorage) { From f53723f4a8de11abd16d733b0bb425cc3a5d230b Mon Sep 17 00:00:00 2001 From: AuroraHuang22 Date: Wed, 11 Sep 2024 13:31:48 +0800 Subject: [PATCH 5/7] =?UTF-8?q?=F0=9F=8E=A8=20Add=20'profile'=20permission?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/AppHeader.vue | 1 + layouts/wallet.vue | 1 + pages/auth/redirect.vue | 1 + 3 files changed, 3 insertions(+) diff --git a/components/AppHeader.vue b/components/AppHeader.vue index ab89d082..171f8e88 100644 --- a/components/AppHeader.vue +++ b/components/AppHeader.vue @@ -213,6 +213,7 @@ export default class AppHeader extends Vue { await this.initWallet(connection) if (!this.currentAddress || !this.signer) return const signature = await this.signMessageMemo('authorize', [ + 'profile', 'read:nftbook', 'write:nftbook', 'read:nftcollection', diff --git a/layouts/wallet.vue b/layouts/wallet.vue index 4cb42cf5..5a084002 100644 --- a/layouts/wallet.vue +++ b/layouts/wallet.vue @@ -67,6 +67,7 @@ export default class WalletLayout extends Vue { await this.initWallet(connection) if (!this.walletAddress || !this.signer) return const signature = await this.signMessageMemo('authorize', [ + 'profile', 'read:nftbook', 'write:nftbook', 'read:nftcollection', diff --git a/pages/auth/redirect.vue b/pages/auth/redirect.vue index 3092d7b1..850f684a 100644 --- a/pages/auth/redirect.vue +++ b/pages/auth/redirect.vue @@ -51,6 +51,7 @@ export default class RedirectPage extends Vue { await this.initWallet(connection) if (!this.currentAddress || !this.signer) return const signature = await this.signMessageMemo('authorize', [ + 'profile', 'read:nftbook', 'write:nftbook', 'read:nftcollection', From 922573ff82e656441eaa88ac726b523cbeaf9051 Mon Sep 17 00:00:00 2001 From: AuroraHuang22 Date: Wed, 11 Sep 2024 13:38:34 +0800 Subject: [PATCH 6/7] =?UTF-8?q?=F0=9F=9A=A8=20Remove=20default=20parameter?= =?UTF-8?q?=20values=20from=20action=20property?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/AppHeader.vue | 2 +- layouts/wallet.vue | 2 +- pages/auth/redirect.vue | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/components/AppHeader.vue b/components/AppHeader.vue index 171f8e88..4fb7d70d 100644 --- a/components/AppHeader.vue +++ b/components/AppHeader.vue @@ -168,7 +168,7 @@ export default class AppHeader extends Vue { @walletModule.Action('signMessageMemo') signMessageMemo!: (action: string, permissions?: string[]) => Promise @walletModule.Getter('getWalletAddress') currentAddress!: string @walletModule.Getter('getSigner') signer!: any - @bookApiModule.Action('authenticate') authenticate!: ({inputWallet = '', signature = {}}: {inputWallet?: string, signature?: any}) => Promise + @bookApiModule.Action('authenticate') authenticate!: ({ inputWallet, signature }: { inputWallet?: string, signature?: any }) => Promise @bookApiModule.Action('clearSession') clearSession!: () => void isLoading = false diff --git a/layouts/wallet.vue b/layouts/wallet.vue index 5a084002..54377b81 100644 --- a/layouts/wallet.vue +++ b/layouts/wallet.vue @@ -29,7 +29,7 @@ export default class WalletLayout extends Vue { @walletModule.Action('signMessageMemo') signMessageMemo!: (action: string, permissions?: string[]) => Promise @walletModule.Getter('getSigner') signer!: any @bookApiModule.Action('restoreSession') restoreSession!: () => void - @bookApiModule.Action('authenticate') authenticate!: ({inputWallet = '', signature = {}}: {inputWallet?: string, signature?: any}) => Promise + @bookApiModule.Action('authenticate') authenticate!: ({ inputWallet, signature }: { inputWallet?: string, signature?: any }) => Promise @bookApiModule.Action('clearSession') clearSession!: () => void @walletModule.Action toggleAlert!: ( diff --git a/pages/auth/redirect.vue b/pages/auth/redirect.vue index 850f684a..4fee2771 100644 --- a/pages/auth/redirect.vue +++ b/pages/auth/redirect.vue @@ -24,7 +24,7 @@ export default class RedirectPage extends Vue { @walletModule.Getter('getSigner') signer!: any @walletModule.Getter('getWalletAddress') currentAddress!: string - @bookApiModule.Action('authenticate') authenticate!: ({inputWallet = '', signature = {}}: {inputWallet?: string, signature?: any}) => Promise + @bookApiModule.Action('authenticate') authenticate!: ({ inputWallet, signature }: { inputWallet?: string, signature?: any }) => Promise @bookApiModule.Action('clearSession') clearSession!: () => void async mounted() { From 625e92cccf8d4971c498db01651fcd7f36d7a773 Mon Sep 17 00:00:00 2001 From: AuroraHuang22 Date: Wed, 11 Sep 2024 13:40:27 +0800 Subject: [PATCH 7/7] =?UTF-8?q?=F0=9F=8E=A8=20Clear=20book=20session=20on?= =?UTF-8?q?=20wallet=20disconnect?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- store/wallet.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/store/wallet.ts b/store/wallet.ts index 3d51da32..1f2d646c 100644 --- a/store/wallet.ts +++ b/store/wallet.ts @@ -276,6 +276,8 @@ export default class Wallet extends VuexModule { this.context.commit('setLikerInfo', null) this.context.commit('setType', '') this.context.commit('setSigner', null) + this.context.dispatch('book-api/clearSession', null, { root: true }) + } get getType() {