@steemit/steem-js 0.8.0 → 1.0.1

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 (128) hide show
  1. package/README.md +202 -105
  2. package/dist/api/index.d.ts +128 -0
  3. package/dist/api/methods.d.ts +9 -0
  4. package/dist/api/rpc-auth.d.ts +43 -0
  5. package/dist/api/transports/base.d.ts +13 -0
  6. package/dist/api/transports/http.d.ts +9 -0
  7. package/dist/api/transports/index.d.ts +9 -0
  8. package/dist/api/transports/types.d.ts +35 -0
  9. package/dist/api/transports/ws.d.ts +18 -0
  10. package/dist/auth/ecc/index.d.ts +9 -0
  11. package/dist/auth/ecc/src/address.d.ts +13 -0
  12. package/dist/auth/ecc/src/aes.d.ts +16 -0
  13. package/dist/auth/ecc/src/brain_key.d.ts +1 -0
  14. package/dist/auth/ecc/src/ecdsa.d.ts +28 -0
  15. package/dist/auth/ecc/src/ecsignature.d.ts +19 -0
  16. package/dist/auth/ecc/src/enforce_types.d.ts +5 -0
  17. package/dist/auth/ecc/src/hash.d.ts +25 -0
  18. package/dist/auth/ecc/src/index.d.ts +9 -0
  19. package/dist/auth/ecc/src/key_private.d.ts +38 -0
  20. package/dist/auth/ecc/src/key_public.d.ts +41 -0
  21. package/dist/auth/ecc/src/key_utils.d.ts +9 -0
  22. package/dist/auth/ecc/src/signature.d.ts +18 -0
  23. package/dist/auth/ecc.d.ts +3 -0
  24. package/dist/auth/index.d.ts +48 -0
  25. package/dist/auth/key_classes.d.ts +3 -0
  26. package/dist/auth/serializer/transaction.d.ts +5 -0
  27. package/dist/auth/serializer.d.ts +19 -0
  28. package/dist/broadcast/helpers.d.ts +11 -0
  29. package/dist/broadcast/index.d.ts +43 -0
  30. package/dist/broadcast/operations.d.ts +6 -0
  31. package/dist/config.d.ts +27 -0
  32. package/dist/crypto/index.d.ts +25 -0
  33. package/dist/formatter/index.d.ts +92 -0
  34. package/dist/index.cjs +26436 -0
  35. package/dist/index.cjs.map +1 -0
  36. package/dist/index.d.ts +30 -0
  37. package/dist/index.js +26400 -0
  38. package/dist/index.js.map +1 -0
  39. package/dist/index.umd.js +58121 -0
  40. package/dist/index.umd.js.map +1 -0
  41. package/dist/memo/index.d.ts +11 -0
  42. package/dist/operations/index.d.ts +44 -0
  43. package/dist/serializer/convert.d.ts +12 -0
  44. package/dist/serializer/index.d.ts +11 -0
  45. package/dist/serializer/number_utils.d.ts +8 -0
  46. package/dist/serializer/precision.d.ts +5 -0
  47. package/dist/serializer/types.d.ts +36 -0
  48. package/dist/types/index.d.ts +131 -0
  49. package/dist/types.d.ts +34 -0
  50. package/dist/utils/debug.d.ts +36 -0
  51. package/dist/utils/index.d.ts +9 -0
  52. package/dist/utils.d.ts +2 -0
  53. package/package.json +68 -87
  54. package/.dockerignore +0 -12
  55. package/.editorconfig +0 -20
  56. package/.eslintrc +0 -27
  57. package/LICENSE +0 -21
  58. package/circle.yml +0 -3
  59. package/config.json +0 -10
  60. package/dist/steem-tests.min.js +0 -4097
  61. package/dist/steem.min.js +0 -2089
  62. package/docker-webpack.config.js +0 -44
  63. package/lib/api/index.js +0 -315
  64. package/lib/api/methods.js +0 -428
  65. package/lib/api/rpc-auth.js +0 -135
  66. package/lib/api/transports/base.js +0 -31
  67. package/lib/api/transports/http.js +0 -157
  68. package/lib/api/transports/index.js +0 -13
  69. package/lib/api/transports/ws.js +0 -128
  70. package/lib/auth/ecc/index.js +0 -13
  71. package/lib/auth/ecc/src/address.js +0 -54
  72. package/lib/auth/ecc/src/aes.js +0 -148
  73. package/lib/auth/ecc/src/brain_key.js +0 -13
  74. package/lib/auth/ecc/src/ecdsa.js +0 -193
  75. package/lib/auth/ecc/src/ecsignature.js +0 -102
  76. package/lib/auth/ecc/src/enforce_types.js +0 -42
  77. package/lib/auth/ecc/src/hash.js +0 -58
  78. package/lib/auth/ecc/src/key_private.js +0 -159
  79. package/lib/auth/ecc/src/key_public.js +0 -143
  80. package/lib/auth/ecc/src/key_utils.js +0 -70
  81. package/lib/auth/ecc/src/signature.js +0 -135
  82. package/lib/auth/index.js +0 -113
  83. package/lib/auth/memo.js +0 -119
  84. package/lib/auth/serializer/index.js +0 -15
  85. package/lib/auth/serializer/src/ChainTypes.js +0 -87
  86. package/lib/auth/serializer/src/convert.js +0 -34
  87. package/lib/auth/serializer/src/error_with_cause.js +0 -27
  88. package/lib/auth/serializer/src/fast_parser.js +0 -57
  89. package/lib/auth/serializer/src/number_utils.js +0 -43
  90. package/lib/auth/serializer/src/object_id.js +0 -43
  91. package/lib/auth/serializer/src/operations.js +0 -695
  92. package/lib/auth/serializer/src/precision.js +0 -77
  93. package/lib/auth/serializer/src/serializer.js +0 -165
  94. package/lib/auth/serializer/src/template.js +0 -22
  95. package/lib/auth/serializer/src/types.js +0 -1085
  96. package/lib/auth/serializer/src/validation.js +0 -300
  97. package/lib/broadcast/helpers.js +0 -140
  98. package/lib/broadcast/index.js +0 -106
  99. package/lib/broadcast/operations.js +0 -255
  100. package/lib/browser.js +0 -25
  101. package/lib/config.js +0 -23
  102. package/lib/formatter.js +0 -163
  103. package/lib/index.js +0 -21
  104. package/lib/utils.js +0 -50
  105. package/node-18.dockerfile +0 -28
  106. package/test/Crypto.js +0 -100
  107. package/test/KeyFormats.js +0 -105
  108. package/test/all_types.js +0 -115
  109. package/test/api.test.js +0 -363
  110. package/test/broadcast.test.js +0 -231
  111. package/test/browser/BrowserTests.js +0 -55
  112. package/test/comment.test.js +0 -83
  113. package/test/hf20-accounts.test.js +0 -76
  114. package/test/hf21-sps.test.js +0 -78
  115. package/test/memo.test.js +0 -37
  116. package/test/number_utils.js +0 -28
  117. package/test/operations_test.js +0 -39
  118. package/test/promise-broadcast.test.js +0 -86
  119. package/test/reputation.test.js +0 -68
  120. package/test/smt.test.js +0 -347
  121. package/test/test-post.json +0 -13
  122. package/test/test.html +0 -13
  123. package/test/test_helper.js +0 -19
  124. package/test/types_test.js +0 -139
  125. package/test-github-workflow.bat +0 -19
  126. package/test-github-workflow.sh +0 -15
  127. package/webpack/makeConfig.js +0 -113
  128. package/webpack.config.js +0 -2
@@ -1,43 +0,0 @@
1
- "use strict";
2
-
3
- const assert = require("assert");
4
-
5
- /**
6
- Convert 12.34 with a precision of 3 into 12340
7
-
8
- @arg {number|string} number - Use strings for large numbers. This may contain one decimal but no sign
9
- @arg {number} precision - number of implied decimal places (usually causes right zero padding)
10
- @return {string} -
11
- */
12
- function toImpliedDecimal(number, precision) {
13
- if (typeof number === "number") {
14
- assert(number <= 9007199254740991, "overflow");
15
- number = "" + number;
16
- } else if (number.toString) number = number.toString();
17
- assert(typeof number === "string", "number should be an actual number or string: " + typeof number);
18
- number = number.trim();
19
- assert(/^[0-9]*\.?[0-9]*$/.test(number), "Invalid decimal number " + number);
20
- let [whole = "", decimal = ""] = number.split(".");
21
- let padding = precision - decimal.length;
22
- assert(padding >= 0, "Too many decimal digits in " + number + " to create an implied decimal of " + precision);
23
- for (let i = 0; i < padding; i++) decimal += "0";
24
- while (whole.charAt(0) === "0") whole = whole.substring(1);
25
- return whole + decimal;
26
- }
27
- function fromImpliedDecimal(number, precision) {
28
- if (typeof number === "number") {
29
- assert(number <= 9007199254740991, "overflow");
30
- number = "" + number;
31
- } else if (number.toString) number = number.toString();
32
- while (number.length < precision + 1)
33
- // 0.123
34
- number = "0" + number;
35
-
36
- // 44000 => 44.000
37
- let dec_string = number.substring(number.length - precision);
38
- return number.substring(0, number.length - precision) + (dec_string ? "." + dec_string : "");
39
- }
40
- module.exports = {
41
- toImpliedDecimal,
42
- fromImpliedDecimal
43
- };
@@ -1,43 +0,0 @@
1
- "use strict";
2
-
3
- var Long = require('bytebuffer').Long;
4
- var v = require('./validation');
5
- var DB_MAX_INSTANCE_ID = Long.fromNumber(Math.pow(2, 48) - 1);
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}`();
15
- }
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
- }
43
- module.exports = ObjectId;