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

zebedee-nodejs

v0.4.1

Published

NodeJS SDK for ZEBEDEE Bitcoin Lightning API

Downloads

25

Readme

ZEBEDEE NodeJS SDK

npm version

ZEBEDEE NodeJS SDK to integrate Bitcoin Lightning microtransactions into your game server or application server with ease.

Documentation

For detailed information about the endpoints available in the ZEBEDEE platform please refer to our Documentation Website.

Installation

zebedee-nodejs is a JavaScript library that facilitates the interaction with the ZEBEDEE API in NodeJS projects.

To install it run:

npm install zebedee-nodejs --save

or

yarn add zebedee-nodejs

API Initialization

// Import the `initAPI` method
import { initAPI } from 'zebedee-node';

// Configure the API (API Keys available at the ZEBEDEE Developers Dashboard)
const apiOptions = { apiKey: 'XXXXXX' };

// Instantiate the API
initAPI(apiOptions);

Creating Charge

// Import the `createCharge` method
import { createCharge } from 'zebedee-nodejs';

// Set the payload
const payload = {
  expiresIn: 300,
  amount: "50000",
  description: 'My Custom Charde Description',
  callbackUrl: 'https://yourapp.com/callback',
  internalId: '11af01d092444a317cb33faa6b8304b8',
};

// Create Charge
try {
  const response = await createCharge(payload);

  // Response Example
  //
  // {
  //   "id": "c8be70f8-6722-4bac-bfaa-504a24ac7082",
  //   "name": "My Custom Charge Name",
  //   "unit": "msats",
  //   "amount": "10000",
  //   "createdAt": "2020-02-19T01:45:49.110Z",
  //   "internalId": "11af01d092444a317cb33faa6b8304b8",
  //   "callbackUrl": "http://your-website.com/callback",
  //   "description": "My Custom Charge Description",
  //   "status": "pending",
  //   "invoice": {
  //       "request": "lnbc100n1p0yey6dpp5fnutjajv9jjv78vpad370rrqzxufqxk3fk2r3m6mk5fxpapq0v8qdpdf4ujqsm4wd6x7mfqgd5xzun8v5sygetnvdexjur5d9hkucqzpgxqzfvsp5rr6v38qxwqu0tnsh5aaqg6kf5k4w8k68n5cpxklr8trdawpytfcs9qy9qsqkxpafcvqgkjvtka0jplgfzumgl7csc7q455au09ucm3q948dey5nvysnpj3vqnvnnqvpz0l2jehlxpzq9d0mqd2vr7x60xd7dpmddkspke8a9c",
  //       "expiresAt": "2020-02-19T01:50:49.059Z"
  //   }
  // }

} catch(error) {
  console.log({ error });
}

Get Charge Details

// Import the `getCharge` method
import { getChargeDetails } from 'zebedee-nodejs';

// Get Charge ID
const chargeId = 'c8be70f8-6722-4bac-bfaa-504a24ac7082';

// Get Charge Details
try {
  const response = await getChargeDetails(chargeId);

  // Response Example
  //
  // {
  //   "id": "c8be70f8-6722-4bac-bfaa-504a24ac7082",
  //   "name": "My Custom Charge Name",
  //   "unit": "msats",
  //   "amount": "10000",
  //   "createdAt": "2020-02-19T01:45:49.110Z",
  //   "internalId": "11af01d092444a317cb33faa6b8304b8",
  //   "callbackUrl": "http://your-website.com/callback",
  //   "description": "My Custom Charge Description",
  //   "status": "pending",
  //   "invoice": {
  //       "request": "lnbc100n1p0yey6dpp5fnutjajv9jjv78vpad370rrqzxufqxk3fk2r3m6mk5fxpapq0v8qdpdf4ujqsm4wd6x7mfqgd5xzun8v5sygetnvdexjur5d9hkucqzpgxqzfvsp5rr6v38qxwqu0tnsh5aaqg6kf5k4w8k68n5cpxklr8trdawpytfcs9qy9qsqkxpafcvqgkjvtka0jplgfzumgl7csc7q455au09ucm3q948dey5nvysnpj3vqnvnnqvpz0l2jehlxpzq9d0mqd2vr7x60xd7dpmddkspke8a9c",
  //       "expiresAt": "2020-02-19T01:50:49.059Z"
  //   }
  // }

} catch(error) {
  console.log({ error });
}

Creating Withdrawal Request

// Import the `createWithdrawalRequest` method
import { createWithdrawalRequest } from 'zebedee-nodejs';

// Set the payload
const payload = {
  expiresIn: 300,
  amount: "50000",
  internalId: '11af01d092444a317cb33faa6b8304b8',
  description: 'My Custom Withdrawal Description',
  callbackUrl: 'https://yourapp.com/callback',
};

// Create Withdrawal Request
try {
  const response = await createWithdrawalRequest(payload);

  // Example Response
  //
  // {
  //   "id": "547c8a36-44d8-40de-80a1-9ad745354a45",
  //   "unit": "msats",
  //   "amount": "50000",
  //   "createdAt": "2020-02-19T01:43:57.485Z",
  //   "internalId": "11af01d092444a317cb33faa6b8304b8",
  //   "description": "My Custom Withdrawal Description",
  //   "callbackUrl": "http://your-website.com/callback",
  //   "status": "pending",
  //   "invoice": {
  //       "request": "lnurl1dp68gurn8ghj7cn9w3sj6ctsdyh85etzv4jx2efwd9hj7a3s9acxz7tvdaskgtthd96xserjv9mkzmpdwfjhzat9wd6r7um9vdex2apav3skxdfev93rwvm9x43nwcf5vvekgdmpxq6rgvrrxumnxdp3vserqe35v4jr2efs8y6k2epkxf3rxc35vg6nwdrpx9jrqv3kxfjxxwqxmuhcd",
  //       "expiresAt": "2020-02-19T01:48:57.482Z"
  //   }
  // }
} catch(error) {
  console.log({ error });
}

Making Payment

// Import the `makePayment` method
import { makePayment } from 'zebedee-nodejs';

// Set the payload
const payload = {
  invoice: 'lnbc10.....',
  description: 'My New Description',
  internalId: '11af01d092444a317cb33faa6b8304b8',
};

// Pay Invoice
try {
  const response = await makePayment(payload);
  console.log({ response });

  // Example Response
  //
  // {
  //   "id": "2a0dc354-573f-4850-85f7-ab4a21e5143b",
  //   "fee": "1000",
  //   "unit": "msats",
  //   "amount": "45000",
  //   "invoice": "lnbc450n1p0yeytspp55yrs0j42wnkw0qutr8e0tgsf2yplxs9986t5gqmfpn7mfd0ckc8sdzq2pshjmt9de6zqen0wgsrgdfqwp5hsetvwvsxzapqwdshgmmndp5hxtnsd3skxefwxqzjccqp2sp5pyccqt6apxelz62d2ndrt0ssahndpcua4wklea80glaczx80t3wqrzjqfn4cln8jwe4dh4dmscddrmd6sdw6hzkn702l6ghwvr8lhad0ez5vzt8vyqqf2sqqqqqqqlgqqqqqqgq9q9qy9qsqqeft09gryr80aaghm7rmh7eeqfl7hxlcynp99730yk7qh534d9nyfwp0nc628rp8hpgp23fxzj5l2aet4y6sc4t79uj3wyjxffejmvgqrmxkvr",
  //   "internalId": "11af01d092444a317cb33faa6b8304b8",
  //   "processedAt": "2020-02-19T01:38:10.757Z",
  //   "description": "My Custom Payment Description",
  //   "status": "completed"
  // }
} catch(error) {
  console.log({ error });
}

Webhooks

Use the callbackUrl properties in the Charge and WithdrawalRequest payloads to receive webhook calls. These webhooks are invoked when your Charge/WithdrawalRequest succeeds, fails, or when it eventually expires.

Webhooks give you more access to these entities' lifecycle.

Contributions

ZEBEDEE is a big proponent of Open Source Software. We welcome PRs and contributions to the SDK and will try to review issues and PRs as soon as we can.