Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,13 @@ version = "0.1.0"
crate-type = ["cdylib"]

[dependencies]
ldk-node = { default-features = false, git = "https://github.com/moneydevkit/ldk-node.git", branch = "with-skimmed-fees" }
napi = { version = "2", features = ["napi4"] }
bitcoin-payment-instructions = { version = "0.5.0", default-features = false, features = [
"http",
] }
ldk-node = { default-features = false, git = "https://github.com/moneydevkit/ldk-node.git", branch = "with-skimmed-fees" }
napi = { version = "2", features = ["napi4"] }
napi-derive = "2"
tokio = { version = "1", features = ["rt-multi-thread"] }
# Temporary pin: ldk-node pulls in home 0.5.12 which needs edition2024 cargo
home = "=0.5.11"
# Pin ICU crates to keep MSRV at 1.82.0
Expand All @@ -25,3 +29,7 @@ napi-build = "=2.2.4"

[profile.release]
lto = true

[dev-dependencies]
bitcoin = "0.32"
lightning-invoice = "0.33.2"
24 changes: 17 additions & 7 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,11 @@

/* auto-generated by NAPI-RS */

export declare function setLogListener(
callback?: (...args: any[]) => any | undefined | null,
minLevel?: string | undefined | null,
): void
export declare function generateMnemonic(): string
export interface LogEntry {
level: 'GOSSIP' | 'TRACE' | 'DEBUG' | 'INFO' | 'WARN' | 'ERROR'
modulePath: string
line: number
message: string
}
export declare function setLogListener(callback: ((log: LogEntry) => void) | null, minLevel?: string): void
export interface MdkNodeOptions {
network: string
mdkApiKey: string
Expand All @@ -37,13 +34,24 @@ export interface NodeBalance {
totalAnchorChannelsReserveSats: number
totalLightningBalanceSats: number
}
export interface NodeChannel {
channelId: string
counterpartyNodeId: string
shortChannelId?: string
inboundCapacityMsat: number
outboundCapacityMsat: number
isChannelReady: boolean
isUsable: boolean
isPublic: boolean
}
export declare class MdkNode {
constructor(options: MdkNodeOptions)
getNodeId(): string
start(): void
stop(): void
syncWallets(): void
getBalance(): NodeBalance
listChannels(): Array<NodeChannel>
receivePayment(minThresholdMs: number, quietThresholdMs: number): Array<ReceivedPayment>
getInvoice(amount: number, description: string, expirySecs: number): PaymentMetadata
getInvoiceWithScid(
Expand All @@ -58,5 +66,7 @@ export declare class MdkNode {
description: string,
expirySecs: number,
): PaymentMetadata
payLnurl(lnurl: string, amountMsat: number): string
payBolt11(bolt11Invoice: string): string
payBolt12Offer(bolt12OfferString: string): string
}
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -284,8 +284,8 @@ if (!nativeBinding) {
throw new Error(`Failed to load native binding`)
}

const { generateMnemonic, setLogListener, MdkNode } = nativeBinding
const { setLogListener, generateMnemonic, MdkNode } = nativeBinding

module.exports.generateMnemonic = generateMnemonic
module.exports.setLogListener = setLogListener
module.exports.generateMnemonic = generateMnemonic
module.exports.MdkNode = MdkNode
Loading
Loading