chore: fixes
This commit is contained in:
parent
27a111466a
commit
93ea3e8e80
@ -2,6 +2,7 @@
|
||||
"name": "@snort/app",
|
||||
"version": "0.2.0",
|
||||
"dependencies": {
|
||||
"@cashu/cashu-ts": "^1.0.0-rc.3",
|
||||
"@here/maps-api-for-javascript": "^1.50.0",
|
||||
"@noble/curves": "^1.0.0",
|
||||
"@noble/hashes": "^1.3.3",
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { LNWallet } from "@snort/wallet";
|
||||
import React, { ReactNode } from "react";
|
||||
import { ReactNode } from "react";
|
||||
import { FormattedMessage } from "react-intl";
|
||||
|
||||
import Copy from "@/Components/Copy/Copy";
|
||||
|
@ -5,10 +5,10 @@ import { useNavigate } from "react-router-dom";
|
||||
import LndLogo from "@/assets/img/lnd-logo.png";
|
||||
import AlbyIcon from "@/Components/Icons/Alby";
|
||||
import BlueWallet from "@/Components/Icons/BlueWallet";
|
||||
import CashuIcon from "@/Components/Icons/Cashu";
|
||||
import Icon from "@/Components/Icons/Icon";
|
||||
import NostrIcon from "@/Components/Icons/Nostrich";
|
||||
import { getAlbyOAuth } from "@/Pages/settings/wallet/utils";
|
||||
import CashuIcon from "@/Components/Icons/Cashu";
|
||||
|
||||
const WalletRow = (props: {
|
||||
logo: ReactNode;
|
||||
|
@ -2,7 +2,7 @@ import { RouteObject } from "react-router-dom";
|
||||
|
||||
import WalletSettings from "../WalletSettings";
|
||||
import AlbyOAuth from "./Alby";
|
||||
import ConnectCashu from "./Cashu";
|
||||
//import ConnectCashu from "./Cashu";
|
||||
import ConnectLNC from "./LNC";
|
||||
import ConnectLNDHub from "./LNDHub";
|
||||
import ConnectNostrWallet from "./NWC";
|
||||
@ -24,10 +24,10 @@ export const WalletSettingsRoutes = [
|
||||
path: "/settings/wallet/nwc",
|
||||
element: <ConnectNostrWallet />,
|
||||
},
|
||||
{
|
||||
/*{
|
||||
path: "/settings/wallet/cashu",
|
||||
element: <ConnectCashu />,
|
||||
},
|
||||
},*/
|
||||
{
|
||||
path: "/settings/wallet/alby",
|
||||
element: <AlbyOAuth />,
|
||||
|
@ -51,8 +51,10 @@ export class WalletStore extends ExternalStore<WalletStoreSnapshot> {
|
||||
if (w) {
|
||||
if ("then" in w) {
|
||||
w.then(async wx => {
|
||||
this.#instance.set(activeConfig.id, wx);
|
||||
this.notifyChange();
|
||||
if (wx) {
|
||||
this.#instance.set(activeConfig.id, wx);
|
||||
this.notifyChange();
|
||||
}
|
||||
});
|
||||
return undefined;
|
||||
} else {
|
||||
@ -116,8 +118,8 @@ export class WalletStore extends ExternalStore<WalletStoreSnapshot> {
|
||||
} as WalletStoreSnapshot;
|
||||
}
|
||||
|
||||
#activateWallet(cfg: WalletConfig): LNWallet | Promise<LNWallet> | undefined {
|
||||
const w = loadWallet(cfg.kind, cfg.data);
|
||||
async #activateWallet(cfg: WalletConfig) {
|
||||
const w = await loadWallet(cfg.kind, cfg.data);
|
||||
if (w) {
|
||||
w.on("change", d => this.#onWalletChange(cfg, d));
|
||||
}
|
||||
|
@ -1,13 +1,13 @@
|
||||
import { decodeInvoice, unwrap } from "@snort/shared";
|
||||
import AlbyWallet from "./AlbyWallet";
|
||||
import { CashuWallet } from "./Cashu";
|
||||
//import { CashuWallet } from "./Cashu";
|
||||
import { LNCWallet } from "./LNCWallet";
|
||||
import LNDHubWallet from "./LNDHub";
|
||||
import { NostrConnectWallet } from "./NostrWalletConnect";
|
||||
import { WebLNWallet } from "./WebLN";
|
||||
import EventEmitter from "eventemitter3";
|
||||
|
||||
export enum WalletKind {
|
||||
export const enum WalletKind {
|
||||
LNDHub = 1,
|
||||
LNC = 2,
|
||||
WebLN = 3,
|
||||
@ -126,12 +126,15 @@ export type LNWallet = EventEmitter<WalletEvents> & {
|
||||
|
||||
/**
|
||||
* Load wallet by kind
|
||||
*
|
||||
* Some wallets are loaded using `async import` to avoid large dependency costs in bundle
|
||||
* @param kind The wallet kind to create
|
||||
* @param data Opaque data
|
||||
*/
|
||||
export function loadWallet(kind: WalletKind, data: string | undefined) {
|
||||
export async function loadWallet(kind: WalletKind, data: string | undefined) {
|
||||
switch (kind) {
|
||||
case WalletKind.LNC: {
|
||||
const { LNCWallet } = await import("./LNCWallet");
|
||||
return LNCWallet.Empty();
|
||||
}
|
||||
case WalletKind.WebLN: {
|
||||
@ -147,9 +150,10 @@ export function loadWallet(kind: WalletKind, data: string | undefined) {
|
||||
return new AlbyWallet(JSON.parse(unwrap(data)));
|
||||
}
|
||||
case WalletKind.Cashu: {
|
||||
return new CashuWallet(JSON.parse(unwrap(data)));
|
||||
//const { CashuWallet } = await import("./Cashu");
|
||||
//return new CashuWallet(JSON.parse(unwrap(data)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export { LNCWallet, WebLNWallet, LNDHubWallet, NostrConnectWallet, AlbyWallet, CashuWallet };
|
||||
export { LNCWallet, WebLNWallet, LNDHubWallet, NostrConnectWallet, AlbyWallet };
|
||||
|
@ -14,5 +14,5 @@
|
||||
"skipLibCheck": true
|
||||
},
|
||||
"include": ["./src/**/*.ts"],
|
||||
"exclude": ["**/*.test.ts"]
|
||||
"exclude": ["**/*.test.ts", "./src/Cashu.ts"]
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user