lnurl-pay
Version:
Client library for lnurl-pay and lightning address
69 lines (68 loc) • 1.78 kB
TypeScript
declare const satoshisSymbol: unique symbol;
export type Satoshis = number & {
[satoshisSymbol]: never;
};
type Json = {
[key: string]: any;
};
export type LightningAddress = {
username: string;
domain: string;
};
export type LNURLPaySuccessAction = {
tag: string;
description: string | null;
url: string | null;
message: string | null;
ciphertext: string | null;
iv: string | null;
decipher: (preimage: string) => string | null;
};
export type FetcGetArgs = {
url: string;
params?: Json;
};
export type LnUrlPayServiceArgs = {
lnUrlOrAddress: string;
onionAllowed?: boolean;
fetchGet?: (args: FetcGetArgs) => Promise<Json>;
};
export type LnUrlPayServiceResponse = {
callback: string;
fixed: boolean;
min: Satoshis;
max: Satoshis;
domain?: string;
metadata: Array<Array<string>>;
metadataHash: string;
identifier: string;
description: string;
image: string;
commentAllowed: number;
rawData: {
[key: string]: string | number;
};
};
export type LnUrlRequestInvoiceBaseArgs = {
tokens: Satoshis;
comment?: string;
onionAllowed?: boolean;
fetchGet?: (args: FetcGetArgs) => Promise<Json>;
validateInvoice?: boolean;
};
export type LnUrlrequestInvoiceWithServiceParamsArgs = LnUrlRequestInvoiceBaseArgs & {
params: LnUrlPayServiceResponse;
};
export type LnUrlRequestInvoiceArgs = LnUrlRequestInvoiceBaseArgs & {
lnUrlOrAddress: string;
};
export type LnUrlRequestInvoiceResponse = {
params: LnUrlPayServiceResponse;
rawData: Json;
invoice: string;
hasValidAmount: boolean;
hasValidDescriptionHash: boolean;
successAction?: LNURLPaySuccessAction;
validatePreimage: (preimage: string) => boolean;
};
export {};