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

bch-dex-lib

v1.4.1

Published

An npm JavaScript library for browser and node.js that incorporates the SWaP protocol used by bch-dex.

Downloads

21

Readme

bch-dex-lib

This is a library for use in both browser and node.js JavaScript applications. It incorporates the basic SWaP protocol used by bch-dex.

The purpose of this library is build a web and Android app that can let Takers purchase tokens using the bch-dex protocol. Makers still still need to run the bch-dex back end to make Offers and accept Counter-Offers. But an app using this library allows Takers to issue a Counter Offer without needing to run back end software.

This library depends on minimal-slp-wallet and p2wdb. Both of these libraries must be instantiated and passed in as arguments when instantiating this library.

Installation

npm install --save-exact bch-dex-lib

Usage

async function start() {
  try {
    // Global npm libraries
    const BchWallet = require('minimal-slp-wallet/index')
    const { Read, Write } = require('p2wdb/index')

    // Customize the two variables below for your own test. The mnemonic
    // should control about $0.20 USD of BCH. The p2wdbHash should be for a
    // valid Offer in the market.
    const mnemonic = 'gaze result fortune pulse jeans lucky tape build maximum puppy urban size'
    const p2wdbHash = 'zdpuAvWMYm7bfHTxbNwsWYmrkK3cnhtH2MzQ7QS74uYbkM3ja'

    // Instantiate dependencies
    const wallet = new BchWallet(mnemonic, { interface: 'consumer-api' })
    await wallet.walletInfoPromise
    const p2wdbRead = new Read()
    const p2wdbWrite = new Write({ wif: wallet.walletInfo.privateKey, interface: 'consumer-api' })

    // Instantiate the Take library.
    const take = new Take({ wallet, p2wdbRead, p2wdbWrite })

    // Generate a Counter Offer to take the other side of the trade expressed in the Offer.
    const hash = await this.p2wdbWrite.postEntry(counterOfferData, offerData.appId)

    console.log(`Counter Offer generated with P2WDB entry ${hash}`)
  } catch(err) {
    console.error(err)
  }
}
start()

Donate

This open source software is developed and maintained by the Permissionless Software Foundation. If this library provides value to you, please consider making a donation to support the PSF developers:

Licence

MIT