
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
phoenixd-client
Advanced tools
A Node.js TypeScript client for the phoenixd Lightning API. This package provides a complete interface to interact with phoenixd Lightning nodes, including creating invoices, making payments, managing channels, and real-time notifications.
phoenixd is the server equivalent of the popular Phoenix wallet for mobile, written in Kotlin Multiplatform and running natively on Linux, MacOS, and Windows.
npm install phoenixd-client
import { PhoenixdClient } from 'phoenixd-client';
// Initialize the client
const client = new PhoenixdClient({
host: 'localhost',
port: 9740,
password: 'your_phoenixd_password',
useHttps: false
});
// Create an invoice
const invoice = await client.createInvoice({
description: 'Coffee payment',
amountSat: 1000,
expirySeconds: 3600
});
console.log('Invoice created:', invoice.serialized);
interface PhoenixdConfig {
host?: string; // Default: 'localhost'
port?: number; // Default: 9740
password: string; // Required: Your phoenixd API password
useHttps?: boolean; // Default: false
timeout?: number; // Default: 30000ms
}
const invoice = await client.createInvoice({
description: 'Payment for services',
amountSat: 5000,
expirySeconds: 3600,
externalId: 'order-123',
webhookUrl: 'https://your-webhook.com/payment'
});
const payment = await client.payInvoice({
invoice: 'lntb1u1pjlsjnqpp57svjqly7mh5sy84lk67sma4apfnqdm90jdf40np0xchrpq6uxajscqpjsp592kp0fs2ssgpq9h54tsfaj5w34287v8fezgaw6cr56f076c05glq9q7sqqqqqqqqqqqqqqqqqqqsqqqqqysgqdq6d4ujqenfwfehggrfdemx76trv5mqz9grzjqwfn3p9278ttzzpe0e00uhyxhned3j5d9acqak5emwfpflp8z2cnflcyamh4dcuhwqqqqqlgqqqqqeqqjqnjpjvnv0p3wvwc6vhzkkgm8kl9r837x4p9qupk5ln5tqlm7prrlsy5xd8cf5agae64f53dvm9el0z5hvgcnta4stgmrg7zwfah0nqrqph4ts8l'
});
const offer = await client.createOffer({
description: 'Donation for the project',
amountSat: 1000
});
const payment = await client.payOffer({
offer: 'lno1qgsyxjtl6luzd9t3pr62xr7eemp6awnejusgf6gw45q75vcfqqqqqqqgqvqcdgq2zdskugr0venx2u3qvehhygzsd9jhyun9zrhq8yecsj40r443pquhuhh7tjrteukce2xj7uqwm2vahys5lsn39vf5q2fyfxsw6xn824393en87nre87xcectkgcj85trcu5hn9r9703645qsrxtcq785whraquh5atw89w5scg707fz23405ygk7jn9uek3tkmvdqqvc8yz8xm2yme6hjx3x02csmq6pfzaejqr3kzg7u8am96txu95z8am8zgvfvfcnzk27ylwk43ut48xv2vrkhqtj3wes32glw5ft5h7f4p8ytwey4cqjsks55zcmr3hka0p8e50thjqpjytmt5wsa4ylhavdmewv7jmj2ppy9daujfmfvpmnw9cf75cymjffzh2nafn883vsqr3a8u2l797mayh3p',
amountSat: 1000,
message: 'Thank you for your work!'
});
const payment = await client.payLnAddress({
address: 'alice@lightning.com',
amountSat: 500,
message: 'For lunch'
});
const payments = await client.listIncomingPayments({
limit: 10,
offset: 0,
all: true
});
const payments = await client.listOutgoingPayments({
limit: 10,
offset: 0,
all: true
});
const payment = await client.getIncomingPayment('payment_hash_here');
const outgoingPayment = await client.getOutgoingPayment('payment_id_here');
const info = await client.getInfo();
console.log('Node ID:', info.nodeId);
console.log('Channels:', info.channels);
const balance = await client.getBalance();
console.log('Balance:', balance.balanceSat, 'sats');
console.log('Fee Credit:', balance.feeCreditSat, 'sats');
const channels = await client.listChannels();
channels.forEach(channel => {
console.log('Channel:', channel.channelId, 'Balance:', channel.balanceSat);
});
const txId = await client.sendToAddress({
amountSat: 100000,
address: 'bc1qxy2kgdygjrsqtzq2n0yrf2493p83kkfjhx0wlh',
feerateSatByte: 12
});
const childTxId = await client.bumpFee({
feerateSatByte: 15
});
const payment = await client.lnUrlPay({
amountSat: 1000,
lnurl: 'LNURL1DP68GURN8GHJ7MRWW4EXCTNXD9SHG6NPVCHXXMMD9AKXUATJDSKHQCTE8AEK2UMND9HKU0TZV9JR2VM9XV6RVV3JVSUNWDRYXUCNVDFHV43KVE3KXQCRJDFHX33XGDENX9NRSVTRXCENVC3KV33NGWR9XQURWC3N8YEN2WP4V4JNZV8XSUH',
message: 'Payment for service'
});
const withdraw = await client.lnUrlWithdraw({
lnurl: 'lightning:LNURL1DP68GURN8GHJ7MRWW4EXCTNXD9SHG6NPVCHXXMMD9AKXUATJDSKHW6T5DPJ8YCTH8AEK2UMND9HKU0T9893XYVF5XQMX2EP4VYCNJWR9X56RSCEE893NYVP3VC6KGEPNX5UNGDFCV9NRJDNXXCMNXENZXPJXVCFS89NRWVFJXYCNXD3K89JNGAXMZVT'
});
const result = await client.lnUrlAuth({
lnurl: 'lnurl1dp68gurn8ghj7um5v93kketj9ehx2amn9ashq6f0d3hxzat5dqlhgct884kx7emfdcnxkvfav3nxxcehxyckvdrpxsexyden8qexywrpv33nvdmpxsukzdpnvgungct9xesnvcf3x9jnsenxvvurvcmzvd3rwdfevgmnwdpjxp3nqvg50j329'
});
const decoded = await client.decodeInvoice({
invoice: 'lntb1u1pjlsjnqpp57svjqly7mh5sy84lk67sma4apfnqdm90jdf40np0xchrpq6uxajscqpjsp592kp0fs2ssgpq9h54tsfaj5w34287v8fezgaw6cr56f076c05glq9q7sqqqqqqqqqqqqqqqqqqqsqqqqqysgqdq6d4ujqenfwfehggrfdemx76trv5mqz9grzjqwfn3p9278ttzzpe0e00uhyxhned3j5d9acqak5emwfpflp8z2cnflcyamh4dcuhwqqqqqlgqqqqqeqqjqnjpjvnv0p3wvwc6vhzkkgm8kl9r837x4p9qupk5ln5tqlm7prrlsy5xd8cf5agae64f53dvm9el0z5hvgcnta4stgmrg7zwfah0nqrqph4ts8l'
});
const fees = await client.estimateLiquidityFees(2000000);
console.log('Mining fee:', fees.miningFeeSat, 'sats');
console.log('Service fee:', fees.serviceFeeSat, 'sats');
The client extends EventEmitter and provides WebSocket support for real-time payment notifications:
// Listen for payment events
client.on('payment_received', (event) => {
console.log('Payment received:', event.amountSat, 'sats');
console.log('Payment hash:', event.paymentHash);
});
// Connect to WebSocket
const ws = client.connectWebSocket();
// Handle WebSocket events
client.on('websocket_closed', () => {
console.log('WebSocket connection closed');
});
client.on('error', (error) => {
console.error('Client error:', error);
});
try {
const invoice = await client.createInvoice({
description: 'Test invoice',
amountSat: 1000
});
} catch (error) {
if (error instanceof Error) {
console.error('Failed to create invoice:', error.message);
}
}
⚠️ Important Security Notes:
# Install dependencies
npm install
# Build the project
npm run build
# Run tests
npm test
# Lint code
npm run lint
# Format code
npm run format
MIT License - see LICENSE file for details.
Contributions are welcome! Please feel free to submit a Pull Request.
For issues and questions:
examples/ directoryFAQs
A Node.js client for the phoenixd Lightning API
We found that phoenixd-client demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.