@getalby/lightning-tools 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +261 -0
  3. package/dist/index.browser.js +1833 -0
  4. package/dist/index.cjs +2 -0
  5. package/dist/index.cjs.map +1 -0
  6. package/dist/index.d.ts +11 -0
  7. package/dist/index.d.ts.map +1 -0
  8. package/dist/index.modern.js +2 -0
  9. package/dist/index.modern.js.map +1 -0
  10. package/dist/index.module.js +2 -0
  11. package/dist/index.module.js.map +1 -0
  12. package/dist/index.umd.js +2 -0
  13. package/dist/index.umd.js.map +1 -0
  14. package/dist/invoice.d.ts +12 -0
  15. package/dist/invoice.d.ts.map +1 -0
  16. package/dist/l402/index.d.ts +4 -0
  17. package/dist/l402/index.d.ts.map +1 -0
  18. package/dist/l402/parse.d.ts +4 -0
  19. package/dist/l402/parse.d.ts.map +1 -0
  20. package/dist/lightning-address.d.ts +39 -0
  21. package/dist/lightning-address.d.ts.map +1 -0
  22. package/dist/lightning-address.test.d.ts +2 -0
  23. package/dist/lightning-address.test.d.ts.map +1 -0
  24. package/dist/podcasting2/boostagrams.d.ts +26 -0
  25. package/dist/podcasting2/boostagrams.d.ts.map +1 -0
  26. package/dist/types.d.ts +92 -0
  27. package/dist/types.d.ts.map +1 -0
  28. package/dist/utils/fiat.d.ts +15 -0
  29. package/dist/utils/fiat.d.ts.map +1 -0
  30. package/dist/utils/invoice.d.ts +2 -0
  31. package/dist/utils/invoice.d.ts.map +1 -0
  32. package/dist/utils/keysend.d.ts +3 -0
  33. package/dist/utils/keysend.d.ts.map +1 -0
  34. package/dist/utils/lnurl.d.ts +9 -0
  35. package/dist/utils/lnurl.d.ts.map +1 -0
  36. package/dist/utils/lnurl.test.d.ts +2 -0
  37. package/dist/utils/lnurl.test.d.ts.map +1 -0
  38. package/dist/utils/nostr.d.ts +7 -0
  39. package/dist/utils/nostr.d.ts.map +1 -0
  40. package/dist/utils/storage.d.ts +13 -0
  41. package/dist/utils/storage.d.ts.map +1 -0
  42. package/dist/window.d.ts +2 -0
  43. package/dist/window.d.ts.map +1 -0
  44. package/dist/window.js +3 -0
  45. package/package.json +61 -0
@@ -0,0 +1,39 @@
1
+ import Invoice from './invoice';
2
+ import { LnUrlPayResponse, NostrResponse, RequestInvoiceArgs, ZapArgs, ZapOptions } from './types';
3
+ import type { Boost } from './podcasting2/boostagrams';
4
+ import { WebLNProvider, SendPaymentResponse } from "@webbtc/webln-types";
5
+ import { KeysendResponse } from './types';
6
+ export declare const DEFAULT_PROXY = "https://lnaddressproxy.getalby.com";
7
+ type LightningAddressOptions = {
8
+ proxy?: string | false;
9
+ webln?: WebLNProvider;
10
+ };
11
+ export default class LightningAddress {
12
+ address: string;
13
+ options: LightningAddressOptions;
14
+ username: string | undefined;
15
+ domain: string | undefined;
16
+ pubkey: string | undefined;
17
+ lnurlpData: LnUrlPayResponse | undefined;
18
+ keysendData: KeysendResponse | undefined;
19
+ nostrData: NostrResponse | undefined;
20
+ nostrPubkey: string | undefined;
21
+ nostrRelays: string[] | undefined;
22
+ webln: WebLNProvider | undefined;
23
+ constructor(address: string, options?: LightningAddressOptions);
24
+ parse(): void;
25
+ fetch(): Promise<void>;
26
+ fetchWithProxy(): Promise<void>;
27
+ fetchWithoutProxy(): Promise<void>;
28
+ lnurlpUrl(): string;
29
+ keysendUrl(): string;
30
+ nostrUrl(): string;
31
+ generateInvoice(params: Record<string, string>): Promise<Invoice>;
32
+ requestInvoice(args: RequestInvoiceArgs): Promise<Invoice>;
33
+ boost(boost: Boost, amount?: number): Promise<SendPaymentResponse>;
34
+ zapInvoice({ satoshi, comment, relays, e }: ZapArgs, options?: ZapOptions): Promise<Invoice>;
35
+ zap(args: ZapArgs, options?: ZapOptions): Promise<SendPaymentResponse>;
36
+ private parseResponse;
37
+ }
38
+ export {};
39
+ //# sourceMappingURL=lightning-address.d.ts.map
@@ -0,0 +1 @@
1
+ {"version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AE,MAAM,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC;IA0BjE,cAAc,CAAC,IAAI,EAAE,kBAAkB,GAAG,OAAO,CAAC,OAAO,CAAC;IAqB1D,KAAK,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,GAAE,MAAU;IAgBtC,UAAU,CAAC,EACf,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,EAC5B,EAAE,OAAO,EAAE,OAAO,GAAE,UAAe,GAAG,OAAO,CAAC,OAAO,CAAC;IA2BjD,GAAG,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,GAAE,UAAe,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAWhF,OAAO,CAAC,aAAa;CAWtB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=lightning-address.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lightning-address.test.d.ts","sourceRoot":"","sources":["../src/lightning-address.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,26 @@
1
+ type BoostOptions = {
2
+ webln?: unknown;
3
+ };
4
+ type BoostArguments = {
5
+ destination: string;
6
+ customKey?: string;
7
+ customValue?: string;
8
+ amount?: number;
9
+ boost: Boost;
10
+ };
11
+ export type Boost = {
12
+ action: string;
13
+ value_msat: number;
14
+ value_msat_total: number;
15
+ app_name: string;
16
+ app_version: string;
17
+ feedId: string;
18
+ podcast: string;
19
+ episode: string;
20
+ ts: number;
21
+ name: string;
22
+ sender_name: string;
23
+ };
24
+ export declare const boost: (args: BoostArguments, options?: BoostOptions) => Promise<import("@webbtc/webln-types").SendPaymentResponse>;
25
+ export default boost;
26
+ //# sourceMappingURL=boostagrams.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"boostagrams.d.ts","sourceRoot":"","sources":["../../src/podcasting2/boostagrams.ts"],"names":[],"mappings":"AAEA,KAAK,YAAY,GAAG;IAClB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,CAAA;AAED,KAAK,cAAc,GAAG;IACpB,WAAW,EAAE,MAAM,CAAA;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,KAAK,CAAC;CACd,CAAA;AAQD,MAAM,MAAM,KAAK,GAAG;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,gBAAgB,EAAE,MAAM,CAAC;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;CACrB,CAAA;AAED,eAAO,MAAM,KAAK,SAAgB,cAAc,YAAY,YAAY,+DAuBvE,CAAA;AAED,eAAe,KAAK,CAAC"}
@@ -0,0 +1,92 @@
1
+ export type KeysendResponse = {
2
+ customKey: string;
3
+ customValue: string;
4
+ destination: string;
5
+ };
6
+ export type LnUrlPayResponse = {
7
+ callback: string;
8
+ fixed: boolean;
9
+ min: number;
10
+ max: number;
11
+ domain?: string;
12
+ metadata: Array<Array<string>>;
13
+ metadataHash: string;
14
+ identifier: string;
15
+ description: string;
16
+ image: string;
17
+ commentAllowed?: number;
18
+ rawData: {
19
+ [key: string]: string | number;
20
+ };
21
+ allowsNostr: boolean;
22
+ payerData?: LUD18ServicePayerData;
23
+ };
24
+ export type LUD18ServicePayerData = Partial<{
25
+ name: {
26
+ mandatory: boolean;
27
+ };
28
+ pubkey: {
29
+ mandatory: boolean;
30
+ };
31
+ identifier: {
32
+ mandatory: boolean;
33
+ };
34
+ email: {
35
+ mandatory: boolean;
36
+ };
37
+ auth: {
38
+ mandatory: boolean;
39
+ k1: string;
40
+ };
41
+ }> & Record<string, unknown>;
42
+ export type LUD18PayerData = Partial<{
43
+ name?: string;
44
+ pubkey?: string;
45
+ identifier?: string;
46
+ email?: string;
47
+ auth?: {
48
+ key: string;
49
+ sig: string;
50
+ };
51
+ }> & Record<string, unknown>;
52
+ export type NostrResponse = {
53
+ names: Record<string, string>;
54
+ relays: Record<string, string[]>;
55
+ };
56
+ export type InvoiceArgs = {
57
+ pr: string;
58
+ verify?: string;
59
+ preimage?: string;
60
+ };
61
+ export type Event = {
62
+ id?: string;
63
+ kind: number;
64
+ pubkey?: string;
65
+ content: string;
66
+ tags: string[][];
67
+ created_at: number;
68
+ sig?: string;
69
+ };
70
+ export type ZapArgs = {
71
+ satoshi: number;
72
+ comment?: string;
73
+ relays: string[];
74
+ p?: string;
75
+ e?: string;
76
+ };
77
+ export type NostrProvider = {
78
+ getPublicKey(): Promise<string>;
79
+ signEvent(event: Event & {
80
+ pubkey: string;
81
+ id: string;
82
+ }): Promise<Event>;
83
+ };
84
+ export type ZapOptions = {
85
+ nostr?: NostrProvider;
86
+ };
87
+ export type RequestInvoiceArgs = {
88
+ satoshi: number;
89
+ comment?: string;
90
+ payerdata?: LUD18PayerData;
91
+ };
92
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,eAAe,GAAG;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;CACrB,CAAA;AAED,MAAM,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,OAAO,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;IA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AE,MAAM,EAAE,CAAC,CAAA;CACjC,CAAA;AAED,MAAM,MAAM,WAAW,GAAG;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAA;AAED,MAAM,MAAM,KAAK,GAAG;IAClB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,EAAE,EAAE,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,GAAG,CAAC,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,OAAO,GAAG;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,CAAC,CAAC,EAAE,MAAM,CAAC;CACZ,CAAA;AAED,MAAM,MAAM,aAAa,GAAG;IAC1B,YAAY,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IAChC,SAAS,CAAC,KAAK,EAAE,KAAK,GAAG;QACvB,MAAM,EAAE,MAAM,CAAC;QACf,EAAE,EAAE,MAAM,CAAC;KACd,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;CAClB,CAAA;AAED,MAAM,MAAM,UAAU,GAAG;IACvB,KAAK,CAAC,EAAE,aAAa,CAAC;CACvB,CAAA;AAED,MAAM,MAAM,kBAAkB,GAAG;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,cAAc,CAAC;CAC5B,CAAA"}
@@ -0,0 +1,15 @@
1
+ export declare const getFiatBtcRate: (currency: string) => Promise<number>;
2
+ export declare const getFiatValue: ({ satoshi, currency }: {
3
+ satoshi: number | string;
4
+ currency: string;
5
+ }) => Promise<number>;
6
+ export declare const getSatoshiValue: ({ amount, currency }: {
7
+ amount: number | string;
8
+ currency: string;
9
+ }) => Promise<number>;
10
+ export declare const getFormattedFiatValue: ({ satoshi, currency, locale }: {
11
+ satoshi: number | string;
12
+ currency: string;
13
+ locale: string;
14
+ }) => Promise<string>;
15
+ //# sourceMappingURL=fiat.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fiat.d.ts","sourceRoot":"","sources":["../../src/utils/fiat.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,cAAc,aAAoB,MAAM,KAAG,QAAQ,MAAM,CAMrE,CAAC;AAEF,eAAO,MAAM,YAAY;aAA4C,MAAM,GAAG,MAAM;cAAY,MAAM;qBAIrG,CAAC;AAEF,eAAO,MAAM,eAAe;YAA0C,MAAM,GAAG,MAAM;cAAY,MAAM;qBAItG,CAAA;AAED,eAAO,MAAM,qBAAqB;aAAoD,MAAM,GAAG,MAAM;cAAY,MAAM;YAAU,MAAM;qBAStI,CAAA"}
@@ -0,0 +1,2 @@
1
+ export declare const getHashFromInvoice: (invoice: any) => any;
2
+ //# sourceMappingURL=invoice.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"invoice.d.ts","sourceRoot":"","sources":["../../src/utils/invoice.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,kBAAkB,uBAgB9B,CAAA"}
@@ -0,0 +1,3 @@
1
+ import type { KeysendResponse } from '../types';
2
+ export declare const parseKeysendResponse: (data: Record<string, any>) => KeysendResponse;
3
+ //# sourceMappingURL=keysend.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keysend.d.ts","sourceRoot":"","sources":["../../src/utils/keysend.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAI/C,eAAO,MAAM,oBAAoB,SACzB,OAAO,MAAM,EAAE,GAAG,CAAC,KACxB,eAsBF,CAAA"}
@@ -0,0 +1,9 @@
1
+ import type { LnUrlPayResponse } from '../types';
2
+ export declare const isUrl: (url: string | null) => url is string;
3
+ export declare const isValidAmount: ({ amount, min, max, }: {
4
+ amount: number;
5
+ min: number;
6
+ max: number;
7
+ }) => boolean;
8
+ export declare const parseLnUrlPayResponse: (data: Record<string, any>) => LnUrlPayResponse;
9
+ //# sourceMappingURL=lnurl.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lnurl.d.ts","sourceRoot":"","sources":["../../src/utils/lnurl.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAyB,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAIvE,eAAO,MAAM,KAAK,QAAS,MAAM,GAAG,IAAI,kBAGvC,CAAA;AAED,eAAO,MAAM,aAAa;YAKhB,MAAM;SACT,MAAM;SACN,MAAM;MACT,OAIH,CAAA;AAKD,eAAO,MAAM,qBAAqB,SAC1B,OAAO,MAAM,EAAE,GAAG,CAAC,KACxB,gBA+DF,CAAA"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=lnurl.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lnurl.test.d.ts","sourceRoot":"","sources":["../../src/utils/lnurl.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,7 @@
1
+ import { Event, NostrResponse, ZapArgs, ZapOptions } from '../types';
2
+ export declare function generateZapEvent({ satoshi, comment, p, e, relays }: ZapArgs, options?: ZapOptions): Promise<Event>;
3
+ export declare function validateEvent(event: Event): boolean;
4
+ export declare function serializeEvent(evt: Event): string;
5
+ export declare function getEventHash(event: Event): string;
6
+ export declare function parseNostrResponse(nostrData: NostrResponse, username: string | undefined): readonly [NostrResponse, string | undefined, string[] | undefined];
7
+ //# sourceMappingURL=nostr.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nostr.d.ts","sourceRoot":"","sources":["../../src/utils/nostr.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAErE,wBAAsB,gBAAgB,CAAC,EACrC,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,MAAM,EAC/B,EAAE,OAAO,EAAE,OAAO,GAAE,UAAe,GAAG,OAAO,CAAC,KAAK,CAAC,CA6BpD;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAiBnD;AAED,wBAAgB,cAAc,CAAC,GAAG,EAAE,KAAK,GAAG,MAAM,CAYjD;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,CAEjD;AAED,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,GAAG,SAAS,sEASxF"}
@@ -0,0 +1,13 @@
1
+ export declare class MemoryStorage {
2
+ storage: any;
3
+ constructor(initial?: any);
4
+ getItem(key: any): any;
5
+ setItem(key: any, value: any): void;
6
+ }
7
+ export declare class NoStorage {
8
+ constructor(initial?: any);
9
+ getItem(key: any): null;
10
+ setItem(key: any, value: any): void;
11
+ }
12
+ export default MemoryStorage;
13
+ //# sourceMappingURL=storage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../src/utils/storage.ts"],"names":[],"mappings":"AAAA,qBAAa,aAAa;IACxB,OAAO,MAAC;gBAEI,OAAO,CAAC,EAAE,GAAG;IAIzB,OAAO,CAAC,GAAG,KAAA;IAIX,OAAO,CAAC,GAAG,KAAA,EAAE,KAAK,KAAA;CAGnB;AAED,qBAAa,SAAS;gBACR,OAAO,CAAC,EAAE,GAAG;IAGzB,OAAO,CAAC,GAAG,KAAA;IAIX,OAAO,CAAC,GAAG,KAAA,EAAE,KAAK,KAAA;CAEnB;AAED,eAAe,aAAa,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=window.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"window.d.ts","sourceRoot":"","sources":["../src/window.js"],"names":[],"mappings":""}
package/dist/window.js ADDED
@@ -0,0 +1,3 @@
1
+ // assign alby-tools exports to global window object (for index.browser.js)
2
+ // @ts-ignore
3
+ window["albyTools"] = require('./index.cjs');
package/package.json ADDED
@@ -0,0 +1,61 @@
1
+ {
2
+ "name": "@getalby/lightning-tools",
3
+ "version": "4.0.0",
4
+ "description": "Collection of helpful building blocks and tools to develop Bitcoin Lightning web apps",
5
+ "type": "module",
6
+ "source": "src/index.ts",
7
+ "main": "./dist/index.cjs",
8
+ "module": "./dist/index.module.js",
9
+ "unpkg": "./dist/index.umd.js",
10
+ "types": "./dist/index.d.ts",
11
+ "repository": "https://github.com/getAlby/js-lightning-tools.git",
12
+ "bugs": "https://github.com/getAlby/js-lightning-tools/issues",
13
+ "funding": {
14
+ "type": "lightning",
15
+ "url": "lightning:hello@getalby.com"
16
+ },
17
+ "files": [
18
+ "dist/**/*"
19
+ ],
20
+ "keywords": [
21
+ "lightning",
22
+ "bitcoin",
23
+ "alby"
24
+ ],
25
+ "exports": {
26
+ "require": "./dist/index.cjs",
27
+ "default": "./dist/index.modern.js",
28
+ "types": "./dist/index.d.ts"
29
+ },
30
+ "scripts": {
31
+ "prebuild": "yarn run clean",
32
+ "prepack": "yarn run build",
33
+ "build:browser": "cp src/window.js dist && browserify dist/window.js > dist/index.browser.js",
34
+ "test": "jest",
35
+ "clean": "rm -rf dist",
36
+ "build": "microbundle && yarn build:browser",
37
+ "dev": "microbundle watch"
38
+ },
39
+ "dependencies": {
40
+ "crypto-js": "^4.1.1",
41
+ "light-bolt11-decoder": "^3.0.0"
42
+ },
43
+ "devDependencies": {
44
+ "@types/crypto-js": "^4.1.1",
45
+ "@types/jest": "^29.4.0",
46
+ "@types/node": "^18.11.0",
47
+ "@webbtc/webln-types": "^1.0.11",
48
+ "browserify": "^17.0.0",
49
+ "jest": "^29.5.0",
50
+ "microbundle": "^0.15.1",
51
+ "nostr-tools": "^1.13.1",
52
+ "ts-jest": "^29.0.5",
53
+ "ts-node": "^10.9.1",
54
+ "typescript": "^5.1.6"
55
+ },
56
+ "engines": {
57
+ "node": ">=14"
58
+ },
59
+ "author": "Alby contributors",
60
+ "license": "MIT"
61
+ }