add mint
This commit is contained in:
@ -14,12 +14,10 @@ import { CashuMint, CashuWallet as TheCashuWallet, getEncodedToken, Proof } from
|
||||
|
||||
export class CashuWallet implements LNWallet {
|
||||
#mint: string;
|
||||
#walletPath: string;
|
||||
#wallet?: TheCashuWallet;
|
||||
|
||||
constructor(mint: string, path: string) {
|
||||
constructor(mint: string) {
|
||||
this.#mint = mint;
|
||||
this.#walletPath = path;
|
||||
}
|
||||
|
||||
isReady(): boolean {
|
||||
@ -30,14 +28,15 @@ export class CashuWallet implements LNWallet {
|
||||
if (!this.#wallet) {
|
||||
throw new WalletError(WalletErrorCode.GeneralError, "Wallet not initialized");
|
||||
}
|
||||
const keysets = await this.#wallet.mint.getKeySets();
|
||||
return {
|
||||
nodePubKey: "asd",
|
||||
alias: "asd",
|
||||
nodePubKey: "asdd",
|
||||
alias: "Cashu mint: " + this.#mint,
|
||||
} as WalletInfo;
|
||||
}
|
||||
|
||||
async login(_?: string | undefined): Promise<boolean> {
|
||||
const m = new CashuMint(this.#mint, this.#walletPath);
|
||||
const m = new CashuMint(this.#mint);
|
||||
const keys = await m.getKeys();
|
||||
this.#wallet = new TheCashuWallet(keys, m);
|
||||
return true;
|
||||
@ -58,7 +57,7 @@ export class CashuWallet implements LNWallet {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
getInvoices(): Promise<WalletInvoice[]> {
|
||||
throw new Error("Method not implemented.");
|
||||
return Promise.resolve([]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4,6 +4,7 @@ import { decodeInvoice, unwrap } from "Util";
|
||||
import { LNCWallet } from "./LNCWallet";
|
||||
import LNDHubWallet from "./LNDHub";
|
||||
import { NostrConnectWallet } from "./NostrWalletConnect";
|
||||
import { CashuWallet } from "./Cashu";
|
||||
import { setupWebLNWalletConfig, WebLNWallet } from "./WebLN";
|
||||
|
||||
export enum WalletKind {
|
||||
@ -11,6 +12,7 @@ export enum WalletKind {
|
||||
LNC = 2,
|
||||
WebLN = 3,
|
||||
NWC = 4,
|
||||
Cashu = 5,
|
||||
}
|
||||
|
||||
export enum WalletErrorCode {
|
||||
@ -251,6 +253,9 @@ export class WalletStore {
|
||||
case WalletKind.NWC: {
|
||||
return new NostrConnectWallet(unwrap(cfg.data));
|
||||
}
|
||||
case WalletKind.Cashu: {
|
||||
return new CashuWallet(unwrap(cfg.data));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user