@fedimint/core-web 0.1.0 → 0.1.1
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/index.d.ts +1 -0
- package/index.js +15 -0
- package/package.json +12 -35
- package/README.md +0 -16
- package/dist/dts/FedimintWallet.d.ts +0 -51
- package/dist/dts/FedimintWallet.d.ts.map +0 -1
- package/dist/dts/WalletDirector.d.ts +0 -78
- package/dist/dts/WalletDirector.d.ts.map +0 -1
- package/dist/dts/index.d.ts +0 -4
- package/dist/dts/index.d.ts.map +0 -1
- package/dist/dts/services/BalanceService.d.ts +0 -15
- package/dist/dts/services/BalanceService.d.ts.map +0 -1
- package/dist/dts/services/FederationService.d.ts +0 -13
- package/dist/dts/services/FederationService.d.ts.map +0 -1
- package/dist/dts/services/LightningService.d.ts +0 -48
- package/dist/dts/services/LightningService.d.ts.map +0 -1
- package/dist/dts/services/MintService.d.ts +0 -23
- package/dist/dts/services/MintService.d.ts.map +0 -1
- package/dist/dts/services/RecoveryService.d.ts +0 -13
- package/dist/dts/services/RecoveryService.d.ts.map +0 -1
- package/dist/dts/services/WalletService.d.ts +0 -13
- package/dist/dts/services/WalletService.d.ts.map +0 -1
- package/dist/dts/services/index.d.ts +0 -7
- package/dist/dts/services/index.d.ts.map +0 -1
- package/dist/dts/transport/TransportClient.d.ts +0 -55
- package/dist/dts/transport/TransportClient.d.ts.map +0 -1
- package/dist/dts/transport/index.d.ts +0 -3
- package/dist/dts/transport/index.d.ts.map +0 -1
- package/dist/dts/transport/wasmTransport/WasmWorkerTransport.d.ts +0 -12
- package/dist/dts/transport/wasmTransport/WasmWorkerTransport.d.ts.map +0 -1
- package/dist/dts/types/index.d.ts +0 -4
- package/dist/dts/types/index.d.ts.map +0 -1
- package/dist/dts/types/transport.d.ts +0 -35
- package/dist/dts/types/transport.d.ts.map +0 -1
- package/dist/dts/types/utils.d.ts +0 -23
- package/dist/dts/types/utils.d.ts.map +0 -1
- package/dist/dts/types/wallet.d.ts +0 -241
- package/dist/dts/types/wallet.d.ts.map +0 -1
- package/dist/dts/utils/logger.d.ts +0 -24
- package/dist/dts/utils/logger.d.ts.map +0 -1
- package/dist/index.d.ts +0 -609
- package/dist/index.js +0 -2
- package/dist/index.js.map +0 -1
- package/dist/worker.js +0 -2
- package/dist/worker.js.map +0 -1
- package/src/FedimintWallet.test.ts +0 -73
- package/src/FedimintWallet.ts +0 -119
- package/src/WalletDirector.ts +0 -118
- package/src/index.ts +0 -3
- package/src/services/BalanceService.test.ts +0 -26
- package/src/services/BalanceService.ts +0 -29
- package/src/services/FederationService.test.ts +0 -58
- package/src/services/FederationService.ts +0 -216
- package/src/services/LightningService.test.ts +0 -265
- package/src/services/LightningService.ts +0 -289
- package/src/services/MintService.test.ts +0 -74
- package/src/services/MintService.ts +0 -129
- package/src/services/RecoveryService.ts +0 -28
- package/src/services/WalletService.test.ts +0 -59
- package/src/services/WalletService.ts +0 -50
- package/src/services/index.ts +0 -6
- package/src/test/TestFedimintWallet.ts +0 -31
- package/src/test/TestWalletDirector.ts +0 -14
- package/src/test/TestingService.ts +0 -79
- package/src/test/crypto.ts +0 -44
- package/src/test/fixtures.test.ts +0 -18
- package/src/test/fixtures.ts +0 -88
- package/src/transport/TransportClient.test.ts +0 -6
- package/src/transport/TransportClient.ts +0 -251
- package/src/transport/index.ts +0 -2
- package/src/transport/wasmTransport/WasmWorkerTransport.ts +0 -39
- package/src/transport/wasmTransport/worker.js +0 -167
- package/src/transport/wasmTransport/worker.test.ts +0 -90
- package/src/types/index.ts +0 -3
- package/src/types/transport.ts +0 -54
- package/src/types/utils.ts +0 -29
- package/src/types/wallet.ts +0 -298
- package/src/utils/logger.ts +0 -69
package/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@fedimint/core'
|
package/index.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
const warnedKey = '__FEDIMINT_CORE_WEB_SHIM__'
|
|
2
|
+
|
|
3
|
+
if (typeof globalThis !== 'undefined') {
|
|
4
|
+
const flagHost = globalThis
|
|
5
|
+
if (!flagHost[warnedKey]) {
|
|
6
|
+
flagHost[warnedKey] = true
|
|
7
|
+
if (typeof console !== 'undefined' && typeof console.warn === 'function') {
|
|
8
|
+
console.warn(
|
|
9
|
+
'[fedimint] `@fedimint/core-web` has been renamed to `@fedimint/core`. Please update your dependencies to use the new package.',
|
|
10
|
+
)
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export * from '@fedimint/core'
|
package/package.json
CHANGED
|
@@ -1,43 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fedimint/core-web",
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
"
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "Shim package that re-exports @fedimint/core. Use that instead.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./index.js",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"import": "./index.js",
|
|
10
|
+
"default": "./index.js"
|
|
11
|
+
}
|
|
9
12
|
},
|
|
10
13
|
"files": [
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
],
|
|
14
|
-
"sideEffects": [
|
|
15
|
-
"./dist/worker.js",
|
|
16
|
-
"./dist/index.js"
|
|
14
|
+
"index.d.ts",
|
|
15
|
+
"index.js"
|
|
17
16
|
],
|
|
18
|
-
"type": "module",
|
|
19
|
-
"main": "./dist/index.js",
|
|
20
|
-
"types": "./dist/index.d.ts",
|
|
21
17
|
"dependencies": {
|
|
22
|
-
"@fedimint/
|
|
23
|
-
},
|
|
24
|
-
"devDependencies": {
|
|
25
|
-
"@rollup/plugin-terser": "^0.4.4",
|
|
26
|
-
"@rollup/plugin-typescript": "^11.1.6",
|
|
27
|
-
"@types/node": "^20.17.49",
|
|
28
|
-
"@types/secp256k1": "^4.0.6",
|
|
29
|
-
"rollup": "^4.41.0",
|
|
30
|
-
"rollup-plugin-dts": "^6.2.1",
|
|
31
|
-
"rollup-plugin-typescript2": "^0.36.0",
|
|
32
|
-
"secp256k1": "^5.0.1",
|
|
33
|
-
"tslib": "^2.8.1",
|
|
34
|
-
"typescript": "^5.8.3"
|
|
35
|
-
},
|
|
36
|
-
"scripts": {
|
|
37
|
-
"build": "rollup --config",
|
|
38
|
-
"clean": "rm -rf dist tsconfig.tsbuildinfo",
|
|
39
|
-
"clean:deep": "pnpm run clean && rm -rf node_modules",
|
|
40
|
-
"typecheck": "tsc --noEmit",
|
|
41
|
-
"typedoc": "typedoc"
|
|
18
|
+
"@fedimint/core": "0.1.1"
|
|
42
19
|
}
|
|
43
20
|
}
|
package/README.md
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
# @fedimint/core-web
|
|
2
|
-
|
|
3
|
-
### This is early software. Use with caution. Report Bugs.
|
|
4
|
-
|
|
5
|
-
Check out the [Getting Started Guide](https://web.fedimint.org/core/getting-started.html) for more information.
|
|
6
|
-
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
Also check out the examples for working code
|
|
10
|
-
|
|
11
|
-
- [Vite + React](https://web.fedimint.org/examples/vite-react)
|
|
12
|
-
- [Bare JS](https://web.fedimint.org/examples/bare-js)
|
|
13
|
-
|
|
14
|
-
### Resources
|
|
15
|
-
|
|
16
|
-
- [Bitcoin Mints](https://bitcoinmints.com/?tab=mints&showFedimint=true) - list of public federations with invite codes
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { TransportClient } from './transport';
|
|
2
|
-
import { BalanceService, MintService, LightningService, FederationService, RecoveryService, WalletService } from './services';
|
|
3
|
-
export declare class FedimintWallet {
|
|
4
|
-
private _client;
|
|
5
|
-
balance: BalanceService;
|
|
6
|
-
mint: MintService;
|
|
7
|
-
lightning: LightningService;
|
|
8
|
-
federation: FederationService;
|
|
9
|
-
recovery: RecoveryService;
|
|
10
|
-
wallet: WalletService;
|
|
11
|
-
private _openPromise;
|
|
12
|
-
private _resolveOpen;
|
|
13
|
-
private _isOpen;
|
|
14
|
-
/**
|
|
15
|
-
* Creates a new instance of FedimintWallet.
|
|
16
|
-
*
|
|
17
|
-
* This constructor initializes a FedimintWallet instance, which manages communication
|
|
18
|
-
* with a Web Worker. The Web Worker is responsible for running WebAssembly code that
|
|
19
|
-
* handles the core Fedimint Client operations.
|
|
20
|
-
*
|
|
21
|
-
* (default) When not in lazy mode, the constructor immediately initializes the
|
|
22
|
-
* Web Worker and begins loading the WebAssembly module in the background. This
|
|
23
|
-
* allows for faster subsequent operations but may increase initial load time.
|
|
24
|
-
*
|
|
25
|
-
* In lazy mode, the Web Worker and WebAssembly initialization are deferred until
|
|
26
|
-
* the first operation that requires them, reducing initial overhead at the cost
|
|
27
|
-
* of a slight delay on the first operation.
|
|
28
|
-
*
|
|
29
|
-
* @example
|
|
30
|
-
* // Create a wallet with immediate initialization
|
|
31
|
-
* const wallet = new FedimintWallet();
|
|
32
|
-
* wallet.open();
|
|
33
|
-
*
|
|
34
|
-
* // Create a wallet with lazy initialization
|
|
35
|
-
* const lazyWallet = new FedimintWallet(true);
|
|
36
|
-
* // Some time later...
|
|
37
|
-
* lazyWallet.initialize();
|
|
38
|
-
* lazyWallet.open();
|
|
39
|
-
*/
|
|
40
|
-
constructor(_client: TransportClient);
|
|
41
|
-
waitForOpen(): Promise<void>;
|
|
42
|
-
open(clientName?: string): Promise<boolean>;
|
|
43
|
-
joinFederation(inviteCode: string, clientName?: string): Promise<boolean>;
|
|
44
|
-
/**
|
|
45
|
-
* This should ONLY be called when UNLOADING the wallet client.
|
|
46
|
-
* After this call, the FedimintWallet instance should be discarded.
|
|
47
|
-
*/
|
|
48
|
-
cleanup(): Promise<void>;
|
|
49
|
-
isOpen(): boolean;
|
|
50
|
-
}
|
|
51
|
-
//# sourceMappingURL=FedimintWallet.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FedimintWallet.d.ts","sourceRoot":"","sources":["../../src/FedimintWallet.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAC7C,OAAO,EACL,cAAc,EACd,WAAW,EACX,gBAAgB,EAChB,iBAAiB,EACjB,eAAe,EACf,aAAa,EACd,MAAM,YAAY,CAAA;AAInB,qBAAa,cAAc;IAsCb,OAAO,CAAC,OAAO;IArCpB,OAAO,EAAE,cAAc,CAAA;IACvB,IAAI,EAAE,WAAW,CAAA;IACjB,SAAS,EAAE,gBAAgB,CAAA;IAC3B,UAAU,EAAE,iBAAiB,CAAA;IAC7B,QAAQ,EAAE,eAAe,CAAA;IACzB,MAAM,EAAE,aAAa,CAAA;IAE5B,OAAO,CAAC,YAAY,CAAuC;IAC3D,OAAO,CAAC,YAAY,CAAuB;IAC3C,OAAO,CAAC,OAAO,CAAiB;IAEhC;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;gBACiB,OAAO,EAAE,eAAe;IAYtC,WAAW;IAKX,IAAI,CAAC,UAAU,GAAE,MAA4B;IAa7C,cAAc,CAClB,UAAU,EAAE,MAAM,EAClB,UAAU,GAAE,MAA4B;IAuB1C;;;OAGG;IACG,OAAO;IAMb,MAAM;CAGP"}
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import { TransportClient } from './transport';
|
|
2
|
-
import { type LogLevel } from './utils/logger';
|
|
3
|
-
import { FederationConfig, JSONValue, Transport } from './types';
|
|
4
|
-
import { FedimintWallet } from './FedimintWallet';
|
|
5
|
-
export declare class WalletDirector {
|
|
6
|
-
protected _client: TransportClient;
|
|
7
|
-
/**
|
|
8
|
-
* Creates a new instance of WalletDirector.
|
|
9
|
-
*
|
|
10
|
-
* @param {Transport} [transport] - Optional worker client instance. Provide your
|
|
11
|
-
* own to use a custom transport (e.g. React Native).
|
|
12
|
-
*
|
|
13
|
-
* @param {boolean} lazy - If true, delays Web Worker and WebAssembly initialization
|
|
14
|
-
* until needed. Default is false.
|
|
15
|
-
*/
|
|
16
|
-
constructor(transport?: Transport, lazy?: boolean);
|
|
17
|
-
initialize(): Promise<void>;
|
|
18
|
-
createWallet(): Promise<FedimintWallet>;
|
|
19
|
-
previewFederation(inviteCode: string): Promise<{
|
|
20
|
-
config: FederationConfig;
|
|
21
|
-
federation_id: string;
|
|
22
|
-
}>;
|
|
23
|
-
/**
|
|
24
|
-
* Sets the log level for the library.
|
|
25
|
-
* @param level The desired log level ('DEBUG', 'INFO', 'WARN', 'ERROR', 'NONE').
|
|
26
|
-
*/
|
|
27
|
-
setLogLevel(level: LogLevel): void;
|
|
28
|
-
/**
|
|
29
|
-
* Parses a federation invite code and retrieves its details.
|
|
30
|
-
*
|
|
31
|
-
* This method sends the provided invite code to the TransportClient for parsing.
|
|
32
|
-
* The response includes the federation_id and url.
|
|
33
|
-
*
|
|
34
|
-
* @param {string} inviteCode - The invite code to be parsed.
|
|
35
|
-
* @returns {Promise<{ federation_id: string, url: string}>}
|
|
36
|
-
* A promise that resolves to an object containing:
|
|
37
|
-
* - `federation_id`: The id of the feder.
|
|
38
|
-
* - `url`: One of the apipoints to connect to the federation
|
|
39
|
-
*
|
|
40
|
-
* @throws {Error} If the TransportClient encounters an issue during the parsing process.
|
|
41
|
-
*
|
|
42
|
-
* @example
|
|
43
|
-
* const inviteCode = "example-invite-code";
|
|
44
|
-
* const parsedCode = await wallet.parseInviteCode(inviteCode);
|
|
45
|
-
* console.log(parsedCode.federation_id, parsedCode.url);
|
|
46
|
-
*/
|
|
47
|
-
parseInviteCode(inviteCode: string): Promise<{
|
|
48
|
-
type: string;
|
|
49
|
-
data: JSONValue;
|
|
50
|
-
requestId: number;
|
|
51
|
-
}>;
|
|
52
|
-
/**
|
|
53
|
-
* Parses a BOLT11 Lightning invoice and retrieves its details.
|
|
54
|
-
*
|
|
55
|
-
* This method sends the provided invoice string to the TransportClient for parsing.
|
|
56
|
-
* The response includes details such as the amount, expiry, and memo.
|
|
57
|
-
*
|
|
58
|
-
* @param {string} invoiceStr - The BOLT11 invoice string to be parsed.
|
|
59
|
-
* @returns {Promise<{ amount: string, expiry: number, memo: string }>}
|
|
60
|
-
* A promise that resolves to an object containing:
|
|
61
|
-
* - `amount`: The amount specified in the invoice.
|
|
62
|
-
* - `expiry`: The expiry time of the invoice in seconds.
|
|
63
|
-
* - `memo`: A description or memo attached to the invoice.
|
|
64
|
-
*
|
|
65
|
-
* @throws {Error} If the TransportClient encounters an issue during the parsing process.
|
|
66
|
-
*
|
|
67
|
-
* @example
|
|
68
|
-
* const invoiceStr = "lnbc1...";
|
|
69
|
-
* const parsedInvoice = await wallet.parseBolt11Invoice(invoiceStr);
|
|
70
|
-
* console.log(parsedInvoice.amount, parsedInvoice.expiry, parsedInvoice.memo);
|
|
71
|
-
*/
|
|
72
|
-
parseBolt11Invoice(invoiceStr: string): Promise<{
|
|
73
|
-
type: string;
|
|
74
|
-
data: JSONValue;
|
|
75
|
-
requestId: number;
|
|
76
|
-
}>;
|
|
77
|
-
}
|
|
78
|
-
//# sourceMappingURL=WalletDirector.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"WalletDirector.d.ts","sourceRoot":"","sources":["../../src/WalletDirector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAuB,MAAM,aAAa,CAAA;AAClE,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAC9C,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAEjD,qBAAa,cAAc;IAEzB,SAAS,CAAC,OAAO,EAAE,eAAe,CAAA;IAElC;;;;;;;;OAQG;gBAED,SAAS,GAAE,SAAqC,EAChD,IAAI,GAAE,OAAe;IASjB,UAAU;IAOV,YAAY;IAKZ,iBAAiB,CAAC,UAAU,EAAE,MAAM;gBAG9B,gBAAgB;uBACT,MAAM;;IAKzB;;;OAGG;IACH,WAAW,CAAC,KAAK,EAAE,QAAQ;IAK3B;;;;;;;;;;;;;;;;;;OAkBG;IACG,eAAe,CAAC,UAAU,EAAE,MAAM;cAG9B,MAAM;cACN,SAAS;mBACJ,MAAM;;IAKrB;;;;;;;;;;;;;;;;;;;OAmBG;IACG,kBAAkB,CAAC,UAAU,EAAE,MAAM;cAGjC,MAAM;cACN,SAAS;mBACJ,MAAM;;CAItB"}
|
package/dist/dts/index.d.ts
DELETED
package/dist/dts/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AACjD,YAAY,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AACtD,mBAAmB,SAAS,CAAA"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { TransportClient } from '../transport';
|
|
2
|
-
/**
|
|
3
|
-
* Balance Service
|
|
4
|
-
*
|
|
5
|
-
* The Balance Service provides methods to interact with the balance of a Fedimint wallet.
|
|
6
|
-
*/
|
|
7
|
-
export declare class BalanceService {
|
|
8
|
-
private client;
|
|
9
|
-
constructor(client: TransportClient);
|
|
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;
|
|
14
|
-
}
|
|
15
|
-
//# sourceMappingURL=BalanceService.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"BalanceService.d.ts","sourceRoot":"","sources":["../../../src/services/BalanceService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAE9C;;;;GAIG;AACH,qBAAa,cAAc;IACb,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,eAAe;IAE3C,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"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { OperationKey, OperationLog, Transactions } from '../types';
|
|
2
|
-
import { TransportClient } from '../transport';
|
|
3
|
-
export declare class FederationService {
|
|
4
|
-
private client;
|
|
5
|
-
constructor(client: TransportClient);
|
|
6
|
-
getConfig(): Promise<import("../types").JSONValue>;
|
|
7
|
-
getFederationId(): Promise<string>;
|
|
8
|
-
getInviteCode(peer?: number): Promise<string | null>;
|
|
9
|
-
listOperations(limit?: number, last_seen?: OperationKey): Promise<[OperationKey, OperationLog][]>;
|
|
10
|
-
getOperation(operationId: string): Promise<OperationLog | null>;
|
|
11
|
-
listTransactions(limit?: number, last_seen?: OperationKey): Promise<Transactions[]>;
|
|
12
|
-
}
|
|
13
|
-
//# sourceMappingURL=FederationService.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FederationService.d.ts","sourceRoot":"","sources":["../../../src/services/FederationService.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAKV,YAAY,EACZ,YAAY,EACZ,YAAY,EAGb,MAAM,UAAU,CAAA;AACjB,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAE9C,qBAAa,iBAAiB;IAChB,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,eAAe;IAErC,SAAS;IAIT,eAAe;IAIf,aAAa,CAAC,IAAI,GAAE,MAAU;IAM9B,cAAc,CAClB,KAAK,CAAC,EAAE,MAAM,EACd,SAAS,CAAC,EAAE,YAAY,GACvB,OAAO,CAAC,CAAC,YAAY,EAAE,YAAY,CAAC,EAAE,CAAC;IAWpC,YAAY,CAAC,WAAW,EAAE,MAAM;IAQhC,gBAAgB,CACpB,KAAK,CAAC,EAAE,MAAM,EACd,SAAS,CAAC,EAAE,YAAY,GACvB,OAAO,CAAC,YAAY,EAAE,CAAC;CAgK3B"}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { TransportClient } from '../transport';
|
|
2
|
-
import type { CreateBolt11Response, GatewayInfo, JSONObject, LightningGateway, LnInternalPayState, LnPayState, LnReceiveState, OutgoingLightningPayment } from '../types';
|
|
3
|
-
export declare class LightningService {
|
|
4
|
-
private client;
|
|
5
|
-
constructor(client: TransportClient);
|
|
6
|
-
/** https://web.fedimint.org/core/FedimintWallet/LightningService/createInvoice#lightning-createinvoice */
|
|
7
|
-
createInvoice(amountMsats: number, description: string, expiryTime?: number, // in seconds
|
|
8
|
-
gatewayInfo?: GatewayInfo, extraMeta?: JSONObject): Promise<CreateBolt11Response>;
|
|
9
|
-
createInvoiceTweaked(amountMsats: number, description: string, tweakKey: string, index: number, expiryTime?: number, // in seconds
|
|
10
|
-
gatewayInfo?: GatewayInfo, extraMeta?: JSONObject): Promise<CreateBolt11Response>;
|
|
11
|
-
scanReceivesForTweaks(tweakKey: string, indices: number[], extraMeta?: JSONObject): Promise<string[]>;
|
|
12
|
-
private _getDefaultGatewayInfo;
|
|
13
|
-
/** https://web.fedimint.org/core/FedimintWallet/LightningService/payInvoice#lightning-payinvoice-invoice-string */
|
|
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
|
-
}>;
|
|
26
|
-
subscribeInternalPayment(operation_id: string, onSuccess?: (state: LnInternalPayState) => void, onError?: (error: string) => void): import("../types").CancelFunction;
|
|
27
|
-
subscribeLnClaim(operationId: string, onSuccess?: (state: LnReceiveState) => void, onError?: (error: string) => void): import("../types").CancelFunction;
|
|
28
|
-
/** https://web.fedimint.org/core/FedimintWallet/LightningService/payInvoice#lightning-payinvoice-invoice-string */
|
|
29
|
-
subscribeLnPay(operationId: string, onSuccess?: (state: LnPayState) => void, onError?: (error: string) => void): import("../types").CancelFunction;
|
|
30
|
-
/** https://web.fedimint.org/core/FedimintWallet/LightningService/payInvoice#lightning-payinvoice-invoice-string */
|
|
31
|
-
waitForPay(operationId: string): Promise<{
|
|
32
|
-
success: false;
|
|
33
|
-
error?: string;
|
|
34
|
-
} | {
|
|
35
|
-
success: true;
|
|
36
|
-
data: {
|
|
37
|
-
preimage: string;
|
|
38
|
-
};
|
|
39
|
-
}>;
|
|
40
|
-
/** https://web.fedimint.org/core/FedimintWallet/LightningService/createInvoice#lightning-createinvoice */
|
|
41
|
-
subscribeLnReceive(operationId: string, onSuccess?: (state: LnReceiveState) => void, onError?: (error: string) => void): import("../types").CancelFunction;
|
|
42
|
-
/** https://web.fedimint.org/core/FedimintWallet/LightningService/createInvoice#lightning-createinvoice */
|
|
43
|
-
waitForReceive(operationId: string, timeoutMs?: number): Promise<LnReceiveState>;
|
|
44
|
-
getGateway(gatewayId?: string | null, forceInternal?: boolean): Promise<LightningGateway | null>;
|
|
45
|
-
listGateways(): Promise<LightningGateway[]>;
|
|
46
|
-
updateGatewayCache(): Promise<import("../types").JSONValue>;
|
|
47
|
-
}
|
|
48
|
-
//# sourceMappingURL=LightningService.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"LightningService.d.ts","sourceRoot":"","sources":["../../../src/services/LightningService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAC9C,OAAO,KAAK,EACV,oBAAoB,EACpB,WAAW,EACX,UAAU,EACV,gBAAgB,EAChB,kBAAkB,EAClB,UAAU,EACV,cAAc,EACd,wBAAwB,EACzB,MAAM,UAAU,CAAA;AAEjB,qBAAa,gBAAgB;IACf,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,eAAe;IAE3C,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,oBAAoB,CACxB,WAAW,EAAE,MAAM,EACnB,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;IAmBlB,qBAAqB,CACzB,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,EAAE,EACjB,SAAS,CAAC,EAAE,UAAU;YAaV,sBAAsB;IAMpC,mHAAmH;IAC7G,UAAU,CACd,OAAO,EAAE,MAAM,EACf,WAAW,CAAC,EAAE,WAAW,EACzB,SAAS,CAAC,EAAE,UAAU;IAcxB,uHAAuH;IACjH,cAAc,CAClB,OAAO,EAAE,MAAM,EACf,SAAS,GAAE,MAAc,EACzB,WAAW,CAAC,EAAE,WAAW,EACzB,SAAS,CAAC,EAAE,UAAU;iBAGP,KAAK;gBAAU,MAAM;;iBAErB,IAAI;cACP;YAAE,QAAQ,EAAE,MAAM,CAAC;YAAC,QAAQ,EAAE,MAAM,CAAA;SAAE;;IA8BpD,wBAAwB,CACtB,YAAY,EAAE,MAAM,EACpB,SAAS,GAAE,CAAC,KAAK,EAAE,kBAAkB,KAAK,IAAe,EACzD,OAAO,GAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAe;IAY7C,gBAAgB,CACd,WAAW,EAAE,MAAM,EACnB,SAAS,GAAE,CAAC,KAAK,EAAE,cAAc,KAAK,IAAe,EACrD,OAAO,GAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAe;IAa7C,mHAAmH;IACnH,cAAc,CACZ,WAAW,EAAE,MAAM,EACnB,SAAS,GAAE,CAAC,KAAK,EAAE,UAAU,KAAK,IAAe,EACjD,OAAO,GAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAe;IAW7C,mHAAmH;IAC7G,UAAU,CAAC,WAAW,EAAE,MAAM;iBAEnB,KAAK;gBAAU,MAAM;;iBACrB,IAAI;cAAQ;YAAE,QAAQ,EAAE,MAAM,CAAA;SAAE;;IA4BjD,0GAA0G;IAC1G,kBAAkB,CAChB,WAAW,EAAE,MAAM,EACnB,SAAS,GAAE,CAAC,KAAK,EAAE,cAAc,KAAK,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,23 +0,0 @@
|
|
|
1
|
-
import { TransportClient } from '../transport';
|
|
2
|
-
import type { Duration, JSONObject, JSONValue, NoteCountByDenomination, ReissueExternalNotesState, SpendNotesState } from '../types';
|
|
3
|
-
export declare class MintService {
|
|
4
|
-
private client;
|
|
5
|
-
constructor(client: TransportClient);
|
|
6
|
-
/** https://web.fedimint.org/core/FedimintWallet/MintService/redeemEcash */
|
|
7
|
-
redeemEcash(notes: string): Promise<string>;
|
|
8
|
-
reissueExternalNotes(oobNotes: string, extraMeta?: JSONObject): Promise<string>;
|
|
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>;
|
|
18
|
-
tryCancelSpendNotes(operationId: string): Promise<void>;
|
|
19
|
-
subscribeSpendNotes(operationId: string, onSuccess?: (state: SpendNotesState) => void, onError?: (error: string) => void): import("../types").CancelFunction;
|
|
20
|
-
awaitSpendOobRefund(operationId: string): Promise<JSONValue>;
|
|
21
|
-
getNotesByDenomination(): Promise<NoteCountByDenomination>;
|
|
22
|
-
}
|
|
23
|
-
//# sourceMappingURL=MintService.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MintService.d.ts","sourceRoot":"","sources":["../../../src/services/MintService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAC9C,OAAO,KAAK,EACV,QAAQ,EACR,UAAU,EACV,SAAS,EAGT,uBAAuB,EACvB,yBAAyB,EACzB,eAAe,EAChB,MAAM,UAAU,CAAA;AAEjB,qBAAa,WAAW;IACV,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,eAAe;IAE3C,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;IAMvC,sBAAsB;CAO7B"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { JSONValue } from '../types';
|
|
2
|
-
import { TransportClient } from '../transport';
|
|
3
|
-
export declare class RecoveryService {
|
|
4
|
-
private client;
|
|
5
|
-
constructor(client: TransportClient);
|
|
6
|
-
hasPendingRecoveries(): Promise<boolean>;
|
|
7
|
-
waitForAllRecoveries(): Promise<void>;
|
|
8
|
-
subscribeToRecoveryProgress(onSuccess: (progress: {
|
|
9
|
-
module_id: number;
|
|
10
|
-
progress: JSONValue;
|
|
11
|
-
}) => void, onError: (error: string) => void): import("../types").CancelFunction;
|
|
12
|
-
}
|
|
13
|
-
//# sourceMappingURL=RecoveryService.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
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,eAAe,EAAE,MAAM,cAAc,CAAA;AAE9C,qBAAa,eAAe;IACd,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,eAAe;IAErC,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"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { JSONValue, WalletSummary, GenerateAddressResponse, WalletDepositState } from '../types';
|
|
2
|
-
import { TransportClient } from '../transport';
|
|
3
|
-
export declare class WalletService {
|
|
4
|
-
private client;
|
|
5
|
-
constructor(client: TransportClient);
|
|
6
|
-
getWalletSummary(): Promise<WalletSummary>;
|
|
7
|
-
generateAddress(extraMeta?: JSONValue): Promise<GenerateAddressResponse>;
|
|
8
|
-
sendOnchain(amountSat: number, address: string, extraMeta?: JSONValue): Promise<{
|
|
9
|
-
operation_id: string;
|
|
10
|
-
}>;
|
|
11
|
-
subscribeDeposit(operation_id: string, onSuccess?: (state: WalletDepositState) => void, onError?: (error: string) => void): import("../types").CancelFunction;
|
|
12
|
-
}
|
|
13
|
-
//# sourceMappingURL=WalletService.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"WalletService.d.ts","sourceRoot":"","sources":["../../../src/services/WalletService.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,aAAa,EACb,uBAAuB,EACvB,kBAAkB,EACnB,MAAM,UAAU,CAAA;AACjB,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAE9C,qBAAa,aAAa;IACZ,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,eAAe;IAErC,gBAAgB,IAAI,OAAO,CAAC,aAAa,CAAC;IAI1C,eAAe,CAAC,SAAS,GAAE,SAAc;IAUzC,WAAW,CACf,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,EACf,SAAS,GAAE,SAAc,GACxB,OAAO,CAAC;QAAE,YAAY,EAAE,MAAM,CAAA;KAAE,CAAC;IAOpC,gBAAgB,CACd,YAAY,EAAE,MAAM,EACpB,SAAS,GAAE,CAAC,KAAK,EAAE,kBAAkB,KAAK,IAAe,EACzD,OAAO,GAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAe;CAU9C"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export { MintService } from './MintService';
|
|
2
|
-
export { BalanceService } from './BalanceService';
|
|
3
|
-
export { LightningService } from './LightningService';
|
|
4
|
-
export { RecoveryService } from './RecoveryService';
|
|
5
|
-
export { FederationService } from './FederationService';
|
|
6
|
-
export { WalletService } from './WalletService';
|
|
7
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
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;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA"}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import type { CancelFunction, JSONValue, ModuleKind, StreamError, TransportMessageType } from '../types';
|
|
2
|
-
import { Logger } from '../utils/logger';
|
|
3
|
-
import type { Transport } from '../types/transport';
|
|
4
|
-
/**
|
|
5
|
-
* Handles communication with a generic transport.
|
|
6
|
-
* Must be instantiated with a platform-specific transport. (wasm for web, react native, etc.)
|
|
7
|
-
*/
|
|
8
|
-
export declare class TransportClient {
|
|
9
|
-
private readonly transport;
|
|
10
|
-
private requestCounter;
|
|
11
|
-
private requestCallbacks;
|
|
12
|
-
private initPromise;
|
|
13
|
-
logger: Logger;
|
|
14
|
-
/**
|
|
15
|
-
* @summary Constructor for the TransportClient
|
|
16
|
-
* @param transport - The platform-specific transport to use. (wasm for web, react native, etc.)
|
|
17
|
-
*/
|
|
18
|
-
constructor(transport: Transport);
|
|
19
|
-
initialize(): Promise<boolean>;
|
|
20
|
-
private handleLogMessage;
|
|
21
|
-
private handleTransportError;
|
|
22
|
-
private handleTransportMessage;
|
|
23
|
-
sendSingleMessage<Response extends JSONValue = JSONValue, Payload extends JSONValue = JSONValue>(type: TransportMessageType, payload?: Payload): Promise<Response>;
|
|
24
|
-
/**
|
|
25
|
-
* @summary Initiates an RPC stream with the specified module and method.
|
|
26
|
-
*
|
|
27
|
-
* @description
|
|
28
|
-
* This function sets up an RPC stream by sending a request to a worker and
|
|
29
|
-
* handling responses asynchronously. It ensures that unsubscription is handled
|
|
30
|
-
* correctly, even if the unsubscribe function is called before the subscription
|
|
31
|
-
* is fully established, by deferring the unsubscription attempt using `setTimeout`.
|
|
32
|
-
*
|
|
33
|
-
* The function operates in a non-blocking manner, leveraging Promises to manage
|
|
34
|
-
* asynchronous operations and callbacks to handle responses.
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
* @template Response - The expected type of the successful response.
|
|
38
|
-
* @template Body - The type of the request body.
|
|
39
|
-
* @param module - The module kind to interact with.
|
|
40
|
-
* @param method - The method name to invoke on the module.
|
|
41
|
-
* @param body - The request payload.
|
|
42
|
-
* @param onSuccess - Callback invoked with the response data on success.
|
|
43
|
-
* @param onError - Callback invoked with error information if an error occurs.
|
|
44
|
-
* @param onEnd - Optional callback invoked when the stream ends.
|
|
45
|
-
* @returns A function that can be called to cancel the subscription.
|
|
46
|
-
*
|
|
47
|
-
*/
|
|
48
|
-
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;
|
|
49
|
-
private _rpcStreamInner;
|
|
50
|
-
rpcSingle<Response extends JSONValue = JSONValue, Error extends string = string>(module: ModuleKind, method: string, body: JSONValue): Promise<Response>;
|
|
51
|
-
cleanup(): Promise<void>;
|
|
52
|
-
_getRequestCounter(): number;
|
|
53
|
-
_getRequestCallbackMap(): Map<number, (value: any) => void>;
|
|
54
|
-
}
|
|
55
|
-
//# sourceMappingURL=TransportClient.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TransportClient.d.ts","sourceRoot":"","sources":["../../../src/transport/TransportClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,SAAS,EACT,UAAU,EACV,WAAW,EAEX,oBAAoB,EACrB,MAAM,UAAU,CAAA;AACjB,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AACxC,OAAO,KAAK,EAAE,SAAS,EAAoB,MAAM,oBAAoB,CAAA;AAErE;;;GAGG;AACH,qBAAa,eAAe;IAE1B,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAW;IACrC,OAAO,CAAC,cAAc,CAAI;IAC1B,OAAO,CAAC,gBAAgB,CAA0C;IAClE,OAAO,CAAC,WAAW,CAA0C;IAC7D,MAAM,EAAE,MAAM,CAAA;IAEd;;;OAGG;gBACS,SAAS,EAAE,SAAS;IAUhC,UAAU;IAMV,OAAO,CAAC,gBAAgB;IAKxB,OAAO,CAAC,oBAAoB,CAE3B;IAED,OAAO,CAAC,sBAAsB,CAkB7B;IAMD,iBAAiB,CACf,QAAQ,SAAS,SAAS,GAAG,SAAS,EACtC,OAAO,SAAS,SAAS,GAAG,SAAS,EACrC,IAAI,EAAE,oBAAoB,EAAE,OAAO,CAAC,EAAE,OAAO;IAgC/C;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,SAAS,CACP,QAAQ,SAAS,SAAS,GAAG,SAAS,EACtC,IAAI,SAAS,SAAS,GAAG,SAAS,EAElC,MAAM,EAAE,UAAU,EAClB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,IAAI,EACV,SAAS,EAAE,CAAC,GAAG,EAAE,QAAQ,KAAK,IAAI,EAClC,OAAO,EAAE,CAAC,GAAG,EAAE,WAAW,CAAC,OAAO,CAAC,KAAK,IAAI,EAC5C,KAAK,GAAE,MAAM,IAAe,GAC3B,cAAc;YA0CH,eAAe;IAuC7B,SAAS,CACP,QAAQ,SAAS,SAAS,GAAG,SAAS,EACtC,KAAK,SAAS,MAAM,GAAG,MAAM,EAC7B,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS;IAO/C,OAAO;IAQb,kBAAkB;IAGlB,sBAAsB,wBApO6B,GAAG,KAAK,IAAI;CAuOhE"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/transport/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAA"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { Transport, TransportErrorHandler, TransportLogger, TransportMessageHandler, TransportRequest } from '../../types/transport';
|
|
2
|
-
export declare class WasmWorkerTransport implements Transport {
|
|
3
|
-
private messageHandler;
|
|
4
|
-
private errorHandler;
|
|
5
|
-
private readonly worker;
|
|
6
|
-
logger: TransportLogger;
|
|
7
|
-
constructor();
|
|
8
|
-
postMessage(message: TransportRequest): void;
|
|
9
|
-
setMessageHandler(handler: TransportMessageHandler): void;
|
|
10
|
-
setErrorHandler(handler: TransportErrorHandler): void;
|
|
11
|
-
}
|
|
12
|
-
//# sourceMappingURL=WasmWorkerTransport.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"WasmWorkerTransport.d.ts","sourceRoot":"","sources":["../../../../src/transport/wasmTransport/WasmWorkerTransport.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,SAAS,EACT,qBAAqB,EACrB,eAAe,EACf,uBAAuB,EACvB,gBAAgB,EACjB,MAAM,uBAAuB,CAAA;AAE9B,qBAAa,mBAAoB,YAAW,SAAS;IACnD,OAAO,CAAC,cAAc,CAAoC;IAC1D,OAAO,CAAC,YAAY,CAAkC;IACtD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAQ;IAE/B,MAAM,EAAE,eAAe,CAAU;;IAcjC,WAAW,CAAC,OAAO,EAAE,gBAAgB;IAIrC,iBAAiB,CAAC,OAAO,EAAE,uBAAuB;IAIlD,eAAe,CAAC,OAAO,EAAE,qBAAqB;CAG/C"}
|
|
@@ -1 +0,0 @@
|
|
|
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,aAAa,CAAA"}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import type { JSONValue } from './utils';
|
|
2
|
-
declare const TransportMessageTypes: readonly ["init", "initialized", "rpc", "log", "open", "join", "error", "unsubscribe", "cleanup", "parseInviteCode", "parseBolt11Invoice", "previewFederation"];
|
|
3
|
-
export type TransportMessageType = (typeof TransportMessageTypes)[number];
|
|
4
|
-
export type TransportRequest = {
|
|
5
|
-
type: TransportMessageType;
|
|
6
|
-
requestId?: number;
|
|
7
|
-
payload?: JSONValue;
|
|
8
|
-
};
|
|
9
|
-
export type TransportMessage = {
|
|
10
|
-
type: TransportMessageType | string;
|
|
11
|
-
requestId?: number;
|
|
12
|
-
} & Record<string, unknown>;
|
|
13
|
-
export type TransportMessageHandler = (message: TransportMessage) => void;
|
|
14
|
-
export type TransportErrorHandler = (error: unknown) => void;
|
|
15
|
-
/**
|
|
16
|
-
* Generic Transport interface for communicating with a specific
|
|
17
|
-
* target of the FedimintClient. Can be Wasm, React Native, Node, etc.
|
|
18
|
-
*/
|
|
19
|
-
export interface Transport {
|
|
20
|
-
postMessage(message: TransportRequest): void;
|
|
21
|
-
setMessageHandler(handler: TransportMessageHandler): void;
|
|
22
|
-
setErrorHandler(handler: TransportErrorHandler): void;
|
|
23
|
-
logger: TransportLogger;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Generic logger interface based on browser console.log
|
|
27
|
-
*/
|
|
28
|
-
export type TransportLogger = {
|
|
29
|
-
debug(message: string, ...args: any[]): void;
|
|
30
|
-
info(message: string, ...args: any[]): void;
|
|
31
|
-
warn(message: string, ...args: any[]): void;
|
|
32
|
-
error(message: string, ...args: any[]): void;
|
|
33
|
-
};
|
|
34
|
-
export {};
|
|
35
|
-
//# sourceMappingURL=transport.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../../../src/types/transport.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAExC,QAAA,MAAM,qBAAqB,iKAajB,CAAA;AAEV,MAAM,MAAM,oBAAoB,GAAG,CAAC,OAAO,qBAAqB,CAAC,CAAC,MAAM,CAAC,CAAA;AAEzE,MAAM,MAAM,gBAAgB,GAAG;IAC7B,IAAI,EAAE,oBAAoB,CAAA;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,OAAO,CAAC,EAAE,SAAS,CAAA;CACpB,CAAA;AAED,MAAM,MAAM,gBAAgB,GAAG;IAC7B,IAAI,EAAE,oBAAoB,GAAG,MAAM,CAAA;IACnC,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;AAE3B,MAAM,MAAM,uBAAuB,GAAG,CAAC,OAAO,EAAE,gBAAgB,KAAK,IAAI,CAAA;AAEzE,MAAM,MAAM,qBAAqB,GAAG,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAA;AAE5D;;;GAGG;AACH,MAAM,WAAW,SAAS;IACxB,WAAW,CAAC,OAAO,EAAE,gBAAgB,GAAG,IAAI,CAAA;IAC5C,iBAAiB,CAAC,OAAO,EAAE,uBAAuB,GAAG,IAAI,CAAA;IACzD,eAAe,CAAC,OAAO,EAAE,qBAAqB,GAAG,IAAI,CAAA;IACrD,MAAM,EAAE,eAAe,CAAA;CACxB;AAED;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI,CAAA;IAC5C,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI,CAAA;IAC3C,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI,CAAA;IAC3C,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI,CAAA;CAC7C,CAAA"}
|
|
@@ -1,23 +0,0 @@
|
|
|
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
|
-
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 };
|
|
23
|
-
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|