Skip to content

Operation Creators

What is this module for?

This module contains functions called operation creators. Their name is self-descriptive - they create operations.

Created operations can be then broadcasted to the Steem network using the broadcastOperations function from broadcasting module.

Most likely you will use this module for creating operations that aren't implemented yet in the broadcasting module.

API reference

Functions

createOperation

export declare const createOperation: (
  type: string,
  {
    ...parameters
  }: {
    [x: string]: any;
  }
) => Operation;
Definition

Creates operation based on given type and parameters.

Parameters
  • type (string): type of the operation
  • parameters (object): the operation parameters
Returns
  • Operation: operation created with given data
Example Usage
import { createOperation, Operation } from 'steemconnect-firebase-functions';

const voteOperation: Operation = createOperation('vote', {
  voter: 'jakipatryk',
  author: 'ned',
  permlink: 'i-am-ned',
  weight: 2000
});
Implementation

The implementation is available on Github.


createComment

export declare const createComment: (
  {
    parent_permlink,
    author,
    permlink,
    body,
    parent_author,
    title,
    json_metadata
  }: CommentConfig
) => Operation;
Definition

Creates comment operation.

Parameters
  • commentConfig (CommentConfig): the configuration object for a comment operation
Returns
Example Usage
import { createComment, Operation } from 'steemconnect-firebase-functions';

const commentOperation: Operation = createComment({
  parent_author: 'ned',
  parent_permlink: 'parentPermlinkOrMainTag',
  author: 'jakipatryk',
  permlink: 'i-am-jakipatryk-from-polska',
  body: 'Hello! Whats up ppl?'
});
Implementation

The implementation is available on Github.


createCommentOptions

export declare const createCommentOptions: (
  {
    author,
    permlink,
    max_accepted_payout,
    percent_steem_dollars,
    allow_votes,
    allow_curation_rewards,
    extensions: [...restExtensions]
  }: CommentOptionsConfig
) => Operation;
Definition

Creates comment_options operation.

Parameters
  • commentOptionsConfig (CommentOptionsConfig): the configuration object for a comment_options operation
Returns
Example Usage
import { createCommentOptions, Operation } from 'steemconnect-firebase-functions';

const commentOptionsOperation: Operation = createComment({
  author: 'jakipatryk',
  permlink: 'i-am-jakipatryk-from-polska',
  max_accepted_payout: '10.000 SBD'
  extensions: [
    [
      0,
      {
        beneficiaries: [
          {
            account: 'utopian.pay',
            weight: 2500
          }
        ]
      }
    ]
  ]
});
Implementation

The implementation is available on Github.


createCustomJson

export declare const createCustomJson: (
  {
    required_posting_auths: [...postingAuths],
    id,
    json,
    required_auths: [...auths]
  }: CustomJsonConfig
) => Operation;
Definition

Creates custom_json operation.

Parameters
  • customJsonConfig (CustomJsonConfig): the configuration object for a custom_json operation
Returns
Example Usage
import { createCustomJson, Operation } from 'steemconnect-firebase-functions';

const customJsonOperation: Operation = createCustomJson({
  requiredPostingAuths: ['jakipatryk'],
  id: 'follow',
  customJson: JSON.stringify([
    'reblog',
    {
      account: 'jakipatryk',
      author: 'ned',
      permlink: 'i-am-ned'
    }
  ])
});
Implementation

The implementation is available on Github.


createDeleteComment

export declare const createDeleteComment: (
  { author, permlink }: DeleteCommentConfig
) => Operation;
Definition

Creates delete_comment operation.

Parameters
  • deleteCommentConfig (DeleteCommentConfig): the configuration object for a delete_comment operation
Returns
Example Usage
import {
  createDeleteComment,
  Operation
} from 'steemconnect-firebase-functions';

const deleteCommentOperation: Operation = createDeleteComment({
  author: 'jakipatryk',
  permlink: 'i-am-jakipatryk-from-polska'
});
Implementation

The implementation is available on Github.


createVote

export declare const createVote: (
  { voter, author, permlink, weight }: VoteConfig
) => Operation;
Definition

Creates vote operation.

Parameters
  • voteConfig (VoteConfig): the configuration object for a vote operation
Returns
Example Usage
import { createVote, Operation } from 'steemconnect-firebase-functions';

const voteOperation: Operation = createVote({
  voter: 'jakipatryk',
  author: 'ned',
  permlink: 'i-am-ned',
  weight: 300
});
Implementation

The implementation is available on Github.