essential-eth 0.9.1-next.0 → 0.9.1-next.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 (104) hide show
  1. package/dist/cjs/classes/Contract.js +66 -311
  2. package/dist/cjs/classes/test/Contract/crv-abi.js +256 -252
  3. package/dist/cjs/classes/test/Contract/ens-abi.js +212 -497
  4. package/dist/cjs/classes/test/Contract/fei-abi.js +284 -605
  5. package/dist/cjs/classes/test/Contract/foo-abi.js +21 -44
  6. package/dist/cjs/classes/test/Contract/uniswap-abi.js +68 -64
  7. package/dist/cjs/classes/utils/clean-block.js +30 -52
  8. package/dist/cjs/classes/utils/clean-log.js +20 -42
  9. package/dist/cjs/classes/utils/clean-transaction-receipt.js +30 -51
  10. package/dist/cjs/classes/utils/clean-transaction.js +30 -52
  11. package/dist/cjs/classes/utils/encode-decode-transaction.js +107 -148
  12. package/dist/cjs/classes/utils/fetchers.js +44 -166
  13. package/dist/cjs/classes/utils/hex-to-decimal.js +6 -1
  14. package/dist/cjs/classes/utils/prepare-transaction.js +36 -59
  15. package/dist/cjs/index.js +56 -25
  16. package/dist/cjs/index.umd.js +1 -1
  17. package/dist/cjs/index.umd.js.map +1 -1
  18. package/dist/cjs/logger/logger.js +29 -123
  19. package/dist/cjs/logger/package-version.d.ts +1 -1
  20. package/dist/cjs/logger/package-version.js +4 -1
  21. package/dist/cjs/providers/AlchemyProvider.js +9 -82
  22. package/dist/cjs/providers/BaseProvider.js +520 -958
  23. package/dist/cjs/providers/FallthroughProvider.js +47 -156
  24. package/dist/cjs/providers/JsonRpcProvider.js +28 -114
  25. package/dist/cjs/providers/test/json-rpc-provider/get-logs/mocks.js +104 -101
  26. package/dist/cjs/providers/test/mock-of.js +6 -3
  27. package/dist/cjs/providers/test/rpc-urls.js +23 -15
  28. package/dist/cjs/providers/utils/chains-info.js +3 -1
  29. package/dist/cjs/shared/tiny-big/helpers.js +42 -93
  30. package/dist/cjs/shared/tiny-big/tiny-big.js +81 -210
  31. package/dist/cjs/shared/validate-type.js +7 -7
  32. package/dist/cjs/types/Block.types.js +2 -1
  33. package/dist/cjs/types/Contract.types.js +2 -1
  34. package/dist/cjs/types/FeeData.types.js +2 -1
  35. package/dist/cjs/types/Filter.types.js +2 -1
  36. package/dist/cjs/types/Network.types.js +2 -3
  37. package/dist/cjs/types/Transaction.types.js +2 -1
  38. package/dist/cjs/utils/bytes.js +318 -286
  39. package/dist/cjs/utils/compute-address.js +15 -8
  40. package/dist/cjs/utils/compute-public-key.js +10 -5
  41. package/dist/cjs/utils/ether-to-gwei.js +11 -10
  42. package/dist/cjs/utils/ether-to-wei.js +11 -10
  43. package/dist/cjs/utils/gwei-to-ether.js +11 -10
  44. package/dist/cjs/utils/hash-message.js +16 -11
  45. package/dist/cjs/utils/is-address.js +12 -8
  46. package/dist/cjs/utils/keccak256.js +14 -8
  47. package/dist/cjs/utils/solidity-keccak256.js +60 -49
  48. package/dist/cjs/utils/split-signature.js +73 -55
  49. package/dist/cjs/utils/to-checksum-address.js +20 -15
  50. package/dist/cjs/utils/to-utf8-bytes.js +6 -1
  51. package/dist/cjs/utils/wei-to-ether.js +15 -13
  52. package/dist/esm/logger/package-version.d.ts +1 -1
  53. package/dist/esm/logger/package-version.js +1 -1
  54. package/package.json +2 -2
  55. package/readme.md +1 -1
  56. package/dist/cjs/classes/test/Contract/crv.test.js +0 -497
  57. package/dist/cjs/classes/test/Contract/ens.test.js +0 -160
  58. package/dist/cjs/classes/test/Contract/fei.test.js +0 -224
  59. package/dist/cjs/classes/test/Contract/foo.test.js +0 -33
  60. package/dist/cjs/classes/test/Contract/uni.test.js +0 -289
  61. package/dist/cjs/providers/test/fallthrough-provider/get-gas-price.test.js +0 -228
  62. package/dist/cjs/providers/test/get-transaction-count.test.js +0 -239
  63. package/dist/cjs/providers/test/json-rpc-provider/call.test.js +0 -375
  64. package/dist/cjs/providers/test/json-rpc-provider/estimate-gas.test.js +0 -217
  65. package/dist/cjs/providers/test/json-rpc-provider/get-balance.test.js +0 -223
  66. package/dist/cjs/providers/test/json-rpc-provider/get-block-number.test.js +0 -163
  67. package/dist/cjs/providers/test/json-rpc-provider/get-block.test.js +0 -414
  68. package/dist/cjs/providers/test/json-rpc-provider/get-code.test.js +0 -282
  69. package/dist/cjs/providers/test/json-rpc-provider/get-fee-data.test.js +0 -187
  70. package/dist/cjs/providers/test/json-rpc-provider/get-gas-price.test.js +0 -167
  71. package/dist/cjs/providers/test/json-rpc-provider/get-logs/get-logs.test.js +0 -219
  72. package/dist/cjs/providers/test/json-rpc-provider/get-network.test.js +0 -232
  73. package/dist/cjs/providers/test/json-rpc-provider/get-transaction-receipt.test.js +0 -280
  74. package/dist/cjs/providers/test/json-rpc-provider/get-transaction.test.js +0 -266
  75. package/dist/cjs/providers/test/test-alchemy-provider.test.js +0 -151
  76. package/dist/cjs/shared/tiny-big/helpers.test.js +0 -29
  77. package/dist/cjs/shared/tiny-big/tiny-big.test.js +0 -34
  78. package/dist/cjs/utils/tests/bytes/arrayify.test.js +0 -64
  79. package/dist/cjs/utils/tests/bytes/concat.test.js +0 -17
  80. package/dist/cjs/utils/tests/bytes/hex-concat.test.js +0 -65
  81. package/dist/cjs/utils/tests/bytes/hex-data-length.test.js +0 -66
  82. package/dist/cjs/utils/tests/bytes/hex-data-slice.test.js +0 -51
  83. package/dist/cjs/utils/tests/bytes/hex-strip-zeros.test.js +0 -75
  84. package/dist/cjs/utils/tests/bytes/hex-value.test.js +0 -141
  85. package/dist/cjs/utils/tests/bytes/hex-zero-pad.test.js +0 -100
  86. package/dist/cjs/utils/tests/bytes/hexlify.test.js +0 -78
  87. package/dist/cjs/utils/tests/bytes/is-bytes-like.test.js +0 -68
  88. package/dist/cjs/utils/tests/bytes/is-bytes.test.js +0 -76
  89. package/dist/cjs/utils/tests/bytes/is-hex-string.test.js +0 -97
  90. package/dist/cjs/utils/tests/bytes/strip-zeros.test.js +0 -106
  91. package/dist/cjs/utils/tests/bytes/zero-pad.test.js +0 -144
  92. package/dist/cjs/utils/tests/compute-address.test.js +0 -49
  93. package/dist/cjs/utils/tests/compute-public-key.test.js +0 -26
  94. package/dist/cjs/utils/tests/ether-to-gwei.test.js +0 -26
  95. package/dist/cjs/utils/tests/ether-to-wei.test.js +0 -36
  96. package/dist/cjs/utils/tests/gwei-to-ether.test.js +0 -28
  97. package/dist/cjs/utils/tests/hash-message.test.js +0 -32
  98. package/dist/cjs/utils/tests/is-address.test.js +0 -48
  99. package/dist/cjs/utils/tests/keccak256.test.js +0 -121
  100. package/dist/cjs/utils/tests/solidity-keccak256.test.js +0 -311
  101. package/dist/cjs/utils/tests/split-signature.test.js +0 -46
  102. package/dist/cjs/utils/tests/to-checksum-address.test.js +0 -39
  103. package/dist/cjs/utils/tests/to-utf8-bytes.test.js +0 -34
  104. package/dist/cjs/utils/tests/wei-to-ether.test.js +0 -41
@@ -1,130 +1,36 @@
1
- function _array_like_to_array(arr, len) {
2
- if (len == null || len > arr.length) len = arr.length;
3
- for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
4
- return arr2;
5
- }
6
- function _array_with_holes(arr) {
7
- if (Array.isArray(arr)) return arr;
8
- }
9
- function _class_call_check(instance, Constructor) {
10
- if (!(instance instanceof Constructor)) {
11
- throw new TypeError("Cannot call a class as a function");
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.logger = void 0;
4
+ const package_version_1 = require("./package-version");
5
+ class Logger {
6
+ constructor() {
7
+ this.packageVersion = package_version_1.version;
12
8
  }
13
- }
14
- function _defineProperties(target, props) {
15
- for(var i = 0; i < props.length; i++){
16
- var descriptor = props[i];
17
- descriptor.enumerable = descriptor.enumerable || false;
18
- descriptor.configurable = true;
19
- if ("value" in descriptor) descriptor.writable = true;
20
- Object.defineProperty(target, descriptor.key, descriptor);
9
+ throwError(message, args) {
10
+ const argsLength = Object.keys(args).length;
11
+ throw new Error(`${message} (${Object.entries(args).map(([key, value], index) => `${key}=${value}${index < argsLength - 1 && ', '}`)}, version=essential-eth@${this.packageVersion})`);
21
12
  }
22
- }
23
- function _create_class(Constructor, protoProps, staticProps) {
24
- if (protoProps) _defineProperties(Constructor.prototype, protoProps);
25
- if (staticProps) _defineProperties(Constructor, staticProps);
26
- return Constructor;
27
- }
28
- function _define_property(obj, key, value) {
29
- if (key in obj) {
30
- Object.defineProperty(obj, key, {
31
- value: value,
32
- enumerable: true,
33
- configurable: true,
34
- writable: true
35
- });
36
- } else {
37
- obj[key] = value;
13
+ throwArgumentError(message, arg, value) {
14
+ throw new Error(`${message} (argument="${arg}" value=${value}, version=essential-eth@${this.packageVersion})`);
38
15
  }
39
- return obj;
40
- }
41
- function _iterable_to_array_limit(arr, i) {
42
- var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
43
- if (_i == null) return;
44
- var _arr = [];
45
- var _n = true;
46
- var _d = false;
47
- var _s, _e;
48
- try {
49
- for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
50
- _arr.push(_s.value);
51
- if (i && _arr.length === i) break;
16
+ checkSafeUint53(value, message = 'value not safe') {
17
+ if (typeof value !== 'number') {
18
+ return;
52
19
  }
53
- } catch (err) {
54
- _d = true;
55
- _e = err;
56
- } finally{
57
- try {
58
- if (!_n && _i["return"] != null) _i["return"]();
59
- } finally{
60
- if (_d) throw _e;
20
+ if (value < 0 || value >= 0x1fffffffffffff) {
21
+ this.throwError(message, {
22
+ operation: 'checkSafeInteger',
23
+ fault: 'out-of-safe-range',
24
+ value: value,
25
+ });
26
+ }
27
+ if (value % 1) {
28
+ this.throwError(message, {
29
+ operation: 'checkSafeInteger',
30
+ fault: 'non-integer',
31
+ value: value,
32
+ });
61
33
  }
62
34
  }
63
- return _arr;
64
- }
65
- function _non_iterable_rest() {
66
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
67
- }
68
- function _sliced_to_array(arr, i) {
69
- return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
70
35
  }
71
- function _unsupported_iterable_to_array(o, minLen) {
72
- if (!o) return;
73
- if (typeof o === "string") return _array_like_to_array(o, minLen);
74
- var n = Object.prototype.toString.call(o).slice(8, -1);
75
- if (n === "Object" && o.constructor) n = o.constructor.name;
76
- if (n === "Map" || n === "Set") return Array.from(n);
77
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
78
- }
79
- import { version } from "./package-version";
80
- var Logger = /*#__PURE__*/ function() {
81
- "use strict";
82
- function Logger() {
83
- _class_call_check(this, Logger);
84
- _define_property(this, "packageVersion", void 0);
85
- this.packageVersion = version;
86
- }
87
- _create_class(Logger, [
88
- {
89
- key: "throwError",
90
- value: function throwError(message, args) {
91
- var argsLength = Object.keys(args).length;
92
- throw new Error("".concat(message, " (").concat(Object.entries(args).map(function(param, index) {
93
- var _param = _sliced_to_array(param, 2), key = _param[0], value = _param[1];
94
- return "".concat(key, "=").concat(value).concat(index < argsLength - 1 && ", ");
95
- }), ", version=essential-eth@").concat(this.packageVersion, ")"));
96
- }
97
- },
98
- {
99
- key: "throwArgumentError",
100
- value: function throwArgumentError(message, arg, value) {
101
- throw new Error("".concat(message, ' (argument="').concat(arg, '" value=').concat(value, ", version=essential-eth@").concat(this.packageVersion, ")"));
102
- }
103
- },
104
- {
105
- key: "checkSafeUint53",
106
- value: function checkSafeUint53(value) {
107
- var message = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "value not safe";
108
- if (typeof value !== "number") {
109
- return;
110
- }
111
- if (value < 0 || value >= 0x1fffffffffffff) {
112
- this.throwError(message, {
113
- operation: "checkSafeInteger",
114
- fault: "out-of-safe-range",
115
- value: value
116
- });
117
- }
118
- if (value % 1) {
119
- this.throwError(message, {
120
- operation: "checkSafeInteger",
121
- fault: "non-integer",
122
- value: value
123
- });
124
- }
125
- }
126
- }
127
- ]);
128
- return Logger;
129
- }();
130
- export var logger = new Logger();
36
+ exports.logger = new Logger();
@@ -1 +1 @@
1
- export declare const version = "0.9.1-next.0";
1
+ export declare const version = "0.9.1-next.1";
@@ -1,2 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.version = void 0;
1
4
  // Generated by genversion.
2
- export var version = "0.9.1-next.0";
5
+ exports.version = '0.9.1-next.1';
@@ -1,84 +1,11 @@
1
- function _assert_this_initialized(self) {
2
- if (self === void 0) {
3
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AlchemyProvider = void 0;
4
+ const JsonRpcProvider_1 = require("./JsonRpcProvider");
5
+ class AlchemyProvider extends JsonRpcProvider_1.JsonRpcProvider {
6
+ constructor(apiKey, network = 'mainnet') {
7
+ const alchemyUrl = `https://eth-${network}.alchemyapi.io/v2/${apiKey}`;
8
+ super(alchemyUrl);
4
9
  }
5
- return self;
6
10
  }
7
- function _class_call_check(instance, Constructor) {
8
- if (!(instance instanceof Constructor)) {
9
- throw new TypeError("Cannot call a class as a function");
10
- }
11
- }
12
- function _get_prototype_of(o) {
13
- _get_prototype_of = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
14
- return o.__proto__ || Object.getPrototypeOf(o);
15
- };
16
- return _get_prototype_of(o);
17
- }
18
- function _inherits(subClass, superClass) {
19
- if (typeof superClass !== "function" && superClass !== null) {
20
- throw new TypeError("Super expression must either be null or a function");
21
- }
22
- subClass.prototype = Object.create(superClass && superClass.prototype, {
23
- constructor: {
24
- value: subClass,
25
- writable: true,
26
- configurable: true
27
- }
28
- });
29
- if (superClass) _set_prototype_of(subClass, superClass);
30
- }
31
- function _possible_constructor_return(self, call) {
32
- if (call && (_type_of(call) === "object" || typeof call === "function")) {
33
- return call;
34
- }
35
- return _assert_this_initialized(self);
36
- }
37
- function _set_prototype_of(o, p) {
38
- _set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
39
- o.__proto__ = p;
40
- return o;
41
- };
42
- return _set_prototype_of(o, p);
43
- }
44
- function _type_of(obj) {
45
- "@swc/helpers - typeof";
46
- return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
47
- }
48
- function _is_native_reflect_construct() {
49
- if (typeof Reflect === "undefined" || !Reflect.construct) return false;
50
- if (Reflect.construct.sham) return false;
51
- if (typeof Proxy === "function") return true;
52
- try {
53
- Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
54
- return true;
55
- } catch (e) {
56
- return false;
57
- }
58
- }
59
- function _create_super(Derived) {
60
- var hasNativeReflectConstruct = _is_native_reflect_construct();
61
- return function _createSuperInternal() {
62
- var Super = _get_prototype_of(Derived), result;
63
- if (hasNativeReflectConstruct) {
64
- var NewTarget = _get_prototype_of(this).constructor;
65
- result = Reflect.construct(Super, arguments, NewTarget);
66
- } else {
67
- result = Super.apply(this, arguments);
68
- }
69
- return _possible_constructor_return(this, result);
70
- };
71
- }
72
- import { JsonRpcProvider } from "./JsonRpcProvider";
73
- export var AlchemyProvider = /*#__PURE__*/ function(JsonRpcProvider) {
74
- "use strict";
75
- _inherits(AlchemyProvider, JsonRpcProvider);
76
- var _super = _create_super(AlchemyProvider);
77
- function AlchemyProvider(apiKey) {
78
- var network = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "mainnet";
79
- _class_call_check(this, AlchemyProvider);
80
- var alchemyUrl = "https://eth-".concat(network, ".alchemyapi.io/v2/").concat(apiKey);
81
- return _super.call(this, alchemyUrl);
82
- }
83
- return AlchemyProvider;
84
- }(JsonRpcProvider);
11
+ exports.AlchemyProvider = AlchemyProvider;