1.4.0 • Published 4 years ago

ucom-libs-social-transactions v1.4.0

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

U°OS Application Transactions

Warning: this library has been deprecated

Please see this library: ucom.libs.wallet

Goal

This package is used to generate signed transactions related to different users actions.

Content type dictionary

numberdescription
1Media post
2Post-offer
10Direct post (like a comment directly on user or on org)
11Repost of other post
3Comment
4Organization (Community)

Interaction type dictionary

numberdescription
1Follow
5Unfollow
2Upvote (like)
4Downvote (dislike)
3Join (to the post-offer)
20Organization team invitation. Not implemented yet

Action name dictionary

namedescription
usertouserUser to user interaction, for ex. follow
makecontentUser makes content by himself (not by organization)
makecontorgOrganization (organization member) makes content
usertocontUser to content interaction, for ex. upvote
dirpostUser creates direct post on other user
dirpostorgUser 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 for detailed project information.

1.4.0

4 years ago

1.3.0

5 years ago

1.2.0

5 years ago

1.1.5

5 years ago

1.1.4

5 years ago

1.1.3

5 years ago

1.1.2

5 years ago

1.1.0

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago

0.15.0

5 years ago