How to use dsteem - 10 common examples

To help you get started, we’ve selected a few dsteem examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github harpagon210 / steemsmartcontracts / plugins / Replay.js View on Github external
function init(payload) {
  const { blocksLogFilePath, streamNodes } = payload;
  filePath = blocksLogFilePath;
  steemNode = streamNodes[0]; // eslint-disable-line
  steemClient = process.env.NODE_ENV === 'test' ? new dsteem.Client('https://testnet.steemitdev.com', { addressPrefix: 'TST', chainId: '46d82ab7d8db682eb1959aed0ada039a6d49afa1602491f93dde9cac3e8e6c32' }) : new dsteem.Client(steemNode);
}
github steemit / devportal-tutorials-js / tutorials / 22_witness_listing_and_voting / public / app.js View on Github external
import { Client, PrivateKey } from 'dsteem';
import { accounts } from '../../configuration';
//define network parameters
let opts = {};
opts.addressPrefix = 'STX';
opts.chainId =
    '79276aea5d4877d9a25892eaa01b0adf019d3e5cb12a97478df3298ccdd01673';
//connect to a steem node, testnet in this case
const client = new Client('https://testnet.steem.vc', opts);

// const dsteem = require('dsteem');
// let opts = {};
// //define network parameters
// opts.addressPrefix = 'STM';
// opts.chainId =
//     '0000000000000000000000000000000000000000000000000000000000000000';
// //connect to a steem node, production in this case
// const client = new dsteem.Client('https://api.steemit.com');

//create witness list function
window.createList = async () => {
    //get list limit
    const limit = document.getElementById('limit').value;

    const witnessdata = await client.database.getState('witnesses');
github MattyIce / postpromoter / postpromoter.js View on Github external
function startup() {
  // Load the settings from the config file
  loadConfig();

  // Connect to the specified RPC node
  rpc_node = config.rpc_nodes ? config.rpc_nodes[0] : (config.rpc_node ? config.rpc_node : 'https://api.steemit.com');
  client = new dsteem.Client(rpc_node);

  utils.log("* START - Version: " + version + " *");
  utils.log("Connected to: " + rpc_node);

  if(config.backup_mode)
    utils.log('*** RUNNING IN BACKUP MODE ***');

  // Load Steem global variables
  utils.updateSteemVariables(client);

  // If the API is enabled, start the web server
  if(config.api && config.api.enabled) {
    var express = require('express');
    var app = express();
    var port = process.env.PORT || config.api.port
github aaroncox / vessel / app / components / global / ServerSelect.js View on Github external
servers.forEach((server) => {
      try {
        const client = new Client(server);
        client.database.getDynamicGlobalProperties().then((props) => {
          let servers = Object.assign({}, this.state.servers);
          servers[server.replace('wss', 'https')] = props.time;
          this.setState({servers});
        });
      } catch(e) {
        console.log(e)
      }
    })
  }
github steemit / devportal-tutorials-js / tutorials / 28_set_withdraw_route / public / app.js View on Github external
const dsteem = require('dsteem');
let opts = {};
//connect to production server
opts.addressPrefix = 'STM';
opts.chainId =
    '0000000000000000000000000000000000000000000000000000000000000000';
//connect to server which is connected to the network/production
const client = new dsteem.Client('https://api.steemit.com');

//submitAcc function from html input
const max = 5;
window.submitAcc = async () => {
    const accSearch = document.getElementById('username').value;

    const _account = await client.database.call('get_withdraw_routes', [
        accSearch,
    ]);
    console.log(`_account:`, _account);
    let info = '';
    let sum = 0;
    if (_account.length > 0) {
        for (var i = 0; i < _account.length; i++) {
            info += `${_account[i].to_account} - ${_account[i].percent /
                100}%<br>`;
github steemit / devportal-tutorials-js / tutorials / 24_power_up_steem / public / app.js View on Github external
const dsteem = require('dsteem');
let opts = {};
//connect to production server
opts.addressPrefix = 'STM';
opts.chainId =
    '0000000000000000000000000000000000000000000000000000000000000000';
//connect to server which is connected to the network/production
const client = new dsteem.Client('https://api.steemit.com');

//submitAcc function from html input
const max = 5;
window.submitAcc = async () =&gt; {
    const accSearch = document.getElementById('username').value;

    const _account = await client.database.call('get_accounts', [[accSearch]]);
    console.log(`_account:`, _account);
    const name = _account[0].name;
    const steem_balance = _account[0].balance;
    const balance = `Available Steem balance for ${name}: ${steem_balance}<br>`;
    document.getElementById('accBalance').innerHTML = balance;
    document.getElementById('steem').value = steem_balance;
    const receiver = document.getElementById('receiver').value;

    document.getElementById('sc').style.display = 'block';
github steemit / devportal-tutorials-js / tutorials / 26_create_account / public / app.js View on Github external
const dsteem = require('dsteem');
let opts = {};
//connect to production server
opts.addressPrefix = 'STM';
opts.chainId =
    '0000000000000000000000000000000000000000000000000000000000000000';
//connect to server which is connected to the network/production
const client = new dsteem.Client('https://api.steemit.com');

//submitAcc function from html input
const max = 5;
window.searchAcc = async () => {
    const accSearch = document.getElementById('username').value;
    let avail = 'Account is NOT available to register';
    if (accSearch.length > 2) {
        const _account = await client.database.call('get_accounts', [
            [accSearch],
        ]);
        console.log(`_account:`, _account, accSearch.length);

        if (_account.length == 0) {
            avail = 'Account is available to register';
        }
    }
github steemit / devportal-tutorials-js / tutorials / 25_power_down / public / app.js View on Github external
const dsteem = require('dsteem');
let opts = {};
//connect to production server
opts.addressPrefix = 'STM';
opts.chainId =
    '0000000000000000000000000000000000000000000000000000000000000000';
//connect to server which is connected to the network/production
const client = new dsteem.Client('https://api.steemit.com');

//submitAcc function from html input
const max = 5;
window.submitAcc = async () => {
    const accSearch = document.getElementById('username').value;

    const _account = await client.database.call('get_accounts', [[accSearch]]);
    console.log(`_account:`, _account);

    const name = _account[0].name;
    const avail =
        parseFloat(_account[0].vesting_shares) -
        (parseFloat(_account[0].to_withdraw) -
            parseFloat(_account[0].withdrawn)) /
            1e6 -
        parseFloat(_account[0].delegated_vesting_shares);
github bonustrack / steemconnect / src / helpers / client.js View on Github external
return address => {
        rawClient = new Client(address, CLIENT_OPTIONS);
      };
    }
github esteemapp / esteem-mobile / src / providers / steem / dsteem.js View on Github external
getClient = async () => {
  const server = await AsyncStorage.getItem('server');

  if (server === null || server === undefined || server === '') {
    client = new Client('https://api.steemit.com');
  } else {
    client = new Client(`${server}`);
  }
};

dsteem

Steem blockchain RPC client library

BSD-3-Clause
Latest version published 5 years ago

Package Health Score

45 / 100
Full package analysis

Popular dsteem functions