npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

phoenix-server-js

v1.1.0

Published

A package to easily use Phoenix Server with JavaScript

Downloads

15

Readme

npm version License: MIT downloads follow me

Phoenix-Server-JS

Phoenix-Server-JS is a streamlined TypeScript/JavaScript library for seamless Lightning Network integration, inspired by the simplicity and power of PhoenixWallet for servers. It offers self-custodial, zero-configuration setup with lightweight binaries, automated liquidity, and an easy HTTP API. Designed for real-time node, channel, and payment management, Phoenix-Server-JS combines promise-based and WebSocket interfaces for developer convenience and efficiency.

🚀 Features

  • Node management: Retrieve node information, balance, and list channels.
  • Channel management: Open, close, and list Lightning Network channels.
  • Payments: Send and receive Lightning payments, manage invoices, and on-chain payments.
  • Real-time notifications: Utilize WebSockets for live updates on payments and channel events.

📋 Prerequisites

Before you can utilize the phoenix-server-js library effectively, you must have the Phoenix server daemon (phoenixd) running in your environment.

Follow these steps to download, unzip, and run phoenixd: https://phoenix.acinq.co/server/get-started

💾 Installation

Install Phoenix-JS using npm:

npm install phoenix-server-js

Or using yarn:

yarn add phoenix-server-js

📖 Usage

Here's how to get started with Phoenix-JS:

import Phoenix from "phoenix-server-js";

const start = async () => {
  const phoenix = new Phoenix({
    username: "phoenix", // optional
    token: "your_api_token_here",
    host: "http://127.0.0.1:9740", // optional
  });

  // Node Management examples
  const nodeInfo = await phoenix.getNodeInfo();
  console.log(nodeInfo);

  const balance = await phoenix.getBalance();
  console.log(balance);

  // Channel Management
  const channels = await phoenix.listChannels();
  console.log(channels);

  const closeChannel = await phoenix.closeChannel({
    channelId: "123",
    address: "your_btc_address",
    feerateSatByte: 1,
  });
  console.log(closeChannel);

  // Real-time Notifications
  const websocket = phoenix.websocket();

  // Payments
  const invoice = await phoenix.receiveLightningPayment({
    amountSat: 1001,
    description: "test invoice",
  });
  console.log(invoice);

  const lnInvoice = await phoenix.sendLightningInvoice({
    amountSat: 1,
    invoice: "your_invoice_here",
  });
  console.log(lnInvoice);

  // On-chain Payments
  const txId = await phoenix.sendOnchainPayment({
    amountSat: 100000,
    address: "your_btc_address_here",
    feerateSatByte: 12,
  });
  console.log(txId);
};

start();

📚 Documentation

For more detailed information about the available methods and their parameters, please refer to the https://phoenix.acinq.co/server.

👥 Contributing

Contributions are welcome! Please feel free to submit pull requests, report issues, or suggest new features.

📜 License

This project is licensed under the MIT LICENSE.