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

payment-tokenator

v0.2.38

Published

Tokenator for P2P Payments

Downloads

173

Readme

payment-tokenator

Overview

PaymentTokenator makes sending Bitcoin payments peer-to-peer between Babbage users a breeze!

Example Usage

This example demonstrates sending and receiving payments with payment-tokenator

const PaymentTokenator = require('payment-tokenator')
const johnSmith = '022600d2ef37d123fdcac7d25d7a464ada7acd3fb65a0daf85412140ee20884311'

const init = async () => {
    // Create a new instance of the PaymentTokenator class
    // Optionally configure a custom peerServHost
    const tokenator = new PaymentTokenator({
        peerServHost: 'https://staging-peerserv.babbage.systems'
    })
    // Send a payment using Babbage
    await tokenator.sendPayment({
        recipient: johnSmith,
        amount: 1033 // satoshis
    })

    // List Incoming Payments
    const payments = await tokenator.listIncomingPayments()

    // Accept the first payment received (for example)
    await tokenator.acceptPayment(payments[0])
}

init()

API

Table of Contents

PaymentTokenator

Extends Tokenator

Extends the Tokenator class to enable peer-to-peer Bitcoin payments

Parameters

  • obj object All parameters are given in an object. (optional, default {})

    • obj.peerServHost String? The PeerServ host you want to connect to. (optional, default 'https://staging-peerserv.babbage.systems')
    • obj.clientPrivateKey String? A private key to use for mutual authentication with Authrite. (Optional - Defaults to Babbage signing strategy).

sendPayment

Sends Bitcoin to a PeerServ recipient

Parameters
  • payment Object The payment object

    • payment.recipient string The recipient of the payment
    • payment.amount Number The amount in satoshis to send

acceptPayment

Accepts a payment into the default basket

Parameters
  • payment Object The payment object

    • payment.messageId Number The Id of the paymentMessage
    • payment.sender String The identityKey of the sender
    • payment.amount Number The amount of the payment
    • payment.token Object containing the P2PKH derivation instructions

listIncomingPayments

Lists incoming Bitcoin payments

Returns Array of payments to receive

PaymentTokenator

Extends Tokenator

Extends the Tokenator class to enable peer-to-peer Bitcoin payments

Parameters

  • obj object All parameters are given in an object. (optional, default {})

    • obj.peerServHost String? The PeerServ host you want to connect to. (optional, default 'https://staging-peerserv.babbage.systems')
    • obj.clientPrivateKey String? A private key to use for mutual authentication with Authrite. (Optional - Defaults to Babbage signing strategy).

sendPayment

Sends Bitcoin to a PeerServ recipient

Parameters

  • payment Object The payment object

    • payment.recipient string The recipient of the payment
    • payment.amount Number The amount in satoshis to send

acceptPayment

Accepts a payment into the default basket

Parameters

  • payment Object The payment object

    • payment.messageId Number The Id of the paymentMessage
    • payment.sender String The identityKey of the sender
    • payment.amount Number The amount of the payment
    • payment.token Object containing the P2PKH derivation instructions

listIncomingPayments

Lists incoming Bitcoin payments

Returns Array of payments to receive