From 217f08395b6f305a9727dfbcf0dbe53ea74dc317 Mon Sep 17 00:00:00 2001 From: callebtc <93376500+callebtc@users.noreply.github.com> Date: Fri, 16 Aug 2024 02:25:26 +0200 Subject: [PATCH] fix init signer (#214) --- src/stores/nostr.ts | 5 ++++- src/stores/npubcash.ts | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/stores/nostr.ts b/src/stores/nostr.ts index 922d3e38..ef85a240 100644 --- a/src/stores/nostr.ts +++ b/src/stores/nostr.ts @@ -6,6 +6,7 @@ import { useWalletStore } from "./wallet"; import { generateSecretKey, getPublicKey } from 'nostr-tools' import { useLocalStorage } from "@vueuse/core"; import { useSettingsStore } from "./settings"; + type MintRecommendation = { url: string; count: number; @@ -33,6 +34,7 @@ export const useNostrStore = defineStore("nostr", { privateKeySigner: {} as NDKPrivateKeySigner, signer: {} as NDKSigner, mintRecommendations: useLocalStorage("cashu.ndk.mintRecommendations", []), + initialized: false, }), getters: { @@ -44,7 +46,7 @@ export const useNostrStore = defineStore("nostr", { this.connected = true; }, initSignerIfNotSet: async function () { - if (!this.signer) { + if (!this.initialized) { await this.initSigner(); } }, @@ -58,6 +60,7 @@ export const useNostrStore = defineStore("nostr", { } else { await this.initWalletSeedPrivateKeySigner(); } + this.initialized = true; }, setSigner: async function (signer: NDKSigner) { this.signer = signer diff --git a/src/stores/npubcash.ts b/src/stores/npubcash.ts index 526c131c..59d135cc 100644 --- a/src/stores/npubcash.ts +++ b/src/stores/npubcash.ts @@ -122,7 +122,8 @@ export const useNPCStore = defineStore("npc", { getInfo: async function (): Promise { const authHeader = await this.generateNip98Event( `${this.baseURL}/api/v1/info`, - "GET" + "GET", + "" ); try { const response = await fetch(`${this.baseURL}/api/v1/info`, {