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,19 +1,128 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
2
|
+
try {
|
|
3
|
+
var info = gen[key](arg);
|
|
4
|
+
var value = info.value;
|
|
5
|
+
} catch (error) {
|
|
6
|
+
reject(error);
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
if (info.done) {
|
|
10
|
+
resolve(value);
|
|
11
|
+
} else {
|
|
12
|
+
Promise.resolve(value).then(_next, _throw);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
function _asyncToGenerator(fn) {
|
|
16
|
+
return function() {
|
|
17
|
+
var self = this, args = arguments;
|
|
18
|
+
return new Promise(function(resolve, reject) {
|
|
19
|
+
var gen = fn.apply(self, args);
|
|
20
|
+
function _next(value) {
|
|
21
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
22
|
+
}
|
|
23
|
+
function _throw(err) {
|
|
24
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
25
|
+
}
|
|
26
|
+
_next(undefined);
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
var __generator = this && this.__generator || function(thisArg, body) {
|
|
31
|
+
var f, y, t, g, _ = {
|
|
32
|
+
label: 0,
|
|
33
|
+
sent: function() {
|
|
34
|
+
if (t[0] & 1) throw t[1];
|
|
35
|
+
return t[1];
|
|
36
|
+
},
|
|
37
|
+
trys: [],
|
|
38
|
+
ops: []
|
|
39
|
+
};
|
|
40
|
+
return(g = {
|
|
41
|
+
next: verb(0),
|
|
42
|
+
"throw": verb(1),
|
|
43
|
+
"return": verb(2)
|
|
44
|
+
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
45
|
+
return this;
|
|
46
|
+
}), g);
|
|
47
|
+
function verb(n) {
|
|
48
|
+
return function(v) {
|
|
49
|
+
return step([
|
|
50
|
+
n,
|
|
51
|
+
v
|
|
52
|
+
]);
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
function step(op) {
|
|
56
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
57
|
+
while(_)try {
|
|
58
|
+
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;
|
|
59
|
+
if (y = 0, t) op = [
|
|
60
|
+
op[0] & 2,
|
|
61
|
+
t.value
|
|
62
|
+
];
|
|
63
|
+
switch(op[0]){
|
|
64
|
+
case 0:
|
|
65
|
+
case 1:
|
|
66
|
+
t = op;
|
|
67
|
+
break;
|
|
68
|
+
case 4:
|
|
69
|
+
_.label++;
|
|
70
|
+
return {
|
|
71
|
+
value: op[1],
|
|
72
|
+
done: false
|
|
73
|
+
};
|
|
74
|
+
case 5:
|
|
75
|
+
_.label++;
|
|
76
|
+
y = op[1];
|
|
77
|
+
op = [
|
|
78
|
+
0
|
|
79
|
+
];
|
|
80
|
+
continue;
|
|
81
|
+
case 7:
|
|
82
|
+
op = _.ops.pop();
|
|
83
|
+
_.trys.pop();
|
|
84
|
+
continue;
|
|
85
|
+
default:
|
|
86
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
87
|
+
_ = 0;
|
|
88
|
+
continue;
|
|
89
|
+
}
|
|
90
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
91
|
+
_.label = op[1];
|
|
92
|
+
break;
|
|
93
|
+
}
|
|
94
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
95
|
+
_.label = t[1];
|
|
96
|
+
t = op;
|
|
97
|
+
break;
|
|
98
|
+
}
|
|
99
|
+
if (t && _.label < t[2]) {
|
|
100
|
+
_.label = t[2];
|
|
101
|
+
_.ops.push(op);
|
|
102
|
+
break;
|
|
103
|
+
}
|
|
104
|
+
if (t[2]) _.ops.pop();
|
|
105
|
+
_.trys.pop();
|
|
106
|
+
continue;
|
|
107
|
+
}
|
|
108
|
+
op = body.call(thisArg, _);
|
|
109
|
+
} catch (e) {
|
|
110
|
+
op = [
|
|
111
|
+
6,
|
|
112
|
+
e
|
|
113
|
+
];
|
|
114
|
+
y = 0;
|
|
115
|
+
} finally{
|
|
116
|
+
f = t = 0;
|
|
117
|
+
}
|
|
118
|
+
if (op[0] & 5) throw op[1];
|
|
119
|
+
return {
|
|
120
|
+
value: op[0] ? op[1] : void 0,
|
|
121
|
+
done: true
|
|
122
|
+
};
|
|
123
|
+
}
|
|
13
124
|
};
|
|
14
|
-
|
|
15
|
-
exports.buildRPCPostBody = exports.post = void 0;
|
|
16
|
-
const isomorphic_unfetch_1 = __importDefault(require("isomorphic-unfetch"));
|
|
125
|
+
import unfetch from "isomorphic-unfetch";
|
|
17
126
|
/**
|
|
18
127
|
* Makes a post request with the specified JSON data, normally to the a Ethereum JSON RPC API endpoint
|
|
19
128
|
*
|
|
@@ -29,33 +138,50 @@ const isomorphic_unfetch_1 = __importDefault(require("isomorphic-unfetch"));
|
|
|
29
138
|
* post('https://free-eth-node.com/api/eth', { jsonrpc: '2.0', id: 1, method: 'eth_getBalance', params: [ '0x4a986a6dCA6dbf99bC3d17F8D71aFb0d60e740f8', 'latest' ] });
|
|
30
139
|
* // '0x312faeb995df61d4'
|
|
31
140
|
* ```
|
|
32
|
-
*/
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
method: 'POST',
|
|
141
|
+
*/ export function post(url, body) {
|
|
142
|
+
return unfetch(url, {
|
|
143
|
+
method: "POST",
|
|
36
144
|
headers: {
|
|
37
|
-
|
|
145
|
+
"Content-Type": "application/json"
|
|
38
146
|
},
|
|
39
|
-
body: JSON.stringify(body)
|
|
40
|
-
})
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
147
|
+
body: JSON.stringify(body)
|
|
148
|
+
}).then(function() {
|
|
149
|
+
var _ref = _asyncToGenerator(function(r) {
|
|
150
|
+
var t;
|
|
151
|
+
return __generator(this, function(_state) {
|
|
152
|
+
switch(_state.label){
|
|
153
|
+
case 0:
|
|
154
|
+
return [
|
|
155
|
+
4,
|
|
156
|
+
r.text()
|
|
157
|
+
];
|
|
158
|
+
case 1:
|
|
159
|
+
t = _state.sent();
|
|
160
|
+
try {
|
|
161
|
+
return [
|
|
162
|
+
2,
|
|
163
|
+
JSON.parse(t)
|
|
164
|
+
];
|
|
165
|
+
} catch (e) {
|
|
166
|
+
throw new Error('Invalid JSON RPC response: "'.concat(t, '"'));
|
|
167
|
+
}
|
|
168
|
+
return [
|
|
169
|
+
2
|
|
170
|
+
];
|
|
171
|
+
}
|
|
172
|
+
});
|
|
173
|
+
});
|
|
174
|
+
return function(r) {
|
|
175
|
+
return _ref.apply(this, arguments);
|
|
176
|
+
};
|
|
177
|
+
}()).then(function(response) {
|
|
178
|
+
var result = response === null || response === void 0 ? void 0 : response.result;
|
|
52
179
|
if (!result) {
|
|
53
|
-
throw new Error(
|
|
180
|
+
throw new Error("Invalid JSON RPC response: ".concat(JSON.stringify(response)));
|
|
54
181
|
}
|
|
55
182
|
return response.result;
|
|
56
183
|
});
|
|
57
184
|
}
|
|
58
|
-
exports.post = post;
|
|
59
185
|
/**
|
|
60
186
|
* Prepares data to be sent using the {@link post} function. Data is prepared per the {@link https://en.wikipedia.org/wiki/JSON-RPC#Examples JSON RPC v2 spec}
|
|
61
187
|
*
|
|
@@ -71,14 +197,12 @@ exports.post = post;
|
|
|
71
197
|
* buildRPCPostBody('eth_getBalance', ['0x407d73d8a49eeb85d32cf465507dd71d507100c1', 'latest']);
|
|
72
198
|
* // { jsonrpc: '2.0', id: 1, method: 'eth_getBalance', params: [ '0x4a986a6dCA6dbf99bC3d17F8D71aFb0d60e740f8', 'latest' ] }
|
|
73
199
|
* ```
|
|
74
|
-
*/
|
|
75
|
-
function buildRPCPostBody(method, params) {
|
|
200
|
+
*/ export function buildRPCPostBody(method, params) {
|
|
76
201
|
return {
|
|
77
|
-
jsonrpc:
|
|
202
|
+
jsonrpc: "2.0",
|
|
78
203
|
// TODO: Increment ID will be needed when websocket support is added
|
|
79
204
|
id: 1,
|
|
80
|
-
method,
|
|
81
|
-
params
|
|
205
|
+
method: method,
|
|
206
|
+
params: params
|
|
82
207
|
};
|
|
83
208
|
}
|
|
84
|
-
exports.buildRPCPostBody = buildRPCPostBody;
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.hexToDecimal = void 0;
|
|
4
1
|
/**
|
|
5
2
|
* Converts a hexadecimal string it's decimal equivalent.
|
|
6
3
|
* This is needed instead of parseInt because parseInt loses precision.
|
|
@@ -17,8 +14,6 @@ exports.hexToDecimal = void 0;
|
|
|
17
14
|
* hexToDecimal('0x628608');
|
|
18
15
|
* // 6456840
|
|
19
16
|
* ```
|
|
20
|
-
*/
|
|
21
|
-
function hexToDecimal(hex) {
|
|
17
|
+
*/ export function hexToDecimal(hex) {
|
|
22
18
|
return BigInt(hex).toString();
|
|
23
19
|
}
|
|
24
|
-
exports.hexToDecimal = hexToDecimal;
|
|
@@ -1,45 +1,68 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
function _defineProperty(obj, key, value) {
|
|
2
|
+
if (key in obj) {
|
|
3
|
+
Object.defineProperty(obj, key, {
|
|
4
|
+
value: value,
|
|
5
|
+
enumerable: true,
|
|
6
|
+
configurable: true,
|
|
7
|
+
writable: true
|
|
8
|
+
});
|
|
9
|
+
} else {
|
|
10
|
+
obj[key] = value;
|
|
11
|
+
}
|
|
12
|
+
return obj;
|
|
13
|
+
}
|
|
14
|
+
function _instanceof(left, right) {
|
|
15
|
+
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
16
|
+
return !!right[Symbol.hasInstance](left);
|
|
17
|
+
} else {
|
|
18
|
+
return left instanceof right;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
function _objectSpread(target) {
|
|
22
|
+
for(var i = 1; i < arguments.length; i++){
|
|
23
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
24
|
+
var ownKeys = Object.keys(source);
|
|
25
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
26
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
27
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
28
|
+
}));
|
|
29
|
+
}
|
|
30
|
+
ownKeys.forEach(function(key) {
|
|
31
|
+
_defineProperty(target, key, source[key]);
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
return target;
|
|
35
|
+
}
|
|
36
|
+
import Big from "big.js";
|
|
37
|
+
import { TinyBig } from "../../shared/tiny-big/tiny-big";
|
|
38
|
+
import { hexlify } from "../../utils/bytes";
|
|
10
39
|
/**
|
|
11
40
|
* @param transaction
|
|
12
41
|
* @example
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
case
|
|
19
|
-
case
|
|
20
|
-
case
|
|
21
|
-
case
|
|
22
|
-
case
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
preparedTransaction[key] =
|
|
42
|
+
*/ export function prepareTransaction(transaction) {
|
|
43
|
+
var preparedTransaction = _objectSpread({}, transaction);
|
|
44
|
+
Object.keys(transaction).forEach(function(key) {
|
|
45
|
+
switch(key){
|
|
46
|
+
case "gas":
|
|
47
|
+
case "gasPrice":
|
|
48
|
+
case "nonce":
|
|
49
|
+
case "maxFeePerGas":
|
|
50
|
+
case "maxPriorityFeePerGas":
|
|
51
|
+
case "value":
|
|
52
|
+
{
|
|
53
|
+
var value = transaction[key];
|
|
54
|
+
if (_instanceof(value, TinyBig)) {
|
|
55
|
+
preparedTransaction[key] = value.toHexString();
|
|
56
|
+
} else if (_instanceof(value, Big)) {
|
|
57
|
+
preparedTransaction[key] = "0x".concat(BigInt(value.toString()).toString(16));
|
|
58
|
+
} else if (typeof transaction[key] === "number") preparedTransaction[key] = "0x" + transaction[key].toString(16);
|
|
59
|
+
else preparedTransaction[key] = transaction[key].toString();
|
|
60
|
+
break;
|
|
30
61
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
'0x' + transaction[key].toString(16);
|
|
34
|
-
else
|
|
35
|
-
preparedTransaction[key] = transaction[key].toString();
|
|
36
|
-
break;
|
|
37
|
-
}
|
|
38
|
-
case 'data':
|
|
39
|
-
preparedTransaction[key] = (0, bytes_1.hexlify)(transaction[key]);
|
|
62
|
+
case "data":
|
|
63
|
+
preparedTransaction[key] = hexlify(transaction[key]);
|
|
40
64
|
break;
|
|
41
65
|
}
|
|
42
66
|
});
|
|
43
67
|
return preparedTransaction;
|
|
44
68
|
}
|
|
45
|
-
exports.prepareTransaction = prepareTransaction;
|
package/dist/cjs/index.js
CHANGED
|
@@ -1,54 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
const tiny_big_1 = require("./shared/tiny-big/tiny-big");
|
|
27
|
-
Object.defineProperty(exports, "tinyBig", { enumerable: true, get: function () { return tiny_big_1.tinyBig; } });
|
|
28
|
-
Object.defineProperty(exports, "TinyBig", { enumerable: true, get: function () { return tiny_big_1.TinyBig; } });
|
|
29
|
-
const compute_address_1 = require("./utils/compute-address");
|
|
30
|
-
Object.defineProperty(exports, "computeAddress", { enumerable: true, get: function () { return compute_address_1.computeAddress; } });
|
|
31
|
-
const compute_public_key_1 = require("./utils/compute-public-key");
|
|
32
|
-
Object.defineProperty(exports, "computePublicKey", { enumerable: true, get: function () { return compute_public_key_1.computePublicKey; } });
|
|
33
|
-
const ether_to_gwei_1 = require("./utils/ether-to-gwei");
|
|
34
|
-
Object.defineProperty(exports, "etherToGwei", { enumerable: true, get: function () { return ether_to_gwei_1.etherToGwei; } });
|
|
35
|
-
const ether_to_wei_1 = require("./utils/ether-to-wei");
|
|
36
|
-
Object.defineProperty(exports, "etherToWei", { enumerable: true, get: function () { return ether_to_wei_1.etherToWei; } });
|
|
37
|
-
const gwei_to_ether_1 = require("./utils/gwei-to-ether");
|
|
38
|
-
Object.defineProperty(exports, "gweiToEther", { enumerable: true, get: function () { return gwei_to_ether_1.gweiToEther; } });
|
|
39
|
-
const hash_message_1 = require("./utils/hash-message");
|
|
40
|
-
Object.defineProperty(exports, "hashMessage", { enumerable: true, get: function () { return hash_message_1.hashMessage; } });
|
|
41
|
-
const is_address_1 = require("./utils/is-address");
|
|
42
|
-
Object.defineProperty(exports, "isAddress", { enumerable: true, get: function () { return is_address_1.isAddress; } });
|
|
43
|
-
const split_signature_1 = require("./utils/split-signature");
|
|
44
|
-
Object.defineProperty(exports, "splitSignature", { enumerable: true, get: function () { return split_signature_1.splitSignature; } });
|
|
45
|
-
const to_checksum_address_1 = require("./utils/to-checksum-address");
|
|
46
|
-
Object.defineProperty(exports, "toChecksumAddress", { enumerable: true, get: function () { return to_checksum_address_1.toChecksumAddress; } });
|
|
47
|
-
const to_utf8_bytes_1 = require("./utils/to-utf8-bytes");
|
|
48
|
-
Object.defineProperty(exports, "toUtf8Bytes", { enumerable: true, get: function () { return to_utf8_bytes_1.toUtf8Bytes; } });
|
|
49
|
-
const wei_to_ether_1 = require("./utils/wei-to-ether");
|
|
50
|
-
Object.defineProperty(exports, "weiToEther", { enumerable: true, get: function () { return wei_to_ether_1.weiToEther; } });
|
|
51
|
-
__exportStar(require("./utils/bytes"), exports);
|
|
52
|
-
__exportStar(require("./utils/hash-message"), exports);
|
|
53
|
-
__exportStar(require("./utils/keccak256"), exports);
|
|
54
|
-
__exportStar(require("./utils/solidity-keccak256"), exports);
|
|
1
|
+
import { BaseContract, Contract } from "./classes/Contract";
|
|
2
|
+
import { ConstructorOptions, FallthroughProvider } from "./providers/FallthroughProvider";
|
|
3
|
+
import { JsonRpcProvider, jsonRpcProvider } from "./providers/JsonRpcProvider";
|
|
4
|
+
import { tinyBig, TinyBig } from "./shared/tiny-big/tiny-big";
|
|
5
|
+
import { BlockResponse, BlockTag, RPCBlock } from "./types/Block.types";
|
|
6
|
+
import { ContractTypes, JSONABI, JSONABIArgument } from "./types/Contract.types";
|
|
7
|
+
import { Filter, FilterByBlockHash } from "./types/Filter.types";
|
|
8
|
+
import { Network } from "./types/Network.types";
|
|
9
|
+
import { BlockTransactionResponse, Log, RPCLog, RPCTransaction, RPCTransactionReceipt, RPCTransactionRequest, TransactionReceipt, TransactionRequest, TransactionResponse } from "./types/Transaction.types";
|
|
10
|
+
import { computeAddress } from "./utils/compute-address";
|
|
11
|
+
import { computePublicKey } from "./utils/compute-public-key";
|
|
12
|
+
import { etherToGwei } from "./utils/ether-to-gwei";
|
|
13
|
+
import { etherToWei } from "./utils/ether-to-wei";
|
|
14
|
+
import { gweiToEther } from "./utils/gwei-to-ether";
|
|
15
|
+
import { hashMessage } from "./utils/hash-message";
|
|
16
|
+
import { isAddress } from "./utils/is-address";
|
|
17
|
+
import { splitSignature } from "./utils/split-signature";
|
|
18
|
+
import { toChecksumAddress } from "./utils/to-checksum-address";
|
|
19
|
+
import { toUtf8Bytes } from "./utils/to-utf8-bytes";
|
|
20
|
+
import { weiToEther } from "./utils/wei-to-ether";
|
|
21
|
+
export * from "./utils/bytes";
|
|
22
|
+
export * from "./utils/hash-message";
|
|
23
|
+
export * from "./utils/keccak256";
|
|
24
|
+
export * from "./utils/solidity-keccak256";
|
|
25
|
+
export { etherToWei, etherToGwei, isAddress, jsonRpcProvider, JsonRpcProvider, FallthroughProvider, tinyBig, toChecksumAddress, weiToEther, gweiToEther, hashMessage, splitSignature, toUtf8Bytes, computeAddress, computePublicKey, /* classes */ Contract, TinyBig, /* types */ BaseContract, BlockResponse, ContractTypes, Filter, FilterByBlockHash, JSONABI, JSONABIArgument, Network, TransactionResponse, RPCBlock, RPCTransaction, RPCTransactionReceipt, TransactionRequest, RPCTransactionRequest, TransactionReceipt, BlockTag, RPCLog, Log, BlockTransactionResponse, ConstructorOptions };
|