essential-eth 0.9.0 → 0.9.1-next.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/dist/cjs/classes/Contract.js +38 -34
- package/dist/cjs/classes/test/Contract/crv.test.js +146 -339
- package/dist/cjs/classes/test/Contract/ens-abi.d.ts +1 -1
- package/dist/cjs/classes/test/Contract/ens.test.js +9 -66
- package/dist/cjs/classes/test/Contract/fei.test.js +11 -11
- package/dist/cjs/classes/test/Contract/foo-abi.d.ts +1 -1
- package/dist/cjs/classes/test/Contract/uni.test.js +66 -164
- package/dist/cjs/classes/utils/clean-block.js +4 -4
- package/dist/cjs/classes/utils/clean-log.js +4 -4
- package/dist/cjs/classes/utils/clean-transaction-receipt.js +4 -4
- package/dist/cjs/classes/utils/clean-transaction.js +4 -4
- package/dist/cjs/classes/utils/encode-decode-transaction.js +10 -10
- package/dist/cjs/classes/utils/fetchers.d.ts +8 -2
- package/dist/cjs/classes/utils/fetchers.js +20 -12
- package/dist/cjs/classes/utils/prepare-transaction.js +4 -4
- package/dist/cjs/index.d.ts +21 -22
- package/dist/cjs/index.js +21 -22
- package/dist/cjs/index.umd.js +1 -1
- package/dist/cjs/index.umd.js.map +1 -1
- package/dist/cjs/logger/logger.js +79 -41
- package/dist/cjs/logger/package-version.d.ts +1 -1
- package/dist/cjs/logger/package-version.js +1 -1
- package/dist/cjs/providers/AlchemyProvider.js +22 -22
- package/dist/cjs/providers/BaseProvider.js +471 -404
- package/dist/cjs/providers/FallthroughProvider.js +62 -30
- package/dist/cjs/providers/JsonRpcProvider.js +52 -31
- package/dist/cjs/providers/test/fallthrough-provider/get-gas-price.test.js +9 -9
- package/dist/cjs/providers/test/get-transaction-count.test.js +54 -91
- package/dist/cjs/providers/test/json-rpc-provider/call.test.js +87 -148
- package/dist/cjs/providers/test/json-rpc-provider/estimate-gas.test.js +45 -116
- package/dist/cjs/providers/test/json-rpc-provider/get-balance.test.js +36 -74
- package/dist/cjs/providers/test/json-rpc-provider/get-block-number.test.js +13 -9
- package/dist/cjs/providers/test/json-rpc-provider/get-block.test.js +191 -254
- package/dist/cjs/providers/test/json-rpc-provider/get-code.test.js +106 -135
- package/dist/cjs/providers/test/json-rpc-provider/get-fee-data.test.js +48 -73
- package/dist/cjs/providers/test/json-rpc-provider/get-gas-price.test.js +11 -8
- package/dist/cjs/providers/test/json-rpc-provider/get-logs/get-logs.test.js +219 -0
- package/dist/cjs/providers/test/json-rpc-provider/get-logs/mocks.d.ts +14 -0
- package/dist/cjs/providers/test/json-rpc-provider/get-logs/mocks.js +149 -0
- package/dist/cjs/providers/test/json-rpc-provider/get-network.test.js +37 -79
- package/dist/cjs/providers/test/json-rpc-provider/get-transaction-receipt.test.js +136 -157
- package/dist/cjs/providers/test/json-rpc-provider/get-transaction.test.js +121 -162
- package/dist/cjs/providers/test/mock-of.js +0 -5
- package/dist/cjs/providers/test/rpc-urls.d.ts +1 -0
- package/dist/cjs/providers/test/rpc-urls.js +5 -4
- package/dist/cjs/providers/test/test-alchemy-provider.test.js +5 -5
- package/dist/cjs/providers/utils/chains-info.d.ts +5 -448
- package/dist/cjs/providers/utils/chains-info.js +13 -1344
- package/dist/cjs/shared/tiny-big/helpers.js +18 -18
- package/dist/cjs/shared/tiny-big/tiny-big.js +96 -56
- package/dist/cjs/shared/tiny-big/tiny-big.test.js +2 -2
- package/dist/cjs/shared/validate-type.d.ts +1 -1
- package/dist/cjs/shared/validate-type.js +4 -4
- package/dist/cjs/types/Block.types.d.ts +3 -3
- package/dist/cjs/types/Contract.types.d.ts +4 -4
- package/dist/cjs/types/Transaction.types.d.ts +5 -5
- package/dist/cjs/utils/bytes.d.ts +4 -4
- package/dist/cjs/utils/bytes.js +3 -3
- package/dist/cjs/utils/tests/bytes/arrayify.test.js +48 -24
- package/dist/cjs/utils/tests/bytes/concat.test.js +5 -3
- package/dist/cjs/utils/tests/bytes/hex-concat.test.js +15 -13
- package/dist/cjs/utils/tests/bytes/hex-data-length.test.js +49 -32
- package/dist/cjs/utils/tests/bytes/hex-data-slice.test.js +15 -16
- package/dist/cjs/utils/tests/bytes/hex-strip-zeros.test.js +57 -40
- package/dist/cjs/utils/tests/bytes/hex-value.test.js +118 -62
- package/dist/cjs/utils/tests/bytes/hex-zero-pad.test.js +71 -33
- package/dist/cjs/utils/tests/bytes/hexlify.test.js +45 -29
- package/dist/cjs/utils/tests/bytes/is-bytes-like.test.js +10 -11
- package/dist/cjs/utils/tests/bytes/is-bytes.test.js +70 -27
- package/dist/cjs/utils/tests/bytes/is-hex-string.test.js +37 -28
- package/dist/cjs/utils/tests/bytes/strip-zeros.test.js +94 -45
- package/dist/cjs/utils/tests/bytes/zero-pad.test.js +98 -34
- package/dist/cjs/utils/tests/compute-address.test.js +42 -20
- package/dist/cjs/utils/tests/compute-public-key.test.js +20 -9
- package/dist/cjs/utils/tests/ether-to-wei.test.js +5 -13
- package/dist/cjs/utils/tests/hash-message.test.js +26 -15
- package/dist/cjs/utils/tests/is-address.test.js +2 -9
- package/dist/cjs/utils/tests/keccak256.test.js +36 -12
- package/dist/cjs/utils/tests/solidity-keccak256.test.js +43 -42
- package/dist/cjs/utils/tests/split-signature.test.js +29 -8
- package/dist/cjs/utils/tests/to-checksum-address.test.js +1 -4
- package/dist/cjs/utils/tests/to-utf8-bytes.test.js +28 -8
- package/dist/cjs/utils/tests/wei-to-ether.test.js +10 -20
- package/dist/esm/classes/test/Contract/ens-abi.d.ts +1 -1
- package/dist/esm/classes/test/Contract/foo-abi.d.ts +1 -1
- package/dist/esm/classes/utils/fetchers.d.ts +8 -2
- package/dist/esm/classes/utils/fetchers.js +6 -3
- package/dist/esm/index.d.ts +21 -22
- package/dist/esm/index.js +16 -17
- package/dist/esm/logger/package-version.d.ts +1 -1
- package/dist/esm/logger/package-version.js +1 -1
- package/dist/esm/providers/FallthroughProvider.js +3 -3
- package/dist/esm/providers/test/json-rpc-provider/get-logs/mocks.d.ts +14 -0
- package/dist/esm/providers/test/json-rpc-provider/get-logs/mocks.js +142 -0
- package/dist/esm/providers/test/rpc-urls.d.ts +1 -0
- package/dist/esm/providers/test/rpc-urls.js +7 -4
- package/dist/esm/providers/utils/chains-info.d.ts +5 -448
- package/dist/esm/providers/utils/chains-info.js +13 -1344
- package/dist/esm/shared/validate-type.d.ts +1 -1
- package/dist/esm/types/Block.types.d.ts +3 -3
- package/dist/esm/types/Contract.types.d.ts +4 -4
- package/dist/esm/types/Transaction.types.d.ts +5 -5
- package/dist/esm/utils/bytes.d.ts +4 -4
- package/package.json +22 -50
- package/readme.md +15 -38
- package/dist/cjs/providers/test/json-rpc-provider/get-logs.test.js +0 -361
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
function
|
|
1
|
+
function _assert_this_initialized(self) {
|
|
2
2
|
if (self === void 0) {
|
|
3
3
|
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
4
4
|
}
|
|
@@ -18,7 +18,7 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
|
18
18
|
Promise.resolve(value).then(_next, _throw);
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
|
-
function
|
|
21
|
+
function _async_to_generator(fn) {
|
|
22
22
|
return function() {
|
|
23
23
|
var self = this, args = arguments;
|
|
24
24
|
return new Promise(function(resolve, reject) {
|
|
@@ -33,12 +33,12 @@ function _asyncToGenerator(fn) {
|
|
|
33
33
|
});
|
|
34
34
|
};
|
|
35
35
|
}
|
|
36
|
-
function
|
|
36
|
+
function _class_call_check(instance, Constructor) {
|
|
37
37
|
if (!(instance instanceof Constructor)) {
|
|
38
38
|
throw new TypeError("Cannot call a class as a function");
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
|
-
function
|
|
41
|
+
function _define_property(obj, key, value) {
|
|
42
42
|
if (key in obj) {
|
|
43
43
|
Object.defineProperty(obj, key, {
|
|
44
44
|
value: value,
|
|
@@ -51,11 +51,11 @@ function _defineProperty(obj, key, value) {
|
|
|
51
51
|
}
|
|
52
52
|
return obj;
|
|
53
53
|
}
|
|
54
|
-
function
|
|
55
|
-
|
|
54
|
+
function _get_prototype_of(o) {
|
|
55
|
+
_get_prototype_of = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
|
|
56
56
|
return o.__proto__ || Object.getPrototypeOf(o);
|
|
57
57
|
};
|
|
58
|
-
return
|
|
58
|
+
return _get_prototype_of(o);
|
|
59
59
|
}
|
|
60
60
|
function _inherits(subClass, superClass) {
|
|
61
61
|
if (typeof superClass !== "function" && superClass !== null) {
|
|
@@ -68,9 +68,9 @@ function _inherits(subClass, superClass) {
|
|
|
68
68
|
configurable: true
|
|
69
69
|
}
|
|
70
70
|
});
|
|
71
|
-
if (superClass)
|
|
71
|
+
if (superClass) _set_prototype_of(subClass, superClass);
|
|
72
72
|
}
|
|
73
|
-
function
|
|
73
|
+
function _object_spread(target) {
|
|
74
74
|
for(var i = 1; i < arguments.length; i++){
|
|
75
75
|
var source = arguments[i] != null ? arguments[i] : {};
|
|
76
76
|
var ownKeys = Object.keys(source);
|
|
@@ -80,29 +80,29 @@ function _objectSpread(target) {
|
|
|
80
80
|
}));
|
|
81
81
|
}
|
|
82
82
|
ownKeys.forEach(function(key) {
|
|
83
|
-
|
|
83
|
+
_define_property(target, key, source[key]);
|
|
84
84
|
});
|
|
85
85
|
}
|
|
86
86
|
return target;
|
|
87
87
|
}
|
|
88
|
-
function
|
|
89
|
-
if (call && (
|
|
88
|
+
function _possible_constructor_return(self, call) {
|
|
89
|
+
if (call && (_type_of(call) === "object" || typeof call === "function")) {
|
|
90
90
|
return call;
|
|
91
91
|
}
|
|
92
|
-
return
|
|
92
|
+
return _assert_this_initialized(self);
|
|
93
93
|
}
|
|
94
|
-
function
|
|
95
|
-
|
|
94
|
+
function _set_prototype_of(o, p) {
|
|
95
|
+
_set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
|
|
96
96
|
o.__proto__ = p;
|
|
97
97
|
return o;
|
|
98
98
|
};
|
|
99
|
-
return
|
|
99
|
+
return _set_prototype_of(o, p);
|
|
100
100
|
}
|
|
101
|
-
|
|
101
|
+
function _type_of(obj) {
|
|
102
102
|
"@swc/helpers - typeof";
|
|
103
103
|
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
104
|
-
}
|
|
105
|
-
function
|
|
104
|
+
}
|
|
105
|
+
function _is_native_reflect_construct() {
|
|
106
106
|
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
107
107
|
if (Reflect.construct.sham) return false;
|
|
108
108
|
if (typeof Proxy === "function") return true;
|
|
@@ -113,20 +113,20 @@ function _isNativeReflectConstruct() {
|
|
|
113
113
|
return false;
|
|
114
114
|
}
|
|
115
115
|
}
|
|
116
|
-
function
|
|
117
|
-
var hasNativeReflectConstruct =
|
|
116
|
+
function _create_super(Derived) {
|
|
117
|
+
var hasNativeReflectConstruct = _is_native_reflect_construct();
|
|
118
118
|
return function _createSuperInternal() {
|
|
119
|
-
var Super =
|
|
119
|
+
var Super = _get_prototype_of(Derived), result;
|
|
120
120
|
if (hasNativeReflectConstruct) {
|
|
121
|
-
var NewTarget =
|
|
121
|
+
var NewTarget = _get_prototype_of(this).constructor;
|
|
122
122
|
result = Reflect.construct(Super, arguments, NewTarget);
|
|
123
123
|
} else {
|
|
124
124
|
result = Super.apply(this, arguments);
|
|
125
125
|
}
|
|
126
|
-
return
|
|
126
|
+
return _possible_constructor_return(this, result);
|
|
127
127
|
};
|
|
128
128
|
}
|
|
129
|
-
|
|
129
|
+
function _ts_generator(thisArg, body) {
|
|
130
130
|
var f, y, t, g, _ = {
|
|
131
131
|
label: 0,
|
|
132
132
|
sent: function() {
|
|
@@ -220,7 +220,7 @@ var __generator = this && this.__generator || function(thisArg, body) {
|
|
|
220
220
|
done: true
|
|
221
221
|
};
|
|
222
222
|
}
|
|
223
|
-
}
|
|
223
|
+
}
|
|
224
224
|
import { decodeRPCResponse, encodeData } from "./utils/encode-decode-transaction";
|
|
225
225
|
/**
|
|
226
226
|
* @param txnData
|
|
@@ -236,7 +236,11 @@ import { decodeRPCResponse, encodeData } from "./utils/encode-decode-transaction
|
|
|
236
236
|
export var BaseContract = function BaseContract(addressOrName, contractInterface, signerOrProvider) {
|
|
237
237
|
"use strict";
|
|
238
238
|
var _this = this;
|
|
239
|
-
|
|
239
|
+
_class_call_check(this, BaseContract);
|
|
240
|
+
/**
|
|
241
|
+
* The URL to your Eth node. Consider POKT or Infura
|
|
242
|
+
*/ _define_property(this, "_address", void 0);
|
|
243
|
+
_define_property(this, "_provider", void 0);
|
|
240
244
|
this._address = addressOrName;
|
|
241
245
|
this._provider = signerOrProvider;
|
|
242
246
|
contractInterface.filter(function(jsonABIArgument) {
|
|
@@ -244,10 +248,10 @@ export var BaseContract = function BaseContract(addressOrName, contractInterface
|
|
|
244
248
|
}).forEach(function(jsonABIArgument) {
|
|
245
249
|
if ("name" in jsonABIArgument && typeof jsonABIArgument.name === "string") {
|
|
246
250
|
var _this1 = _this;
|
|
247
|
-
defineReadOnly(_this, jsonABIArgument.name, /*#__PURE__*/
|
|
251
|
+
defineReadOnly(_this, jsonABIArgument.name, /*#__PURE__*/ _async_to_generator(function() {
|
|
248
252
|
var _len, _args, _key, functionArguments, options, lastArg, data, decimalGas, req, nodeResponse;
|
|
249
253
|
var _arguments = arguments;
|
|
250
|
-
return
|
|
254
|
+
return _ts_generator(this, function(_state) {
|
|
251
255
|
switch(_state.label){
|
|
252
256
|
case 0:
|
|
253
257
|
for(_len = _arguments.length, _args = new Array(_len), _key = 0; _key < _len; _key++){
|
|
@@ -263,13 +267,13 @@ export var BaseContract = function BaseContract(addressOrName, contractInterface
|
|
|
263
267
|
data = encodeData(jsonABIArgument, functionArguments);
|
|
264
268
|
decimalGas = typeof options.gasLimit === "number" ? options.gasLimit /* user passed in "gasLimit" directly */ : typeof (jsonABIArgument === null || jsonABIArgument === void 0 ? void 0 : jsonABIArgument.gas) === "number" /* ABI specified "gas". */ ? estimateGas(data) : null;
|
|
265
269
|
req = function() {
|
|
266
|
-
var _ref =
|
|
267
|
-
return
|
|
270
|
+
var _ref = _async_to_generator(function() {
|
|
271
|
+
return _ts_generator(this, function(_state) {
|
|
268
272
|
switch(_state.label){
|
|
269
273
|
case 0:
|
|
270
274
|
return [
|
|
271
275
|
4,
|
|
272
|
-
_this1._provider.call(
|
|
276
|
+
_this1._provider.call(_object_spread({
|
|
273
277
|
to: _this1._address.toLowerCase(),
|
|
274
278
|
data: data
|
|
275
279
|
}, decimalGas ? {
|
|
@@ -370,9 +374,9 @@ export var BaseContract = function BaseContract(addressOrName, contractInterface
|
|
|
370
374
|
*/ export var Contract = /*#__PURE__*/ function(BaseContract) {
|
|
371
375
|
"use strict";
|
|
372
376
|
_inherits(Contract, BaseContract);
|
|
373
|
-
var _super =
|
|
377
|
+
var _super = _create_super(Contract);
|
|
374
378
|
function Contract() {
|
|
375
|
-
|
|
379
|
+
_class_call_check(this, Contract);
|
|
376
380
|
return _super.apply(this, arguments);
|
|
377
381
|
}
|
|
378
382
|
return Contract;
|