New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

steem

Package Overview
Dependencies
Maintainers
2
Versions
121
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

steem - npm Package Compare versions

Comparing version 0.3.17 to 0.3.18

8

lib/broadcast.js

@@ -1,3 +0,2 @@

var moment = require('moment'),
steemAuth = require('../../steemauth/index.js'),
var steemAuth = require('steemauth'),
steemApi = require('./api');

@@ -10,3 +9,6 @@ formatter = require('./formatter');

steemApi.getDynamicGlobalProperties(function(err, result) {
tx.expiration = moment.utc(result.timestamp).add(15, 'second').format().replace('Z', '');
var seconds = 1000;
result.timestamp = result.timestamp || Date.now()
var expiration = new Date(result.timestamp + 15 * seconds);
tx.expiration = expiration.toISOString().replace('Z', '');
tx.ref_block_num = result.head_block_number & 0xFFFF;

@@ -13,0 +15,0 @@ tx.ref_block_prefix = new Buffer(result.head_block_id, 'hex').readUInt32LE(4);

{
"name": "steem",
"version": "0.3.17",
"version": "0.3.18",
"description": "Steem.js the JavaScript API for Steem blockchain",

@@ -31,4 +31,3 @@ "main": "index.js",

"detect-node": "^2.0.3",
"moment": "^2.14.1",
"steemauth": "0.0.14",
"steemauth": "0.0.15",
"ws": "^1.1.1"

@@ -35,0 +34,0 @@ },

@@ -1,1 +0,1 @@

(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){var isNode=require("detect-node");if(isNode)var WS=require("ws");var Steem={url:"wss://steemit.com/wspa",apiIds:{database_api:0,login_api:1,follow_api:2,network_broadcast_api:4},id:0,reqs:[],isOpen:false,isReady:false};Steem.setWebSocket=function(url){this.url=url};Steem.init=function(callback){if(!this.isReady){if(isNode){this.ws=new WS(this.url);this.ws.setMaxListeners(0)}else this.ws=new WebSocket(this.url);this.ws.addEventListener("close",function(){this.isOpen=false}.bind(this));this.isReady=true}if(!this.isOpen){this.ws.addEventListener("open",function(){this.isOpen=true;this.getApiByName("database_api",function(){});this.getApiByName("login_api",function(){});this.getApiByName("follow_api",function(){});this.getApiByName("network_broadcast_api",function(){});callback()}.bind(this))}else{callback()}};Steem.iterate=function(){this.id++;var id=this.id;this.reqs.push(id);return id};Steem.getApi=function(api,callback){if(this.apiIds[api]||this.apiIds[api]===0){callback("",this.apiIds[api])}else{this.getApiByName(api,function(err,result){this.apiIds[api]=result;callback("",result)}.bind(this))}};Steem.send=function(api,data,callback){data.id=data.id||0;data.params=data.params||[];this.init(function(){var call={};call.id=data.id;call.method="call";call.params=[this.apiIds[api],data.method,data.params];this.ws.send(JSON.stringify(call))}.bind(this));this.ws.addEventListener("message",function(msg){var data=JSON.parse(msg.data);var err=data.error&&data.error.data&&data.error.data.stack?data.error.data.stack:"";callback(err,data)}.bind(this));this.ws.addEventListener("error",function(error){callback(error,null)})};Steem.setSubscribeCallback=function(cb,clearFilter,callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"set_subscribe_callback",params:[callback,clearFilter]},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.setPendingTransactionCallback=function(cb,callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"set_pending_transaction_callback",params:[cb]},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.setBlockAppliedCallback=function(cb,callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"set_block_applied_callback",params:[cb]},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.cancelAllSubscriptions=function(callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"cancel_all_subscriptions"},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.getTrendingTags=function(afterTag,limit,callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"get_trending_tags",params:[afterTag,limit]},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.getDiscussionsByTrending=function(query,callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"get_discussions_by_trending",params:[query]},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.getDiscussionsByCreated=function(query,callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"get_discussions_by_created",params:[query]},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.getDiscussionsByActive=function(query,callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"get_discussions_by_active",params:[query]},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.getDiscussionsByCashout=function(query,callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"get_discussions_by_cashout",params:[query]},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.getDiscussionsByPayout=function(query,callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"get_discussions_by_payout",params:[query]},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.getDiscussionsByVotes=function(query,callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"get_discussions_by_votes",params:[query]},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.getDiscussionsByChildren=function(query,callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"get_discussions_by_children",params:[query]},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.getDiscussionsByHot=function(query,callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"get_discussions_by_hot",params:[query]},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.getDiscussionsByFeed=function(query,callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"get_discussions_by_feed",params:[query]},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.getBlockHeader=function(blockNum,callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"get_block_header",params:[blockNum]},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.getBlock=function(blockNum,callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"get_block",params:[blockNum]},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.getState=function(path,callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"get_state",params:[path]},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.getTrendingCategories=function(after,limit,callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"get_trending_categories",params:[after,limit]},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.getBestCategories=function(after,limit,callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"get_best_categories",params:[after,limit]},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.getActiveCategories=function(after,limit,callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"get_active_categories",params:[after,limit]},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.getRecentCategories=function(after,limit,callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"get_recent_categories",params:[after,limit]},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.getConfig=function(callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"get_config"},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.getDynamicGlobalProperties=function(callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"get_dynamic_global_properties"},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.getChainProperties=function(after,limit,callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"get_chain_properties"},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.getFeedHistory=function(callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"get_feed_history"},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.getCurrentMedianHistoryPrice=function(callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"get_current_median_history_price"},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.getWitnessSchedule=function(callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"get_recent_categories",params:[after,limit]},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.getHardforkVersion=function(callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"get_hardfork_version"},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.getNextScheduledHardfork=function(callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"get_next_scheduled_hardfork"},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.getKeyReferences=function(key,callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"get_key_references",params:[key]},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.getAccounts=function(names,callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"get_accounts",params:[names]},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.getAccountReferences=function(accountId,callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"get_account_references",params:[accountId]},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.lookupAccountNames=function(accountNames,callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"lookup_account_names",params:[accountNames]},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.lookupAccounts=function(lowerBoundName,limit,callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"lookup_accounts",params:[lowerBoundName,limit]},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.getAccountCount=function(callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"get_account_count"},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.getConversionRequests=function(accountName,callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"get_conversion_requests",params:[accountName]},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.getAccountHistory=function(account,from,limit,callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"get_account_history",params:[account,from,limit]},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.getOwnerHistory=function(account,callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"get_owner_history",params:[account]},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.getRecoveryRequest=function(account,callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"get_recovery_request",params:[account]},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.getOrderBook=function(limit,callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"getOrderBook",params:[limit]},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.getOpenOrders=function(owner,callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"get_open_orders",params:[owner]},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.getLiquidityQueue=function(startAccount,limit,callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"get_liquidity_queue",params:[startAccount,limit]},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.getTransactionHex=function(trx,callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"get_transaction_hex",params:[trx]},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.getTransaction=function(trxId,callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"get_transaction",params:[trxId]},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.getRequiredSignatures=function(trx,availableKeys,callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"get_required_signatures",params:[trx,availableKeys]},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.getPotentialSignatures=function(trx,callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"get_potential_signatures",params:[trx]},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.verifyAuthority=function(trx,callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"verify_authority",params:[trx]},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.verifyAccountAuthority=function(nameOrId,signers,callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"verify_account_authority",params:[nameOrId,signers]},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.getActiveVotes=function(author,permlink,callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"get_active_votes",params:[author,permlink]},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.getAccountVotes=function(voter,callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"get_account_votes",params:[voter]},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.getContent=function(author,permlink,callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"get_content",params:[author,permlink]},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.getContentReplies=function(parent,parentPermlink,callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"get_content_replies",params:[parent,parentPermlink]},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.getDiscussionsByAuthorBeforeDate=function(author,startPermlink,beforeDate,limit,callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"get_discussions_by_author_before_date",params:[author,startPermlink,beforeDate,limit]},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.getRepliesByLastUpdate=function(startAuthor,startPermlink,limit,callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"get_replies_by_last_update",params:[startAuthor,startPermlink,limit]},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.getWitnesses=function(witnessIds,callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"get_witnesses",params:[witnessIds]},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.getWitnessByAccount=function(accountName,callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"get_witness_by_account",params:[accountName]},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.getWitnessesByVote=function(from,limit,callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"get_witnesses_by_vote",params:[from,limit]},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.lookupWitnessAccounts=function(lowerBoundName,limit,callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"lookup_witness_accounts",params:[lowerBoundName,limit]},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.getWitnessCount=function(callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"get_witness_count"},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.getActiveWitnesses=function(callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"get_active_witnesses"},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.getMinerQueue=function(callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"get_miner_queue"},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.login=function(username,password,callback){var iterator=this.iterate();this.send("login_api",{id:iterator,method:"login",params:[username,password]},function(err,data){if(iterator==data.id){this.getApiByName("network_broadcast_api",function(){});callback(err,data.result)}}.bind(this))};Steem.getApiByName=function(apiName,callback){var iterator=this.iterate();this.send("login_api",{id:iterator,method:"get_api_by_name",params:[apiName]},function(err,data){if(iterator==data.id){this.apiIds[apiName]=data.result;callback(err,data.result)}}.bind(this))};Steem.getFollowers=function(following,startFollower,followType,limit,callback){var iterator=this.iterate();this.send("follow_api",{id:iterator,method:"get_followers",params:[following,startFollower,followType,limit]},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.getFollowing=function(follower,startFollowing,followType,limit,callback){var iterator=this.iterate();this.send("follow_api",{id:iterator,method:"get_following",params:[follower,startFollowing,followType,limit]},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.broadcastTransaction=function(trx,callback){var iterator=this.iterate();this.send("network_broadcast_api",{id:iterator,method:"broadcast_transaction",params:[trx]},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.broadcastTransactionSynchronous=function(trx,callback){var iterator=this.iterate();this.send("network_broadcast_api",{id:iterator,method:"broadcast_transaction_synchronous",params:[trx]},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.broadcastBlock=function(b,callback){var iterator=this.iterate();this.send("network_broadcast_api",{id:iterator,method:"broadcast_block",params:[b]},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.broadcastTransactionWithCallback=function(confirmationCallback,trx,callback){var iterator=this.iterate();this.send("network_broadcast_api",{id:iterator,method:"broadcast_transaction_with_callback",params:[confirmationCallback,trx]},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.streamBlockNumber=function(callback){var current="";var self=this;setInterval(function(){self.getDynamicGlobalProperties(function(err,result){var blockId=result.head_block_number;if(blockId!=current){current=blockId;callback(null,current)}})},200)};Steem.streamBlock=function(callback){var current="";var last="";var self=this;this.streamBlockNumber(function(err,id){current=id;if(current!=last){last=current;self.getBlock(current,function(err,result){callback(null,result)})}})};Steem.streamTransactions=function(callback){this.streamBlock(function(err,result){if(!!result){result.transactions.forEach(function(transaction){callback(null,transaction)})}})};Steem.streamOperations=function(callback){this.streamBlock(function(err,result){if(!!result){result.transactions.forEach(function(transaction){transaction.operations.forEach(function(operation){callback(null,operation)})})}})};module.exports=Steem},{"detect-node":5,ws:4}],2:[function(require,module,exports){steem={api:require("./api"),formatter:require("./formatter")}},{"./api":1,"./formatter":3}],3:[function(require,module,exports){module.exports={reputation:function(reputation){if(reputation==null)return reputation;reputation=parseInt(reputation);var rep=String(reputation);var neg=rep.charAt(0)==="-";rep=neg?rep.substring(1):rep;var str=rep;var leadingDigits=parseInt(str.substring(0,4));var log=Math.log(leadingDigits)/Math.log(10);var n=str.length-1;var out=n+(log-parseInt(log));if(isNaN(out))out=0;out=Math.max(out-9,0);out=(neg?-1:1)*out;out=out*9+25;out=parseInt(out);return out},vestToSteem:function(vestingShares,totalVestingShares,totalVestingFundSteem){return parseFloat(totalVestingFundSteem)*(parseFloat(vestingShares)/parseFloat(totalVestingShares))},commentPermlink:function(parentAuthor,parentPermlink){var timeStr=(new Date).toISOString().replace(/[^a-zA-Z0-9]+/g,"");parentPermlink=parentPermlink.replace(/(-\d{8}t\d{9}z)/g,"");return"re-"+parentAuthor+"-"+parentPermlink+"-"+timeStr},amount:function(amount,asset){return amount.toFixed(3)+" "+asset}}},{}],4:[function(require,module,exports){},{}],5:[function(require,module,exports){(function(global){module.exports=false;try{module.exports=Object.prototype.toString.call(global.process)==="[object process]"}catch(e){}}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}]},{},[2]);
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){var isNode=require("detect-node");if(isNode)var WS=require("ws");var Steem={url:"wss://steemit.com/wspa",apiIds:{database_api:0,login_api:1,follow_api:2,network_broadcast_api:4},id:0,reqs:[],isOpen:false,isReady:false};Steem.setWebSocket=function(url){this.url=url};Steem.init=function(callback){if(!this.isReady){if(isNode){this.ws=new WS(this.url);this.ws.setMaxListeners(0)}else{this.ws=new WebSocket(this.url)}this.ws.addEventListener("close",function(){this.ws.close();this.isReady=false;this.isOpen=false}.bind(this));this.isReady=true}if(!this.isOpen){this.ws.addEventListener("open",function(){this.isOpen=true;this.getApiByName("database_api",function(){});this.getApiByName("login_api",function(){});this.getApiByName("follow_api",function(){});this.getApiByName("network_broadcast_api",function(){});callback()}.bind(this))}else{callback()}};Steem.iterate=function(){this.id++;var id=this.id;this.reqs.push(id);return id};Steem.getApi=function(api,callback){if(this.apiIds[api]||this.apiIds[api]===0){callback("",this.apiIds[api])}else{this.getApiByName(api,function(err,result){this.apiIds[api]=result;callback("",result)}.bind(this))}};Steem.send=function(api,data,callback){data.id=data.id||0;data.params=data.params||[];this.init(function(){var call={};call.id=data.id;call.method="call";call.params=[this.apiIds[api],data.method,data.params];this.ws.send(JSON.stringify(call))}.bind(this));this.ws.addEventListener("message",function(msg){var data=JSON.parse(msg.data);var err=data.error&&data.error.data&&data.error.data.stack?data.error.data.stack:"";callback(err,data)}.bind(this));this.ws.addEventListener("error",function(error){callback(error,null)})};Steem.setSubscribeCallback=function(cb,clearFilter,callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"set_subscribe_callback",params:[callback,clearFilter]},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.setPendingTransactionCallback=function(cb,callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"set_pending_transaction_callback",params:[cb]},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.setBlockAppliedCallback=function(cb,callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"set_block_applied_callback",params:[cb]},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.cancelAllSubscriptions=function(callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"cancel_all_subscriptions"},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.getTrendingTags=function(afterTag,limit,callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"get_trending_tags",params:[afterTag,limit]},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.getDiscussionsByTrending=function(query,callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"get_discussions_by_trending",params:[query]},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.getDiscussionsByCreated=function(query,callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"get_discussions_by_created",params:[query]},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.getDiscussionsByActive=function(query,callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"get_discussions_by_active",params:[query]},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.getDiscussionsByCashout=function(query,callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"get_discussions_by_cashout",params:[query]},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.getDiscussionsByPayout=function(query,callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"get_discussions_by_payout",params:[query]},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.getDiscussionsByVotes=function(query,callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"get_discussions_by_votes",params:[query]},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.getDiscussionsByChildren=function(query,callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"get_discussions_by_children",params:[query]},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.getDiscussionsByHot=function(query,callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"get_discussions_by_hot",params:[query]},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.getDiscussionsByFeed=function(query,callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"get_discussions_by_feed",params:[query]},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.getBlockHeader=function(blockNum,callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"get_block_header",params:[blockNum]},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.getBlock=function(blockNum,callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"get_block",params:[blockNum]},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.getState=function(path,callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"get_state",params:[path]},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.getTrendingCategories=function(after,limit,callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"get_trending_categories",params:[after,limit]},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.getBestCategories=function(after,limit,callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"get_best_categories",params:[after,limit]},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.getActiveCategories=function(after,limit,callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"get_active_categories",params:[after,limit]},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.getRecentCategories=function(after,limit,callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"get_recent_categories",params:[after,limit]},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.getConfig=function(callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"get_config"},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.getDynamicGlobalProperties=function(callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"get_dynamic_global_properties"},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.getChainProperties=function(after,limit,callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"get_chain_properties"},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.getFeedHistory=function(callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"get_feed_history"},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.getCurrentMedianHistoryPrice=function(callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"get_current_median_history_price"},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.getWitnessSchedule=function(callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"get_recent_categories",params:[after,limit]},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.getHardforkVersion=function(callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"get_hardfork_version"},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.getNextScheduledHardfork=function(callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"get_next_scheduled_hardfork"},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.getKeyReferences=function(key,callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"get_key_references",params:[key]},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.getAccounts=function(names,callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"get_accounts",params:[names]},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.getAccountReferences=function(accountId,callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"get_account_references",params:[accountId]},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.lookupAccountNames=function(accountNames,callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"lookup_account_names",params:[accountNames]},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.lookupAccounts=function(lowerBoundName,limit,callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"lookup_accounts",params:[lowerBoundName,limit]},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.getAccountCount=function(callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"get_account_count"},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.getConversionRequests=function(accountName,callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"get_conversion_requests",params:[accountName]},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.getAccountHistory=function(account,from,limit,callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"get_account_history",params:[account,from,limit]},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.getOwnerHistory=function(account,callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"get_owner_history",params:[account]},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.getRecoveryRequest=function(account,callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"get_recovery_request",params:[account]},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.getOrderBook=function(limit,callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"getOrderBook",params:[limit]},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.getOpenOrders=function(owner,callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"get_open_orders",params:[owner]},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.getLiquidityQueue=function(startAccount,limit,callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"get_liquidity_queue",params:[startAccount,limit]},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.getTransactionHex=function(trx,callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"get_transaction_hex",params:[trx]},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.getTransaction=function(trxId,callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"get_transaction",params:[trxId]},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.getRequiredSignatures=function(trx,availableKeys,callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"get_required_signatures",params:[trx,availableKeys]},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.getPotentialSignatures=function(trx,callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"get_potential_signatures",params:[trx]},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.verifyAuthority=function(trx,callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"verify_authority",params:[trx]},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.verifyAccountAuthority=function(nameOrId,signers,callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"verify_account_authority",params:[nameOrId,signers]},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.getActiveVotes=function(author,permlink,callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"get_active_votes",params:[author,permlink]},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.getAccountVotes=function(voter,callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"get_account_votes",params:[voter]},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.getContent=function(author,permlink,callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"get_content",params:[author,permlink]},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.getContentReplies=function(parent,parentPermlink,callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"get_content_replies",params:[parent,parentPermlink]},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.getDiscussionsByAuthorBeforeDate=function(author,startPermlink,beforeDate,limit,callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"get_discussions_by_author_before_date",params:[author,startPermlink,beforeDate,limit]},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.getRepliesByLastUpdate=function(startAuthor,startPermlink,limit,callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"get_replies_by_last_update",params:[startAuthor,startPermlink,limit]},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.getWitnesses=function(witnessIds,callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"get_witnesses",params:[witnessIds]},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.getWitnessByAccount=function(accountName,callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"get_witness_by_account",params:[accountName]},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.getWitnessesByVote=function(from,limit,callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"get_witnesses_by_vote",params:[from,limit]},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.lookupWitnessAccounts=function(lowerBoundName,limit,callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"lookup_witness_accounts",params:[lowerBoundName,limit]},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.getWitnessCount=function(callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"get_witness_count"},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.getActiveWitnesses=function(callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"get_active_witnesses"},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.getMinerQueue=function(callback){var iterator=this.iterate();this.send("database_api",{id:iterator,method:"get_miner_queue"},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.login=function(username,password,callback){var iterator=this.iterate();this.send("login_api",{id:iterator,method:"login",params:[username,password]},function(err,data){if(iterator==data.id){this.getApiByName("network_broadcast_api",function(){});callback(err,data.result)}}.bind(this))};Steem.getApiByName=function(apiName,callback){var iterator=this.iterate();this.send("login_api",{id:iterator,method:"get_api_by_name",params:[apiName]},function(err,data){if(iterator==data.id){this.apiIds[apiName]=data.result;callback(err,data.result)}}.bind(this))};Steem.getFollowers=function(following,startFollower,followType,limit,callback){var iterator=this.iterate();this.send("follow_api",{id:iterator,method:"get_followers",params:[following,startFollower,followType,limit]},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.getFollowing=function(follower,startFollowing,followType,limit,callback){var iterator=this.iterate();this.send("follow_api",{id:iterator,method:"get_following",params:[follower,startFollowing,followType,limit]},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.broadcastTransaction=function(trx,callback){var iterator=this.iterate();this.send("network_broadcast_api",{id:iterator,method:"broadcast_transaction",params:[trx]},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.broadcastTransactionSynchronous=function(trx,callback){var iterator=this.iterate();this.send("network_broadcast_api",{id:iterator,method:"broadcast_transaction_synchronous",params:[trx]},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.broadcastBlock=function(b,callback){var iterator=this.iterate();this.send("network_broadcast_api",{id:iterator,method:"broadcast_block",params:[b]},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.broadcastTransactionWithCallback=function(confirmationCallback,trx,callback){var iterator=this.iterate();this.send("network_broadcast_api",{id:iterator,method:"broadcast_transaction_with_callback",params:[confirmationCallback,trx]},function(err,data){if(iterator==data.id)callback(err,data.result)})};Steem.streamBlockNumber=function(callback){var current="";var self=this;setInterval(function(){self.getDynamicGlobalProperties(function(err,result){var blockId=result.head_block_number;if(blockId!=current){current=blockId;callback(null,current)}})},200)};Steem.streamBlock=function(callback){var current="";var last="";var self=this;this.streamBlockNumber(function(err,id){current=id;if(current!=last){last=current;self.getBlock(current,function(err,result){callback(null,result)})}})};Steem.streamTransactions=function(callback){this.streamBlock(function(err,result){if(!!result){result.transactions.forEach(function(transaction){callback(null,transaction)})}})};Steem.streamOperations=function(callback){this.streamBlock(function(err,result){if(!!result){result.transactions.forEach(function(transaction){transaction.operations.forEach(function(operation){callback(null,operation)})})}})};module.exports=Steem},{"detect-node":5,ws:4}],2:[function(require,module,exports){steem={api:require("./api"),formatter:require("./formatter")}},{"./api":1,"./formatter":3}],3:[function(require,module,exports){module.exports={reputation:function(reputation){if(reputation==null)return reputation;reputation=parseInt(reputation);var rep=String(reputation);var neg=rep.charAt(0)==="-";rep=neg?rep.substring(1):rep;var str=rep;var leadingDigits=parseInt(str.substring(0,4));var log=Math.log(leadingDigits)/Math.log(10);var n=str.length-1;var out=n+(log-parseInt(log));if(isNaN(out))out=0;out=Math.max(out-9,0);out=(neg?-1:1)*out;out=out*9+25;out=parseInt(out);return out},vestToSteem:function(vestingShares,totalVestingShares,totalVestingFundSteem){return parseFloat(totalVestingFundSteem)*(parseFloat(vestingShares)/parseFloat(totalVestingShares))},commentPermlink:function(parentAuthor,parentPermlink){var timeStr=(new Date).toISOString().replace(/[^a-zA-Z0-9]+/g,"");parentPermlink=parentPermlink.replace(/(-\d{8}t\d{9}z)/g,"");return"re-"+parentAuthor+"-"+parentPermlink+"-"+timeStr},amount:function(amount,asset){return amount.toFixed(3)+" "+asset}}},{}],4:[function(require,module,exports){},{}],5:[function(require,module,exports){(function(global){module.exports=false;try{module.exports=Object.prototype.toString.call(global.process)==="[object process]"}catch(e){}}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}]},{},[2]);
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc