@fedimint/core-web 0.0.9 → 0.0.11
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/dist/dts/FedimintWallet.d.ts +50 -0
- package/dist/dts/FedimintWallet.d.ts.map +1 -1
- package/dist/dts/services/BalanceService.d.ts +4 -24
- package/dist/dts/services/BalanceService.d.ts.map +1 -1
- package/dist/dts/services/FederationService.d.ts +1 -1
- package/dist/dts/services/FederationService.d.ts.map +1 -1
- package/dist/dts/services/LightningService.d.ts +31 -5
- package/dist/dts/services/LightningService.d.ts.map +1 -1
- package/dist/dts/services/MintService.d.ts +13 -7
- package/dist/dts/services/MintService.d.ts.map +1 -1
- package/dist/dts/services/RecoveryService.d.ts +1 -1
- package/dist/dts/services/RecoveryService.d.ts.map +1 -1
- package/dist/dts/types/utils.d.ts +8 -1
- package/dist/dts/types/utils.d.ts.map +1 -1
- package/dist/dts/types/wallet.d.ts +4 -10
- package/dist/dts/types/wallet.d.ts.map +1 -1
- package/dist/dts/types/worker.d.ts +1 -1
- package/dist/dts/types/worker.d.ts.map +1 -1
- package/dist/dts/worker/WorkerClient.d.ts +1 -1
- package/dist/dts/worker/WorkerClient.d.ts.map +1 -1
- package/dist/index.d.ts +110 -46
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/worker.js +1 -1
- package/dist/worker.js.map +1 -1
- package/package.json +8 -8
- package/src/FedimintWallet.ts +58 -0
- package/src/services/BalanceService.ts +6 -28
- package/src/services/FederationService.ts +9 -7
- package/src/services/LightningService.ts +136 -48
- package/src/services/MintService.ts +33 -26
- package/src/services/RecoveryService.ts +9 -7
- package/src/types/utils.ts +5 -1
- package/src/types/wallet.ts +12 -9
- package/src/types/worker.ts +2 -0
- package/src/worker/WorkerClient.ts +8 -9
- package/src/worker/worker.js +34 -0
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { BalanceService, MintService, LightningService, FederationService, RecoveryService } from './services';
|
|
2
2
|
import { type LogLevel } from './utils/logger';
|
|
3
|
+
import { JSONValue } from './types';
|
|
3
4
|
export declare class FedimintWallet {
|
|
4
5
|
private _client;
|
|
5
6
|
balance: BalanceService;
|
|
@@ -55,5 +56,54 @@ export declare class FedimintWallet {
|
|
|
55
56
|
* @param level The desired log level ('DEBUG', 'INFO', 'WARN', 'ERROR', 'NONE').
|
|
56
57
|
*/
|
|
57
58
|
setLogLevel(level: LogLevel): void;
|
|
59
|
+
/**
|
|
60
|
+
* Parses a federation invite code and retrieves its details.
|
|
61
|
+
*
|
|
62
|
+
* This method sends the provided invite code to the WorkerClient for parsing.
|
|
63
|
+
* The response includes the federation_id and url.
|
|
64
|
+
*
|
|
65
|
+
* @param {string} inviteCode - The invite code to be parsed.
|
|
66
|
+
* @returns {Promise<{ federation_id: string, url: string}>}
|
|
67
|
+
* A promise that resolves to an object containing:
|
|
68
|
+
* - `federation_id`: The id of the feder.
|
|
69
|
+
* - `url`: One of the apipoints to connect to the federation
|
|
70
|
+
*
|
|
71
|
+
* @throws {Error} If the WorkerClient encounters an issue during the parsing process.
|
|
72
|
+
*
|
|
73
|
+
* @example
|
|
74
|
+
* const inviteCode = "example-invite-code";
|
|
75
|
+
* const parsedCode = await wallet.parseInviteCode(inviteCode);
|
|
76
|
+
* console.log(parsedCode.federation_id, parsedCode.url);
|
|
77
|
+
*/
|
|
78
|
+
parseInviteCode(inviteCode: string): Promise<{
|
|
79
|
+
type: string;
|
|
80
|
+
data: JSONValue;
|
|
81
|
+
requestId: number;
|
|
82
|
+
}>;
|
|
83
|
+
/**
|
|
84
|
+
* Parses a BOLT11 Lightning invoice and retrieves its details.
|
|
85
|
+
*
|
|
86
|
+
* This method sends the provided invoice string to the WorkerClient for parsing.
|
|
87
|
+
* The response includes details such as the amount, expiry, and memo.
|
|
88
|
+
*
|
|
89
|
+
* @param {string} invoiceStr - The BOLT11 invoice string to be parsed.
|
|
90
|
+
* @returns {Promise<{ amount: string, expiry: number, memo: string }>}
|
|
91
|
+
* A promise that resolves to an object containing:
|
|
92
|
+
* - `amount`: The amount specified in the invoice.
|
|
93
|
+
* - `expiry`: The expiry time of the invoice in seconds.
|
|
94
|
+
* - `memo`: A description or memo attached to the invoice.
|
|
95
|
+
*
|
|
96
|
+
* @throws {Error} If the WorkerClient encounters an issue during the parsing process.
|
|
97
|
+
*
|
|
98
|
+
* @example
|
|
99
|
+
* const invoiceStr = "lnbc1...";
|
|
100
|
+
* const parsedInvoice = await wallet.parseBolt11Invoice(invoiceStr);
|
|
101
|
+
* console.log(parsedInvoice.amount, parsedInvoice.expiry, parsedInvoice.memo);
|
|
102
|
+
*/
|
|
103
|
+
parseBolt11Invoice(invoiceStr: string): Promise<{
|
|
104
|
+
type: string;
|
|
105
|
+
data: JSONValue;
|
|
106
|
+
requestId: number;
|
|
107
|
+
}>;
|
|
58
108
|
}
|
|
59
109
|
//# sourceMappingURL=FedimintWallet.d.ts.map
|
|
@@ -1 +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;
|
|
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;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAInC,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;IAwB1C;;;OAGG;IACG,OAAO;IAMb,MAAM;IAIN;;;OAGG;IACH,WAAW,CAAC,KAAK,EAAE,QAAQ;IAK3B;;;;;;;;;;;;;;;;;;OAkBG;IACG,eAAe,CAAC,UAAU,EAAE,MAAM;cAE9B,MAAM;cACN,SAAS;mBACJ,MAAM;;IAKrB;;;;;;;;;;;;;;;;;;;OAmBG;IACG,kBAAkB,CAAC,UAAU,EAAE,MAAM;cAEjC,MAAM;cACN,SAAS;mBACJ,MAAM;;CAItB"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { MSats } from '../types';
|
|
2
1
|
import { WorkerClient } from '../worker';
|
|
3
2
|
/**
|
|
4
3
|
* Balance Service
|
|
@@ -8,28 +7,9 @@ import { WorkerClient } from '../worker';
|
|
|
8
7
|
export declare class BalanceService {
|
|
9
8
|
private client;
|
|
10
9
|
constructor(client: WorkerClient);
|
|
11
|
-
/**
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
* ```ts
|
|
16
|
-
* const balance = await wallet.balance.getBalance()
|
|
17
|
-
* ```
|
|
18
|
-
*/
|
|
19
|
-
getBalance(): Promise<MSats>;
|
|
20
|
-
/**
|
|
21
|
-
* Subscribe to the balance of the current wallet in milli-satoshis (MSats)
|
|
22
|
-
*
|
|
23
|
-
* @example
|
|
24
|
-
* ```ts
|
|
25
|
-
* const unsubscribe = wallet.balance.subscribeBalance((balance) => {
|
|
26
|
-
* console.log(balance)
|
|
27
|
-
* })
|
|
28
|
-
*
|
|
29
|
-
* // ...Cleanup Later
|
|
30
|
-
* unsubscribe()
|
|
31
|
-
* ```
|
|
32
|
-
*/
|
|
33
|
-
subscribeBalance(onSuccess?: (balance: MSats) => void, onError?: (error: string) => void): import("../types").CancelFunction;
|
|
10
|
+
/** https://web.fedimint.org/core/FedimintWallet/BalanceService/getBalance */
|
|
11
|
+
getBalance(): Promise<number>;
|
|
12
|
+
/** https://web.fedimint.org/core/FedimintWallet/BalanceService/subscribeBalance */
|
|
13
|
+
subscribeBalance(onSuccess?: (balanceMsats: number) => void, onError?: (error: string) => void): import("..").CancelFunction;
|
|
34
14
|
}
|
|
35
15
|
//# sourceMappingURL=BalanceService.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BalanceService.d.ts","sourceRoot":"","sources":["../../../src/services/BalanceService.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"BalanceService.d.ts","sourceRoot":"","sources":["../../../src/services/BalanceService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAExC;;;;GAIG;AACH,qBAAa,cAAc;IACb,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,YAAY;IAExC,6EAA6E;IACvE,UAAU;IAIhB,mFAAmF;IACnF,gBAAgB,CACd,SAAS,GAAE,CAAC,YAAY,EAAE,MAAM,KAAK,IAAe,EACpD,OAAO,GAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAe;CAU9C"}
|
|
@@ -5,7 +5,7 @@ export declare class FederationService {
|
|
|
5
5
|
constructor(client: WorkerClient);
|
|
6
6
|
getConfig(): Promise<JSONValue>;
|
|
7
7
|
getFederationId(): Promise<string>;
|
|
8
|
-
getInviteCode(peer
|
|
8
|
+
getInviteCode(peer?: number): Promise<string | null>;
|
|
9
9
|
listOperations(): Promise<JSONValue[]>;
|
|
10
10
|
}
|
|
11
11
|
//# sourceMappingURL=FederationService.d.ts.map
|
|
@@ -1 +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
|
|
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;IAIT,eAAe;IAIf,aAAa,CAAC,IAAI,GAAE,MAAU;IAM9B,cAAc;CAGrB"}
|
|
@@ -1,21 +1,47 @@
|
|
|
1
1
|
import { WorkerClient } from '../worker';
|
|
2
|
-
import type { CreateBolt11Response, GatewayInfo, JSONObject,
|
|
2
|
+
import type { CreateBolt11Response, GatewayInfo, JSONObject, LightningGateway, LnPayState, LnReceiveState, OutgoingLightningPayment } from '../types';
|
|
3
3
|
export declare class LightningService {
|
|
4
4
|
private client;
|
|
5
5
|
constructor(client: WorkerClient);
|
|
6
|
-
createInvoice
|
|
6
|
+
/** https://web.fedimint.org/core/FedimintWallet/LightningService/createInvoice#lightning-createinvoice */
|
|
7
|
+
createInvoice(amountMsats: number, description: string, expiryTime?: number, // in seconds
|
|
7
8
|
gatewayInfo?: GatewayInfo, extraMeta?: JSONObject): Promise<CreateBolt11Response>;
|
|
8
|
-
createInvoiceTweaked(
|
|
9
|
+
createInvoiceTweaked(amountMsats: number, description: string, tweakKey: string, index: number, expiryTime?: number, // in seconds
|
|
9
10
|
gatewayInfo?: GatewayInfo, extraMeta?: JSONObject): Promise<CreateBolt11Response>;
|
|
10
11
|
scanReceivesForTweaks(tweakKey: string, indices: number[], extraMeta?: JSONObject): Promise<string[]>;
|
|
11
12
|
private _getDefaultGatewayInfo;
|
|
13
|
+
/** https://web.fedimint.org/core/FedimintWallet/LightningService/payInvoice#lightning-payinvoice-invoice-string */
|
|
12
14
|
payInvoice(invoice: string, gatewayInfo?: GatewayInfo, extraMeta?: JSONObject): Promise<OutgoingLightningPayment>;
|
|
15
|
+
/** https://web.fedimint.org/core/FedimintWallet/LightningService/payInvoice#lightning-payinvoicesync-invoice-string */
|
|
16
|
+
payInvoiceSync(invoice: string, timeoutMs?: number, gatewayInfo?: GatewayInfo, extraMeta?: JSONObject): Promise<{
|
|
17
|
+
success: false;
|
|
18
|
+
error?: string;
|
|
19
|
+
} | {
|
|
20
|
+
success: true;
|
|
21
|
+
data: {
|
|
22
|
+
feeMsats: number;
|
|
23
|
+
preimage: string;
|
|
24
|
+
};
|
|
25
|
+
}>;
|
|
13
26
|
subscribeLnClaim(operationId: string, onSuccess?: (state: LnReceiveState) => void, onError?: (error: string) => void): import("../types").CancelFunction;
|
|
27
|
+
/** https://web.fedimint.org/core/FedimintWallet/LightningService/payInvoice#lightning-payinvoice-invoice-string */
|
|
14
28
|
subscribeLnPay(operationId: string, onSuccess?: (state: LnPayState) => void, onError?: (error: string) => void): import("../types").CancelFunction;
|
|
29
|
+
/** https://web.fedimint.org/core/FedimintWallet/LightningService/payInvoice#lightning-payinvoice-invoice-string */
|
|
30
|
+
waitForPay(operationId: string): Promise<{
|
|
31
|
+
success: false;
|
|
32
|
+
error?: string;
|
|
33
|
+
} | {
|
|
34
|
+
success: true;
|
|
35
|
+
data: {
|
|
36
|
+
preimage: string;
|
|
37
|
+
};
|
|
38
|
+
}>;
|
|
39
|
+
/** https://web.fedimint.org/core/FedimintWallet/LightningService/createInvoice#lightning-createinvoice */
|
|
15
40
|
subscribeLnReceive(operationId: string, onSuccess?: (state: LnReceiveState) => void, onError?: (error: string) => void): import("../types").CancelFunction;
|
|
16
|
-
|
|
41
|
+
/** https://web.fedimint.org/core/FedimintWallet/LightningService/createInvoice#lightning-createinvoice */
|
|
42
|
+
waitForReceive(operationId: string, timeoutMs?: number): Promise<LnReceiveState>;
|
|
17
43
|
getGateway(gatewayId?: string | null, forceInternal?: boolean): Promise<LightningGateway | null>;
|
|
18
44
|
listGateways(): Promise<LightningGateway[]>;
|
|
19
|
-
updateGatewayCache(): Promise<JSONValue>;
|
|
45
|
+
updateGatewayCache(): Promise<import("../types").JSONValue>;
|
|
20
46
|
}
|
|
21
47
|
//# sourceMappingURL=LightningService.d.ts.map
|
|
@@ -1 +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,
|
|
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,gBAAgB,EAChB,UAAU,EACV,cAAc,EACd,wBAAwB,EACzB,MAAM,UAAU,CAAA;AAEjB,qBAAa,gBAAgB;IACf,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,YAAY;IAExC,0GAA0G;IACpG,aAAa,CACjB,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,EACnB,UAAU,CAAC,EAAE,MAAM,EAAE,aAAa;IAClC,WAAW,CAAC,EAAE,WAAW,EACzB,SAAS,CAAC,EAAE,UAAU;IAgBlB,oBAA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,IAAe,EACrD,OAAO,GAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAe;IAW7C,0GAA0G;IACpG,cAAc,CAAC,WAAW,EAAE,MAAM,EAAE,SAAS,GAAE,MAAc;IAyB7D,UAAU,CACd,SAAS,GAAE,MAAM,GAAG,IAAW,EAC/B,aAAa,GAAE,OAAe;IAY1B,YAAY;IAQZ,kBAAkB;CAGzB"}
|
|
@@ -1,16 +1,22 @@
|
|
|
1
1
|
import { WorkerClient } from '../worker';
|
|
2
|
-
import type { Duration, JSONObject, JSONValue,
|
|
2
|
+
import type { Duration, JSONObject, JSONValue, ReissueExternalNotesState, SpendNotesState } from '../types';
|
|
3
3
|
export declare class MintService {
|
|
4
4
|
private client;
|
|
5
5
|
constructor(client: WorkerClient);
|
|
6
|
-
redeemEcash
|
|
6
|
+
/** https://web.fedimint.org/core/FedimintWallet/MintService/redeemEcash */
|
|
7
|
+
redeemEcash(notes: string): Promise<string>;
|
|
7
8
|
reissueExternalNotes(oobNotes: string, extraMeta?: JSONObject): Promise<string>;
|
|
8
|
-
subscribeReissueExternalNotes(operationId: string, onSuccess?: (state:
|
|
9
|
-
spendNotes
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
subscribeReissueExternalNotes(operationId: string, onSuccess?: (state: ReissueExternalNotesState) => void, onError?: (error: string) => void): import("../types").CancelFunction;
|
|
10
|
+
/** https://web.fedimint.org/core/FedimintWallet/MintService/spendNotes */
|
|
11
|
+
spendNotes(amountMsats: number, tryCancelAfter?: number | Duration, // defaults to 1 day
|
|
12
|
+
includeInvite?: boolean, extraMeta?: JSONValue): Promise<{
|
|
13
|
+
notes: string;
|
|
14
|
+
operation_id: string;
|
|
15
|
+
}>;
|
|
16
|
+
/** https://web.fedimint.org/core/FedimintWallet/MintService/parseEcash */
|
|
17
|
+
parseNotes(oobNotes: string): Promise<number>;
|
|
12
18
|
tryCancelSpendNotes(operationId: string): Promise<void>;
|
|
13
|
-
subscribeSpendNotes(operationId: string, onSuccess?: (state:
|
|
19
|
+
subscribeSpendNotes(operationId: string, onSuccess?: (state: SpendNotesState) => void, onError?: (error: string) => void): import("../types").CancelFunction;
|
|
14
20
|
awaitSpendOobRefund(operationId: string): Promise<JSONValue>;
|
|
15
21
|
}
|
|
16
22
|
//# sourceMappingURL=MintService.d.ts.map
|
|
@@ -1 +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,
|
|
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,EAGT,yBAAyB,EACzB,eAAe,EAChB,MAAM,UAAU,CAAA;AAEjB,qBAAa,WAAW;IACV,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,YAAY;IAExC,2EAA2E;IACrE,WAAW,CAAC,KAAK,EAAE,MAAM;IAWzB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,GAAE,UAAe;IAWvE,6BAA6B,CAC3B,WAAW,EAAE,MAAM,EACnB,SAAS,GAAE,CAAC,KAAK,EAAE,yBAAyB,KAAK,IAAe,EAChE,OAAO,GAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAe;IAa7C,0EAA0E;IACpE,UAAU,CACd,WAAW,EAAE,MAAM,EAInB,cAAc,GAAE,MAAM,GAAG,QAAoB,EAAE,oBAAoB;IACnE,aAAa,GAAE,OAAe,EAC9B,SAAS,GAAE,SAAc;;;;IA0B3B,0EAA0E;IACpE,UAAU,CAAC,QAAQ,EAAE,MAAM;IAM3B,mBAAmB,CAAC,WAAW,EAAE,MAAM;IAM7C,mBAAmB,CACjB,WAAW,EAAE,MAAM,EACnB,SAAS,GAAE,CAAC,KAAK,EAAE,eAAe,KAAK,IAAe,EACtD,OAAO,GAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAe;IAWvC,mBAAmB,CAAC,WAAW,EAAE,MAAM;CAK9C"}
|
|
@@ -8,6 +8,6 @@ export declare class RecoveryService {
|
|
|
8
8
|
subscribeToRecoveryProgress(onSuccess: (progress: {
|
|
9
9
|
module_id: number;
|
|
10
10
|
progress: JSONValue;
|
|
11
|
-
}) => void, onError: (error: string) => void): ()
|
|
11
|
+
}) => void, onError: (error: string) => void): import("../types").CancelFunction;
|
|
12
12
|
}
|
|
13
13
|
//# sourceMappingURL=RecoveryService.d.ts.map
|
|
@@ -1 +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
|
|
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;IAQpB,oBAAoB;IAI1B,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;CAOnC"}
|
|
@@ -12,5 +12,12 @@ type JSONValue = string | number | boolean | null | {
|
|
|
12
12
|
[key: string]: JSONValue;
|
|
13
13
|
} | JSONValue[];
|
|
14
14
|
type JSONObject = Record<string, JSONValue>;
|
|
15
|
-
|
|
15
|
+
type Result<T, U = string> = {
|
|
16
|
+
success: true;
|
|
17
|
+
data?: T;
|
|
18
|
+
} | {
|
|
19
|
+
success: false;
|
|
20
|
+
error: U;
|
|
21
|
+
};
|
|
22
|
+
export { Alias, Resolve, Duration, MSats, Sats, JSONValue, JSONObject, Result };
|
|
16
23
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +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
|
+
{"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,KAAK,MAAM,CAAC,CAAC,EAAE,CAAC,GAAG,MAAM,IACrB;IAAE,OAAO,EAAE,IAAI,CAAC;IAAC,IAAI,CAAC,EAAE,CAAC,CAAA;CAAE,GAC3B;IAAE,OAAO,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,CAAC,CAAA;CAAE,CAAA;AAEhC,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,EAAE,CAAA"}
|
|
@@ -78,14 +78,8 @@ type StreamEnd = {
|
|
|
78
78
|
};
|
|
79
79
|
type StreamResult<T extends JSONValue> = StreamSuccess<T> | StreamError | StreamEnd;
|
|
80
80
|
type CancelFunction = () => void;
|
|
81
|
-
type ReissueExternalNotesState = 'Created' | 'Issuing' | 'Done'
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
};
|
|
86
|
-
type MintSpendNotesResponse = {
|
|
87
|
-
notes: string;
|
|
88
|
-
operation_id: string;
|
|
89
|
-
};
|
|
90
|
-
export { LightningGateway, RouteHint, FeeToAmount, OutgoingLightningPayment, PayType, LnPayState, LnReceiveState, CreateBolt11Response, GatewayInfo, StreamError, StreamSuccess, StreamResult, ModuleKind, CancelFunction, ReissueExternalNotesState, MintSpendNotesResponse, };
|
|
81
|
+
type ReissueExternalNotesState = 'Created' | 'Issuing' | 'Done';
|
|
82
|
+
type MintSpendNotesResponse = Array<string>;
|
|
83
|
+
type SpendNotesState = 'Created' | 'UserCanceledProcessing' | 'UserCanceledSuccess' | 'UserCanceledFailure' | 'Success' | 'Refunded';
|
|
84
|
+
export { LightningGateway, RouteHint, FeeToAmount, OutgoingLightningPayment, PayType, LnPayState, LnReceiveState, CreateBolt11Response, GatewayInfo, StreamError, StreamSuccess, StreamResult, ModuleKind, CancelFunction, ReissueExternalNotesState, MintSpendNotesResponse, SpendNotesState, };
|
|
91
85
|
//# sourceMappingURL=wallet.d.ts.map
|
|
@@ -1 +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,WAA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,KAAK,EAAE,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,GAAG,SAAS,GAAG,SAAS,GAAG,MAAM,CAAA;AAG/D,KAAK,sBAAsB,GAAG,KAAK,CAAC,MAAM,CAAC,CAAA;AAE3C,KAAK,eAAe,GAChB,SAAS,GACT,wBAAwB,GACxB,qBAAqB,GACrB,qBAAqB,GACrB,SAAS,GACT,UAAU,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,EACtB,eAAe,GAChB,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
declare const WorkerMessageTypes: readonly ["init", "initialized", "rpc", "log", "open", "join", "error", "unsubscribe", "cleanup"];
|
|
1
|
+
declare const WorkerMessageTypes: readonly ["init", "initialized", "rpc", "log", "open", "join", "error", "unsubscribe", "cleanup", "parseInviteCode", "parseBolt11Invoice"];
|
|
2
2
|
export type WorkerMessageType = (typeof WorkerMessageTypes)[number];
|
|
3
3
|
export {};
|
|
4
4
|
//# sourceMappingURL=worker.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"worker.d.ts","sourceRoot":"","sources":["../../../src/types/worker.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,kBAAkB,
|
|
1
|
+
{"version":3,"file":"worker.d.ts","sourceRoot":"","sources":["../../../src/types/worker.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,kBAAkB,4IAYd,CAAA;AAEV,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,CAAC,CAAA"}
|
|
@@ -36,7 +36,7 @@ export declare class WorkerClient {
|
|
|
36
36
|
*/
|
|
37
37
|
rpcStream<Response extends JSONValue = JSONValue, Body extends JSONValue = JSONValue>(module: ModuleKind, method: string, body: Body, onSuccess: (res: Response) => void, onError: (res: StreamError['error']) => void, onEnd?: () => void): CancelFunction;
|
|
38
38
|
private _rpcStreamInner;
|
|
39
|
-
rpcSingle<Response extends JSONValue = JSONValue>(module: ModuleKind, method: string, body: JSONValue): Promise<Response>;
|
|
39
|
+
rpcSingle<Response extends JSONValue = JSONValue, Error extends string = string>(module: ModuleKind, method: string, body: JSONValue): Promise<Response>;
|
|
40
40
|
cleanup(): Promise<void>;
|
|
41
41
|
_getRequestCounter(): number;
|
|
42
42
|
_getRequestCallbackMap(): Map<number, (value: any) => void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WorkerClient.d.ts","sourceRoot":"","sources":["../../../src/worker/WorkerClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,SAAS,EACT,UAAU,EACV,WAAW,EAEX,iBAAiB,EAClB,MAAM,UAAU,CAAA;AAKjB,qBAAa,YAAY;IACvB,OAAO,CAAC,MAAM,CAAQ;IACtB,OAAO,CAAC,cAAc,CAAI;IAC1B,OAAO,CAAC,gBAAgB,CAA0C;IAClE,OAAO,CAAC,WAAW,CAA0C;;IAc7D,UAAU;IAMV,OAAO,CAAC,gBAAgB;IAKxB,OAAO,CAAC,iBAAiB;IAIzB,OAAO,CAAC,mBAAmB;IAuB3B,iBAAiB,CACf,QAAQ,SAAS,SAAS,GAAG,SAAS,EACtC,OAAO,SAAS,SAAS,GAAG,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6B,GAAG,KAAK,IAAI;CA4NhE"}
|
package/dist/index.d.ts
CHANGED
|
@@ -12,6 +12,13 @@ type JSONValue = string | number | boolean | null | {
|
|
|
12
12
|
[key: string]: JSONValue;
|
|
13
13
|
} | JSONValue[];
|
|
14
14
|
type JSONObject = Record<string, JSONValue>;
|
|
15
|
+
type Result<T, U = string> = {
|
|
16
|
+
success: true;
|
|
17
|
+
data?: T;
|
|
18
|
+
} | {
|
|
19
|
+
success: false;
|
|
20
|
+
error: U;
|
|
21
|
+
};
|
|
15
22
|
//# sourceMappingURL=utils.d.ts.map
|
|
16
23
|
|
|
17
24
|
declare const MODULE_KINDS: readonly ["", "ln", "mint"];
|
|
@@ -93,18 +100,12 @@ type StreamEnd = {
|
|
|
93
100
|
};
|
|
94
101
|
type StreamResult<T extends JSONValue> = StreamSuccess<T> | StreamError | StreamEnd;
|
|
95
102
|
type CancelFunction = () => void;
|
|
96
|
-
type ReissueExternalNotesState = 'Created' | 'Issuing' | 'Done'
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
};
|
|
100
|
-
};
|
|
101
|
-
type MintSpendNotesResponse = {
|
|
102
|
-
notes: string;
|
|
103
|
-
operation_id: string;
|
|
104
|
-
};
|
|
103
|
+
type ReissueExternalNotesState = 'Created' | 'Issuing' | 'Done';
|
|
104
|
+
type MintSpendNotesResponse = Array<string>;
|
|
105
|
+
type SpendNotesState = 'Created' | 'UserCanceledProcessing' | 'UserCanceledSuccess' | 'UserCanceledFailure' | 'Success' | 'Refunded';
|
|
105
106
|
//# sourceMappingURL=wallet.d.ts.map
|
|
106
107
|
|
|
107
|
-
declare const WorkerMessageTypes: readonly ["init", "initialized", "rpc", "log", "open", "join", "error", "unsubscribe", "cleanup"];
|
|
108
|
+
declare const WorkerMessageTypes: readonly ["init", "initialized", "rpc", "log", "open", "join", "error", "unsubscribe", "cleanup", "parseInviteCode", "parseBolt11Invoice"];
|
|
108
109
|
type WorkerMessageType = (typeof WorkerMessageTypes)[number];
|
|
109
110
|
|
|
110
111
|
declare class WorkerClient {
|
|
@@ -144,7 +145,7 @@ declare class WorkerClient {
|
|
|
144
145
|
*/
|
|
145
146
|
rpcStream<Response extends JSONValue = JSONValue, Body extends JSONValue = JSONValue>(module: ModuleKind, method: string, body: Body, onSuccess: (res: Response) => void, onError: (res: StreamError['error']) => void, onEnd?: () => void): CancelFunction;
|
|
146
147
|
private _rpcStreamInner;
|
|
147
|
-
rpcSingle<Response extends JSONValue = JSONValue>(module: ModuleKind, method: string, body: JSONValue): Promise<Response>;
|
|
148
|
+
rpcSingle<Response extends JSONValue = JSONValue, Error extends string = string>(module: ModuleKind, method: string, body: JSONValue): Promise<Response>;
|
|
148
149
|
cleanup(): Promise<void>;
|
|
149
150
|
_getRequestCounter(): number;
|
|
150
151
|
_getRequestCallbackMap(): Map<number, (value: any) => void>;
|
|
@@ -153,14 +154,20 @@ declare class WorkerClient {
|
|
|
153
154
|
declare class MintService {
|
|
154
155
|
private client;
|
|
155
156
|
constructor(client: WorkerClient);
|
|
156
|
-
redeemEcash
|
|
157
|
+
/** https://web.fedimint.org/core/FedimintWallet/MintService/redeemEcash */
|
|
158
|
+
redeemEcash(notes: string): Promise<string>;
|
|
157
159
|
reissueExternalNotes(oobNotes: string, extraMeta?: JSONObject): Promise<string>;
|
|
158
|
-
subscribeReissueExternalNotes(operationId: string, onSuccess?: (state:
|
|
159
|
-
spendNotes
|
|
160
|
-
|
|
161
|
-
|
|
160
|
+
subscribeReissueExternalNotes(operationId: string, onSuccess?: (state: ReissueExternalNotesState) => void, onError?: (error: string) => void): CancelFunction;
|
|
161
|
+
/** https://web.fedimint.org/core/FedimintWallet/MintService/spendNotes */
|
|
162
|
+
spendNotes(amountMsats: number, tryCancelAfter?: number | Duration, // defaults to 1 day
|
|
163
|
+
includeInvite?: boolean, extraMeta?: JSONValue): Promise<{
|
|
164
|
+
notes: string;
|
|
165
|
+
operation_id: string;
|
|
166
|
+
}>;
|
|
167
|
+
/** https://web.fedimint.org/core/FedimintWallet/MintService/parseEcash */
|
|
168
|
+
parseNotes(oobNotes: string): Promise<number>;
|
|
162
169
|
tryCancelSpendNotes(operationId: string): Promise<void>;
|
|
163
|
-
subscribeSpendNotes(operationId: string, onSuccess?: (state:
|
|
170
|
+
subscribeSpendNotes(operationId: string, onSuccess?: (state: SpendNotesState) => void, onError?: (error: string) => void): CancelFunction;
|
|
164
171
|
awaitSpendOobRefund(operationId: string): Promise<JSONValue>;
|
|
165
172
|
}
|
|
166
173
|
|
|
@@ -172,45 +179,52 @@ declare class MintService {
|
|
|
172
179
|
declare class BalanceService {
|
|
173
180
|
private client;
|
|
174
181
|
constructor(client: WorkerClient);
|
|
175
|
-
/**
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
* ```ts
|
|
180
|
-
* const balance = await wallet.balance.getBalance()
|
|
181
|
-
* ```
|
|
182
|
-
*/
|
|
183
|
-
getBalance(): Promise<MSats>;
|
|
184
|
-
/**
|
|
185
|
-
* Subscribe to the balance of the current wallet in milli-satoshis (MSats)
|
|
186
|
-
*
|
|
187
|
-
* @example
|
|
188
|
-
* ```ts
|
|
189
|
-
* const unsubscribe = wallet.balance.subscribeBalance((balance) => {
|
|
190
|
-
* console.log(balance)
|
|
191
|
-
* })
|
|
192
|
-
*
|
|
193
|
-
* // ...Cleanup Later
|
|
194
|
-
* unsubscribe()
|
|
195
|
-
* ```
|
|
196
|
-
*/
|
|
197
|
-
subscribeBalance(onSuccess?: (balance: MSats) => void, onError?: (error: string) => void): CancelFunction;
|
|
182
|
+
/** https://web.fedimint.org/core/FedimintWallet/BalanceService/getBalance */
|
|
183
|
+
getBalance(): Promise<number>;
|
|
184
|
+
/** https://web.fedimint.org/core/FedimintWallet/BalanceService/subscribeBalance */
|
|
185
|
+
subscribeBalance(onSuccess?: (balanceMsats: number) => void, onError?: (error: string) => void): CancelFunction;
|
|
198
186
|
}
|
|
199
187
|
|
|
200
188
|
declare class LightningService {
|
|
201
189
|
private client;
|
|
202
190
|
constructor(client: WorkerClient);
|
|
203
|
-
createInvoice
|
|
191
|
+
/** https://web.fedimint.org/core/FedimintWallet/LightningService/createInvoice#lightning-createinvoice */
|
|
192
|
+
createInvoice(amountMsats: number, description: string, expiryTime?: number, // in seconds
|
|
204
193
|
gatewayInfo?: GatewayInfo, extraMeta?: JSONObject): Promise<CreateBolt11Response>;
|
|
205
|
-
createInvoiceTweaked(
|
|
194
|
+
createInvoiceTweaked(amountMsats: number, description: string, tweakKey: string, index: number, expiryTime?: number, // in seconds
|
|
206
195
|
gatewayInfo?: GatewayInfo, extraMeta?: JSONObject): Promise<CreateBolt11Response>;
|
|
207
196
|
scanReceivesForTweaks(tweakKey: string, indices: number[], extraMeta?: JSONObject): Promise<string[]>;
|
|
208
197
|
private _getDefaultGatewayInfo;
|
|
198
|
+
/** https://web.fedimint.org/core/FedimintWallet/LightningService/payInvoice#lightning-payinvoice-invoice-string */
|
|
209
199
|
payInvoice(invoice: string, gatewayInfo?: GatewayInfo, extraMeta?: JSONObject): Promise<OutgoingLightningPayment>;
|
|
200
|
+
/** https://web.fedimint.org/core/FedimintWallet/LightningService/payInvoice#lightning-payinvoicesync-invoice-string */
|
|
201
|
+
payInvoiceSync(invoice: string, timeoutMs?: number, gatewayInfo?: GatewayInfo, extraMeta?: JSONObject): Promise<{
|
|
202
|
+
success: false;
|
|
203
|
+
error?: string;
|
|
204
|
+
} | {
|
|
205
|
+
success: true;
|
|
206
|
+
data: {
|
|
207
|
+
feeMsats: number;
|
|
208
|
+
preimage: string;
|
|
209
|
+
};
|
|
210
|
+
}>;
|
|
210
211
|
subscribeLnClaim(operationId: string, onSuccess?: (state: LnReceiveState) => void, onError?: (error: string) => void): CancelFunction;
|
|
212
|
+
/** https://web.fedimint.org/core/FedimintWallet/LightningService/payInvoice#lightning-payinvoice-invoice-string */
|
|
211
213
|
subscribeLnPay(operationId: string, onSuccess?: (state: LnPayState) => void, onError?: (error: string) => void): CancelFunction;
|
|
214
|
+
/** https://web.fedimint.org/core/FedimintWallet/LightningService/payInvoice#lightning-payinvoice-invoice-string */
|
|
215
|
+
waitForPay(operationId: string): Promise<{
|
|
216
|
+
success: false;
|
|
217
|
+
error?: string;
|
|
218
|
+
} | {
|
|
219
|
+
success: true;
|
|
220
|
+
data: {
|
|
221
|
+
preimage: string;
|
|
222
|
+
};
|
|
223
|
+
}>;
|
|
224
|
+
/** https://web.fedimint.org/core/FedimintWallet/LightningService/createInvoice#lightning-createinvoice */
|
|
212
225
|
subscribeLnReceive(operationId: string, onSuccess?: (state: LnReceiveState) => void, onError?: (error: string) => void): CancelFunction;
|
|
213
|
-
|
|
226
|
+
/** https://web.fedimint.org/core/FedimintWallet/LightningService/createInvoice#lightning-createinvoice */
|
|
227
|
+
waitForReceive(operationId: string, timeoutMs?: number): Promise<LnReceiveState>;
|
|
214
228
|
getGateway(gatewayId?: string | null, forceInternal?: boolean): Promise<LightningGateway | null>;
|
|
215
229
|
listGateways(): Promise<LightningGateway[]>;
|
|
216
230
|
updateGatewayCache(): Promise<JSONValue>;
|
|
@@ -224,7 +238,7 @@ declare class RecoveryService {
|
|
|
224
238
|
subscribeToRecoveryProgress(onSuccess: (progress: {
|
|
225
239
|
module_id: number;
|
|
226
240
|
progress: JSONValue;
|
|
227
|
-
}) => void, onError: (error: string) => void):
|
|
241
|
+
}) => void, onError: (error: string) => void): CancelFunction;
|
|
228
242
|
}
|
|
229
243
|
|
|
230
244
|
declare class FederationService {
|
|
@@ -232,7 +246,7 @@ declare class FederationService {
|
|
|
232
246
|
constructor(client: WorkerClient);
|
|
233
247
|
getConfig(): Promise<JSONValue>;
|
|
234
248
|
getFederationId(): Promise<string>;
|
|
235
|
-
getInviteCode(peer
|
|
249
|
+
getInviteCode(peer?: number): Promise<string | null>;
|
|
236
250
|
listOperations(): Promise<JSONValue[]>;
|
|
237
251
|
}
|
|
238
252
|
|
|
@@ -294,6 +308,56 @@ declare class FedimintWallet {
|
|
|
294
308
|
* @param level The desired log level ('DEBUG', 'INFO', 'WARN', 'ERROR', 'NONE').
|
|
295
309
|
*/
|
|
296
310
|
setLogLevel(level: LogLevel): void;
|
|
311
|
+
/**
|
|
312
|
+
* Parses a federation invite code and retrieves its details.
|
|
313
|
+
*
|
|
314
|
+
* This method sends the provided invite code to the WorkerClient for parsing.
|
|
315
|
+
* The response includes the federation_id and url.
|
|
316
|
+
*
|
|
317
|
+
* @param {string} inviteCode - The invite code to be parsed.
|
|
318
|
+
* @returns {Promise<{ federation_id: string, url: string}>}
|
|
319
|
+
* A promise that resolves to an object containing:
|
|
320
|
+
* - `federation_id`: The id of the feder.
|
|
321
|
+
* - `url`: One of the apipoints to connect to the federation
|
|
322
|
+
*
|
|
323
|
+
* @throws {Error} If the WorkerClient encounters an issue during the parsing process.
|
|
324
|
+
*
|
|
325
|
+
* @example
|
|
326
|
+
* const inviteCode = "example-invite-code";
|
|
327
|
+
* const parsedCode = await wallet.parseInviteCode(inviteCode);
|
|
328
|
+
* console.log(parsedCode.federation_id, parsedCode.url);
|
|
329
|
+
*/
|
|
330
|
+
parseInviteCode(inviteCode: string): Promise<{
|
|
331
|
+
type: string;
|
|
332
|
+
data: JSONValue;
|
|
333
|
+
requestId: number;
|
|
334
|
+
}>;
|
|
335
|
+
/**
|
|
336
|
+
* Parses a BOLT11 Lightning invoice and retrieves its details.
|
|
337
|
+
*
|
|
338
|
+
* This method sends the provided invoice string to the WorkerClient for parsing.
|
|
339
|
+
* The response includes details such as the amount, expiry, and memo.
|
|
340
|
+
*
|
|
341
|
+
* @param {string} invoiceStr - The BOLT11 invoice string to be parsed.
|
|
342
|
+
* @returns {Promise<{ amount: string, expiry: number, memo: string }>}
|
|
343
|
+
* A promise that resolves to an object containing:
|
|
344
|
+
* - `amount`: The amount specified in the invoice.
|
|
345
|
+
* - `expiry`: The expiry time of the invoice in seconds.
|
|
346
|
+
* - `memo`: A description or memo attached to the invoice.
|
|
347
|
+
*
|
|
348
|
+
* @throws {Error} If the WorkerClient encounters an issue during the parsing process.
|
|
349
|
+
*
|
|
350
|
+
* @example
|
|
351
|
+
* const invoiceStr = "lnbc1...";
|
|
352
|
+
* const parsedInvoice = await wallet.parseBolt11Invoice(invoiceStr);
|
|
353
|
+
* console.log(parsedInvoice.amount, parsedInvoice.expiry, parsedInvoice.memo);
|
|
354
|
+
*/
|
|
355
|
+
parseBolt11Invoice(invoiceStr: string): Promise<{
|
|
356
|
+
type: string;
|
|
357
|
+
data: JSONValue;
|
|
358
|
+
requestId: number;
|
|
359
|
+
}>;
|
|
297
360
|
}
|
|
298
361
|
|
|
299
|
-
export {
|
|
362
|
+
export { FedimintWallet };
|
|
363
|
+
export type { Alias, CancelFunction, CreateBolt11Response, Duration, FeeToAmount, GatewayInfo, JSONObject, JSONValue, LightningGateway, LnPayState, LnReceiveState, MSats, MintSpendNotesResponse, ModuleKind, OutgoingLightningPayment, PayType, ReissueExternalNotesState, Resolve, Result, RouteHint, Sats, SpendNotesState, StreamError, StreamResult, StreamSuccess, WorkerMessageType };
|