# ucom-libs-social-transactions

> NPM package to sign UOS transactions

Latest version **1.4.0** (published 2020-06-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install ucom-libs-social-transactions
pnpm add ucom-libs-social-transactions
yarn add ucom-libs-social-transactions
bun add ucom-libs-social-transactions
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.4.0 |
| Published | 2020-06-15 |
| First published | 2018-12-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 80.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | UOS |
| Maintainers | vladimirice |
| Keywords | UOS, EOS, DPOS, DPOI |

## Links

- npm: https://www.npmjs.com/package/ucom-libs-social-transactions
- Repository: https://github.com/UOSnetwork/ucom.libs.social.transactions
- Homepage: https://github.com/UOSnetwork/ucom.libs.social.transactions/blob/master/README.md
- Issues: https://github.com/UOSnetwork/ucom.libs.social.transactions/issues
- npm.io page: https://npm.io/package/ucom-libs-social-transactions

## Dependencies (1)

- [eosjs](https://npm.io/package/eosjs.md) 16.0.0

## Recent versions

- 1.4.0 (latest) — 2020-06-15
- 1.3.0 — 2019-07-17
- 1.2.0 — 2019-05-20
- 1.1.5 — 2019-05-14
- 1.1.4 — 2019-04-12
- 1.1.3 — 2019-04-12
- 1.1.2 — 2019-04-12
- 1.1.0 — 2019-03-28
- 1.0.2 — 2019-02-04
- 1.0.1 — 2019-01-30
- 1.0.0 — 2018-12-18
- 0.15.0 — 2018-12-06

## README

# U°OS Application Transactions

# Warning: this library has been deprecated
Please see this library: [ucom.libs.wallet](../../../ucom.libs.wallet)

## Goal

This package is used to generate signed transactions related to different users actions.

## Content type dictionary

number | description
--- | ---
`1` | Media post
`2` | Post-offer
`10` | Direct post (like a comment directly on user or on org)
`11` | Repost of other post
`3` | Comment
`4` | Organization (Community)

## Interaction type dictionary
number | description
--- | ---
`1` | Follow
`5` | Unfollow
`2` | Upvote (like)
`4` | Downvote (dislike)
`3` | Join (to the post-offer)
`20` | Organization team invitation. Not implemented yet

## Action name dictionary
name | description
--- | ---
`usertouser` | User to user interaction, for ex. follow
`makecontent` | User makes content by himself (not by organization)
`makecontorg` | Organization (organization member) makes content
`usertocont` | User to content interaction, for ex. upvote
`dirpost` | User creates direct post on other user
`dirpostorg` | User creates direct post on organization

## Workflow
1. Call one of the methods and receive signed transaction.
2. Send this transaction as is to backend server. Backend server will push this transaction to blockchain.
Example:
```
body = {
// other request params
'signed_transaction': signed_transaction_string,
// other request params
}
```

## How to install:

```
npm i git+ssh://git@bitbucket.org/gravityprotocol/uos.app.transaction.git#latest
```

## User to user transactions
### User follows other user
```
const { TransactionFactory } = require('uos-app-transaction');

// Init for test env before doing any calls
TransactionFactory.initForTestEnv();
// In production call this method instead: TransactionFactory.initForProductionEnv(); 

(async () => {

  const senderAccountName = 'vlad';
  const senderActivePrivateKey = accountsData.vlad.activePk;
  const recipientAccountName = 'jane';

  const signed = await TransactionFactory.getSignedUserFollowsUser(
    senderAccountName,
    senderActivePrivateKey,
    recipientAccountName
  );
  
  const signed_transaction_string = JSON.stringify(signed);
  // Then send this value in request body
})();
```
See also [CONTRIBUTING](../../../uos.docs/blob/master/CONTRIBUTING.md) for detailed project information.

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