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

steem

Package Overview
Dependencies
Maintainers
3
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.28 to 0.3.30

.dockerignore

93

lib/api.js

@@ -5,6 +5,2 @@ 'use strict';

var _debug = require('debug');
var _debug2 = _interopRequireDefault(_debug);
var _events = require('events');

@@ -30,2 +26,6 @@

var _debug = require('debug');
var _debug2 = _interopRequireDefault(_debug);
var _methods = require('./methods');

@@ -48,2 +48,3 @@

var debugSetup = (0, _debug2.default)('steem:setup');
var debugApiIds = (0, _debug2.default)('steem:api_ids');
var debugWs = (0, _debug2.default)('steem:ws');

@@ -65,4 +66,4 @@

login_api: 1,
follow_api: 3,
network_broadcast_api: 2
follow_api: 2,
network_broadcast_api: 4
},

@@ -91,2 +92,5 @@ id: 0

_this.releases = [];
// A Map of api name to a promise to it's API ID refresh call
_this.apiIdsP = {};
return _this;

@@ -152,3 +156,3 @@ }

if (this.ws) this.ws.close();
delete this.apiIdsP;
this.apiIdsP = {};
delete this.startP;

@@ -172,22 +176,38 @@ delete this.ws;

}
/**
* Refreshes API IDs, populating the `Steem::apiIdsP` map.
*
* @param {String} [requestName] If provided, only this API will be refreshed
* @param {Boolean} [force] If true the API will be forced to refresh, ignoring existing results
*/
}, {
key: 'getApiIds',
value: function getApiIds() {
value: function getApiIds(requestName, force) {
var _this3 = this;
if (this.apiIdsP) return this.apiIdsP;
this.apiIdsP = _bluebird2.default.map(Object.keys(this.apiIds), function (name) {
debugSetup('Syncing API IDs', name);
return _this3.getApiByNameAsync(name).then(function (result) {
if (!force && requestName && this.apiIdsP[requestName]) {
return this.apiIdsP[requestName];
}
var apiNamesToRefresh = requestName ? [requestName] : Object.keys(this.apiIds);
apiNamesToRefresh.forEach(function (name) {
debugApiIds('Syncing API ID', name);
_this3.apiIdsP[name] = _this3.getApiByNameAsync(name).then(function (result) {
if (result != null) {
_this3.apiIds[name] = result;
} else {
debugSetup('Dropped null API ID for', name, result);
debugApiIds('Dropped null API ID for', name, result);
}
});
}).then(function (ret) {
debugSetup('DONE - Synced API IDs', _this3.apiIds);
return ret;
});
return this.apiIdsP;
// If `requestName` was provided, only wait for this API ID
if (requestName) {
return this.apiIdsP[requestName];
}
// Otherwise wait for all of them
return _bluebird2.default.props(this.apiIdsP);
}

@@ -222,10 +242,8 @@ }, {

// const currentP = this.currentP;
var apiIdsP = api === 'login_api' && data.method === 'get_api_by_name' ? _bluebird2.default.fulfilled() : this.getApiIds(api);
var apiIdsP = api === 'login_api' && data.method === 'get_api_by_name' ? _bluebird2.default.fulfilled() : this.getApiIds();
if (api === 'login_api' && data.method === 'get_api_by_name') {
debugProtocol('Sending setup message');
debugApiIds('Sending setup message');
} else {
debugProtocol('Going to wait for setup messages to resolve');
debugApiIds('Going to wait for setup messages to resolve');
}

@@ -248,4 +266,4 @@

// We're still seeing old messages
if (message.id < id) {
debugProtocol('Old message was dropped', message);
if (message.id !== id) {
debugProtocol('Different message was dropped', message);
return;

@@ -257,14 +275,9 @@ }

// We dropped a message
if (message.id !== id) {
debugProtocol('Response to RPC call was dropped', payload);
reject(new Error('The response to this RPC call was dropped, please file this as a bug at https://github.com/adcpm/steem/issues'));
return;
}
// Our message's response came back
var errorCause = data.error;
var errorCause = message.error;
if (errorCause) {
var err = new Error(errorCause);
err.message = data;
var err = new Error(
// eslint-disable-next-line prefer-template
(errorCause.message || 'Failed to complete operation') + ' (see err.payload for the full error payload)');
err.payload = message;
reject(err);

@@ -274,2 +287,7 @@ return;

if (api === 'login_api' && data.method === 'login') {
debugApiIds('network_broadcast_api API ID depends on the WS\' session. ' + 'Triggering a refresh...');
_this5.getApiIds('network_broadcast_api', true);
}
debugProtocol('Resolved', api, data, '->', message);

@@ -282,8 +300,3 @@ resolve(message.result);

});
}).then(function (result) {
return callback(null, result);
}, function (err) {
callback(err);
throw err;
});
}).nodeify(callback);

@@ -290,0 +303,0 @@ this.inFlight += 1;

'use strict';
var steemAuth = require('steemauth');
var steemApi = require('./api');
var formatter = require('./formatter');
var _clone = require('lodash/clone');
module.exports = {
var _clone2 = _interopRequireDefault(_clone);
var _debug = require('debug');
var _debug2 = _interopRequireDefault(_debug);
var _steemauth = require('steemauth');
var _steemauth2 = _interopRequireDefault(_steemauth);
var _formatter = require('./formatter');
var _formatter2 = _interopRequireDefault(_formatter);
var _api = require('./api');
var _api2 = _interopRequireDefault(_api);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var debug = (0, _debug2.default)('steem:broadcast');
exports = module.exports = {
send: function send(tx, privKeys, callback) {
steemApi.login('', '', function () {
steemApi.getDynamicGlobalProperties(function (err, result) {
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;
tx.ref_block_prefix = new Buffer(result.head_block_id, 'hex').readUInt32LE(4);
var signedTransaction = steemAuth.signTransaction(tx, privKeys);
steemApi.broadcastTransactionWithCallback(function () {}, signedTransaction, function (err, result) {
callback(err, result);
});
_api2.default.login('', '', function () {
_api2.default.getDynamicGlobalProperties(function (err, result) {
if (err) {
callback(err);
return;
}
var output = (0, _clone2.default)(result);
var transaction = (0, _clone2.default)(tx);
output.timestamp = output.timestamp || Date.now();
var expiration = new Date(output.timestamp + 15 * 1000);
transaction.expiration = expiration.toISOString().replace('Z', '');
transaction.ref_block_num = output.head_block_number & 0xFFFF;
transaction.ref_block_prefix = new Buffer(output.head_block_id, 'hex').readUInt32LE(4);
debug('Signing transaction (transaction, transaction.operations)', transaction, transaction.operations);
var signedTransaction = _steemauth2.default.signTransaction(transaction, privKeys);
_api2.default.broadcastTransactionWithCallback(function () {}, signedTransaction, callback);
});
});
},
vote: function vote(wif, voter, author, permlink, weight, callback) {

@@ -35,40 +63,25 @@ var tx = {

};
this.send(tx, { posting: wif }, function (err, result) {
callback(err, result);
});
exports.send(tx, { posting: wif }, callback);
},
upvote: function upvote(wif, voter, author, permlink, weight, callback) {
weight = weight || 10000;
vote(wif, author, permlink, weight, function (err, result) {
callback(err, result);
});
exports.vote(wif, voter, author, permlink, weight || 10000, callback);
},
downvote: function downvote(wif, voter, author, permlink, weight, callback) {
weight = weight || 10000;
vote(wif, author, permlink, -Math.abs(weight), function (err, result) {
callback(err, result);
});
exports.vote(wif, voter, author, permlink, -Math.abs(weight || 10000), callback);
},
comment: function comment(wif, parentAuthor, parentPermlink, author, permlink, title, body, jsonMetadata, callback) {
permlink = permlink || formatter.commentPermlink(parentAuthor, parentPermlink);
var tx = {
extensions: [],
operations: [['comment', {
parent_author: parentAuthor,
parent_permlink: parentPermlink,
author: author,
permlink: permlink,
title: title,
body: body,
parent_author: parentAuthor,
parent_permlink: parentPermlink,
permlink: permlink || _formatter2.default.commentPermlink(parentAuthor, parentPermlink),
json_metadata: JSON.stringify(jsonMetadata)
}]]
};
this.send(tx, { posting: wif }, function (err, result) {
callback(err, result);
});
exports.send(tx, { posting: wif }, callback);
},
transfer: function transfer(wif, from, to, amount, memo, callback) {

@@ -84,7 +97,4 @@ var tx = {

};
this.send(tx, { active: wif }, function (err, result) {
callback(err, result);
});
exports.send(tx, { active: wif }, callback);
},
transferToVesting: function transferToVesting(wif, from, to, amount, callback) {

@@ -99,7 +109,4 @@ var tx = {

};
this.send(tx, { active: wif }, function (err, result) {
callback(err, result);
});
exports.send(tx, { active: wif }, callback);
},
withdrawVesting: function withdrawVesting(wif, account, vestingShares, callback) {

@@ -113,7 +120,4 @@ var tx = {

};
this.send(tx, { active: wif }, function (err, result) {
callback(err, result);
});
exports.send(tx, { active: wif }, callback);
},
limitOrderCreate: function limitOrderCreate(wif, owner, orderid, amountToSell, minToReceive, fillOrKill, expiration, callback) {

@@ -125,13 +129,10 @@ var tx = {

orderid: orderid,
expiration: expiration,
amount_to_sell: amountToSell,
min_to_receive: minToReceive,
fill_or_kill: fillOrKill,
expiration: expiration
fill_or_kill: fillOrKill
}]]
};
this.send(tx, { active: wif }, function (err, result) {
callback(err, result);
});
exports.send(tx, { active: wif }, callback);
},
limitOrderCancel: function limitOrderCancel(wif, owner, orderid, callback) {

@@ -145,7 +146,4 @@ var tx = {

};
this.send(tx, { active: wif }, function (err, result) {
callback(err, result);
});
exports.send(tx, { active: wif }, callback);
},
feedPublish: function feedPublish(wif, publisher, exchangeRate, callback) {

@@ -159,7 +157,4 @@ var tx = {

};
this.send(tx, { posting: wif }, function (err, result) {
callback(err, result);
});
exports.send(tx, { posting: wif }, callback);
},
convert: function convert(wif, owner, requestid, amount, callback) {

@@ -174,7 +169,4 @@ var tx = {

};
this.send(tx, { active: wif }, function (err, result) {
callback(err, result);
});
exports.send(tx, { active: wif }, callback);
},
accountCreate: function accountCreate(wif, fee, creator, newAccountName, owner, active, posting, memoKey, jsonMetadata, callback) {

@@ -186,6 +178,6 @@ var tx = {

creator: creator,
new_account_name: newAccountName,
owner: owner,
active: active,
posting: posting,
new_account_name: newAccountName,
memo_key: memoKey,

@@ -195,7 +187,4 @@ json_metadata: JSON.stringify(jsonMetadata)

};
this.send(tx, { owner: wif }, function (err, result) {
callback(err, result);
});
exports.send(tx, { owner: wif }, callback);
},
accountUpdate: function accountUpdate(wif, account, owner, active, posting, memoKey, jsonMetadata, callback) {

@@ -213,7 +202,4 @@ var tx = {

};
this.send(tx, { owner: wif }, function (err, result) {
callback(err, result);
});
exports.send(tx, { owner: wif }, callback);
},
witnessUpdate: function witnessUpdate(wif, owner, url, blockSigningKey, props, fee, callback) {

@@ -225,12 +211,9 @@ var tx = {

url: url,
block_signing_key: blockSigningKey,
props: props,
fee: fee
fee: fee,
block_signing_key: blockSigningKey
}]]
};
this.send(tx, { posting: wif }, function (err, result) {
callback(err, result);
});
exports.send(tx, { posting: wif }, callback);
},
accountWitnessVote: function accountWitnessVote(wif, account, witness, approve, callback) {

@@ -245,7 +228,4 @@ var tx = {

};
this.send(tx, { posting: wif }, function (err, result) {
callback(err, result);
});
exports.send(tx, { posting: wif }, callback);
},
accountWitnessProxy: function accountWitnessProxy(wif, account, proxy, callback) {

@@ -259,7 +239,4 @@ var tx = {

};
this.send(tx, { posting: wif }, function (err, result) {
callback(err, result);
});
exports.send(tx, { posting: wif }, callback);
},
pow: function pow(wif, worker, input, signature, work, callback) {

@@ -275,7 +252,4 @@ var tx = {

};
this.send(tx, { posting: wif }, function (err, result) {
callback(err, result);
});
exports.send(tx, { posting: wif }, callback);
},
custom: function custom(wif, requiredAuths, id, data, callback) {

@@ -285,12 +259,9 @@ var tx = {

operations: [['custom', {
required_auths: requiredAuths,
id: id,
data: data
data: data,
required_auths: requiredAuths
}]]
};
this.send(tx, { posting: wif }, function (err, result) {
callback(err, result);
});
exports.send(tx, { posting: wif }, callback);
},
reportOverProduction: function reportOverProduction(wif, reporter, firstBlock, secondBlock, callback) {

@@ -305,7 +276,4 @@ var tx = {

};
this.send(tx, { posting: wif }, function (err, result) {
callback(err, result);
});
exports.send(tx, { posting: wif }, callback);
},
deleteComment: function deleteComment(wif, author, permlink, callback) {

@@ -319,7 +287,4 @@ var tx = {

};
this.send(tx, { posting: wif }, function (err, result) {
callback(err, result);
});
exports.send(tx, { posting: wif }, callback);
},
customJson: function customJson(wif, requiredAuths, requiredPostingAuths, id, json, callback) {

@@ -329,13 +294,10 @@ var tx = {

operations: [['custom_json', {
id: id,
json: json,
required_auths: requiredAuths,
required_posting_auths: requiredPostingAuths,
id: id,
json: json
required_posting_auths: requiredPostingAuths
}]]
};
this.send(tx, { posting: wif }, function (err, result) {
callback(err, result);
});
exports.send(tx, { posting: wif }, callback);
},
commentOptions: function commentOptions(wif, author, permlink, maxAcceptedPayout, percentSteemDollars, allowVotes, allowCurationRewards, extensions, callback) {

@@ -346,2 +308,3 @@ var tx = {

author: author,
extensions: extensions,
permlink: permlink,

@@ -351,11 +314,7 @@ max_accepted_payout: maxAcceptedPayout,

allow_votes: allowVotes,
allow_curation_rewards: allowCurationRewards,
extensions: extensions
allow_curation_rewards: allowCurationRewards
}]]
};
this.send(tx, { posting: wif }, function (err, result) {
callback(err, result);
});
exports.send(tx, { posting: wif }, callback);
},
setWithdrawVestingRoute: function setWithdrawVestingRoute(wif, fromAccount, toAccount, percent, autoVest, callback) {

@@ -371,7 +330,4 @@ var tx = {

};
this.send(tx, { active: wif }, function (err, result) {
callback(err, result);
});
exports.send(tx, { active: wif }, callback);
},
limitOrderCreate2: function limitOrderCreate2(wif, owner, orderid, amountToSell, exchangeRate, fillOrKill, expiration, callback) {

@@ -381,2 +337,3 @@ var tx = {

operations: [['limit_order_create2', {
expiration: expiration,
owner: owner,

@@ -386,11 +343,7 @@ orderid: orderid,

exchange_rate: exchangeRate,
fill_or_kill: fillOrKill,
expiration: expiration
fill_or_kill: fillOrKill
}]]
};
this.send(tx, { active: wif }, function (err, result) {
callback(err, result);
});
exports.send(tx, { active: wif }, callback);
},
challengeAuthority: function challengeAuthority(wif, challenger, challenged, requireOwner, callback) {

@@ -405,7 +358,4 @@ var tx = {

};
this.send(tx, { posting: wif }, function (err, result) {
callback(err, result);
});
exports.send(tx, { posting: wif }, callback);
},
proveAuthority: function proveAuthority(wif, challenged, requireOwner, callback) {

@@ -419,7 +369,4 @@ var tx = {

};
this.send(tx, { posting: wif }, function (err, result) {
callback(err, result);
});
exports.send(tx, { posting: wif }, callback);
},
requestAccountRecovery: function requestAccountRecovery(wif, recoveryAccount, accountToRecover, newOwnerAuthority, extensions, callback) {

@@ -429,13 +376,10 @@ var tx = {

operations: [['request_account_recovery', {
extensions: extensions,
recovery_account: recoveryAccount,
account_to_recover: accountToRecover,
new_owner_authority: newOwnerAuthority,
extensions: extensions
new_owner_authority: newOwnerAuthority
}]]
};
this.send(tx, { owner: wif }, function (err, result) {
callback(err, result);
});
exports.send(tx, { owner: wif }, callback);
},
recoverAccount: function recoverAccount(wif, accountToRecover, newOwnerAuthority, recentOwnerAuthority, extensions, callback) {

@@ -445,13 +389,10 @@ var tx = {

operations: [['recover_account', {
extensions: extensions,
account_to_recover: accountToRecover,
new_owner_authority: newOwnerAuthority,
recent_owner_authority: recentOwnerAuthority,
extensions: extensions
recent_owner_authority: recentOwnerAuthority
}]]
};
this.send(tx, { owner: wif }, function (err, result) {
callback(err, result);
});
exports.send(tx, { owner: wif }, callback);
},
changeRecoveryAccount: function changeRecoveryAccount(wif, accountToRecover, newRecoveryAccount, extensions, callback) {

@@ -461,12 +402,9 @@ var tx = {

operations: [['change_recovery_account', {
extensions: extensions,
account_to_recover: accountToRecover,
new_recovery_account: newRecoveryAccount,
extensions: extensions
new_recovery_account: newRecoveryAccount
}]]
};
this.send(tx, { owner: wif }, function (err, result) {
callback(err, result);
});
exports.send(tx, { owner: wif }, callback);
},
escrowTransfer: function escrowTransfer(wif, from, to, amount, memo, escrowId, agent, fee, jsonMeta, expiration, callback) {

@@ -487,7 +425,6 @@ var tx = {

};
this.send(tx, { posting: wif }, function (err, result) {
exports.send(tx, { posting: wif }, function (err, result) {
callback(err, result);
});
},
escrowDispute: function escrowDispute(wif, from, to, escrowId, who, callback) {

@@ -503,7 +440,6 @@ var tx = {

};
this.send(tx, { posting: wif }, function (err, result) {
exports.send(tx, { posting: wif }, function (err, result) {
callback(err, result);
});
},
escrowRelease: function escrowRelease(wif, from, to, escrowId, who, amount, callback) {

@@ -520,7 +456,6 @@ var tx = {

};
this.send(tx, { posting: wif }, function (err, result) {
exports.send(tx, { posting: wif }, function (err, result) {
callback(err, result);
});
},
fillConvertRequest: function fillConvertRequest(wif, owner, requestid, amountIn, amountOut, callback) {

@@ -536,7 +471,6 @@ var tx = {

};
this.send(tx, { active: wif }, function (err, result) {
exports.send(tx, { active: wif }, function (err, result) {
callback(err, result);
});
},
commentReward: function commentReward(wif, author, permlink, sbdPayout, vestingPayout, callback) {

@@ -552,7 +486,6 @@ var tx = {

};
this.send(tx, { posting: wif }, function (err, result) {
exports.send(tx, { posting: wif }, function (err, result) {
callback(err, result);
});
},
curateReward: function curateReward(wif, curator, reward, commentAuthor, commentPermlink, callback) {

@@ -568,7 +501,6 @@ var tx = {

};
this.send(tx, { active: wif }, function (err, result) {
exports.send(tx, { active: wif }, function (err, result) {
callback(err, result);
});
},
liquidityReward: function liquidityReward(wif, owner, payout, callback) {

@@ -582,7 +514,6 @@ var tx = {

};
this.send(tx, { active: wif }, function (err, result) {
exports.send(tx, { active: wif }, function (err, result) {
callback(err, result);
});
},
interest: function interest(wif, owner, _interest, callback) {

@@ -596,7 +527,6 @@ var tx = {

};
this.send(tx, { active: wif }, function (err, result) {
exports.send(tx, { active: wif }, function (err, result) {
callback(err, result);
});
},
fillVestingWithdraw: function fillVestingWithdraw(wif, fromAccount, toAccount, withdrawn, deposited, callback) {

@@ -612,7 +542,6 @@ var tx = {

};
this.send(tx, { active: wif }, function (err, result) {
exports.send(tx, { active: wif }, function (err, result) {
callback(err, result);
});
},
fillOrder: function fillOrder(wif, currentOwner, currentOrderid, currentPays, openOwner, openOrderid, openPays, callback) {

@@ -630,7 +559,6 @@ var tx = {

};
this.send(tx, { posting: wif }, function (err, result) {
exports.send(tx, { posting: wif }, function (err, result) {
callback(err, result);
});
},
commentPayout: function commentPayout(wif, author, permlink, payout, callback) {

@@ -645,3 +573,3 @@ var tx = {

};
this.send(tx, { posting: wif }, function (err, result) {
exports.send(tx, { posting: wif }, function (err, result) {
callback(err, result);

@@ -648,0 +576,0 @@ });

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

@@ -35,2 +35,3 @@ "main": "index.js",

"detect-node": "^2.0.3",
"lodash": "^4.16.4",
"steemauth": "0.0.16",

@@ -47,4 +48,2 @@ "ws": "^1.1.1"

"bluebird": "^3.4.6",
"browserify": "^13.0.1",
"bufferutil": "^1.2.1",
"eslint": "^3.5.0",

@@ -59,4 +58,2 @@ "eslint-config-airbnb": "^11.1.0",

"should": "^11.1.0",
"uglifyjs": "^2.4.10",
"utf-8-validate": "^1.2.1",
"webpack": "^1.13.2",

@@ -63,0 +60,0 @@ "webpack-visualizer-plugin": "^0.1.5"

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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