-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathprovider.ts
50 lines (42 loc) · 1.17 KB
/
provider.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/**
* Everything needed to implement your own provider.
*/
export interface WebLNNode {
alias: string;
pubkey: string;
color?: string;
}
export interface GetInfoResponse {
node: WebLNNode;
}
export interface SendPaymentResponse {
preimage: string;
}
export interface RequestInvoiceArgs {
amount?: string | number;
defaultAmount?: string | number;
minimumAmount?: string | number;
maximumAmount?: string | number;
defaultMemo?: string;
}
export interface KeysendArgs {
destination: string;
customRecords?: Record<string, string>;
amount: string | number;
}
export interface RequestInvoiceResponse {
paymentRequest: string;
}
export interface SignMessageResponse {
message: string;
signature: string;
}
export interface WebLNProvider {
enable(): Promise<void>;
getInfo(): Promise<GetInfoResponse>;
sendPayment(paymentRequest: string): Promise<SendPaymentResponse>;
keysend(args: KeysendArgs): Promise<SendPaymentResponse>;
makeInvoice(args: string | number | RequestInvoiceArgs): Promise<RequestInvoiceResponse>;
signMessage(message: string): Promise<SignMessageResponse>;
verifyMessage(signature: string, message: string): Promise<void>;
}