@steemit/steem-js 0.7.11 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/README.md +22 -3
  2. package/circle.yml +1 -1
  3. package/config.json +1 -1
  4. package/dist/steem-tests.min.js +4097 -23
  5. package/dist/steem.min.js +2089 -18
  6. package/docker-webpack.config.js +44 -0
  7. package/lib/api/index.js +305 -412
  8. package/lib/api/methods.js +16 -1
  9. package/lib/api/rpc-auth.js +135 -0
  10. package/lib/api/transports/base.js +25 -66
  11. package/lib/api/transports/http.js +114 -129
  12. package/lib/api/transports/index.js +8 -15
  13. package/lib/api/transports/ws.js +107 -207
  14. package/lib/auth/ecc/index.js +9 -9
  15. package/lib/auth/ecc/src/address.js +48 -78
  16. package/lib/auth/ecc/src/aes.js +93 -129
  17. package/lib/auth/ecc/src/brain_key.js +7 -7
  18. package/lib/auth/ecc/src/ecdsa.js +7 -33
  19. package/lib/auth/ecc/src/ecsignature.js +4 -30
  20. package/lib/auth/ecc/src/enforce_types.js +1 -8
  21. package/lib/auth/ecc/src/hash.js +16 -25
  22. package/lib/auth/ecc/src/key_private.js +146 -199
  23. package/lib/auth/ecc/src/key_public.js +130 -202
  24. package/lib/auth/ecc/src/key_utils.js +64 -106
  25. package/lib/auth/ecc/src/signature.js +125 -177
  26. package/lib/auth/index.js +84 -97
  27. package/lib/auth/memo.js +90 -118
  28. package/lib/auth/serializer/index.js +12 -18
  29. package/lib/auth/serializer/src/ChainTypes.js +0 -3
  30. package/lib/auth/serializer/src/convert.js +29 -32
  31. package/lib/auth/serializer/src/error_with_cause.js +22 -37
  32. package/lib/auth/serializer/src/fast_parser.js +54 -74
  33. package/lib/auth/serializer/src/number_utils.js +30 -54
  34. package/lib/auth/serializer/src/object_id.js +37 -62
  35. package/lib/auth/serializer/src/operations.js +597 -689
  36. package/lib/auth/serializer/src/precision.js +55 -73
  37. package/lib/auth/serializer/src/serializer.js +158 -204
  38. package/lib/auth/serializer/src/template.js +13 -8
  39. package/lib/auth/serializer/src/types.js +949 -1102
  40. package/lib/auth/serializer/src/validation.js +268 -328
  41. package/lib/broadcast/helpers.js +61 -98
  42. package/lib/broadcast/index.js +61 -82
  43. package/lib/browser.js +15 -19
  44. package/lib/config.js +16 -38
  45. package/lib/formatter.js +89 -115
  46. package/lib/index.js +19 -17
  47. package/lib/utils.js +4 -9
  48. package/node-18.dockerfile +28 -0
  49. package/package.json +62 -38
  50. package/test/Crypto.js +16 -16
  51. package/test/KeyFormats.js +1 -1
  52. package/test/api.test.js +37 -0
  53. package/test/broadcast.test.js +14 -8
  54. package/test/comment.test.js +17 -3
  55. package/test/operations_test.js +1 -1
  56. package/test/promise-broadcast.test.js +86 -0
  57. package/test/reputation.test.js +68 -0
  58. package/test/smt.test.js +10 -10
  59. package/test-github-workflow.bat +19 -0
  60. package/test-github-workflow.sh +15 -0
  61. package/webpack/makeConfig.js +25 -17
  62. package/.circleci/config.yml +0 -23
  63. package/dist/statistics.html +0 -208
  64. package/dist/steem-tests.min.js.gz +0 -0
  65. package/dist/steem-tests.min.js.map +0 -1
  66. package/dist/steem.min.js.gz +0 -0
  67. package/dist/steem.min.js.map +0 -1
  68. package/lib/auth/ecc/README.md +0 -20
  69. package/lib/auth/ecc/package.json +0 -36
  70. package/lib/auth/serializer/README.md +0 -13
  71. package/lib/auth/serializer/package.json +0 -32
  72. package/node-4.dockerfile +0 -6
  73. package/node-6.dockerfile +0 -6
  74. package/yarn.lock +0 -3336
@@ -1,40 +1,27 @@
1
- 'use strict';
2
-
3
- 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"); } }; }();
4
-
5
- var _api = require('../api');
6
-
7
- var _api2 = _interopRequireDefault(_api);
8
-
9
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
-
11
- exports = module.exports = function (steemBroadcast) {
12
- steemBroadcast.addAccountAuth = function (_ref, cb) {
13
- var signingKey = _ref.signingKey,
14
- username = _ref.username,
15
- authorizedUsername = _ref.authorizedUsername,
16
- _ref$role = _ref.role,
17
- role = _ref$role === undefined ? 'posting' : _ref$role,
18
- weight = _ref.weight;
19
-
20
- _api2.default.getAccounts([username], function (err, _ref2) {
21
- var _ref3 = _slicedToArray(_ref2, 1),
22
- userAccount = _ref3[0];
23
-
1
+ "use strict";
2
+
3
+ var _api = _interopRequireDefault(require("../api"));
4
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
5
+ exports = module.exports = steemBroadcast => {
6
+ steemBroadcast.addAccountAuth = ({
7
+ signingKey,
8
+ username,
9
+ authorizedUsername,
10
+ role = 'posting',
11
+ weight
12
+ }, cb) => {
13
+ _api.default.getAccounts([username], (err, [userAccount]) => {
24
14
  if (err) {
25
15
  return cb(new Error(err), null);
26
16
  }
27
17
  if (!userAccount) {
28
18
  return cb(new Error('Invalid account name'), null);
29
19
  }
30
-
31
- var updatedAuthority = userAccount[role];
20
+ const updatedAuthority = userAccount[role];
32
21
 
33
22
  /** Release callback if the account already exist in the account_auths array */
34
- var authorizedAccounts = updatedAuthority.account_auths.map(function (auth) {
35
- return auth[0];
36
- });
37
- var hasAuthority = authorizedAccounts.indexOf(authorizedUsername) !== -1;
23
+ const authorizedAccounts = updatedAuthority.account_auths.map(auth => auth[0]);
24
+ const hasAuthority = authorizedAccounts.indexOf(authorizedUsername) !== -1;
38
25
  if (hasAuthority) {
39
26
  return cb(null, null);
40
27
  }
@@ -42,37 +29,31 @@ exports = module.exports = function (steemBroadcast) {
42
29
  /** Use weight_thresold as default weight */
43
30
  weight = weight || userAccount[role].weight_threshold;
44
31
  updatedAuthority.account_auths.push([authorizedUsername, weight]);
45
- var owner = role === 'owner' ? updatedAuthority : undefined;
46
- var active = role === 'active' ? updatedAuthority : undefined;
47
- var posting = role === 'posting' ? updatedAuthority : undefined;
32
+ const owner = role === 'owner' ? updatedAuthority : undefined;
33
+ const active = role === 'active' ? updatedAuthority : undefined;
34
+ const posting = role === 'posting' ? updatedAuthority : undefined;
48
35
 
49
36
  /** Add authority on user account */
50
37
  steemBroadcast.accountUpdate(signingKey, userAccount.name, owner, active, posting, userAccount.memo_key, userAccount.json_metadata, cb);
51
38
  });
52
39
  };
53
-
54
- steemBroadcast.removeAccountAuth = function (_ref4, cb) {
55
- var signingKey = _ref4.signingKey,
56
- username = _ref4.username,
57
- authorizedUsername = _ref4.authorizedUsername,
58
- _ref4$role = _ref4.role,
59
- role = _ref4$role === undefined ? 'posting' : _ref4$role;
60
-
61
- _api2.default.getAccounts([username], function (err, _ref5) {
62
- var _ref6 = _slicedToArray(_ref5, 1),
63
- userAccount = _ref6[0];
64
-
40
+ steemBroadcast.removeAccountAuth = ({
41
+ signingKey,
42
+ username,
43
+ authorizedUsername,
44
+ role = 'posting'
45
+ }, cb) => {
46
+ _api.default.getAccounts([username], (err, [userAccount]) => {
65
47
  if (err) {
66
48
  return cb(new Error(err), null);
67
49
  }
68
50
  if (!userAccount) {
69
51
  return cb(new Error('Invalid account name'), null);
70
52
  }
71
-
72
- var updatedAuthority = userAccount[role];
73
- var totalAuthorizedUser = updatedAuthority.account_auths.length;
74
- for (var i = 0; i < totalAuthorizedUser; i++) {
75
- var user = updatedAuthority.account_auths[i];
53
+ const updatedAuthority = userAccount[role];
54
+ const totalAuthorizedUser = updatedAuthority.account_auths.length;
55
+ for (let i = 0; i < totalAuthorizedUser; i++) {
56
+ const user = updatedAuthority.account_auths[i];
76
57
  if (user[0] === authorizedUsername) {
77
58
  updatedAuthority.account_auths.splice(i, 1);
78
59
  break;
@@ -83,41 +64,31 @@ exports = module.exports = function (steemBroadcast) {
83
64
  if (totalAuthorizedUser === updatedAuthority.account_auths.length) {
84
65
  return cb(null, null);
85
66
  }
86
-
87
- var owner = role === 'owner' ? updatedAuthority : undefined;
88
- var active = role === 'active' ? updatedAuthority : undefined;
89
- var posting = role === 'posting' ? updatedAuthority : undefined;
90
-
67
+ const owner = role === 'owner' ? updatedAuthority : undefined;
68
+ const active = role === 'active' ? updatedAuthority : undefined;
69
+ const posting = role === 'posting' ? updatedAuthority : undefined;
91
70
  steemBroadcast.accountUpdate(signingKey, userAccount.name, owner, active, posting, userAccount.memo_key, userAccount.json_metadata, cb);
92
71
  });
93
72
  };
94
-
95
- steemBroadcast.addKeyAuth = function (_ref7, cb) {
96
- var signingKey = _ref7.signingKey,
97
- username = _ref7.username,
98
- authorizedKey = _ref7.authorizedKey,
99
- _ref7$role = _ref7.role,
100
- role = _ref7$role === undefined ? 'posting' : _ref7$role,
101
- weight = _ref7.weight;
102
-
103
- _api2.default.getAccounts([username], function (err, _ref8) {
104
- var _ref9 = _slicedToArray(_ref8, 1),
105
- userAccount = _ref9[0];
106
-
73
+ steemBroadcast.addKeyAuth = ({
74
+ signingKey,
75
+ username,
76
+ authorizedKey,
77
+ role = 'posting',
78
+ weight
79
+ }, cb) => {
80
+ _api.default.getAccounts([username], (err, [userAccount]) => {
107
81
  if (err) {
108
82
  return cb(new Error(err), null);
109
83
  }
110
84
  if (!userAccount) {
111
85
  return cb(new Error('Invalid account name'), null);
112
86
  }
113
-
114
- var updatedAuthority = userAccount[role];
87
+ const updatedAuthority = userAccount[role];
115
88
 
116
89
  /** Release callback if the key already exist in the key_auths array */
117
- var authorizedKeys = updatedAuthority.key_auths.map(function (auth) {
118
- return auth[0];
119
- });
120
- var hasAuthority = authorizedKeys.indexOf(authorizedKey) !== -1;
90
+ const authorizedKeys = updatedAuthority.key_auths.map(auth => auth[0]);
91
+ const hasAuthority = authorizedKeys.indexOf(authorizedKey) !== -1;
121
92
  if (hasAuthority) {
122
93
  return cb(null, null);
123
94
  }
@@ -125,37 +96,31 @@ exports = module.exports = function (steemBroadcast) {
125
96
  /** Use weight_thresold as default weight */
126
97
  weight = weight || userAccount[role].weight_threshold;
127
98
  updatedAuthority.key_auths.push([authorizedKey, weight]);
128
- var owner = role === 'owner' ? updatedAuthority : undefined;
129
- var active = role === 'active' ? updatedAuthority : undefined;
130
- var posting = role === 'posting' ? updatedAuthority : undefined;
99
+ const owner = role === 'owner' ? updatedAuthority : undefined;
100
+ const active = role === 'active' ? updatedAuthority : undefined;
101
+ const posting = role === 'posting' ? updatedAuthority : undefined;
131
102
 
132
103
  /** Add authority on user account */
133
104
  steemBroadcast.accountUpdate(signingKey, userAccount.name, owner, active, posting, userAccount.memo_key, userAccount.json_metadata, cb);
134
105
  });
135
106
  };
136
-
137
- steemBroadcast.removeKeyAuth = function (_ref10, cb) {
138
- var signingKey = _ref10.signingKey,
139
- username = _ref10.username,
140
- authorizedKey = _ref10.authorizedKey,
141
- _ref10$role = _ref10.role,
142
- role = _ref10$role === undefined ? 'posting' : _ref10$role;
143
-
144
- _api2.default.getAccounts([username], function (err, _ref11) {
145
- var _ref12 = _slicedToArray(_ref11, 1),
146
- userAccount = _ref12[0];
147
-
107
+ steemBroadcast.removeKeyAuth = ({
108
+ signingKey,
109
+ username,
110
+ authorizedKey,
111
+ role = 'posting'
112
+ }, cb) => {
113
+ _api.default.getAccounts([username], (err, [userAccount]) => {
148
114
  if (err) {
149
115
  return cb(new Error(err), null);
150
116
  }
151
117
  if (!userAccount) {
152
118
  return cb(new Error('Invalid account name'), null);
153
119
  }
154
-
155
- var updatedAuthority = userAccount[role];
156
- var totalAuthorizedKey = updatedAuthority.key_auths.length;
157
- for (var i = 0; i < totalAuthorizedKey; i++) {
158
- var user = updatedAuthority.key_auths[i];
120
+ const updatedAuthority = userAccount[role];
121
+ const totalAuthorizedKey = updatedAuthority.key_auths.length;
122
+ for (let i = 0; i < totalAuthorizedKey; i++) {
123
+ const user = updatedAuthority.key_auths[i];
159
124
  if (user[0] === authorizedKey) {
160
125
  updatedAuthority.key_auths.splice(i, 1);
161
126
  break;
@@ -166,11 +131,9 @@ exports = module.exports = function (steemBroadcast) {
166
131
  if (totalAuthorizedKey === updatedAuthority.key_auths.length) {
167
132
  return cb(null, null);
168
133
  }
169
-
170
- var owner = role === 'owner' ? updatedAuthority : undefined;
171
- var active = role === 'active' ? updatedAuthority : undefined;
172
- var posting = role === 'posting' ? updatedAuthority : undefined;
173
-
134
+ const owner = role === 'owner' ? updatedAuthority : undefined;
135
+ const active = role === 'active' ? updatedAuthority : undefined;
136
+ const posting = role === 'posting' ? updatedAuthority : undefined;
174
137
  steemBroadcast.accountUpdate(signingKey, userAccount.name, owner, active, posting, userAccount.memo_key, userAccount.json_metadata, cb);
175
138
  });
176
139
  };
@@ -1,76 +1,56 @@
1
- 'use strict';
2
-
3
- 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; };
4
-
5
- var _bluebird = require('bluebird');
6
-
7
- var _bluebird2 = _interopRequireDefault(_bluebird);
8
-
9
- var _debug = require('debug');
10
-
11
- var _debug2 = _interopRequireDefault(_debug);
12
-
13
- var _helpers = require('./helpers');
14
-
15
- var _helpers2 = _interopRequireDefault(_helpers);
16
-
17
- var _formatter = require('../formatter');
18
-
19
- var _formatter2 = _interopRequireDefault(_formatter);
20
-
21
- var _operations = require('./operations');
22
-
23
- var _operations2 = _interopRequireDefault(_operations);
24
-
25
- var _api = require('../api');
26
-
27
- var _api2 = _interopRequireDefault(_api);
28
-
29
- var _auth = require('../auth');
30
-
31
- var _auth2 = _interopRequireDefault(_auth);
32
-
33
- var _utils = require('../utils');
34
-
35
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
36
-
37
- var debug = (0, _debug2.default)('steem:broadcast');
38
- var noop = function noop() {};
39
- var formatter = (0, _formatter2.default)(_api2.default);
40
-
41
- var steemBroadcast = {};
1
+ "use strict";
2
+
3
+ var _bluebird = _interopRequireDefault(require("bluebird"));
4
+ var _debug = _interopRequireDefault(require("debug"));
5
+ var _helpers = _interopRequireDefault(require("./helpers"));
6
+ var _formatter = _interopRequireDefault(require("../formatter"));
7
+ var _operations = _interopRequireDefault(require("./operations"));
8
+ var _api = _interopRequireDefault(require("../api"));
9
+ var _auth = _interopRequireDefault(require("../auth"));
10
+ var _utils = require("../utils");
11
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
+ const debug = (0, _debug.default)('steem:broadcast');
13
+ const noop = function () {};
14
+ const formatter = (0, _formatter.default)(_api.default);
15
+ const steemBroadcast = {};
42
16
 
43
17
  // Base transaction logic -----------------------------------------------------
44
18
 
45
19
  /**
46
20
  * Sign and broadcast transactions on the steem network
21
+ * @param {Object} tx - Transaction object
22
+ * @param {Object|String} privKeys - Private keys or key string
23
+ * @param {Function} [callback] - Optional callback function
24
+ * @return {Promise} - Returns a promise if no callback is provided
47
25
  */
48
-
49
26
  steemBroadcast.send = function steemBroadcast$send(tx, privKeys, callback) {
50
- var resultP = steemBroadcast._prepareTransaction(tx).then(function (transaction) {
27
+ const resultP = steemBroadcast._prepareTransaction(tx).then(transaction => {
51
28
  debug('Signing transaction (transaction, transaction.operations)', transaction, transaction.operations);
52
- return _bluebird2.default.join(transaction, _auth2.default.signTransaction(transaction, privKeys));
53
- }).spread(function (transaction, signedTransaction) {
29
+ return _bluebird.default.join(transaction, _auth.default.signTransaction(transaction, privKeys));
30
+ }).spread((transaction, signedTransaction) => {
54
31
  debug('Broadcasting transaction (transaction, transaction.operations)', transaction, transaction.operations);
55
- return _api2.default.broadcastTransactionSynchronousAsync(signedTransaction).then(function (result) {
32
+ return _api.default.broadcastTransactionSynchronousAsync(signedTransaction).then(result => {
56
33
  return Object.assign({}, result, signedTransaction);
57
34
  });
58
35
  });
59
-
60
- resultP.nodeify(callback || noop);
36
+ if (callback) {
37
+ resultP.nodeify(callback);
38
+ return undefined;
39
+ } else {
40
+ return resultP;
41
+ }
61
42
  };
62
-
63
43
  steemBroadcast._prepareTransaction = function steemBroadcast$_prepareTransaction(tx) {
64
- var propertiesP = _api2.default.getDynamicGlobalPropertiesAsync();
65
- return propertiesP.then(function (properties) {
44
+ const propertiesP = _api.default.getDynamicGlobalPropertiesAsync();
45
+ return propertiesP.then(properties => {
66
46
  // Set defaults on the transaction
67
- var chainDate = new Date(properties.time + 'Z');
68
- var refBlockNum = properties.last_irreversible_block_num - 1 & 0xFFFF;
69
- return _api2.default.getBlockHeaderAsync(properties.last_irreversible_block_num).then(function (block) {
70
- var headBlockId = block ? block.previous : '0000000000000000000000000000000000000000';
47
+ const chainDate = new Date(properties.time + 'Z');
48
+ const refBlockNum = properties.last_irreversible_block_num - 1 & 0xFFFF;
49
+ return _api.default.getBlockHeaderAsync(properties.last_irreversible_block_num).then(block => {
50
+ const headBlockId = block ? block.previous : '0000000000000000000000000000000000000000';
71
51
  return Object.assign({
72
52
  ref_block_num: refBlockNum,
73
- ref_block_prefix: new Buffer(headBlockId, 'hex').readUInt32LE(4),
53
+ ref_block_prefix: new Buffer.from(headBlockId, 'hex').readUInt32LE(4),
74
54
  expiration: new Date(chainDate.getTime() + 600 * 1000)
75
55
  }, tx);
76
56
  });
@@ -80,15 +60,16 @@ steemBroadcast._prepareTransaction = function steemBroadcast$_prepareTransaction
80
60
  // Generated wrapper ----------------------------------------------------------
81
61
 
82
62
  // Generate operations from operations.json
83
- _operations2.default.forEach(function (operation) {
84
- var operationName = (0, _utils.camelCase)(operation.operation);
85
- var operationParams = operation.params || [];
86
-
87
- var useCommentPermlink = operationParams.indexOf('parent_author') !== -1 && operationParams.indexOf('parent_permlink') !== -1;
88
-
89
- steemBroadcast[operationName + 'With'] = function steemBroadcast$specializedSendWith(wif, options, callback) {
90
- debug('Sending operation "' + operationName + '" with', { options: options, callback: callback });
91
- var keys = {};
63
+ _operations.default.forEach(operation => {
64
+ const operationName = (0, _utils.camelCase)(operation.operation);
65
+ const operationParams = operation.params || [];
66
+ const useCommentPermlink = operationParams.indexOf('parent_author') !== -1 && operationParams.indexOf('parent_permlink') !== -1;
67
+ steemBroadcast[`${operationName}With`] = function steemBroadcast$specializedSendWith(wif, options, callback) {
68
+ debug(`Sending operation "${operationName}" with`, {
69
+ options,
70
+ callback
71
+ });
72
+ const keys = {};
92
73
  if (operation.roles && operation.roles.length) {
93
74
  keys[operation.roles[0]] = wif; // TODO - Automatically pick a role? Send all?
94
75
  }
@@ -101,27 +82,25 @@ _operations2.default.forEach(function (operation) {
101
82
  } : {})]]
102
83
  }, keys, callback);
103
84
  };
104
-
105
- steemBroadcast[operationName] = function steemBroadcast$specializedSend(wif) {
106
- for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
107
- args[_key - 1] = arguments[_key];
108
- }
109
-
110
- debug('Parsing operation "' + operationName + '" with', { args: args });
111
- var options = operationParams.reduce(function (memo, param, i) {
85
+ steemBroadcast[operationName] = function steemBroadcast$specializedSend(wif, ...args) {
86
+ debug(`Parsing operation "${operationName}" with`, {
87
+ args
88
+ });
89
+ const options = operationParams.reduce((memo, param, i) => {
112
90
  memo[param] = args[i]; // eslint-disable-line no-param-reassign
113
91
  return memo;
114
92
  }, {});
115
- var callback = args[operationParams.length];
116
- return steemBroadcast[operationName + 'With'](wif, options, callback);
93
+ // Check if the last argument is a function (callback)
94
+ let callback = null;
95
+ if (args.length > operationParams.length && typeof args[operationParams.length] === 'function') {
96
+ callback = args[operationParams.length];
97
+ }
98
+ return steemBroadcast[`${operationName}With`](wif, options, callback);
117
99
  };
118
100
  });
101
+ const toString = obj => typeof obj === 'object' ? JSON.stringify(obj) : obj;
102
+ (0, _helpers.default)(steemBroadcast);
119
103
 
120
- var toString = function toString(obj) {
121
- return (typeof obj === 'undefined' ? 'undefined' : _typeof(obj)) === 'object' ? JSON.stringify(obj) : obj;
122
- };
123
- (0, _helpers2.default)(steemBroadcast);
124
-
125
- _bluebird2.default.promisifyAll(steemBroadcast);
126
-
104
+ // For backwards compatibility, maintain the Async versions
105
+ _bluebird.default.promisifyAll(steemBroadcast);
127
106
  exports = module.exports = steemBroadcast;
package/lib/browser.js CHANGED
@@ -1,29 +1,25 @@
1
1
  "use strict";
2
2
 
3
- var api = require("./api");
4
- var auth = require("./auth");
5
- var memo = require("./auth/memo");
6
- var broadcast = require("./broadcast");
7
- var config = require("./config");
8
- var formatter = require("./formatter")(api);
9
- var utils = require("./utils");
10
-
11
- var steem = {
12
- api: api,
13
- auth: auth,
14
- memo: memo,
15
- broadcast: broadcast,
16
- config: config,
17
- formatter: formatter,
18
- utils: utils
3
+ const api = require("./api");
4
+ const auth = require("./auth");
5
+ const memo = require("./auth/memo");
6
+ const broadcast = require("./broadcast");
7
+ const config = require("./config");
8
+ const formatter = require("./formatter")(api);
9
+ const utils = require("./utils");
10
+ const steem = {
11
+ api,
12
+ auth,
13
+ memo,
14
+ broadcast,
15
+ config,
16
+ formatter,
17
+ utils
19
18
  };
20
-
21
19
  if (typeof window !== "undefined") {
22
20
  window.steem = steem;
23
21
  }
24
-
25
22
  if (typeof global !== "undefined") {
26
23
  global.steem = steem;
27
24
  }
28
-
29
25
  exports = module.exports = steem;
package/lib/config.js CHANGED
@@ -1,43 +1,21 @@
1
- 'use strict';
2
-
3
- var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
4
-
5
- var _each = require('lodash/each');
6
-
7
- var _each2 = _interopRequireDefault(_each);
8
-
9
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
-
11
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
12
-
13
- var defaultConfig = require('../config.json');
14
-
15
- var Config = function () {
16
- function Config(c) {
17
- var _this = this;
18
-
19
- _classCallCheck(this, Config);
20
-
21
- (0, _each2.default)(c, function (value, key) {
22
- _this[key] = value;
1
+ "use strict";
2
+
3
+ var _each = _interopRequireDefault(require("lodash/each"));
4
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
5
+ const defaultConfig = require('../config.json');
6
+ class Config {
7
+ constructor(c) {
8
+ (0, _each.default)(c, (value, key) => {
9
+ this[key] = value;
23
10
  });
24
11
  }
25
-
26
- _createClass(Config, [{
27
- key: 'get',
28
- value: function get(k) {
29
- return this[k];
30
- }
31
- }, {
32
- key: 'set',
33
- value: function set(k, v) {
34
- this[k] = v;
35
- }
36
- }]);
37
-
38
- return Config;
39
- }();
40
-
12
+ get(k) {
13
+ return this[k];
14
+ }
15
+ set(k, v) {
16
+ this[k] = v;
17
+ }
18
+ }
41
19
  module.exports = new Config(defaultConfig);
42
20
  if (typeof module.exports.Config !== 'undefined') {
43
21
  throw new Error("default config.json file may not contain a property 'Config'");