Socket
Socket
Sign inDemoInstall

@webbtc/webln-types

Package Overview
Dependencies
Maintainers
2
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@webbtc/webln-types - npm Package Compare versions

Comparing version 1.0.11 to 1.0.12

2

package.json
{
"name": "@webbtc/webln-types",
"description": "Type definitions for WebLN",
"version": "1.0.11",
"version": "1.0.12",
"types": "types/index.d.ts",

@@ -6,0 +6,0 @@ "repository": {

@@ -64,2 +64,171 @@ // Workaround for code completion to account for values this library doesn't know about yet.

type ListPeersResponse = {
peers: {
pub_key: string;
address: string;
bytes_sent: string;
bytes_recv: string;
sat_sent: string;
sat_recv: string;
inbound: boolean;
ping_time: string;
sync_type: string;
features: Record<string, unknown>;
errors: [];
flap_count: number;
last_flap_ns: string;
last_ping_payload: string;
}[];
};
type ListPeersRequestFunc = (method: "listpeers") => ListPeersResponse;
type ListChannelsResponse = {
channels: {
active: boolean;
remote_pubkey: string;
channel_point: string;
chan_id: string;
capacity: string;
local_balance: string;
remote_balance: string;
commit_fee: string;
commit_weight: string;
fee_per_kw: string;
unsettled_balance: string;
total_satoshis_sent: string;
total_satoshis_received: string;
num_updates: string;
pending_htlcs: unknown[];
csv_delay: number;
private: boolean;
initiator: boolean;
chan_status_flags: string;
local_chan_reserve_sat: string;
remote_chan_reserve_sat: string;
static_remote_key: boolean;
commitment_type: string;
lifetime: string;
uptime: string;
close_address: string;
push_amount_sat: string;
thaw_height: number;
local_constraints: {
csv_delay: number;
chan_reserve_sat: string;
dust_limit_sat: string;
max_pending_amt_msat: string;
min_htlc_msat: string;
max_accepted_htlcs: number;
};
remote_constraints: {
csv_delay: number;
chan_reserve_sat: string;
dust_limit_sat: string;
max_pending_amt_msat: string;
min_htlc_msat: string;
max_accepted_htlcs: number;
};
alias_scids: unknown[];
zero_conf: false;
zero_conf_confirmed_scid: string;
peer_alias: string;
}[];
};
type ListChannelsRequestFunc = (method: "listchannels") => ListPeersResponse;
type ListInvoicesResponse = {
invoices: {
memo: string;
r_preimage: string;
r_hash: string;
value: string;
value_msat: string;
settled: boolean;
creation_date: string;
settle_date: string;
payment_request: string;
description_hash: string;
expiry: string;
fallback_addr: string;
cltv_expiry: string;
route_hints: unknown;
private: boolean;
add_index: string;
settle_index: string;
amt_paid: string;
amt_paid_sat: string;
amt_paid_msat: string;
state: "SETTLED" | "CANCELED" | string;
is_keysend: boolean;
payment_addr: string;
is_amp: false;
amp_invoice_state: {};
htlcs: {
chan_id: string;
htlc_index: string;
amt_msat: string;
accept_height: number;
accept_time: string;
resolve_time: string;
expiry_height: number;
state: "SETTLED" | "CANCELED" | string;
custom_records: { [key: string]: string };
mpp_total_amt_msat: string;
amp: unknown;
}[];
features: { [key: string]: unknown };
}[];
last_index_offset: string;
first_index_offset: string;
};
type ListInvoicesRequestFunc = (
method: "listinvoices",
args?: {
reversed?: boolean;
num_max_invoices?: number;
index_offset?: number;
pending_only?: boolean;
creation_date_start?: number;
creation_date_end?: number;
}
) => ListInvoicesResponse;
type ListPaymentsResponse = {
payments: {
payment_hash: string;
value: string;
creation_date: string;
fee: string;
payment_preimage: string;
value_sat: string;
value_msat: string;
payment_request: string;
status: string;
fee_sat: string;
fee_msat: string;
creation_time_ns: string;
htlcs: unknown[]; // TODO: add htlc type
payment_index: string;
failure_reason: string;
}[];
last_index_offset: string;
first_index_offset: string;
total_num_payments: string;
};
type ListPaymentsRequestFunc = (
method: "listpayments",
args?: {
reversed?: boolean;
num_max_invoices?: number;
index_offset?: number;
pending_only?: boolean;
creation_date_start?: number;
creation_date_end?: number;
}
) => ListInvoicesResponse;
type LNURLResponse =

@@ -71,2 +240,20 @@ | {

type WalletBalanceResponse = {
total_balance: string;
confirmed_balance: string;
unconfirmed_balance: string;
locked_balance: string;
reserved_balance_anchor_chan: string;
account_balance: {
default: {
confirmed_balance: string;
unconfirmed_balance: string;
};
};
};
type WalletBalanceRequestFunc = (
method: "walletbalance"
) => WalletBalanceResponse;
interface WebLNProvider {

@@ -80,3 +267,8 @@ enable(): Promise<void>; // Promise<{ enabled: boolean; remember: boolean }>

): Promise<RequestInvoiceResponse>;
request(method: RequestMethod, args?: unknown): Promise<unknown>;
request: ListPeersRequestFunc &
ListChannelsRequestFunc &
ListInvoicesRequestFunc &
ListPaymentsRequestFunc &
WalletBalanceRequestFunc &
((method: RequestMethod, args?: unknown) => Promise<unknown>);
sendPayment(paymentRequest: string): Promise<SendPaymentResponse>;

@@ -103,2 +295,7 @@ signMessage(message: string): Promise<SignMessageResponse>;

SignMessageResponse,
ListPeersResponse,
ListChannelsResponse,
WalletBalanceResponse,
ListInvoicesResponse,
ListPaymentsResponse,
};
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc