# bsocial

> BSocial npm module

Latest version **0.0.1** (published 2021-07-01) · 0 weekly downloads

## Install

```sh
npm install bsocial
pnpm add bsocial
yarn add bsocial
bun add bsocial
```

## 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.0.1 |
| Published | 2021-07-01 |
| First published | 2021-07-01 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 199.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | icellan |

## Links

- npm: https://www.npmjs.com/package/bsocial
- Repository: https://github.com/icellan/bsocial
- Homepage: https://github.com/icellan/bsocial#readme
- Issues: https://github.com/icellan/bsocial/issues
- npm.io page: https://npm.io/package/bsocial

## Recent versions

- 0.0.1 (latest) — 2021-07-01

## README

# BSocial
> A javascript library to create bsocial (BitcoinSchema) compatible transactions.

## Usage

This library returns an hexArray of ops using the Bitcom convention

### Post

```javascript
import BSocial from 'bsocial';
const bsocial = new BSocial('app name');

const post = bSocial.post();
post.addText('Hello World!');

const hexArrayOps = post.getOps();
```

### Post with an image

```javascript
import BSocial from 'bsocial';
const bsocial = new BSocial('app name');

const post = bSocial.post();
post.addText('Hello World!');
// and image data Url
post.addImage('data:image/png,.....;base64');

const hexArrayOps = post.getOps();
```

### Post with a paywall

```javascript
import bsv from 'bsv';
import BSocial from 'bsocial';
const bsocial = new BSocial('app name');
const apiUrl = 'https://example.com/v1/';

// store this key in a database for retreival via the API URL when someone pays
const key = bsv.PrivateKey.fromRandom().toWIF();
const payTo = '1bsoShMdRZJ4UH3GFWcJqkkGBFzJPLHPr:0.10';
const post = bSocial.paywall(
  'Some text you want to be paid for',
  key,
  payTo,
  apiUrl,
);
post.setPaywallType('text/plain');

// Adding a text will be prepended as the first element in the post
post.addText('Intro text for the paywall. Maybe first paragraph');

const hexArrayOps = post.getOps();
```

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