@fedimint/core-web 0.0.6 → 0.0.7
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.
- package/README.md +6 -71
- package/dist/{FedimintWallet.d.ts → dts/FedimintWallet.d.ts} +2 -2
- package/dist/dts/FedimintWallet.d.ts.map +1 -0
- package/dist/dts/index.d.ts +3 -0
- package/dist/dts/index.d.ts.map +1 -0
- package/dist/{services → dts/services}/BalanceService.d.ts +5 -4
- package/dist/dts/services/BalanceService.d.ts.map +1 -0
- package/dist/{services → dts/services}/FederationService.d.ts +1 -1
- package/dist/dts/services/FederationService.d.ts.map +1 -0
- package/dist/dts/services/LightningService.d.ts +21 -0
- package/dist/dts/services/LightningService.d.ts.map +1 -0
- package/dist/{services → dts/services}/MintService.d.ts +6 -5
- package/dist/dts/services/MintService.d.ts.map +1 -0
- package/dist/{services → dts/services}/RecoveryService.d.ts +1 -1
- package/dist/dts/services/RecoveryService.d.ts.map +1 -0
- package/dist/dts/services/index.d.ts.map +1 -0
- package/dist/dts/types/index.d.ts +4 -0
- package/dist/dts/types/index.d.ts.map +1 -0
- package/dist/dts/types/utils.d.ts +16 -0
- package/dist/dts/types/utils.d.ts.map +1 -0
- package/dist/{types → dts/types}/wallet.d.ts +4 -14
- package/dist/dts/types/wallet.d.ts.map +1 -0
- package/dist/dts/types/worker.d.ts +4 -0
- package/dist/dts/types/worker.d.ts.map +1 -0
- package/dist/dts/utils/logger.d.ts.map +1 -0
- package/dist/{worker → dts/worker}/WorkerClient.d.ts +3 -3
- package/dist/dts/worker/WorkerClient.d.ts.map +1 -0
- package/dist/dts/worker/index.d.ts.map +1 -0
- package/dist/index.d.ts +298 -5
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +8 -5
- package/src/FedimintWallet.ts +10 -10
- package/src/index.ts +2 -22
- package/src/services/BalanceService.ts +5 -4
- package/src/services/FederationService.ts +1 -1
- package/src/services/LightningService.test.ts +83 -37
- package/src/services/LightningService.ts +68 -40
- package/src/services/MintService.test.ts +8 -1
- package/src/services/MintService.ts +6 -5
- package/src/services/RecoveryService.ts +1 -1
- package/src/test/crypto.ts +44 -0
- package/src/types/index.ts +3 -0
- package/src/types/utils.ts +25 -0
- package/src/types/wallet.ts +4 -23
- package/src/types/worker.ts +12 -0
- package/src/worker/WorkerClient.ts +25 -18
- package/src/worker/worker.test.ts +1 -1
- package/dist/FedimintWallet.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/services/BalanceService.d.ts.map +0 -1
- package/dist/services/FederationService.d.ts.map +0 -1
- package/dist/services/LightningService.d.ts +0 -18
- package/dist/services/LightningService.d.ts.map +0 -1
- package/dist/services/MintService.d.ts.map +0 -1
- package/dist/services/RecoveryService.d.ts.map +0 -1
- package/dist/services/index.d.ts.map +0 -1
- package/dist/types/wallet.d.ts.map +0 -1
- package/dist/utils/logger.d.ts.map +0 -1
- package/dist/worker/WorkerClient.d.ts.map +0 -1
- package/dist/worker/index.d.ts.map +0 -1
- /package/dist/{services → dts/services}/index.d.ts +0 -0
- /package/dist/{utils → dts/utils}/logger.d.ts +0 -0
- /package/dist/{worker → dts/worker}/index.d.ts +0 -0
package/README.md
CHANGED
|
@@ -1,80 +1,15 @@
|
|
|
1
1
|
# @fedimint/core-web
|
|
2
2
|
|
|
3
|
-
###
|
|
3
|
+
### This is early software. Use with caution. Report Bugs.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Check out the [Getting Started Guide](https://web.fedimint.org/core/getting-started.html) for more information.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
---
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
Also check out the examples for working code
|
|
10
10
|
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
- **Lightning Payments**: Ships with zero-setup Lightning Network payments.
|
|
14
|
-
- 🛠️ **State Management**: Handles the complex state management and storage challenges for browser wallets.
|
|
15
|
-
- 🤫 **Privacy Included**: Offers a privacy-centric wallet by default.
|
|
16
|
-
- ⚙️ **Framework Agnostic**: Designed as a "core" library compatible with vanilla JavaScript, laying the groundwork for future framework-specific packages.
|
|
17
|
-
|
|
18
|
-
## Installation
|
|
19
|
-
|
|
20
|
-
```bash
|
|
21
|
-
// npm or yarn or pnpm
|
|
22
|
-
pnpm add @fedimint/core-web
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
## Setup
|
|
26
|
-
|
|
27
|
-
This package relies on the wasm binary to be bundled with your application. You will likely need to update your bundler's or framework's configuration to load the wasm file. Setup guides for popular frameworks are coming soon.
|
|
28
|
-
|
|
29
|
-
See the `vite.config.ts` file in the [vite-core example](../../examples/vite-core/vite.config.ts) for an example of configuring wasm within a web-worker using Vite.
|
|
30
|
-
|
|
31
|
-
## Usage
|
|
32
|
-
|
|
33
|
-
```ts
|
|
34
|
-
import { FedimintWallet } from '@fedimint/core-web'
|
|
35
|
-
|
|
36
|
-
// Create the Wallet client
|
|
37
|
-
const wallet = new FedimintWallet()
|
|
38
|
-
|
|
39
|
-
// This should be called only once in the application
|
|
40
|
-
// lifecycle. It will automatically load your saved
|
|
41
|
-
// wallet state from previous sessions.
|
|
42
|
-
await wallet.open()
|
|
43
|
-
|
|
44
|
-
// Joining a Federation
|
|
45
|
-
|
|
46
|
-
// You can't join a federation
|
|
47
|
-
// if your wallet is already open
|
|
48
|
-
if (!wallet.isOpen()) {
|
|
49
|
-
// Check out [bitcoin mints](https://bitcoinmints.com/?tab=mints&showFedimint=true) for
|
|
50
|
-
// a list of federations with public invite codes.
|
|
51
|
-
const inviteCode = 'fed11qgqpw9thwvaz7t...'
|
|
52
|
-
|
|
53
|
-
await wallet.joinFederation(inviteCode)
|
|
54
|
-
// After you've joined a federation, your federation state
|
|
55
|
-
// will be stored in the browser. Future calls to `open()`
|
|
56
|
-
// will automatically load your saved federation.
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
// Get Wallet Balance (sync)
|
|
60
|
-
const balance = await wallet.balance.getBalance()
|
|
61
|
-
|
|
62
|
-
// Subscribe to Balance Updates
|
|
63
|
-
const unsubscribe = wallet.balance.subscribeBalance((balance: number) => {
|
|
64
|
-
console.log('updated balance', balance)
|
|
65
|
-
})
|
|
66
|
-
// Make sure to call `unsubscribe()` when you're done
|
|
67
|
-
|
|
68
|
-
// Receive Ecash Payments
|
|
69
|
-
await wallet.mint.reissueNotes('A11qgqpw9thwvaz7t...')
|
|
70
|
-
|
|
71
|
-
// Pay Lightning Invoice
|
|
72
|
-
await wallet.lightning.payInvoice('lnbc...')
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
### Check out the example
|
|
76
|
-
|
|
77
|
-
- Vite + React: [`examples/vite-core`](../../examples/vite-core/README.md) [(demo)](https://fedimint.github.io/fedimint-web-sdk/)
|
|
11
|
+
- [Vite + React](https://web.fedimint.org/examples/vite-react)
|
|
12
|
+
- [Bare JS](https://web.fedimint.org/examples/bare-js)
|
|
78
13
|
|
|
79
14
|
### Resources
|
|
80
15
|
|
|
@@ -41,8 +41,8 @@ export declare class FedimintWallet {
|
|
|
41
41
|
*/
|
|
42
42
|
constructor(lazy?: boolean);
|
|
43
43
|
initialize(): Promise<void>;
|
|
44
|
-
waitForOpen(): Promise<void
|
|
45
|
-
open(clientName?: string): Promise<
|
|
44
|
+
waitForOpen(): Promise<void>;
|
|
45
|
+
open(clientName?: string): Promise<boolean>;
|
|
46
46
|
joinFederation(inviteCode: string, clientName?: string): Promise<void>;
|
|
47
47
|
/**
|
|
48
48
|
* This should ONLY be called when UNLOADING the wallet client.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FedimintWallet.d.ts","sourceRoot":"","sources":["../../src/FedimintWallet.ts"],"names":[],"mappings":"AACA,OAAO,EACL,cAAc,EACd,WAAW,EACX,gBAAgB,EAChB,iBAAiB,EACjB,eAAe,EAChB,MAAM,YAAY,CAAA;AACnB,OAAO,EAAU,KAAK,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAItD,qBAAa,cAAc;IACzB,OAAO,CAAC,OAAO,CAAc;IAEtB,OAAO,EAAE,cAAc,CAAA;IACvB,IAAI,EAAE,WAAW,CAAA;IACjB,SAAS,EAAE,gBAAgB,CAAA;IAC3B,UAAU,EAAE,iBAAiB,CAAA;IAC7B,QAAQ,EAAE,eAAe,CAAA;IAEhC,OAAO,CAAC,YAAY,CAAuC;IAC3D,OAAO,CAAC,YAAY,CAAuB;IAC3C,OAAO,CAAC,OAAO,CAAiB;IAEhC;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4BG;gBACS,IAAI,GAAE,OAAe;IAkB3B,UAAU;IAMV,WAAW;IAKX,IAAI,CAAC,UAAU,GAAE,MAA4B;IAc7C,cAAc,CAClB,UAAU,EAAE,MAAM,EAClB,UAAU,GAAE,MAA4B;IAkB1C;;;OAGG;IACG,OAAO;IAMb,MAAM;IAIN;;;OAGG;IACH,WAAW,CAAC,KAAK,EAAE,QAAQ;CAI5B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AACjD,mBAAmB,SAAS,CAAA"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { MSats } from '../types';
|
|
1
2
|
import { WorkerClient } from '../worker';
|
|
2
3
|
/**
|
|
3
4
|
* Balance Service
|
|
@@ -8,16 +9,16 @@ export declare class BalanceService {
|
|
|
8
9
|
private client;
|
|
9
10
|
constructor(client: WorkerClient);
|
|
10
11
|
/**
|
|
11
|
-
* Get the balance of the current wallet
|
|
12
|
+
* Get the balance of the current wallet in milli-satoshis (MSats)
|
|
12
13
|
*
|
|
13
14
|
* @example
|
|
14
15
|
* ```ts
|
|
15
16
|
* const balance = await wallet.balance.getBalance()
|
|
16
17
|
* ```
|
|
17
18
|
*/
|
|
18
|
-
getBalance(): Promise<
|
|
19
|
+
getBalance(): Promise<MSats>;
|
|
19
20
|
/**
|
|
20
|
-
* Subscribe to the balance of the current wallet
|
|
21
|
+
* Subscribe to the balance of the current wallet in milli-satoshis (MSats)
|
|
21
22
|
*
|
|
22
23
|
* @example
|
|
23
24
|
* ```ts
|
|
@@ -29,6 +30,6 @@ export declare class BalanceService {
|
|
|
29
30
|
* unsubscribe()
|
|
30
31
|
* ```
|
|
31
32
|
*/
|
|
32
|
-
subscribeBalance(onSuccess?: (balance:
|
|
33
|
+
subscribeBalance(onSuccess?: (balance: MSats) => void, onError?: (error: string) => void): import("../types").CancelFunction;
|
|
33
34
|
}
|
|
34
35
|
//# sourceMappingURL=BalanceService.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BalanceService.d.ts","sourceRoot":"","sources":["../../../src/services/BalanceService.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,UAAU,CAAA;AACrC,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAExC;;;;GAIG;AACH,qBAAa,cAAc;IACb,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,YAAY;IAExC;;;;;;;OAOG;IACG,UAAU,IAAI,OAAO,CAAC,KAAK,CAAC;IAIlC;;;;;;;;;;;;OAYG;IACH,gBAAgB,CACd,SAAS,GAAE,CAAC,OAAO,EAAE,KAAK,KAAK,IAAe,EAC9C,OAAO,GAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAe;CAY9C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FederationService.d.ts","sourceRoot":"","sources":["../../../src/services/FederationService.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAExC,qBAAa,iBAAiB;IAChB,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,YAAY;IAElC,SAAS,IAAI,OAAO,CAAC,SAAS,CAAC;IAI/B,eAAe,IAAI,OAAO,CAAC,MAAM,CAAC;IAIlC,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAInD,cAAc,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC;CAG7C"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { WorkerClient } from '../worker';
|
|
2
|
+
import type { CreateBolt11Response, GatewayInfo, JSONObject, JSONValue, LightningGateway, LnPayState, LnReceiveState, MSats, OutgoingLightningPayment } from '../types';
|
|
3
|
+
export declare class LightningService {
|
|
4
|
+
private client;
|
|
5
|
+
constructor(client: WorkerClient);
|
|
6
|
+
createInvoice(amount: MSats, description: string, expiryTime?: number, // in seconds
|
|
7
|
+
extraMeta?: JSONObject, gatewayInfo?: GatewayInfo): Promise<CreateBolt11Response>;
|
|
8
|
+
createInvoiceTweaked(amount: MSats, description: string, tweakKey: string, index: number, expiryTime?: number, // in seconds
|
|
9
|
+
gatewayInfo?: GatewayInfo, extraMeta?: JSONObject): Promise<CreateBolt11Response>;
|
|
10
|
+
scanReceivesForTweaks(tweakKey: string, indices: number[], extraMeta?: JSONObject): Promise<string[]>;
|
|
11
|
+
private _getDefaultGatewayInfo;
|
|
12
|
+
payInvoice(invoice: string, gatewayInfo?: GatewayInfo, extraMeta?: JSONObject): Promise<OutgoingLightningPayment>;
|
|
13
|
+
subscribeLnClaim(operationId: string, onSuccess?: (state: LnReceiveState) => void, onError?: (error: string) => void): import("../types").CancelFunction;
|
|
14
|
+
subscribeLnPay(operationId: string, onSuccess?: (state: LnPayState) => void, onError?: (error: string) => void): import("../types").CancelFunction;
|
|
15
|
+
subscribeLnReceive(operationId: string, onSuccess?: (state: LnReceiveState) => void, onError?: (error: string) => void): import("../types").CancelFunction;
|
|
16
|
+
waitForReceive(operationId: string): Promise<LnReceiveState>;
|
|
17
|
+
getGateway(gatewayId?: string | null, forceInternal?: boolean): Promise<LightningGateway | null>;
|
|
18
|
+
listGateways(): Promise<LightningGateway[]>;
|
|
19
|
+
updateGatewayCache(): Promise<JSONValue>;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=LightningService.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LightningService.d.ts","sourceRoot":"","sources":["../../../src/services/LightningService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AACxC,OAAO,KAAK,EACV,oBAAoB,EACpB,WAAW,EACX,UAAU,EACV,SAAS,EACT,gBAAgB,EAChB,UAAU,EACV,cAAc,EACd,KAAK,EACL,wBAAwB,EACzB,MAAM,UAAU,CAAA;AAEjB,qBAAa,gBAAgB;IACf,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,YAAY;IAElC,aAAa,CACjB,MAAM,EAAE,KAAK,EACb,WAAW,EAAE,MAAM,EACnB,UAAU,CAAC,EAAE,MAAM,EAAE,aAAa;IAClC,SAAS,CAAC,EAAE,UAAU,EACtB,WAAW,CAAC,EAAE,WAAW,GACxB,OAAO,CAAC,oBAAoB,CAAC;IAW1B,oBAAoB,CACxB,MAAM,EAAE,KAAK,EACb,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,MAAM,EACb,UAAU,CAAC,EAAE,MAAM,EAAE,aAAa;IAClC,WAAW,CAAC,EAAE,WAAW,EACzB,SAAS,CAAC,EAAE,UAAU,GACrB,OAAO,CAAC,oBAAoB,CAAC;IAkB1B,qBAAqB,CACzB,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,EAAE,EACjB,SAAS,CAAC,EAAE,UAAU,GACrB,OAAO,CAAC,MAAM,EAAE,CAAC;YAQN,sBAAsB;IAM9B,UAAU,CACd,OAAO,EAAE,MAAM,EACf,WAAW,CAAC,EAAE,WAAW,EACzB,SAAS,CAAC,EAAE,UAAU,GACrB,OAAO,CAAC,wBAAwB,CAAC;IASpC,gBAAgB,CACd,WAAW,EAAE,MAAM,EACnB,SAAS,GAAE,CAAC,KAAK,EAAE,cAAc,KAAK,IAAe,EACrD,OAAO,GAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAe;IAa7C,cAAc,CACZ,WAAW,EAAE,MAAM,EACnB,SAAS,GAAE,CAAC,KAAK,EAAE,UAAU,KAAK,IAAe,EACjD,OAAO,GAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAe;IAa7C,kBAAkB,CAChB,WAAW,EAAE,MAAM,EACnB,SAAS,GAAE,CAAC,KAAK,EAAE,cAAc,KAAK,IAAe,EACrD,OAAO,GAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAe;IAavC,cAAc,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IAgB5D,UAAU,CACd,SAAS,GAAE,MAAM,GAAG,IAAW,EAC/B,aAAa,GAAE,OAAe,GAC7B,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC;IAO7B,YAAY,IAAI,OAAO,CAAC,gBAAgB,EAAE,CAAC;IAI3C,kBAAkB,IAAI,OAAO,CAAC,SAAS,CAAC;CAG/C"}
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { WorkerClient } from '../worker';
|
|
2
|
-
import { Duration, JSONObject, JSONValue, MintSpendNotesResponse } from '../types
|
|
2
|
+
import type { Duration, JSONObject, JSONValue, MintSpendNotesResponse, MSats } from '../types';
|
|
3
3
|
export declare class MintService {
|
|
4
4
|
private client;
|
|
5
5
|
constructor(client: WorkerClient);
|
|
6
6
|
redeemEcash(notes: string): Promise<void>;
|
|
7
7
|
reissueExternalNotes(oobNotes: string, extraMeta?: JSONObject): Promise<string>;
|
|
8
|
-
subscribeReissueExternalNotes(operationId: string, onSuccess?: (state: JSONValue) => void, onError?: (error: string) => void): import("../types
|
|
9
|
-
spendNotes(minAmount:
|
|
10
|
-
|
|
8
|
+
subscribeReissueExternalNotes(operationId: string, onSuccess?: (state: JSONValue) => void, onError?: (error: string) => void): import("../types").CancelFunction;
|
|
9
|
+
spendNotes(minAmount: MSats, tryCancelAfter?: number | Duration, // in seconds or Duration object
|
|
10
|
+
includeInvite?: boolean, extraMeta?: JSONValue): Promise<MintSpendNotesResponse>;
|
|
11
|
+
parseNotes(oobNotes: string): Promise<MSats>;
|
|
11
12
|
tryCancelSpendNotes(operationId: string): Promise<void>;
|
|
12
|
-
subscribeSpendNotes(operationId: string, onSuccess?: (state: JSONValue) => void, onError?: (error: string) => void): import("../types
|
|
13
|
+
subscribeSpendNotes(operationId: string, onSuccess?: (state: JSONValue) => void, onError?: (error: string) => void): import("../types").CancelFunction;
|
|
13
14
|
awaitSpendOobRefund(operationId: string): Promise<JSONValue>;
|
|
14
15
|
}
|
|
15
16
|
//# sourceMappingURL=MintService.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MintService.d.ts","sourceRoot":"","sources":["../../../src/services/MintService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AACxC,OAAO,KAAK,EACV,QAAQ,EACR,UAAU,EACV,SAAS,EACT,sBAAsB,EACtB,KAAK,EAEN,MAAM,UAAU,CAAA;AAEjB,qBAAa,WAAW;IACV,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,YAAY;IAElC,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAOzC,oBAAoB,CACxB,QAAQ,EAAE,MAAM,EAChB,SAAS,GAAE,UAAe,GACzB,OAAO,CAAC,MAAM,CAAC;IAOlB,6BAA6B,CAC3B,WAAW,EAAE,MAAM,EACnB,SAAS,GAAE,CAAC,KAAK,EAAE,SAAS,KAAK,IAAe,EAChD,OAAO,GAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAe;IAavC,UAAU,CACd,SAAS,EAAE,KAAK,EAKhB,cAAc,GAAE,MAAM,GAAG,QAAY,EAAE,gCAAgC;IACvE,aAAa,GAAE,OAAe,EAC9B,SAAS,GAAE,SAAc,GACxB,OAAO,CAAC,sBAAsB,CAAC;IAyB5B,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC;IAM5C,mBAAmB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAM7D,mBAAmB,CACjB,WAAW,EAAE,MAAM,EACnB,SAAS,GAAE,CAAC,KAAK,EAAE,SAAS,KAAK,IAAe,EAChD,OAAO,GAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAe;IAavC,mBAAmB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC;CAKnE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RecoveryService.d.ts","sourceRoot":"","sources":["../../../src/services/RecoveryService.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAExC,qBAAa,eAAe;IACd,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,YAAY;IAElC,oBAAoB,IAAI,OAAO,CAAC,OAAO,CAAC;IAIxC,oBAAoB,IAAI,OAAO,CAAC,IAAI,CAAC;IAI3C,2BAA2B,CACzB,SAAS,EAAE,CAAC,QAAQ,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,SAAS,CAAA;KAAE,KAAK,IAAI,EACzE,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,GAC/B,MAAM,IAAI;CAQd"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/services/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA;AACxB,cAAc,SAAS,CAAA;AACvB,cAAc,UAAU,CAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
type Alias<T> = T & {};
|
|
2
|
+
type Resolve<T> = T & unknown;
|
|
3
|
+
type Seconds = Alias<number>;
|
|
4
|
+
type Nanos = Alias<number>;
|
|
5
|
+
type Duration = {
|
|
6
|
+
nanos: Nanos;
|
|
7
|
+
secs: Seconds;
|
|
8
|
+
};
|
|
9
|
+
type MSats = Alias<number>;
|
|
10
|
+
type Sats = Alias<number>;
|
|
11
|
+
type JSONValue = string | number | boolean | null | {
|
|
12
|
+
[key: string]: JSONValue;
|
|
13
|
+
} | JSONValue[];
|
|
14
|
+
type JSONObject = Record<string, JSONValue>;
|
|
15
|
+
export { Alias, Resolve, Duration, MSats, Sats, JSONValue, JSONObject };
|
|
16
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/types/utils.ts"],"names":[],"mappings":"AAAA,KAAK,KAAK,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CAAA;AACtB,KAAK,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,OAAO,CAAA;AAE7B,KAAK,OAAO,GAAG,KAAK,CAAC,MAAM,CAAC,CAAA;AAC5B,KAAK,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,CAAA;AAE1B,KAAK,QAAQ,GAAG;IACd,KAAK,EAAE,KAAK,CAAA;IACZ,IAAI,EAAE,OAAO,CAAA;CACd,CAAA;AAED,KAAK,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,CAAA;AAC1B,KAAK,IAAI,GAAG,KAAK,CAAC,MAAM,CAAC,CAAA;AAEzB,KAAK,SAAS,GACV,MAAM,GACN,MAAM,GACN,OAAO,GACP,IAAI,GACJ;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,GAC5B,SAAS,EAAE,CAAA;AAEf,KAAK,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAA;AAE3C,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,UAAU,EAAE,CAAA"}
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
+
import { MSats, Duration, JSONValue } from './utils';
|
|
1
2
|
declare const MODULE_KINDS: readonly ["", "ln", "mint"];
|
|
2
3
|
type ModuleKind = (typeof MODULE_KINDS)[number];
|
|
3
|
-
type JSONValue = string | number | boolean | null | {
|
|
4
|
-
[key: string]: JSONValue;
|
|
5
|
-
} | JSONValue[];
|
|
6
|
-
type JSONObject = Record<string, JSONValue>;
|
|
7
4
|
type GatewayInfo = {
|
|
8
5
|
gateway_id: string;
|
|
9
6
|
api: string;
|
|
@@ -15,17 +12,14 @@ type GatewayInfo = {
|
|
|
15
12
|
type LightningGateway = {
|
|
16
13
|
info: GatewayInfo;
|
|
17
14
|
vetted: boolean;
|
|
18
|
-
ttl:
|
|
19
|
-
nanos: number;
|
|
20
|
-
secs: number;
|
|
21
|
-
};
|
|
15
|
+
ttl: Duration;
|
|
22
16
|
};
|
|
23
17
|
type RouteHint = {};
|
|
24
18
|
type FeeToAmount = {};
|
|
25
19
|
type OutgoingLightningPayment = {
|
|
26
20
|
payment_type: PayType;
|
|
27
21
|
contract_id: string;
|
|
28
|
-
fee:
|
|
22
|
+
fee: MSats;
|
|
29
23
|
};
|
|
30
24
|
type PayType = {
|
|
31
25
|
type: 'Internal' | 'Lightning';
|
|
@@ -88,13 +82,9 @@ type ReissueExternalNotesState = 'Created' | 'Issuing' | 'Done' | {
|
|
|
88
82
|
error: string;
|
|
89
83
|
};
|
|
90
84
|
};
|
|
91
|
-
type Duration = {
|
|
92
|
-
nanos: number;
|
|
93
|
-
secs: number;
|
|
94
|
-
};
|
|
95
85
|
type MintSpendNotesResponse = {
|
|
96
86
|
notes: string;
|
|
97
87
|
operation_id: string;
|
|
98
88
|
};
|
|
99
|
-
export {
|
|
89
|
+
export { LightningGateway, RouteHint, FeeToAmount, OutgoingLightningPayment, PayType, LnPayState, LnReceiveState, CreateBolt11Response, GatewayInfo, StreamError, StreamSuccess, StreamResult, ModuleKind, CancelFunction, ReissueExternalNotesState, MintSpendNotesResponse, };
|
|
100
90
|
//# sourceMappingURL=wallet.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wallet.d.ts","sourceRoot":"","sources":["../../../src/types/wallet.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAEpD,QAAA,MAAM,YAAY,6BAA8B,CAAA;AAChD,KAAK,UAAU,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,CAAC,CAAA;AAC/C,KAAK,WAAW,GAAG;IACjB,UAAU,EAAE,MAAM,CAAA;IAClB,GAAG,EAAE,MAAM,CAAA;IACX,YAAY,EAAE,MAAM,CAAA;IACpB,gBAAgB,EAAE,MAAM,CAAA;IACxB,WAAW,EAAE,SAAS,EAAE,CAAA;IACxB,IAAI,EAAE,WAAW,CAAA;CAClB,CAAA;AACD,KAAK,gBAAgB,GAAG;IACtB,IAAI,EAAE,WAAW,CAAA;IACjB,MAAM,EAAE,OAAO,CAAA;IACf,GAAG,EAAE,QAAQ,CAAA;CACd,CAAA;AAED,KAAK,SAAS,GAAG,EAEhB,CAAA;AAED,KAAK,WAAW,GAAG,EAElB,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E,KAAK,CAAA;IACZ,GAAG,EAAE,KAAK,CAAA;CACX,CAAA;AAED,KAAK,SAAS,GAAG;IACf,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,KAAK,CAAA;IACX,KAAK,EAAE,KAAK,CAAA;CACb,CAAA;AAED,KAAK,YAAY,CAAC,CAAC,SAAS,SAAS,IACjC,aAAa,CAAC,CAAC,CAAC,GAChB,WAAW,GACX,SAAS,CAAA;AAEb,KAAK,cAAc,GAAG,MAAM,IAAI,CAAA;AAEhC,KAAK,yBAAyB,GAC1B,SAAS,GACT,SAAS,GACT,MAAM,GACN;IAAE,MAAM,EAAE;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,CAAA;CAAE,CAAA;AAEjC,KAAK,sBAAsB,GAAG;IAC5B,KAAK,EAAE,MAAM,CAAA;IACb,YAAY,EAAE,MAAM,CAAA;CACrB,CAAA;AAED,OAAO,EACL,gBAAgB,EAChB,SAAS,EACT,WAAW,EACX,wBAAwB,EACxB,OAAO,EACP,UAAU,EACV,cAAc,EACd,oBAAoB,EACpB,WAAW,EACX,WAAW,EACX,aAAa,EACb,YAAY,EACZ,UAAU,EACV,cAAc,EACd,yBAAyB,EACzB,sBAAsB,GACvB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worker.d.ts","sourceRoot":"","sources":["../../../src/types/worker.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,kBAAkB,wFASd,CAAA;AAEV,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../../src/utils/logger.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,SAAS,qDAAsD,CAAA;AACrE,MAAM,MAAM,QAAQ,GAAG,CAAC,OAAO,SAAS,CAAC,CAAC,MAAM,CAAC,CAAA;AAEjD,qBAAa,MAAM;IACjB,OAAO,CAAC,KAAK,CAAU;gBAEX,KAAK,GAAE,QAAiB;IAIpC,QAAQ,CAAC,KAAK,EAAE,QAAQ;IAIxB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,QAAQ;IAOpC,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE;IASlD,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE;IAIrC,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE;IAIpC,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE;IAIpC,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE;IAIrC,OAAO,CAAC,SAAS;CAYlB;AAED,eAAO,MAAM,MAAM,QAAe,CAAA"}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { CancelFunction, JSONValue, ModuleKind, StreamError } from '../types
|
|
1
|
+
import type { CancelFunction, JSONValue, ModuleKind, StreamError, WorkerMessageType } from '../types';
|
|
2
2
|
export declare class WorkerClient {
|
|
3
3
|
private worker;
|
|
4
4
|
private requestCounter;
|
|
5
5
|
private requestCallbacks;
|
|
6
6
|
private initPromise;
|
|
7
7
|
constructor();
|
|
8
|
-
initialize(): Promise<
|
|
8
|
+
initialize(): Promise<boolean>;
|
|
9
9
|
private handleWorkerLogs;
|
|
10
10
|
private handleWorkerError;
|
|
11
11
|
private handleWorkerMessage;
|
|
12
|
-
sendSingleMessage(type:
|
|
12
|
+
sendSingleMessage<Response extends JSONValue = JSONValue, Payload extends JSONValue = JSONValue>(type: WorkerMessageType, payload?: Payload): Promise<Response>;
|
|
13
13
|
/**
|
|
14
14
|
* @summary Initiates an RPC stream with the specified module and method.
|
|
15
15
|
*
|
|
@@ -0,0 +1 @@
|
|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