@steemit/steem-js 0.7.10 → 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.
- package/README.md +22 -3
- package/circle.yml +1 -1
- package/config.json +1 -1
- package/dist/steem-tests.min.js +4097 -23
- package/dist/steem.min.js +2089 -18
- package/docker-webpack.config.js +44 -0
- package/lib/api/index.js +305 -412
- package/lib/api/methods.js +16 -1
- package/lib/api/rpc-auth.js +135 -0
- package/lib/api/transports/base.js +25 -66
- package/lib/api/transports/http.js +114 -129
- package/lib/api/transports/index.js +8 -15
- package/lib/api/transports/ws.js +107 -207
- package/lib/auth/ecc/index.js +9 -9
- package/lib/auth/ecc/src/address.js +48 -78
- package/lib/auth/ecc/src/aes.js +93 -129
- package/lib/auth/ecc/src/brain_key.js +7 -7
- package/lib/auth/ecc/src/ecdsa.js +7 -33
- package/lib/auth/ecc/src/ecsignature.js +4 -30
- package/lib/auth/ecc/src/enforce_types.js +1 -8
- package/lib/auth/ecc/src/hash.js +16 -25
- package/lib/auth/ecc/src/key_private.js +146 -199
- package/lib/auth/ecc/src/key_public.js +130 -202
- package/lib/auth/ecc/src/key_utils.js +64 -106
- package/lib/auth/ecc/src/signature.js +125 -177
- package/lib/auth/index.js +84 -97
- package/lib/auth/memo.js +90 -118
- package/lib/auth/serializer/index.js +12 -18
- package/lib/auth/serializer/src/ChainTypes.js +0 -3
- package/lib/auth/serializer/src/convert.js +29 -32
- package/lib/auth/serializer/src/error_with_cause.js +22 -37
- package/lib/auth/serializer/src/fast_parser.js +54 -74
- package/lib/auth/serializer/src/number_utils.js +30 -54
- package/lib/auth/serializer/src/object_id.js +37 -62
- package/lib/auth/serializer/src/operations.js +597 -689
- package/lib/auth/serializer/src/precision.js +55 -73
- package/lib/auth/serializer/src/serializer.js +158 -204
- package/lib/auth/serializer/src/template.js +13 -8
- package/lib/auth/serializer/src/types.js +949 -1110
- package/lib/auth/serializer/src/validation.js +268 -328
- package/lib/broadcast/helpers.js +61 -98
- package/lib/broadcast/index.js +61 -82
- package/lib/browser.js +15 -19
- package/lib/config.js +16 -38
- package/lib/formatter.js +89 -115
- package/lib/index.js +19 -17
- package/lib/utils.js +4 -9
- package/node-18.dockerfile +28 -0
- package/package.json +62 -38
- package/test/Crypto.js +16 -16
- package/test/KeyFormats.js +1 -1
- package/test/api.test.js +37 -0
- package/test/broadcast.test.js +14 -8
- package/test/comment.test.js +17 -3
- package/test/operations_test.js +1 -1
- package/test/promise-broadcast.test.js +86 -0
- package/test/reputation.test.js +68 -0
- package/test/smt.test.js +11 -11
- package/test-github-workflow.bat +19 -0
- package/test-github-workflow.sh +15 -0
- package/webpack/makeConfig.js +25 -17
- package/.circleci/config.yml +0 -23
- package/dist/statistics.html +0 -208
- package/dist/steem-tests.min.js.gz +0 -0
- package/dist/steem-tests.min.js.map +0 -1
- package/dist/steem.min.js.gz +0 -0
- package/dist/steem.min.js.map +0 -1
- package/lib/auth/ecc/README.md +0 -20
- package/lib/auth/ecc/package.json +0 -36
- package/lib/auth/serializer/README.md +0 -13
- package/lib/auth/serializer/package.json +0 -32
- package/node-4.dockerfile +0 -6
- package/node-6.dockerfile +0 -6
- package/yarn.lock +0 -3336
|
@@ -1,68 +1,43 @@
|
|
|
1
|
-
|
|
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
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
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;
|