@fedimint/core 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +18 -0
- package/dist/dts/FedimintWallet.d.ts +51 -0
- package/dist/dts/FedimintWallet.d.ts.map +1 -0
- package/dist/dts/WalletDirector.d.ts +79 -0
- package/dist/dts/WalletDirector.d.ts.map +1 -0
- package/dist/dts/index.d.ts +5 -0
- package/dist/dts/index.d.ts.map +1 -0
- package/dist/dts/services/BalanceService.d.ts +15 -0
- package/dist/dts/services/BalanceService.d.ts.map +1 -0
- package/dist/dts/services/FederationService.d.ts +13 -0
- package/dist/dts/services/FederationService.d.ts.map +1 -0
- package/dist/dts/services/LightningService.d.ts +48 -0
- package/dist/dts/services/LightningService.d.ts.map +1 -0
- package/dist/dts/services/MintService.d.ts +23 -0
- package/dist/dts/services/MintService.d.ts.map +1 -0
- package/dist/dts/services/RecoveryService.d.ts +13 -0
- package/dist/dts/services/RecoveryService.d.ts.map +1 -0
- package/dist/dts/services/WalletService.d.ts +13 -0
- package/dist/dts/services/WalletService.d.ts.map +1 -0
- package/dist/dts/services/index.d.ts +7 -0
- package/dist/dts/services/index.d.ts.map +1 -0
- package/dist/dts/transport/TransportClient.d.ts +55 -0
- package/dist/dts/transport/TransportClient.d.ts.map +1 -0
- package/dist/dts/transport/index.d.ts +2 -0
- package/dist/dts/transport/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/transport.d.ts +2 -0
- package/dist/dts/types/transport.d.ts.map +1 -0
- package/dist/dts/types/utils.d.ts +21 -0
- package/dist/dts/types/utils.d.ts.map +1 -0
- package/dist/dts/types/wallet.d.ts +241 -0
- package/dist/dts/types/wallet.d.ts.map +1 -0
- package/dist/dts/utils/logger.d.ts +24 -0
- package/dist/dts/utils/logger.d.ts.map +1 -0
- package/dist/index.d.ts +578 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/package.json +40 -0
- package/src/FedimintWallet.ts +119 -0
- package/src/WalletDirector.ts +119 -0
- package/src/index.ts +4 -0
- package/src/services/BalanceService.test.ts +26 -0
- package/src/services/BalanceService.ts +29 -0
- package/src/services/FederationService.test.ts +58 -0
- package/src/services/FederationService.ts +216 -0
- package/src/services/LightningService.test.ts +265 -0
- package/src/services/LightningService.ts +289 -0
- package/src/services/MintService.test.ts +74 -0
- package/src/services/MintService.ts +129 -0
- package/src/services/RecoveryService.ts +28 -0
- package/src/services/WalletService.test.ts +59 -0
- package/src/services/WalletService.ts +50 -0
- package/src/services/index.ts +6 -0
- package/src/transport/TransportClient.ts +254 -0
- package/src/transport/index.ts +1 -0
- package/src/types/index.ts +3 -0
- package/src/types/transport.ts +1 -0
- package/src/types/utils.ts +23 -0
- package/src/types/wallet.ts +298 -0
- package/src/utils/logger.ts +69 -0
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
import { MSats, Duration, JSONValue, JSONObject } from './utils';
|
|
2
|
+
declare const MODULE_KINDS: readonly ["", "ln", "mint", "wallet"];
|
|
3
|
+
type ModuleKind = (typeof MODULE_KINDS)[number];
|
|
4
|
+
type FederationConfig = JSONObject;
|
|
5
|
+
type GatewayInfo = {
|
|
6
|
+
gateway_id: string;
|
|
7
|
+
api: string;
|
|
8
|
+
node_pub_key: string;
|
|
9
|
+
federation_index: number;
|
|
10
|
+
route_hints: RouteHint[];
|
|
11
|
+
fees: FeeToAmount;
|
|
12
|
+
};
|
|
13
|
+
type LightningGateway = {
|
|
14
|
+
info: GatewayInfo;
|
|
15
|
+
vetted: boolean;
|
|
16
|
+
ttl: Duration;
|
|
17
|
+
};
|
|
18
|
+
type RouteHint = {};
|
|
19
|
+
type FeeToAmount = {};
|
|
20
|
+
type OutgoingLightningPayment = {
|
|
21
|
+
payment_type: PayType;
|
|
22
|
+
contract_id: string;
|
|
23
|
+
fee: MSats;
|
|
24
|
+
};
|
|
25
|
+
type PayType = {
|
|
26
|
+
lightning: string;
|
|
27
|
+
} | {
|
|
28
|
+
internal: string;
|
|
29
|
+
};
|
|
30
|
+
type LnPayState = 'created' | 'canceled' | {
|
|
31
|
+
funded: {
|
|
32
|
+
block_height: number;
|
|
33
|
+
};
|
|
34
|
+
} | {
|
|
35
|
+
waiting_for_refund: {
|
|
36
|
+
error_reason: string;
|
|
37
|
+
};
|
|
38
|
+
} | 'awaiting_change' | {
|
|
39
|
+
success: {
|
|
40
|
+
preimage: string;
|
|
41
|
+
};
|
|
42
|
+
} | {
|
|
43
|
+
refunded: {
|
|
44
|
+
gateway_error: string;
|
|
45
|
+
};
|
|
46
|
+
} | {
|
|
47
|
+
unexpected_error: {
|
|
48
|
+
error_message: string;
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
type LnReceiveState = 'created' | {
|
|
52
|
+
waiting_for_payment: {
|
|
53
|
+
invoice: string;
|
|
54
|
+
timeout: number;
|
|
55
|
+
};
|
|
56
|
+
} | {
|
|
57
|
+
canceled: {
|
|
58
|
+
reason: string;
|
|
59
|
+
};
|
|
60
|
+
} | 'funded' | 'awaiting_funds' | 'claimed';
|
|
61
|
+
type LnInternalPayState = 'funding' | {
|
|
62
|
+
preimage: string;
|
|
63
|
+
} | {
|
|
64
|
+
refund_success: {
|
|
65
|
+
out_points: BtcOutPoint[];
|
|
66
|
+
error: string;
|
|
67
|
+
};
|
|
68
|
+
} | {
|
|
69
|
+
refund_error: {
|
|
70
|
+
error_message: string;
|
|
71
|
+
error: string;
|
|
72
|
+
};
|
|
73
|
+
} | {
|
|
74
|
+
funding_failed: {
|
|
75
|
+
error: string;
|
|
76
|
+
};
|
|
77
|
+
} | {
|
|
78
|
+
unexpected_error: string;
|
|
79
|
+
};
|
|
80
|
+
type CreateBolt11Response = {
|
|
81
|
+
operation_id: string;
|
|
82
|
+
invoice: string;
|
|
83
|
+
};
|
|
84
|
+
type StreamError = {
|
|
85
|
+
error: string;
|
|
86
|
+
data: never;
|
|
87
|
+
end: never;
|
|
88
|
+
};
|
|
89
|
+
type StreamSuccess<T extends JSONValue> = {
|
|
90
|
+
data: T;
|
|
91
|
+
error: never;
|
|
92
|
+
end: never;
|
|
93
|
+
};
|
|
94
|
+
type StreamEnd = {
|
|
95
|
+
end: string;
|
|
96
|
+
data: never;
|
|
97
|
+
error: never;
|
|
98
|
+
};
|
|
99
|
+
type StreamResult<T extends JSONValue> = StreamSuccess<T> | StreamError | StreamEnd;
|
|
100
|
+
type CancelFunction = () => void;
|
|
101
|
+
type ReissueExternalNotesState = 'Created' | 'Issuing' | 'Done';
|
|
102
|
+
type MintSpendNotesResponse = Array<string>;
|
|
103
|
+
type SpendNotesState = 'Created' | 'UserCanceledProcessing' | 'UserCanceledSuccess' | 'UserCanceledFailure' | 'Success' | 'Refunded';
|
|
104
|
+
type TxOutputSummary = {
|
|
105
|
+
outpoint: {
|
|
106
|
+
txid: string;
|
|
107
|
+
vout: number;
|
|
108
|
+
};
|
|
109
|
+
amount: number;
|
|
110
|
+
};
|
|
111
|
+
type BtcOutPoint = {
|
|
112
|
+
txid: string;
|
|
113
|
+
vout: number;
|
|
114
|
+
};
|
|
115
|
+
type WalletDepositState = 'WaitingForTransaction' | {
|
|
116
|
+
WaitingForConfirmation: {
|
|
117
|
+
btc_deposited: number;
|
|
118
|
+
btc_out_point: BtcOutPoint;
|
|
119
|
+
};
|
|
120
|
+
} | {
|
|
121
|
+
Confirmed: {
|
|
122
|
+
btc_deposited: number;
|
|
123
|
+
btc_out_point: BtcOutPoint;
|
|
124
|
+
};
|
|
125
|
+
} | {
|
|
126
|
+
Claimed: {
|
|
127
|
+
btc_deposited: number;
|
|
128
|
+
btc_out_point: BtcOutPoint;
|
|
129
|
+
};
|
|
130
|
+
} | {
|
|
131
|
+
Failed: string;
|
|
132
|
+
};
|
|
133
|
+
type WalletSummary = {
|
|
134
|
+
spendable_utxos: TxOutputSummary[];
|
|
135
|
+
unsigned_peg_out_txos: TxOutputSummary[];
|
|
136
|
+
unsigned_change_utxos: TxOutputSummary[];
|
|
137
|
+
unconfirmed_peg_out_txos: TxOutputSummary[];
|
|
138
|
+
unconfirmed_change_utxos: TxOutputSummary[];
|
|
139
|
+
};
|
|
140
|
+
type LnVariant = {
|
|
141
|
+
pay?: {
|
|
142
|
+
gateway_id: string;
|
|
143
|
+
invoice: string;
|
|
144
|
+
fee: number;
|
|
145
|
+
is_internal_payment: boolean;
|
|
146
|
+
out_point: {
|
|
147
|
+
out_idx: number;
|
|
148
|
+
txid: string;
|
|
149
|
+
};
|
|
150
|
+
};
|
|
151
|
+
receive?: {
|
|
152
|
+
gateway_id: string;
|
|
153
|
+
invoice: string;
|
|
154
|
+
out_point: {
|
|
155
|
+
out_idx: number;
|
|
156
|
+
txid: string;
|
|
157
|
+
};
|
|
158
|
+
};
|
|
159
|
+
};
|
|
160
|
+
type MintVariant = {
|
|
161
|
+
spend_o_o_b?: {
|
|
162
|
+
requested_amount: number;
|
|
163
|
+
oob_notes: string;
|
|
164
|
+
};
|
|
165
|
+
reissuance?: {
|
|
166
|
+
txid: string;
|
|
167
|
+
};
|
|
168
|
+
};
|
|
169
|
+
type WalletVariant = {
|
|
170
|
+
deposit?: {
|
|
171
|
+
address: string;
|
|
172
|
+
tweak_idx: number;
|
|
173
|
+
};
|
|
174
|
+
withdraw?: {
|
|
175
|
+
address: string;
|
|
176
|
+
amountMsats: number;
|
|
177
|
+
fee: {
|
|
178
|
+
fee_rate: {
|
|
179
|
+
sats_per_kvb: number;
|
|
180
|
+
};
|
|
181
|
+
total_weight: number;
|
|
182
|
+
};
|
|
183
|
+
};
|
|
184
|
+
};
|
|
185
|
+
type OperationKey = {
|
|
186
|
+
creation_time: {
|
|
187
|
+
nanos_since_epoch: number;
|
|
188
|
+
secs_since_epoch: number;
|
|
189
|
+
};
|
|
190
|
+
operation_id: string;
|
|
191
|
+
};
|
|
192
|
+
type OperationMeta = {
|
|
193
|
+
amount: number;
|
|
194
|
+
extra_meta: JSONObject;
|
|
195
|
+
variant: LnVariant | MintVariant | WalletVariant;
|
|
196
|
+
};
|
|
197
|
+
type OperationLog = {
|
|
198
|
+
meta: OperationMeta;
|
|
199
|
+
operation_module_kind: string;
|
|
200
|
+
outcome: {
|
|
201
|
+
outcome: LnPayState | LnReceiveState | SpendNotesState | WalletDepositState;
|
|
202
|
+
};
|
|
203
|
+
};
|
|
204
|
+
type BaseTransactions = {
|
|
205
|
+
timestamp: number;
|
|
206
|
+
operationId: string;
|
|
207
|
+
kind: 'ln' | 'mint' | 'wallet';
|
|
208
|
+
};
|
|
209
|
+
type LightningTransaction = BaseTransactions & {
|
|
210
|
+
type: 'send' | 'receive';
|
|
211
|
+
invoice: string;
|
|
212
|
+
outcome: 'created' | 'canceled' | 'claimed' | 'pending' | 'success' | 'funded' | 'awaiting_funds' | 'unexpected_error';
|
|
213
|
+
gateway: string;
|
|
214
|
+
fee?: number;
|
|
215
|
+
internalPay?: boolean;
|
|
216
|
+
preimage?: string;
|
|
217
|
+
txId: string;
|
|
218
|
+
};
|
|
219
|
+
type EcashTransaction = BaseTransactions & {
|
|
220
|
+
type: 'spend_oob' | 'reissue';
|
|
221
|
+
amountMsats: number;
|
|
222
|
+
outcome?: SpendNotesState | ReissueExternalNotesState;
|
|
223
|
+
notes?: string;
|
|
224
|
+
txId?: string;
|
|
225
|
+
};
|
|
226
|
+
type WalletTransaction = BaseTransactions & {
|
|
227
|
+
type: 'withdraw' | 'deposit';
|
|
228
|
+
onchainAddress: string;
|
|
229
|
+
amountMsats: number;
|
|
230
|
+
fee: number;
|
|
231
|
+
outcome?: 'WaitingForTransaction' | 'WaitingForConfirmation' | 'Confirmed' | 'Claimed' | 'Failed';
|
|
232
|
+
};
|
|
233
|
+
type Transactions = LightningTransaction | EcashTransaction | WalletTransaction;
|
|
234
|
+
/** Keys are powers of 2 */
|
|
235
|
+
type NoteCountByDenomination = Record<number, number>;
|
|
236
|
+
type GenerateAddressResponse = {
|
|
237
|
+
deposit_address: string;
|
|
238
|
+
operation_id: string;
|
|
239
|
+
};
|
|
240
|
+
export { LightningGateway, FederationConfig, RouteHint, FeeToAmount, OutgoingLightningPayment, PayType, LnPayState, LnReceiveState, CreateBolt11Response, GatewayInfo, StreamError, StreamSuccess, StreamResult, ModuleKind, CancelFunction, LnInternalPayState, ReissueExternalNotesState, MintSpendNotesResponse, SpendNotesState, WalletSummary, TxOutputSummary, NoteCountByDenomination, GenerateAddressResponse, OperationKey, OperationLog, LnVariant, MintVariant, WalletVariant, LightningTransaction, EcashTransaction, WalletTransaction, Transactions, WalletDepositState, };
|
|
241
|
+
//# 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,UAAU,EAAE,MAAM,SAAS,CAAA;AAEhE,QAAA,MAAM,YAAY,uCAAwC,CAAA;AAC1D,KAAK,UAAU,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,CAAC,CAAA;AAG/C,KAAK,gBAAgB,GAAG,UAAU,CAAA;AAElC,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,CAAA;AAED,KAAK,wBAAwB,GAAG;IAC9B,YAAY,EAAE,OAAO,CAAA;IACrB,WAAW,EAAE,MAAM,CAAA;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,iBAAiB,EACjB,YAAY,EACZ,kBAAkB,GACnB,CAAA"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { TransportLogger } from '@fedimint/types';
|
|
2
|
+
declare const logLevels: readonly ["debug", "info", "warn", "error", "none"];
|
|
3
|
+
export type LogLevel = (typeof logLevels)[number];
|
|
4
|
+
export declare class Logger {
|
|
5
|
+
private level;
|
|
6
|
+
private logger;
|
|
7
|
+
/**
|
|
8
|
+
* Generic Logger for a given environment.
|
|
9
|
+
*
|
|
10
|
+
* @param _logger - The transport's logger to use. (console for web, react native, etc.)
|
|
11
|
+
* @param level - The log level to use. (debug, info, warn, error, none)
|
|
12
|
+
*/
|
|
13
|
+
constructor(_logger?: TransportLogger, level?: LogLevel);
|
|
14
|
+
setLevel(level: LogLevel): void;
|
|
15
|
+
private coerceLevel;
|
|
16
|
+
log(level: string, message: string, ...args: any[]): void;
|
|
17
|
+
debug(message: string, ...args: any[]): void;
|
|
18
|
+
info(message: string, ...args: any[]): void;
|
|
19
|
+
warn(message: string, ...args: any[]): void;
|
|
20
|
+
error(message: string, ...args: any[]): void;
|
|
21
|
+
private shouldLog;
|
|
22
|
+
}
|
|
23
|
+
export {};
|
|
24
|
+
//# sourceMappingURL=logger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../../src/utils/logger.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAEtD,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;IACvB,OAAO,CAAC,MAAM,CAAiB;IAE/B;;;;;OAKG;gBACS,OAAO,GAAE,eAAyB,EAAE,KAAK,GAAE,QAAiB;IAKxE,QAAQ,CAAC,KAAK,EAAE,QAAQ;IAIxB,OAAO,CAAC,WAAW;IAOnB,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"}
|