Huge News!Announcing our $40M Series B led by Abstract Ventures.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.7.7 to 0.7.8

test/smt.test.js

4

lib/api/methods.js

@@ -409,2 +409,6 @@ "use strict";

"params": ["start", "limit", "order_by", "order_direction", "status"]
}, {
"api": "condenser_api",
"method": "get_nai_pool",
"params": []
}];

36

lib/auth/serializer/src/ChainTypes.js

@@ -61,16 +61,24 @@ "use strict";

remove_proposal: 46,
fill_convert_request: 47,
author_reward: 48,
curation_reward: 49,
comment_reward: 50,
liquidity_reward: 51,
interest: 52,
fill_vesting_withdraw: 53,
fill_order: 54,
shutdown_witness: 55,
fill_transfer_from_savings: 56,
hardfork: 57,
comment_payout_update: 58,
return_vesting_delegation: 59,
comment_benefactor_reward: 60
claim_reward_balance2: 47,
vote2: 48,
smt_setup: 49,
smt_setup_emissions: 50,
smt_set_setup_parameters: 51,
smt_set_runtime_parameters: 52,
smt_create: 53,
smt_contribute: 54,
fill_convert_request: 55,
author_reward: 56,
curation_reward: 57,
comment_reward: 58,
liquidity_reward: 59,
interest: 60,
fill_vesting_withdraw: 61,
fill_order: 62,
shutdown_witness: 63,
fill_transfer_from_savings: 64,
hardfork: 65,
comment_payout_update: 66,
return_vesting_delegation: 67,
comment_benefactor_reward: 68
};

@@ -77,0 +85,0 @@

@@ -45,6 +45,9 @@ "use strict";

var uint16 = _types2.default.uint16,
var uint8 = _types2.default.uint8,
uint16 = _types2.default.uint16,
int16 = _types2.default.int16,
uint32 = _types2.default.uint32,
int16 = _types2.default.int16,
uint64 = _types2.default.uint64,
int64 = _types2.default.int64,
uint128 = _types2.default.uint128,
string = _types2.default.string,

@@ -61,3 +64,4 @@ string_binary = _types2.default.string_binary,

optional = _types2.default.optional,
asset = _types2.default.asset;
asset = _types2.default.asset,
asset_symbol = _types2.default.asset_symbol;

@@ -68,2 +72,4 @@

var version = _types2.default.void;
var required_automated_actions = _types2.default.void;
var optional_automated_actions = _types2.default.void;

@@ -91,2 +97,54 @@ // Place-holder, their are dependencies on "operation" .. The final list of

var votable_asset_options = new Serializer("votable_asset_options", {
max_accepted_payout: int64,
allow_curation_rewards: bool,
beneficiaries: comment_payout_beneficiaries
});
var allowed_vote_assets = new Serializer(1, {
votable_assets: map(asset_symbol, votable_asset_options)
});
var smt_generation_unit = new Serializer("smt_generation_unit", {
steem_unit: map(string, uint16),
token_unit: map(string, uint16)
});
var smt_capped_generation_policy = new Serializer(0, {
pre_soft_cap_unit: smt_generation_unit,
post_soft_cap_unit: smt_generation_unit,
min_unit_ratio: uint32,
max_unit_ratio: uint32,
extensions: set(future_extensions)
});
var smt_emissions_unit = new Serializer("smt_emissions_unit", {
token_unit: map(string, uint16)
});
var smt_param_allow_voting = new Serializer(0, {
value: bool
});
var smt_param_windows_v1 = new Serializer(0, {
cashout_window_seconds: uint32,
reverse_auction_window_seconds: uint32
});
var smt_param_vote_regeneration_period_seconds_v1 = new Serializer(1, {
vote_regeneration_period_seconds: uint32,
votes_per_regeneration_period: uint32
});
var smt_param_rewards_v1 = new Serializer(2, {
content_constant: uint128,
percent_curation_rewards: uint16,
author_reward_curve: int64,
curation_reward_curve: int64
});
var smt_param_allow_downvotes = new Serializer(3, {
value: bool
});
// Custom-types after Generated code

@@ -130,3 +188,3 @@

transaction_merkle_root: bytes(20),
extensions: set(static_variant([future_extensions, version, hardfork_version_vote])),
extensions: set(static_variant([future_extensions, version, hardfork_version_vote, required_automated_actions, optional_automated_actions])),
witness_signature: bytes(65),

@@ -149,3 +207,3 @@ transactions: array(signed_transaction)

transaction_merkle_root: bytes(20),
extensions: set(static_variant([future_extensions, version, hardfork_version_vote])),
extensions: set(static_variant([future_extensions, version, hardfork_version_vote, required_automated_actions, optional_automated_actions])),
witness_signature: bytes(65)

@@ -308,3 +366,3 @@ });

allow_curation_rewards: bool,
extensions: set(static_variant([comment_payout_beneficiaries]))
extensions: set(static_variant([comment_payout_beneficiaries, allowed_vote_assets]))
});

@@ -544,2 +602,79 @@

var claim_reward_balance2 = new Serializer("claim_reward_balance2", {
account: string,
reward_tokens: array(asset),
extensions: set(future_extensions)
});
var vote2 = new Serializer("vote2", {
voter: string,
author: string,
permlink: string,
rshares: map(asset_symbol, int64),
extensions: set(future_extensions)
});
var smt_create = new Serializer("smt_create", {
control_account: string,
symbol: asset_symbol,
smt_creation_fee: asset,
precision: uint8,
extensions: set(future_extensions)
});
var smt_setup = new Serializer("smt_setup", {
control_account: string,
symbol: asset_symbol,
max_supply: int64,
initial_generation_policy: static_variant([smt_capped_generation_policy]),
contribution_begin_time: time_point_sec,
contribution_end_time: time_point_sec,
launch_time: time_point_sec,
steem_units_min: int64,
steem_units_soft_cap: int64,
steem_units_hard_cap: int64,
extensions: set(future_extensions)
});
var smt_setup_emissions = new Serializer("smt_setup_emissions", {
control_account: string,
symbol: asset_symbol,
schedule_time: time_point_sec,
emissions_unit: smt_emissions_unit,
interval_seconds: uint32,
interval_count: uint32,
lep_time: time_point_sec,
rep_time: time_point_sec,
lep_abs_amount: int64,
rep_abs_amount: int64,
lep_rel_amount_numerator: uint32,
rep_rel_amount_numerator: uint32,
rel_amount_denom_bits: uint8,
remove: bool,
floor_emissions: bool,
extensions: set(future_extensions)
});
var smt_set_setup_parameters = new Serializer("smt_set_setup_parameters", {
control_account: string,
symbol: asset_symbol,
setup_parameters: set(static_variant([smt_param_allow_voting])),
extensions: set(future_extensions)
});
var smt_set_runtime_parameters = new Serializer("smt_set_runtime_parameters", {
control_account: string,
symbol: asset_symbol,
runtime_parameters: set(static_variant([smt_param_windows_v1, smt_param_vote_regeneration_period_seconds_v1, smt_param_rewards_v1, smt_param_allow_downvotes])),
extensions: set(future_extensions)
});
var smt_contribute = new Serializer("smt_contribute", {
contributor: string,
symbol: asset_symbol,
contribution_id: uint32,
contribution: asset,
extensions: set(future_extensions)
});
var fill_convert_request = new Serializer("fill_convert_request", {

@@ -628,3 +763,3 @@ owner: string,

operation.st_operations = [vote, comment, transfer, transfer_to_vesting, withdraw_vesting, limit_order_create, limit_order_cancel, feed_publish, convert, account_create, account_update, witness_update, account_witness_vote, account_witness_proxy, pow, custom, report_over_production, delete_comment, custom_json, comment_options, set_withdraw_vesting_route, limit_order_create2, claim_account, create_claimed_account, request_account_recovery, recover_account, change_recovery_account, escrow_transfer, escrow_dispute, escrow_release, pow2, escrow_approve, transfer_to_savings, transfer_from_savings, cancel_transfer_from_savings, custom_binary, decline_voting_rights, reset_account, set_reset_account, claim_reward_balance, delegate_vesting_shares, account_create_with_delegation, witness_set_properties, account_update2, create_proposal, update_proposal_votes, remove_proposal, fill_convert_request, author_reward, curation_reward, comment_reward, liquidity_reward, interest, fill_vesting_withdraw, fill_order, shutdown_witness, fill_transfer_from_savings, hardfork, comment_payout_update, return_vesting_delegation, comment_benefactor_reward];
operation.st_operations = [vote, comment, transfer, transfer_to_vesting, withdraw_vesting, limit_order_create, limit_order_cancel, feed_publish, convert, account_create, account_update, witness_update, account_witness_vote, account_witness_proxy, pow, custom, report_over_production, delete_comment, custom_json, comment_options, set_withdraw_vesting_route, limit_order_create2, claim_account, create_claimed_account, request_account_recovery, recover_account, change_recovery_account, escrow_transfer, escrow_dispute, escrow_release, pow2, escrow_approve, transfer_to_savings, transfer_from_savings, cancel_transfer_from_savings, custom_binary, decline_voting_rights, reset_account, set_reset_account, claim_reward_balance, delegate_vesting_shares, account_create_with_delegation, witness_set_properties, account_update2, create_proposal, update_proposal_votes, remove_proposal, claim_reward_balance2, vote2, smt_setup, smt_setup_emissions, smt_set_setup_parameters, smt_set_runtime_parameters, smt_create, smt_contribute, fill_convert_request, author_reward, curation_reward, comment_reward, liquidity_reward, interest, fill_vesting_withdraw, fill_order, shutdown_witness, fill_transfer_from_savings, hardfork, comment_payout_update, return_vesting_delegation, comment_benefactor_reward];

@@ -631,0 +766,0 @@ var transaction = new Serializer("transaction", {

'use strict';
var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
var _ecc = require('../../ecc');

@@ -17,4 +17,5 @@

var chain_types = require('./ChainTypes');
//const BigInt = require('BigInt')
var Types = {};
var Types = { useTestNet: false };
module.exports = Types;

@@ -24,2 +25,36 @@

// Highly optimized implementation of Damm algorithm
// https://en.wikipedia.org/wiki/Damm_algorithm
function damm_checksum_8digit(value) {
if (value >= 100000000) throw new Error("Expected value less than 100000000, instead got " + value);
var t = [0, 30, 10, 70, 50, 90, 80, 60, 40, 20, 70, 0, 90, 20, 10, 50, 40, 80, 60, 30, 40, 20, 0, 60, 80, 70, 10, 30, 50, 90, 10, 70, 50, 0, 90, 80, 30, 40, 20, 60, 60, 10, 20, 30, 0, 40, 50, 90, 70, 80, 30, 60, 70, 40, 20, 0, 90, 50, 80, 10, 50, 80, 60, 90, 70, 20, 0, 10, 30, 40, 80, 90, 40, 50, 30, 60, 20, 0, 10, 70, 90, 40, 30, 80, 60, 10, 70, 20, 0, 50, 20, 50, 80, 10, 40, 30, 60, 70, 90, 0];
var q0 = value / 10;
var d0 = value % 10;
var q1 = q0 / 10;
var d1 = q0 % 10;
var q2 = q1 / 10;
var d2 = q1 % 10;
var q3 = q2 / 10;
var d3 = q2 % 10;
var q4 = q3 / 10;
var d4 = q3 % 10;
var q5 = q4 / 10;
var d5 = q4 % 10;
var d6 = q5 % 10;
var d7 = q5 / 10;
var x = t[d7];
x = t[x + d6];
x = t[x + d5];
x = t[x + d4];
x = t[x + d3];
x = t[x + d2];
x = t[x + d1];
x = t[x + d0];
return x / 10;
}
/**

@@ -35,2 +70,12 @@ * Asset symbols contain the following information

* is easily converted to something that can be displayed.
*
* Legacy serialization of assets
* 0000pppp aaaaaaaa bbbbbbbb cccccccc dddddddd eeeeeeee ffffffff 00000000
* Symbol = abcdef
*
* NAI serialization of assets
* aaa1pppp bbbbbbbb cccccccc dddddddd
* NAI = (MSB to LSB) dddddddd cccccccc bbbbbbbb aaa
*
* NAI internal storage of legacy assets
*/

@@ -41,28 +86,93 @@ Types.asset = {

var precision = b.readUint8();
var b_copy = b.copy(b.offset, b.offset + 7);
var symbol = new Buffer(b_copy.toBinary(), "binary").toString().replace(/\x00/g, "");
b.skip(7);
// "1.000 STEEM" always written with full precision
var amount_string = (0, _number_utils.fromImpliedDecimal)(amount, precision);
var amount_string = "";
var symbol = "";
if (precision >= 16) {
// NAI Case
var b_copy = b.copy(b.offset - 1, b.offset + 3);
var nai = new Buffer(b_copy.toBinary(), "binary").readInt32();
nai = nai / 32;
symbol = "@@" + nai.toString().padStart(8, '0') + damm_checksum_8digit(nai).to_String();
precision = precision % 16;
b.skip(3);
amount_string = (0, _number_utils.fromImpliedDecimal)(amount, precision);
} else {
// Legacy Case
var _b_copy = b.copy(b.offset, b.offset + 7);
symbol = new Buffer(_b_copy.toBinary(), "binary").toString().replace(/\x00/g, "");
b.skip(7);
// "1.000 STEEM" always written with full precision
amount_string = (0, _number_utils.fromImpliedDecimal)(amount, precision);
}
return amount_string + " " + symbol;
},
appendByteBuffer: function appendByteBuffer(b, object) {
object = object.trim();
if (!/^[0-9]+\.?[0-9]* [A-Za-z0-9]+$/.test(object)) throw new Error("Expecting amount like '99.000 SYMBOL', instead got '" + object + "'");
var amount = "";
var symbol = "";
var nai = 0;
var precision = 0;
var _object$split = object.split(" "),
_object$split2 = _slicedToArray(_object$split, 2),
amount = _object$split2[0],
symbol = _object$split2[1];
if (object["nai"]) {
symbol = object["nai"];
nai = parseInt(symbol.slice(2));
var checksum = nai % 10;
nai = Math.floor(nai / 10);
var expected_checksum = damm_checksum_8digit(nai);
if (symbol.length > 6) throw new Error("Symbols are not longer than 6 characters " + symbol + "-" + symbol.length);
//if(checksum != expected_checksum)
// throw new Error("Checksums do not match, expected " + expected_checksum + " actual " + checksum)
b.writeInt64(v.to_long(amount.replace(".", "")));
var dot = amount.indexOf("."); // 0.000
var precision = dot === -1 ? 0 : amount.length - dot - 1;
b.writeUint8(precision);
b.append(symbol.toUpperCase(), 'binary');
for (var i = 0; i < 7 - symbol.length; i++) {
b.writeUint8(0);
}return;
switch (object["nai"]) {
case "@@000000021":
precision = 3;
symbol = this.useTestNet ? "TESTS" : "STEEM";
break;
case "@@000000013":
precision = 3;
symbol = this.useTestNet ? "TBD" : "SBD";
break;
case "@@000000037":
precision = 6;
symbol = "VESTS";
break;
}
precision = parseInt(object["precision"]);
b.writeInt64(v.to_long(parseInt(object["amount"])));
} else {
object = object.trim();
if (!/^[0-9]+\.?[0-9]* [A-Za-z0-9@]+$/.test(object)) throw new Error("Expecting amount like '99.000 SYMBOL', instead got '" + object + "'");
var res = object.split(" ");
amount = res[0];
symbol = res[1];
if (symbol.startsWith("@@")) {
// NAI Case
nai = parseInt(symbol.slice(2));
var _checksum = nai % 10;
nai = Math.floor(nai / 10);
var _expected_checksum = damm_checksum_8digit(nai);
if (_checksum != _expected_checksum) throw new Error("Checksums do not match, expected " + _expected_checksum + " actual " + _checksum);
} else if (symbol.length > 6) throw new Error("Symbols are not longer than 6 characters " + symbol + "-" + symbol.length);
b.writeInt64(v.to_long(amount.replace(".", "")));
var dot = amount.indexOf("."); // 0.000
precision = dot === -1 ? 0 : amount.length - dot - 1;
}
if (symbol.startsWith("@@")) {
nai = (nai << 5) + 16 + precision;
b.writeUint32(nai);
} else {
b.writeUint8(precision);
b.append(symbol.toUpperCase(), 'binary');
for (var i = 0; i < 7 - symbol.length; i++) {
b.writeUint8(0);
}
}
return;
},

@@ -82,2 +192,83 @@ fromObject: function fromObject(object) {

Types.asset_symbol = {
fromByteBuffer: function fromByteBuffer(b) {
var precision = b.readUint8();
var amount_string = "";
var nai_string = "";
if (precision >= 16) {
// NAI Case
var b_copy = b.copy(b.offset - 1, b.offset + 3);
var nai = new Buffer(b_copy.toBinary(), "binary").readInt32();
nai = nai / 32;
nai_string = "@@" + nai.toString().padStart(8, '0') + damm_checksum_8digit(nai).to_String();
precision = precision % 16;
b.skip(3);
} else {
// Legacy Case
var _b_copy2 = b.copy(b.offset, b.offset + 7);
var symbol = new Buffer(_b_copy2.toBinary(), "binary").toString().replace(/\x00/g, "");
if (symbol == "STEEM" || symbol == "TESTS") nai_string = "@@000000021";else if (symbol == "SBD" || symbol == "TBD") nai_string = "@@000000013";else if (symbol == "VESTS") nai_string = "@@000000037";else throw new Error("Expecting non-smt core asset symbol, instead got '" + symbol + "'");
b.skip(7);
}
return { "nai": nai_string, "precision": precision };
},
appendByteBuffer: function appendByteBuffer(b, object) {
var nai = 0;
if (!object["nai"].startsWith("@@")) throw new Error("Asset Symbols NAIs must be prefixed with '@@'. Was " + object["nai"]);
nai = parseInt(object["nai"].slice(2));
var checksum = nai % 10;
nai = Math.floor(nai / 10);
var expected_checksum = damm_checksum_8digit(nai);
//if(checksum != expected_checksum)
// throw new Error("Checksums do not match, expected " + expected_checksum + " actual " + checksum)
var precision = 0;
var symbol = "";
switch (object["nai"]) {
case "@@000000021":
precision = 3;
symbol = this.useTestNet ? "TESTS" : "STEEM";
break;
case "@@000000013":
precision = 3;
symbol = this.useTestNet ? "TBD" : "SBD";
break;
case "@@000000037":
precision = 6;
symbol = "VESTS";
break;
}
if (precision > 0) {
//Core Symbol Case
b.writeUint8(precision);
b.append(symbol, 'binary');
for (var i = 0; i < 7 - symbol.length; i++) {
b.writeUint8(0);
}
} else {
nai = (nai << 5) + 16 + object["precision"];
b.writeUint32(nai);
}
return;
},
fromObject: function fromObject(object) {
return object;
},
toObject: function toObject(object) {
var debug = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
if (debug.use_default && object === undefined) {
return "STEEM";
}
return object;
}
};
Types.uint8 = {

@@ -248,2 +439,25 @@ fromByteBuffer: function fromByteBuffer(b) {

Types.uint128 = {
fromByteBuffer: function fromByteBuffer(b) {
b.readBigInt64();
return b.readBigInt64();
},
appendByteBuffer: function appendByteBuffer(b, object) {
b.writeUint64(v.to_long(v.unsigned(0)));
b.writeUint64(v.to_long(v.unsigned(object)));
return;
},
fromObject: function fromObject(object) {
return v.to_long(v.unsigned(object));
},
toObject: function toObject(object) {
var debug = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
if (debug.use_default && object === undefined) {
return "0";
}
return v.to_long(object).toString();
}
};
Types.string = {

@@ -723,6 +937,6 @@ fromByteBuffer: function fromByteBuffer(b) {

var _object$split3 = object.split(':'),
_object$split4 = _slicedToArray(_object$split3, 2),
type = _object$split4[0],
id = _object$split4[1];
var _object$split = object.split(':'),
_object$split2 = _slicedToArray(_object$split, 2),
type = _object$split2[0],
id = _object$split2[1];

@@ -729,0 +943,0 @@ v.require_range(0, 0xff, type, 'vote type ' + object);

@@ -70,3 +70,3 @@ 'use strict';

return _api2.default.getBlockHeaderAsync(properties.last_irreversible_block_num).then(function (block) {
var headBlockId = block.previous;
var headBlockId = block ? block.previous : '0000000000000000000000000000000000000000';
return Object.assign({

@@ -73,0 +73,0 @@ ref_block_num: refBlockNum,

@@ -192,3 +192,35 @@ "use strict";

}, {
"roles": ["posting", "active", "owner"],
"operation": "claim_reward_balance2",
"params": ["account", "reward_tokens", "extensions"]
}, {
"roles": ["posting", "active", "owner"],
"operation": "vote2",
"params": ["voter", "author", "permlink", "rshares", "extensions"]
}, {
"roles": ["active", "owner"],
"operation": "smt_create",
"params": ["control_account", "symbol", "smt_creation_fee", "precision", "extensions"]
}, {
"roles": ["active", "owner"],
"operation": "smt_setup",
"params": ["control_account", "symbol", "max_supply", "initial_generation_policy", "contribution_begin_time", "contribution_end_time", "launch_time", "steem_units_min", "steem_units_soft_cap", "steem_units_hard_cap", "extensions"]
}, {
"roles": ["active", "owner"],
"operation": "smt_setup_emissions",
"params": ["control_account", "symbol", "schedule_time", "emissions_unit", "interval_seconds", "interval_coount", "lep_time", "rep_time", "lep_abs_amount", "rep_abs_amount", "lep_rel_amount_numerator", "rep_rel_amount_numerator", "rel_amount_denom_bits", "remove", "floor_emissions", "extensions"]
}, {
"roles": ["active", "owner"],
"operation": "smt_set_setup_parameters",
"params": ["control_account", "symbol", "setup_parameters", "extensions"]
}, {
"roles": ["active", "owner"],
"operation": "smt_set_runtime_parameters",
"params": ["control_account", "symbol", "runtime_parameters", "extensions"]
}, {
"roles": ["active", "owner"],
"operation": "smt_contribute",
"params": ["contributor", "symbol", "contribution_id", "contribution", "extensions"]
}, {
"roles": ["active", "owner"],
"operation": "fill_convert_request",

@@ -195,0 +227,0 @@ "params": ["owner", "requestid", "amount_in", "amount_out"]

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

{"name":"steem","version":"0.7.7","description":"Steem.js the JavaScript API for Steem blockchain","main":"lib/index.js","scripts":{"test":"eslint --quiet src test; mocha -t 40000 --require babel-polyfill --require babel-register","test-auth":"npm test -- --grep 'steem.auth'","build":"npm run build-browser && npm run build-node","build-browser":"rm -rf dist && NODE_ENV=production node ./node_modules/webpack/bin/webpack.js && gzip -k -f ./dist/*.js && du -h ./dist/*","build-node":"mkdir -p ./lib && cp -r ./src/* ./lib/ && babel ./src --out-dir ./lib","prepublish":"npm run build"},"browser":{"ws":false,"crypto":false},"repository":{"type":"git","url":"git+https://github.com/steemit/steem-js.git"},"keywords":["steem","steemit","blockchain","steemjs"],"author":"Fabien (https://github.com/bonustrack)","license":"MIT","bugs":{"url":"https://github.com/steemit/steem-js/issues"},"homepage":"https://github.com/steemit/steem-js#readme","dependencies":{"@steemit/rpc-auth":"^1.1.1","bigi":"^1.4.2","bluebird":"^3.4.6","browserify-aes":"^1.0.6","bs58":"^4.0.0","buffer":"^5.0.6","bytebuffer":"^5.0.1","create-hash":"^1.1.2","create-hmac":"^1.1.4","cross-env":"^5.0.0","cross-fetch":"^1.1.1","debug":"^2.6.8","detect-node":"^2.0.3","ecurve":"^1.0.5","lodash":"^4.16.4","retry":"^0.12.0","secure-random":"^1.1.2","ws":"^3.3.2"},"devDependencies":{"babel-cli":"^6.16.0","babel-eslint":"^7.1.1","babel-loader":"^6.2.5","babel-polyfill":"^6.23.0","babel-preset-es2015":"^6.16.0","babel-preset-es2017":"^6.16.0","babel-register":"^6.14.0","bluebird":"^3.4.6","eslint":"^3.5.0","eslint-plugin-import":"^1.15.0","eslint-plugin-jsx-a11y":"^2.2.2","eslint-plugin-react":"^6.2.1","json-loader":"^0.5.4","mocha":"^3.0.2","mocha-make-stub":"^2.3.2","should":"^11.1.0","webpack":"^1.13.2","webpack-visualizer-plugin":"^0.1.5"},"contributors":["Fabien (https://github.com/bonustrack)","James Calfee (https://github.com/jcalfee)","Nilesh Suthar (https://github.com/nil1511)","Pedro Tacla Yamada (https://github.com/yamadapc)"]}
{"name":"steem","version":"0.7.8","description":"Steem.js the JavaScript API for Steem blockchain","main":"lib/index.js","scripts":{"test":"eslint --quiet src test; mocha -t 40000 --require babel-polyfill --require babel-register","test-auth":"npm test -- --grep 'steem.auth'","build":"npm run build-browser && npm run build-node","build-browser":"rm -rf dist && NODE_ENV=production node ./node_modules/webpack/bin/webpack.js && gzip -k -f ./dist/*.js && du -h ./dist/*","build-node":"mkdir -p ./lib && cp -r ./src/* ./lib/ && babel ./src --out-dir ./lib","prepublish":"npm run build"},"browser":{"ws":false,"crypto":false},"repository":{"type":"git","url":"git+https://github.com/steemit/steem-js.git"},"keywords":["steem","steemit","blockchain","steemjs"],"author":"Fabien (https://github.com/bonustrack)","license":"MIT","bugs":{"url":"https://github.com/steemit/steem-js/issues"},"homepage":"https://github.com/steemit/steem-js#readme","dependencies":{"@steemit/rpc-auth":"^1.1.1","bigi":"^1.4.2","bluebird":"^3.4.6","browserify-aes":"^1.0.6","bs58":"^4.0.0","buffer":"^5.0.6","bytebuffer":"^5.0.1","create-hash":"^1.1.2","create-hmac":"^1.1.4","cross-env":"^5.0.0","cross-fetch":"^1.1.1","debug":"^2.6.8","detect-node":"^2.0.3","ecurve":"^1.0.5","lodash":"^4.16.4","retry":"^0.12.0","secure-random":"^1.1.2","ws":"^3.3.2"},"devDependencies":{"babel-cli":"^6.16.0","babel-eslint":"^7.1.1","babel-loader":"^6.2.5","babel-polyfill":"^6.23.0","babel-preset-es2015":"^6.16.0","babel-preset-es2017":"^6.16.0","babel-register":"^6.14.0","bluebird":"^3.4.6","eslint":"^3.5.0","eslint-plugin-import":"^1.15.0","eslint-plugin-jsx-a11y":"^2.2.2","eslint-plugin-react":"^6.2.1","json-loader":"^0.5.4","mocha":"^3.0.2","mocha-make-stub":"^2.3.2","should":"^11.1.0","webpack":"^1.13.2","webpack-visualizer-plugin":"^0.1.5"},"contributors":["Fabien (https://github.com/bonustrack)","James Calfee (https://github.com/jcalfee)","Nilesh Suthar (https://github.com/nil1511)","Pedro Tacla Yamada (https://github.com/yamadapc)"]}

@@ -45,5 +45,5 @@ [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/steemit/steem-js/blob/master/LICENSE)

## CDN
https://cdn.steemjs.com/lib/latest/steem.min.js<br/>
https://cdn.jsdelivr.net/npm/steem/dist/steem.min.js<br/>
```html
<script src="//cdn.steemjs.com/lib/latest/steem.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/steem/dist/steem.min.js"></script>
```

@@ -96,2 +96,21 @@

### Steem Testnet
Steem-js requires some configuration to work on the public Steem testnet.
You need to set two Steem API options, `address_prefix` and `chain_id`.
```js
steem.api.setOptions({
address_prefix: 'TST',
chain_id: '46d82ab7d8db682eb1959aed0ada039a6d49afa1602491f93dde9cac3e8e6c32',
});
```
The Chain ID could change. If it does, it may not be reflected here, but will be documented on any testnet launch announcements.
Furthermore, you need to change asset serializations for the testnet.
```js
Types.useTestNet = true
```
## Contributions

@@ -98,0 +117,0 @@ Patches are welcome! Contributors are listed in the package.json file. Please run the tests before opening a pull request and make sure that you are passing all of them. If you would like to contribute, but don't know what to work on, check the issues list or on Steemit Chat channel #steemjs https://steemit.chat/channel/steemjs.

@@ -54,2 +54,63 @@ import Promise from 'bluebird';

describe('no blocks on chain', () => {
it('works', async () => {
const newAccountName = username + '-' + Math.floor(Math.random() * 10000);
const keys = steem.auth.generateKeys(
username, password, ['posting', 'active', 'owner', 'memo']);
const oldGetDynamicGlobalProperties = steem.api.getDynamicGlobalPropertiesAsync;
steem.api.getDynamicGlobalPropertiesAsync = () => Promise.resolve({
time: '2019-04-14T21:30:56',
last_irreversible_block_num: 32047459,
});
// If the block returned is `null`, then no blocks are on the chain yet.
const oldGetBlockAsync = steem.api.getBlockAsync;
steem.api.getBlockAsync = () => Promise.resolve(null);
try {
const tx = await steem.broadcast._prepareTransaction({
extensions: [],
operations: [[
'account_create',
{
fee: '0.000 STEEM',
creator: username,
new_account_name: newAccountName,
owner: {
weight_threshold: 1,
account_auths: [],
key_auths: [[keys.owner, 1]],
},
active: {
weight_threshold: 1,
account_auths: [],
key_auths: [[keys.active, 1]],
},
posting: {
weight_threshold: 1,
account_auths: [],
key_auths: [[keys.posting, 1]],
},
memo_key: keys.memo,
json_metadata: '',
extensions: [],
}
]],
});
tx.should.have.properties([
'expiration',
'ref_block_num',
'ref_block_prefix',
'extensions',
'operations',
]);
} finally {
steem.api.getDynamicGlobalPropertiesAsync = oldGetDynamicGlobalProperties;
steem.api.getBlockAsync = oldGetBlockAsync;
}
});
});
describe('downvoting', () => {

@@ -153,3 +214,3 @@ it('works', async () => {

});
describe('writeOperations', () => {

@@ -156,0 +217,0 @@ it('receives a properly formatted error response', () => {

@@ -23,2 +23,4 @@ import Promise from 'bluebird';

/* Skip these tests. Steem-js test infrastructure not set up for testing active auths
Blocked by Steem issue #3546
it('signs and verifies auth', function(done) {

@@ -29,7 +31,7 @@ let tx = {

'creator': username,
'fee': '0.000 TESTS'}]]
'fee': '0.000 STEEM'}]]
}
steem.api.callAsync('condenser_api.get_version', []).then((result) => {
if(result['blockchain_version'] < '0.22.0') return done(); /* SKIP AS THIS WILL ONLY PASS ON A TESTNET CURRENTLY */
if(result['blockchain_version'] < '0.22.0') return done();

@@ -51,5 +53,5 @@ steem.broadcast._prepareTransaction(tx).then(function(tx){

steem.api.callAsync('condenser_api.get_version', []).then((result) => {
if(result['blockchain_version'] < '0.22.0') return done(); /* SKIP AS THIS WILL ONLY PASS ON A TESTNET CURRENTLY */
if(result['blockchain_version'] < '0.22.0') return done();
steem.broadcast.claimAccountAsync(activeWif, username, '0.000 TESTS', []).then((result) => {
steem.broadcast.claimAccountAsync(activeWif, username, '0.000 STEEM', []).then((result) => {
let newAccountName = username + '-' + Math.floor(Math.random() * 10000);

@@ -75,4 +77,4 @@ let keys = steem.auth.generateKeys(

});
*/
});
});

@@ -24,2 +24,4 @@ import assert from "assert"

describe('create proposal ops', () => {
/* Skip these tests. Steem-js test infrastructure not set up for testing active auths
Blocked by Steem issue #3546
it('signs and verifies create_proposal', function(done) {

@@ -35,3 +37,3 @@ let permlink = 'test';

'end_date': '2019-10-01T00:00:00',
'daily_pay': '1.000 TBD',
'daily_pay': '1.000 SBD',
'subject': 'testing',

@@ -43,3 +45,3 @@ 'permlink': permlink

steem.api.callAsync('condenser_api.get_version', []).then((result) => {
if(result['blockchain_version'] < '0.22.0') return done(); /* SKIP AS THIS WILL ONLY PASS ON A TESTNET CURRENTLY */
if(result['blockchain_version'] < '0.22.0') return done();
result.should.have.property('blockchain_version');

@@ -67,3 +69,3 @@

return done(); /* SKIP AS THIS WILL ONLY PASS ON A TESTNET CURRENTLY */
return done();

@@ -78,3 +80,4 @@ steem.broadcast._prepareTransaction(tx).then(function(tx){

})
*/
});
});

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