Skip to content

Commit

Permalink
fix init signer (#214)
Browse files Browse the repository at this point in the history
  • Loading branch information
callebtc authored Aug 16, 2024
1 parent 6c8dfee commit 217f083
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/stores/nostr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -33,6 +34,7 @@ export const useNostrStore = defineStore("nostr", {
privateKeySigner: {} as NDKPrivateKeySigner,
signer: {} as NDKSigner,
mintRecommendations: useLocalStorage<MintRecommendation[]>("cashu.ndk.mintRecommendations", []),
initialized: false,
}),
getters: {

Expand All @@ -44,7 +46,7 @@ export const useNostrStore = defineStore("nostr", {
this.connected = true;
},
initSignerIfNotSet: async function () {
if (!this.signer) {
if (!this.initialized) {
await this.initSigner();
}
},
Expand All @@ -58,6 +60,7 @@ export const useNostrStore = defineStore("nostr", {
} else {
await this.initWalletSeedPrivateKeySigner();
}
this.initialized = true;
},
setSigner: async function (signer: NDKSigner) {
this.signer = signer
Expand Down
3 changes: 2 additions & 1 deletion src/stores/npubcash.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,8 @@ export const useNPCStore = defineStore("npc", {
getInfo: async function (): Promise<NPCInfo> {
const authHeader = await this.generateNip98Event(
`${this.baseURL}/api/v1/info`,
"GET"
"GET",
""
);
try {
const response = await fetch(`${this.baseURL}/api/v1/info`, {
Expand Down

0 comments on commit 217f083

Please sign in to comment.