@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,68 +1,43 @@
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
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
1
+ "use strict";
6
2
 
7
3
  var Long = require('bytebuffer').Long;
8
-
9
4
  var v = require('./validation');
10
5
  var DB_MAX_INSTANCE_ID = Long.fromNumber(Math.pow(2, 48) - 1);
11
-
12
- var ObjectId = function () {
13
- function ObjectId(space, type, instance) {
14
- _classCallCheck(this, ObjectId);
15
-
16
- this.space = space;
17
- this.type = type;
18
- this.instance = instance;
19
- var instance_string = this.instance.toString();
20
- var object_id = this.space + '.' + this.type + '.' + instance_string;
21
- if (!v.is_digits(instance_string)) {
22
- throw new ('Invalid object id ' + object_id)();
23
- }
6
+ class ObjectId {
7
+ constructor(space, type, instance) {
8
+ this.space = space;
9
+ this.type = type;
10
+ this.instance = instance;
11
+ var instance_string = this.instance.toString();
12
+ var object_id = `${this.space}.${this.type}.${instance_string}`;
13
+ if (!v.is_digits(instance_string)) {
14
+ throw new `Invalid object id ${object_id}`();
24
15
  }
25
-
26
- _createClass(ObjectId, [{
27
- key: 'toLong',
28
- value: function toLong() {
29
- return Long.fromNumber(this.space).shiftLeft(56).or(Long.fromNumber(this.type).shiftLeft(48).or(this.instance));
30
- }
31
- }, {
32
- key: 'appendByteBuffer',
33
- value: function appendByteBuffer(b) {
34
- return b.writeUint64(this.toLong());
35
- }
36
- }, {
37
- key: 'toString',
38
- value: function toString() {
39
- return this.space + '.' + this.type + '.' + this.instance.toString();
40
- }
41
- }], [{
42
- key: 'fromString',
43
- value: function fromString(value) {
44
- if (value.space !== undefined && value.type !== undefined && value.instance !== undefined) {
45
- return value;
46
- }
47
- var params = v.require_match(/^([0-9]+)\.([0-9]+)\.([0-9]+)$/, v.required(value, "object_id"), "object_id");
48
- return new ObjectId(parseInt(params[1]), parseInt(params[2]), Long.fromString(params[3]));
49
- }
50
- }, {
51
- key: 'fromLong',
52
- value: function fromLong(long) {
53
- var space = long.shiftRight(56).toInt();
54
- var type = long.shiftRight(48).toInt() & 0x00ff;
55
- var instance = long.and(DB_MAX_INSTANCE_ID);
56
- return new ObjectId(space, type, instance);
57
- }
58
- }, {
59
- key: 'fromByteBuffer',
60
- value: function fromByteBuffer(b) {
61
- return ObjectId.fromLong(b.readUint64());
62
- }
63
- }]);
64
-
65
- return ObjectId;
66
- }();
67
-
16
+ }
17
+ static fromString(value) {
18
+ if (value.space !== undefined && value.type !== undefined && value.instance !== undefined) {
19
+ return value;
20
+ }
21
+ var params = v.require_match(/^([0-9]+)\.([0-9]+)\.([0-9]+)$/, v.required(value, "object_id"), "object_id");
22
+ return new ObjectId(parseInt(params[1]), parseInt(params[2]), Long.fromString(params[3]));
23
+ }
24
+ static fromLong(long) {
25
+ var space = long.shiftRight(56).toInt();
26
+ var type = long.shiftRight(48).toInt() & 0x00ff;
27
+ var instance = long.and(DB_MAX_INSTANCE_ID);
28
+ return new ObjectId(space, type, instance);
29
+ }
30
+ static fromByteBuffer(b) {
31
+ return ObjectId.fromLong(b.readUint64());
32
+ }
33
+ toLong() {
34
+ return Long.fromNumber(this.space).shiftLeft(56).or(Long.fromNumber(this.type).shiftLeft(48).or(this.instance));
35
+ }
36
+ appendByteBuffer(b) {
37
+ return b.writeUint64(this.toLong());
38
+ }
39
+ toString() {
40
+ return `${this.space}.${this.type}.${this.instance.toString()}`;
41
+ }
42
+ }
68
43
  module.exports = ObjectId;