chore: fixes
Some checks reported errors
continuous-integration/drone/push Build encountered an error

This commit is contained in:
kieran 2024-04-11 14:42:34 +01:00
parent 27a111466a
commit 93ea3e8e80
Signed by: Kieran
GPG Key ID: DE71CEB3925BE941
9 changed files with 23 additions and 15 deletions

View File

@ -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",

View File

@ -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";

View File

@ -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;

View File

@ -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 />,

View File

@ -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));
}

View File

@ -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 };

View File

@ -14,5 +14,5 @@
"skipLibCheck": true
},
"include": ["./src/**/*.ts"],
"exclude": ["**/*.test.ts"]
"exclude": ["**/*.test.ts", "./src/Cashu.ts"]
}

View File

@ -3236,6 +3236,7 @@ __metadata:
version: 0.0.0-use.local
resolution: "@snort/app@workspace:packages/app"
dependencies:
"@cashu/cashu-ts": "npm:^1.0.0-rc.3"
"@formatjs/cli": "npm:^6.1.3"
"@here/maps-api-for-javascript": "npm:^1.50.0"
"@noble/curves": "npm:^1.0.0"