essential-eth 0.6.2 → 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/dist/cjs/classes/Contract.js +307 -66
- package/dist/cjs/classes/test/Contract/crv-abi.js +252 -256
- package/dist/cjs/classes/test/Contract/crv.test.js +690 -0
- package/dist/cjs/classes/test/Contract/ens-abi.js +497 -212
- package/dist/cjs/classes/test/Contract/ens.test.js +217 -0
- package/dist/cjs/classes/test/Contract/fei-abi.js +605 -284
- package/dist/cjs/classes/test/Contract/fei.test.js +224 -0
- package/dist/cjs/classes/test/Contract/foo-abi.js +44 -21
- package/dist/cjs/classes/test/Contract/foo.test.js +33 -0
- package/dist/cjs/classes/test/Contract/uni.test.js +387 -0
- package/dist/cjs/classes/test/Contract/uniswap-abi.js +64 -68
- package/dist/cjs/classes/utils/clean-block.d.ts +1 -2
- package/dist/cjs/classes/utils/clean-block.js +52 -30
- package/dist/cjs/classes/utils/clean-log.js +42 -20
- package/dist/cjs/classes/utils/clean-transaction-receipt.js +51 -29
- package/dist/cjs/classes/utils/clean-transaction.js +52 -29
- package/dist/cjs/classes/utils/encode-decode-transaction.d.ts +1 -1
- package/dist/cjs/classes/utils/encode-decode-transaction.js +163 -83
- package/dist/cjs/classes/utils/fetchers.js +165 -41
- package/dist/cjs/classes/utils/hex-to-decimal.js +1 -6
- package/dist/cjs/classes/utils/prepare-transaction.js +59 -36
- package/dist/cjs/index.js +25 -54
- package/dist/cjs/index.umd.js +1 -1
- package/dist/cjs/index.umd.js.map +1 -1
- package/dist/cjs/logger/logger.js +79 -23
- package/dist/cjs/logger/package-version.d.ts +1 -1
- package/dist/cjs/logger/package-version.js +1 -4
- package/dist/cjs/providers/BaseProvider.d.ts +2 -0
- package/dist/cjs/providers/BaseProvider.js +883 -475
- package/dist/cjs/providers/FallthroughProvider.js +118 -37
- package/dist/cjs/providers/JsonRpcProvider.js +93 -28
- package/dist/cjs/providers/test/fallthrough-provider/get-gas-price.test.js +228 -0
- package/dist/cjs/providers/test/get-transaction-count.test.js +276 -0
- package/dist/cjs/providers/test/json-rpc-provider/call.test.js +436 -0
- package/dist/cjs/providers/test/json-rpc-provider/estimate-gas.test.js +288 -0
- package/dist/cjs/providers/test/json-rpc-provider/get-balance.test.js +261 -0
- package/dist/cjs/providers/test/json-rpc-provider/get-block-number.test.js +230 -0
- package/dist/cjs/providers/test/json-rpc-provider/get-block.test.js +501 -0
- package/dist/cjs/providers/test/json-rpc-provider/get-code.test.js +311 -0
- package/dist/cjs/providers/test/json-rpc-provider/get-fee-data.test.js +212 -0
- package/dist/cjs/providers/test/json-rpc-provider/get-gas-price.test.js +202 -0
- package/dist/cjs/providers/test/json-rpc-provider/get-logs.test.js +361 -0
- package/dist/cjs/providers/test/json-rpc-provider/get-network.test.js +274 -0
- package/dist/cjs/providers/test/json-rpc-provider/get-transaction-receipt.test.js +301 -0
- package/dist/cjs/providers/test/json-rpc-provider/get-transaction.test.js +307 -0
- package/dist/cjs/providers/test/rpc-urls.js +9 -12
- package/dist/cjs/providers/utils/chains-info.js +1 -3
- package/dist/cjs/shared/tiny-big/helpers.js +93 -42
- package/dist/cjs/shared/tiny-big/helpers.test.js +29 -0
- package/dist/cjs/shared/tiny-big/tiny-big.js +161 -72
- package/dist/cjs/shared/tiny-big/tiny-big.test.js +34 -0
- package/dist/cjs/shared/validate-type.js +7 -7
- package/dist/cjs/types/Block.types.js +1 -2
- package/dist/cjs/types/Contract.types.js +1 -2
- package/dist/cjs/types/FeeData.types.d.ts +7 -0
- package/dist/cjs/types/FeeData.types.js +1 -0
- package/dist/cjs/types/Filter.types.js +1 -2
- package/dist/cjs/types/Network.types.js +3 -2
- package/dist/cjs/types/Transaction.types.js +1 -2
- package/dist/cjs/utils/bytes.js +286 -318
- package/dist/cjs/utils/compute-address.js +8 -14
- package/dist/cjs/utils/compute-public-key.js +5 -10
- package/dist/cjs/utils/ether-to-gwei.js +10 -11
- package/dist/cjs/utils/ether-to-wei.js +10 -11
- package/dist/cjs/utils/gwei-to-ether.js +10 -11
- package/dist/cjs/utils/hash-message.d.ts +1 -1
- package/dist/cjs/utils/hash-message.js +11 -14
- package/dist/cjs/utils/is-address.js +8 -12
- package/dist/cjs/utils/keccak256.js +8 -14
- package/dist/cjs/utils/solidity-keccak256.js +49 -60
- package/dist/cjs/utils/split-signature.js +55 -73
- package/dist/cjs/utils/tests/bytes/arrayify.test.js +40 -0
- package/dist/cjs/utils/tests/bytes/concat.test.js +15 -0
- package/dist/cjs/utils/tests/bytes/hex-concat.test.js +63 -0
- package/dist/cjs/utils/tests/bytes/hex-data-length.test.js +49 -0
- package/dist/cjs/utils/tests/bytes/hex-data-slice.test.js +52 -0
- package/dist/cjs/utils/tests/bytes/hex-strip-zeros.test.js +58 -0
- package/dist/cjs/utils/tests/bytes/hex-value.test.js +85 -0
- package/dist/cjs/utils/tests/bytes/hex-zero-pad.test.js +62 -0
- package/dist/cjs/utils/tests/bytes/hexlify.test.js +62 -0
- package/dist/cjs/utils/tests/bytes/is-bytes-like.test.js +69 -0
- package/dist/cjs/utils/tests/bytes/is-bytes.test.js +33 -0
- package/dist/cjs/utils/tests/bytes/is-hex-string.test.js +88 -0
- package/dist/cjs/utils/tests/bytes/strip-zeros.test.js +57 -0
- package/dist/cjs/utils/tests/bytes/zero-pad.test.js +80 -0
- package/dist/cjs/utils/tests/compute-address.test.js +27 -0
- package/dist/cjs/utils/tests/compute-public-key.test.js +15 -0
- package/dist/cjs/utils/tests/ether-to-gwei.test.js +26 -0
- package/dist/cjs/utils/tests/ether-to-wei.test.js +44 -0
- package/dist/cjs/utils/tests/gwei-to-ether.test.js +28 -0
- package/dist/cjs/utils/tests/hash-message.test.js +21 -0
- package/dist/cjs/utils/tests/is-address.test.js +55 -0
- package/dist/cjs/utils/tests/keccak256.test.js +97 -0
- package/dist/cjs/utils/tests/solidity-keccak256.test.js +310 -0
- package/dist/cjs/utils/tests/split-signature.test.js +25 -0
- package/dist/cjs/utils/tests/to-checksum-address.test.js +42 -0
- package/dist/cjs/utils/tests/to-utf8-bytes.test.js +14 -0
- package/dist/cjs/utils/tests/wei-to-ether.test.js +51 -0
- package/dist/cjs/utils/to-checksum-address.js +15 -20
- package/dist/cjs/utils/to-utf8-bytes.js +1 -6
- package/dist/cjs/utils/wei-to-ether.js +13 -15
- package/dist/esm/classes/utils/clean-block.d.ts +1 -2
- package/dist/esm/classes/utils/clean-block.js +1 -1
- package/dist/esm/classes/utils/clean-transaction-receipt.js +2 -1
- package/dist/esm/classes/utils/clean-transaction.js +2 -1
- package/dist/esm/classes/utils/encode-decode-transaction.d.ts +1 -1
- package/dist/esm/classes/utils/encode-decode-transaction.js +37 -2
- package/dist/esm/logger/package-version.d.ts +1 -1
- package/dist/esm/logger/package-version.js +1 -1
- package/dist/esm/providers/BaseProvider.d.ts +2 -0
- package/dist/esm/providers/BaseProvider.js +15 -0
- package/dist/esm/types/FeeData.types.d.ts +7 -0
- package/dist/esm/types/FeeData.types.js +1 -0
- package/dist/esm/utils/compute-address.js +2 -1
- package/dist/esm/utils/hash-message.d.ts +1 -1
- package/dist/esm/utils/hash-message.js +3 -1
- package/dist/esm/utils/is-address.js +1 -1
- package/package.json +10 -8
- package/readme.md +63 -3
|
@@ -1,72 +1,309 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
function _assertThisInitialized(self) {
|
|
2
|
+
if (self === void 0) {
|
|
3
|
+
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
4
|
+
}
|
|
5
|
+
return self;
|
|
6
|
+
}
|
|
7
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
8
|
+
try {
|
|
9
|
+
var info = gen[key](arg);
|
|
10
|
+
var value = info.value;
|
|
11
|
+
} catch (error) {
|
|
12
|
+
reject(error);
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
if (info.done) {
|
|
16
|
+
resolve(value);
|
|
17
|
+
} else {
|
|
18
|
+
Promise.resolve(value).then(_next, _throw);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
function _asyncToGenerator(fn) {
|
|
22
|
+
return function() {
|
|
23
|
+
var self = this, args = arguments;
|
|
24
|
+
return new Promise(function(resolve, reject) {
|
|
25
|
+
var gen = fn.apply(self, args);
|
|
26
|
+
function _next(value) {
|
|
27
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
28
|
+
}
|
|
29
|
+
function _throw(err) {
|
|
30
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
31
|
+
}
|
|
32
|
+
_next(undefined);
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
function _classCallCheck(instance, Constructor) {
|
|
37
|
+
if (!(instance instanceof Constructor)) {
|
|
38
|
+
throw new TypeError("Cannot call a class as a function");
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
function _defineProperty(obj, key, value) {
|
|
42
|
+
if (key in obj) {
|
|
43
|
+
Object.defineProperty(obj, key, {
|
|
44
|
+
value: value,
|
|
45
|
+
enumerable: true,
|
|
46
|
+
configurable: true,
|
|
47
|
+
writable: true
|
|
48
|
+
});
|
|
49
|
+
} else {
|
|
50
|
+
obj[key] = value;
|
|
51
|
+
}
|
|
52
|
+
return obj;
|
|
53
|
+
}
|
|
54
|
+
function _getPrototypeOf(o) {
|
|
55
|
+
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
|
|
56
|
+
return o.__proto__ || Object.getPrototypeOf(o);
|
|
57
|
+
};
|
|
58
|
+
return _getPrototypeOf(o);
|
|
59
|
+
}
|
|
60
|
+
function _inherits(subClass, superClass) {
|
|
61
|
+
if (typeof superClass !== "function" && superClass !== null) {
|
|
62
|
+
throw new TypeError("Super expression must either be null or a function");
|
|
63
|
+
}
|
|
64
|
+
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
65
|
+
constructor: {
|
|
66
|
+
value: subClass,
|
|
67
|
+
writable: true,
|
|
68
|
+
configurable: true
|
|
69
|
+
}
|
|
9
70
|
});
|
|
71
|
+
if (superClass) _setPrototypeOf(subClass, superClass);
|
|
72
|
+
}
|
|
73
|
+
function _objectSpread(target) {
|
|
74
|
+
for(var i = 1; i < arguments.length; i++){
|
|
75
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
76
|
+
var ownKeys = Object.keys(source);
|
|
77
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
78
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
79
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
80
|
+
}));
|
|
81
|
+
}
|
|
82
|
+
ownKeys.forEach(function(key) {
|
|
83
|
+
_defineProperty(target, key, source[key]);
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
return target;
|
|
87
|
+
}
|
|
88
|
+
function _possibleConstructorReturn(self, call) {
|
|
89
|
+
if (call && (_typeof(call) === "object" || typeof call === "function")) {
|
|
90
|
+
return call;
|
|
91
|
+
}
|
|
92
|
+
return _assertThisInitialized(self);
|
|
93
|
+
}
|
|
94
|
+
function _setPrototypeOf(o, p) {
|
|
95
|
+
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
|
|
96
|
+
o.__proto__ = p;
|
|
97
|
+
return o;
|
|
98
|
+
};
|
|
99
|
+
return _setPrototypeOf(o, p);
|
|
100
|
+
}
|
|
101
|
+
var _typeof = function(obj) {
|
|
102
|
+
"@swc/helpers - typeof";
|
|
103
|
+
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
10
104
|
};
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
105
|
+
function _isNativeReflectConstruct() {
|
|
106
|
+
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
107
|
+
if (Reflect.construct.sham) return false;
|
|
108
|
+
if (typeof Proxy === "function") return true;
|
|
109
|
+
try {
|
|
110
|
+
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
|
|
111
|
+
return true;
|
|
112
|
+
} catch (e) {
|
|
113
|
+
return false;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
function _createSuper(Derived) {
|
|
117
|
+
var hasNativeReflectConstruct = _isNativeReflectConstruct();
|
|
118
|
+
return function _createSuperInternal() {
|
|
119
|
+
var Super = _getPrototypeOf(Derived), result;
|
|
120
|
+
if (hasNativeReflectConstruct) {
|
|
121
|
+
var NewTarget = _getPrototypeOf(this).constructor;
|
|
122
|
+
result = Reflect.construct(Super, arguments, NewTarget);
|
|
123
|
+
} else {
|
|
124
|
+
result = Super.apply(this, arguments);
|
|
125
|
+
}
|
|
126
|
+
return _possibleConstructorReturn(this, result);
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
var __generator = this && this.__generator || function(thisArg, body) {
|
|
130
|
+
var f, y, t, g, _ = {
|
|
131
|
+
label: 0,
|
|
132
|
+
sent: function() {
|
|
133
|
+
if (t[0] & 1) throw t[1];
|
|
134
|
+
return t[1];
|
|
135
|
+
},
|
|
136
|
+
trys: [],
|
|
137
|
+
ops: []
|
|
138
|
+
};
|
|
139
|
+
return(g = {
|
|
140
|
+
next: verb(0),
|
|
141
|
+
"throw": verb(1),
|
|
142
|
+
"return": verb(2)
|
|
143
|
+
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
144
|
+
return this;
|
|
145
|
+
}), g);
|
|
146
|
+
function verb(n) {
|
|
147
|
+
return function(v) {
|
|
148
|
+
return step([
|
|
149
|
+
n,
|
|
150
|
+
v
|
|
151
|
+
]);
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
function step(op) {
|
|
155
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
156
|
+
while(_)try {
|
|
157
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
158
|
+
if (y = 0, t) op = [
|
|
159
|
+
op[0] & 2,
|
|
160
|
+
t.value
|
|
161
|
+
];
|
|
162
|
+
switch(op[0]){
|
|
163
|
+
case 0:
|
|
164
|
+
case 1:
|
|
165
|
+
t = op;
|
|
166
|
+
break;
|
|
167
|
+
case 4:
|
|
168
|
+
_.label++;
|
|
169
|
+
return {
|
|
170
|
+
value: op[1],
|
|
171
|
+
done: false
|
|
172
|
+
};
|
|
173
|
+
case 5:
|
|
174
|
+
_.label++;
|
|
175
|
+
y = op[1];
|
|
176
|
+
op = [
|
|
177
|
+
0
|
|
178
|
+
];
|
|
179
|
+
continue;
|
|
180
|
+
case 7:
|
|
181
|
+
op = _.ops.pop();
|
|
182
|
+
_.trys.pop();
|
|
183
|
+
continue;
|
|
184
|
+
default:
|
|
185
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
186
|
+
_ = 0;
|
|
187
|
+
continue;
|
|
188
|
+
}
|
|
189
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
190
|
+
_.label = op[1];
|
|
191
|
+
break;
|
|
192
|
+
}
|
|
193
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
194
|
+
_.label = t[1];
|
|
195
|
+
t = op;
|
|
196
|
+
break;
|
|
197
|
+
}
|
|
198
|
+
if (t && _.label < t[2]) {
|
|
199
|
+
_.label = t[2];
|
|
200
|
+
_.ops.push(op);
|
|
201
|
+
break;
|
|
202
|
+
}
|
|
203
|
+
if (t[2]) _.ops.pop();
|
|
204
|
+
_.trys.pop();
|
|
205
|
+
continue;
|
|
206
|
+
}
|
|
207
|
+
op = body.call(thisArg, _);
|
|
208
|
+
} catch (e) {
|
|
209
|
+
op = [
|
|
210
|
+
6,
|
|
211
|
+
e
|
|
212
|
+
];
|
|
213
|
+
y = 0;
|
|
214
|
+
} finally{
|
|
215
|
+
f = t = 0;
|
|
216
|
+
}
|
|
217
|
+
if (op[0] & 5) throw op[1];
|
|
218
|
+
return {
|
|
219
|
+
value: op[0] ? op[1] : void 0,
|
|
220
|
+
done: true
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
};
|
|
224
|
+
import { decodeRPCResponse, encodeData } from "./utils/encode-decode-transaction";
|
|
14
225
|
/**
|
|
15
226
|
* @param txnData
|
|
16
227
|
* @example
|
|
17
|
-
*/
|
|
18
|
-
function estimateGas(txnData) {
|
|
228
|
+
*/ function estimateGas(txnData) {
|
|
19
229
|
// https://ethereum.stackexchange.com/questions/1570/what-does-intrinsic-gas-too-low-mean/1694
|
|
20
|
-
txnData.split(
|
|
230
|
+
txnData.split("").reduce(function(previousValue, currentValue) {
|
|
21
231
|
// 0 characters are 4 gwei, all others are 48 gwei
|
|
22
|
-
|
|
232
|
+
var characterCost = currentValue === "0" ? 4 : 68;
|
|
23
233
|
return previousValue + characterCost;
|
|
24
234
|
}, 0);
|
|
25
235
|
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
236
|
+
export var BaseContract = function BaseContract(addressOrName, contractInterface, signerOrProvider) {
|
|
237
|
+
"use strict";
|
|
238
|
+
var _this = this;
|
|
239
|
+
_classCallCheck(this, BaseContract);
|
|
240
|
+
this._address = addressOrName;
|
|
241
|
+
this._provider = signerOrProvider;
|
|
242
|
+
contractInterface.filter(function(jsonABIArgument) {
|
|
243
|
+
return jsonABIArgument.type === "function";
|
|
244
|
+
}).forEach(function(jsonABIArgument) {
|
|
245
|
+
if ("name" in jsonABIArgument && typeof jsonABIArgument.name === "string") {
|
|
246
|
+
var _this1 = _this;
|
|
247
|
+
defineReadOnly(_this, jsonABIArgument.name, /*#__PURE__*/ _asyncToGenerator(function() {
|
|
248
|
+
var _len, _args, _key, functionArguments, options, lastArg, data, decimalGas, req, nodeResponse;
|
|
249
|
+
var _arguments = arguments;
|
|
250
|
+
return __generator(this, function(_state) {
|
|
251
|
+
switch(_state.label){
|
|
252
|
+
case 0:
|
|
253
|
+
for(_len = _arguments.length, _args = new Array(_len), _key = 0; _key < _len; _key++){
|
|
254
|
+
_args[_key] = _arguments[_key];
|
|
255
|
+
}
|
|
256
|
+
functionArguments = _args;
|
|
257
|
+
options = {};
|
|
258
|
+
lastArg = _args[_args.length - 1];
|
|
259
|
+
if (!Array.isArray(lastArg) && typeof lastArg === "object") {
|
|
260
|
+
options = lastArg;
|
|
261
|
+
functionArguments = _args.slice(0, _args.length - 1);
|
|
262
|
+
}
|
|
263
|
+
data = encodeData(jsonABIArgument, functionArguments);
|
|
264
|
+
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
|
+
req = function() {
|
|
266
|
+
var _ref = _asyncToGenerator(function() {
|
|
267
|
+
return __generator(this, function(_state) {
|
|
268
|
+
switch(_state.label){
|
|
269
|
+
case 0:
|
|
270
|
+
return [
|
|
271
|
+
4,
|
|
272
|
+
_this1._provider.call(_objectSpread({
|
|
273
|
+
to: _this1._address.toLowerCase(),
|
|
274
|
+
data: data
|
|
275
|
+
}, decimalGas ? {
|
|
276
|
+
gas: "0x".concat(decimalGas.toString(16))
|
|
277
|
+
} : {}), "latest")
|
|
278
|
+
];
|
|
279
|
+
case 1:
|
|
280
|
+
return [
|
|
281
|
+
2,
|
|
282
|
+
_state.sent()
|
|
283
|
+
];
|
|
284
|
+
}
|
|
285
|
+
});
|
|
286
|
+
});
|
|
287
|
+
return function req() {
|
|
288
|
+
return _ref.apply(this, arguments);
|
|
289
|
+
};
|
|
290
|
+
}();
|
|
291
|
+
return [
|
|
292
|
+
4,
|
|
293
|
+
req()
|
|
294
|
+
];
|
|
295
|
+
case 1:
|
|
296
|
+
nodeResponse = _state.sent();
|
|
297
|
+
return [
|
|
298
|
+
2,
|
|
299
|
+
decodeRPCResponse(jsonABIArgument, nodeResponse)
|
|
300
|
+
];
|
|
49
301
|
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
? estimateGas(data)
|
|
56
|
-
: null;
|
|
57
|
-
const req = () => __awaiter(this, void 0, void 0, function* () {
|
|
58
|
-
return yield this._provider.call(Object.assign({ to: this._address.toLowerCase(), data }, (decimalGas
|
|
59
|
-
? { gas: `0x${decimalGas.toString(16)}` }
|
|
60
|
-
: {})), 'latest');
|
|
61
|
-
});
|
|
62
|
-
const nodeResponse = yield req();
|
|
63
|
-
return (0, encode_decode_transaction_1.decodeRPCResponse)(jsonABIArgument, nodeResponse);
|
|
64
|
-
}));
|
|
65
|
-
}
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
exports.BaseContract = BaseContract;
|
|
302
|
+
});
|
|
303
|
+
}));
|
|
304
|
+
}
|
|
305
|
+
});
|
|
306
|
+
};
|
|
70
307
|
/**
|
|
71
308
|
* Applies the unique contract's methods to the instantiated Contract in the constructor based-upon the provided ABI
|
|
72
309
|
*
|
|
@@ -75,15 +312,13 @@ exports.BaseContract = BaseContract;
|
|
|
75
312
|
* @param value
|
|
76
313
|
* @internal
|
|
77
314
|
* @example
|
|
78
|
-
*/
|
|
79
|
-
function defineReadOnly(object, name, value) {
|
|
315
|
+
*/ export function defineReadOnly(object, name, value) {
|
|
80
316
|
Object.defineProperty(object, name, {
|
|
81
317
|
enumerable: true,
|
|
82
318
|
value: value,
|
|
83
|
-
writable: false
|
|
319
|
+
writable: false
|
|
84
320
|
});
|
|
85
321
|
}
|
|
86
|
-
exports.defineReadOnly = defineReadOnly;
|
|
87
322
|
/**
|
|
88
323
|
* @alpha
|
|
89
324
|
* Only accepts ABIS in JSON format. This allows for stronger typing and assurances of data-types
|
|
@@ -132,7 +367,13 @@ exports.defineReadOnly = defineReadOnly;
|
|
|
132
367
|
*
|
|
133
368
|
*
|
|
134
369
|
* ```
|
|
135
|
-
*/
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
370
|
+
*/ export var Contract = /*#__PURE__*/ function(BaseContract) {
|
|
371
|
+
"use strict";
|
|
372
|
+
_inherits(Contract, BaseContract);
|
|
373
|
+
var _super = _createSuper(Contract);
|
|
374
|
+
function Contract() {
|
|
375
|
+
_classCallCheck(this, Contract);
|
|
376
|
+
return _super.apply(this, arguments);
|
|
377
|
+
}
|
|
378
|
+
return Contract;
|
|
379
|
+
}(BaseContract);
|