# pushdrop-tokenator

> Tokenator for sending pushdrop tokens P2P

Latest version **0.1.27** (published 2024-10-01) · Open BSV License license · 0 weekly downloads

## Install

```sh
npm install pushdrop-tokenator
pnpm add pushdrop-tokenator
yarn add pushdrop-tokenator
bun add pushdrop-tokenator
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.27 |
| Published | 2024-10-01 |
| First published | 2023-01-20 |
| Weekly downloads | 0 |
| License | Open BSV License |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 1.4 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Peer-to-peer Privacy Systems Research, LLC |
| Maintainers | tonesnotes, braydude, tyeverett |

## Links

- npm: https://www.npmjs.com/package/pushdrop-tokenator
- npm.io page: https://npm.io/package/pushdrop-tokenator

## Dependencies (4)

- [pushdrop](https://npm.io/package/pushdrop.md) ^0.1.64
- [ninja-base](https://npm.io/package/ninja-base.md) ^0.3.52
- [@babbage/tokenator](https://npm.io/package/@babbage/tokenator.md) ^0.2.37
- [@babbage/wrapped-sdk](https://npm.io/package/@babbage/wrapped-sdk.md) ^0.1.2

## Recent versions

- 0.1.27 (latest) — 2024-10-01
- 0.1.26 — 2024-09-21
- 0.1.25 — 2024-08-07
- 0.1.24 — 2024-07-18
- 0.1.23 — 2024-07-17
- 0.1.22 — 2024-07-17
- 0.1.21 — 2024-07-07
- 0.1.20 — 2024-06-19
- 0.1.19 — 2024-06-07
- 0.1.18 — 2024-06-07
- 0.1.17 — 2024-05-11
- 0.1.16 — 2024-05-07
- 0.1.15 — 2024-05-07
- 0.1.14 — 2024-05-04
- 0.1.13 — 2024-05-04
- … 12 more at https://npm.io/package/pushdrop-tokenator/versions

## README

# pushdrop-tokenator

A Tokenator for Exchanging PushDrop Tokens P2P

## Overview

PushDropTokenator is a specialized derived class of Tokenator that enables the creation and transfer of Bitcoin tokens with arbitrary signed payloads stored on the stack. These tokens can be used to represent and transfer ownership of any type of digital asset, such as files, text, images, videos, and more.

Developers can easily use PushDropTokenator as a base class and derive specialized class with new functionalty for dealing with a particular token type. For example, EmailTokenator is a class that is derived from PushDropTokenator for sending and receiving email tokens peer-to-peer. ScribeTokenator is another example for exchanging Scribe notes

PushDropTokenator is a powerful tool for creating Bitcoin powered applications that involve the transfer of digital assets. It is an excellent example of how Tokenator's base-level class can be extended to create specialized tokens that solve real-world problems.

## Example Usage

This example demonstrates sending and receiving PushDrop tokens with pushdrop-tokenator

```js
const PushDropTokenator = require('pushdrop-tokenator')
const johnSmith = '022600d2ef37d123fdcac7d25d7a464ada7acd3fb65a0daf85412140ee20884311'

const init = async () => {
    // Create a new instance of the PushDropTokenator class
    // Configure the parameters according to the protocol being used
    const tokenator = new PushDropTokenator({
        peerServHost: 'https://staging-peerserv.babbage.systems',
        defaultTokenValue = 1,
        protocolID = 'customProtocol',
        protocolKeyID = 1,
        protocolBasketName = 'customProtocol',
        protocolMessageBox = 'customProtocol_inbox',
        protocolAddress = 'UNIQUE PROTOCOL ID HERE'
    })
    // Send a PushDrop token using Babbage
    await tokenator.sendPushDropToken({
        recipient: johnSmith,
        title: 'Example token with a title',
        contents: 'You can include any data you want inside this object.',
        htmlCode: '<html><body><h1>PUSHDROP TOKEN</h1></body></html>'
    })

    // Receive incoming tokens into your PushDrop basket
    const tokensReceived = await tokenator.receivePushDropTokens()
}

init()
```

## API

<!-- Generated by documentation.js. Update this documentation by updating the source code. -->

#### Table of Contents

*   [PushDropTokenator](#pushdroptokenator)
    *   [Parameters](#parameters)
    *   [createPushDropToken](#createpushdroptoken)
        *   [Parameters](#parameters-1)
    *   [redeemPushDropToken](#redeempushdroptoken)
        *   [Parameters](#parameters-2)
    *   [sendPushDropToken](#sendpushdroptoken)
        *   [Parameters](#parameters-3)
    *   [receivePushDropTokens](#receivepushdroptokens)

### PushDropTokenator

**Extends Tokenator**

Extends the Tokenator class to enable sending PushDrop tokens with custom instructions Peer-to-Peer

#### Parameters

*   `obj` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?** All parameters are given in an object (optional, default `{}`)

    *   `obj.peerServHost` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** The PeerServ host you want to connect to (optional, default `'https://staging-peerserv.babbage.systems'`)
    *   `obj.dojoHost` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** The Dojo to use for UTXO management (optional, default `'https://staging-dojo.babbage.systems'`)
    *   `obj.clientPrivateKey` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** A private key to use for mutual authentication with Authrite. (Optional - Defaults to Babbage signing strategy).
    *   `obj.defaultTokenValue`   (optional, default `1`)
    *   `obj.protocolID`  
    *   `obj.protocolKeyID`  
    *   `obj.protocolBasketName`  
    *   `obj.protocolMessageBox`  
    *   `obj.protocolAddress`  

#### createPushDropToken

##### Parameters

*   `data` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** The data object with any data fields to send

    *   `data.recipient` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Who this data should be sent to (optional, default `'self'`)

#### redeemPushDropToken

Redeems a PushDrop Token by Spending the UTXO

##### Parameters

*   `token` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** the token object returned from createPushDropToken
*   `description` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** description of this action (optional, default `` `Delete a ${this.protocolID} token` ``)

Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** the result of the createAction call

#### sendPushDropToken

Sends a PushDrop token to a PeerServ recipient

##### Parameters

*   `data` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** The data object with any data fields to send

    *   `data.recipient` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Who this data should be sent to (optional, default `'self'`)

#### receivePushDropTokens

Receives incoming PushDrop tokens

Returns **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)** An array indicating the tokens received

---
_Source: https://npm.io/package/pushdrop-tokenator · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
