Please see this library: ucom.libs.wallet
This package is used to generate signed transactions related to different users actions.
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) |
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 |
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 |
- Call one of the methods and receive signed transaction.
- 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
}
npm i git+ssh://[email protected]/gravityprotocol/uos.app.transaction.git#latest
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.