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

localbitcoins-api-promise

v1.0.0

Published

Asynchronous Node.js LocalBitcoins API wrapper

Downloads

5

Readme

LocalBitcoins API

This is an asynchronous Node.js LocalBitcoins API wrapper for a few of the API endpoints. I wanted to do some programmatic trading on LocalBitcoins and just started writing functions before I realized other API wrappers already existed.

I only added support for a few of the API endpoints, just what I specifically required. If you need a complete wrapper I suggest going with localbitcoins-client instead.

It will also help to read more about the LocalBitcoins API.

Usage

npm install localbitcoins-api-promise

Then import the package, and create a new LocalBitcoins object with your API key and secret:

const LocalBitcoins = require('localbitcoins-api-promise')
let LBC = new LocalBitcoins(key, secret)

 // Example, will return your wallet balance data
let response = await LBC.checkBalance()

LocalBitcoins Object Member Functions

getAdData(adNumber)

  • Input: the ID number of an ad
  • Output: the LocalBitcoins server response containing the data from an ad with ID number

setAdData(adNumber, adData)

  • Input: an object containing the ad data, and an ID for the ad you want to update
  • I recommend calling getAdData() on the ad you want to update, editing the data fields, and then posting that object.
  • Output: the LocalBitcoins server response from the update call

checkBalance()

  • Input: none
  • Output: the LocalBitcoins server response containing info about your wallet balance.
  • response.data.total.sendable is your spendable balance.

sendBitcoins(address, amount)

  • Input: a bitcoin address to send money to, and an amount to send
  • Output: the LocalBitcoins server response

getUnpaidTrades()

  • Input: none
  • Output: a processed array of trade objects that have not been paid yet.

markPaid(trade)

  • Input: a trade object (like the one returned by getUnpaidTrades)
  • Output: the LocalBitcoins server response

sendMessage(trade, message)

  • Input: a trade object (like the one returned by getUnpaidTrades) and a string message to send to the person you are in the trade with.
  • Output: the LocalBitcoins server response