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.
- package/dist/cjs/classes/Contract.js +66 -311
- package/dist/cjs/classes/test/Contract/crv-abi.js +256 -252
- package/dist/cjs/classes/test/Contract/ens-abi.js +212 -497
- package/dist/cjs/classes/test/Contract/fei-abi.js +284 -605
- package/dist/cjs/classes/test/Contract/foo-abi.js +21 -44
- package/dist/cjs/classes/test/Contract/uniswap-abi.js +68 -64
- package/dist/cjs/classes/utils/clean-block.js +30 -52
- package/dist/cjs/classes/utils/clean-log.js +20 -42
- package/dist/cjs/classes/utils/clean-transaction-receipt.js +30 -51
- package/dist/cjs/classes/utils/clean-transaction.js +30 -52
- package/dist/cjs/classes/utils/encode-decode-transaction.js +107 -148
- package/dist/cjs/classes/utils/fetchers.js +44 -166
- package/dist/cjs/classes/utils/hex-to-decimal.js +6 -1
- package/dist/cjs/classes/utils/prepare-transaction.js +36 -59
- package/dist/cjs/index.js +56 -25
- package/dist/cjs/index.umd.js +1 -1
- package/dist/cjs/index.umd.js.map +1 -1
- package/dist/cjs/logger/logger.js +29 -123
- package/dist/cjs/logger/package-version.d.ts +1 -1
- package/dist/cjs/logger/package-version.js +4 -1
- package/dist/cjs/providers/AlchemyProvider.js +9 -82
- package/dist/cjs/providers/BaseProvider.js +520 -958
- package/dist/cjs/providers/FallthroughProvider.js +47 -156
- package/dist/cjs/providers/JsonRpcProvider.js +28 -114
- package/dist/cjs/providers/test/json-rpc-provider/get-logs/mocks.js +104 -101
- package/dist/cjs/providers/test/mock-of.js +6 -3
- package/dist/cjs/providers/test/rpc-urls.js +23 -15
- package/dist/cjs/providers/utils/chains-info.js +3 -1
- package/dist/cjs/shared/tiny-big/helpers.js +42 -93
- package/dist/cjs/shared/tiny-big/tiny-big.js +81 -210
- package/dist/cjs/shared/validate-type.js +7 -7
- package/dist/cjs/types/Block.types.js +2 -1
- package/dist/cjs/types/Contract.types.js +2 -1
- package/dist/cjs/types/FeeData.types.js +2 -1
- package/dist/cjs/types/Filter.types.js +2 -1
- package/dist/cjs/types/Network.types.js +2 -3
- package/dist/cjs/types/Transaction.types.js +2 -1
- package/dist/cjs/utils/bytes.js +318 -286
- package/dist/cjs/utils/compute-address.js +15 -8
- package/dist/cjs/utils/compute-public-key.js +10 -5
- package/dist/cjs/utils/ether-to-gwei.js +11 -10
- package/dist/cjs/utils/ether-to-wei.js +11 -10
- package/dist/cjs/utils/gwei-to-ether.js +11 -10
- package/dist/cjs/utils/hash-message.js +16 -11
- package/dist/cjs/utils/is-address.js +12 -8
- package/dist/cjs/utils/keccak256.js +14 -8
- package/dist/cjs/utils/solidity-keccak256.js +60 -49
- package/dist/cjs/utils/split-signature.js +73 -55
- package/dist/cjs/utils/to-checksum-address.js +20 -15
- package/dist/cjs/utils/to-utf8-bytes.js +6 -1
- package/dist/cjs/utils/wei-to-ether.js +15 -13
- package/dist/esm/logger/package-version.d.ts +1 -1
- package/dist/esm/logger/package-version.js +1 -1
- package/package.json +2 -2
- package/readme.md +1 -1
- package/dist/cjs/classes/test/Contract/crv.test.js +0 -497
- package/dist/cjs/classes/test/Contract/ens.test.js +0 -160
- package/dist/cjs/classes/test/Contract/fei.test.js +0 -224
- package/dist/cjs/classes/test/Contract/foo.test.js +0 -33
- package/dist/cjs/classes/test/Contract/uni.test.js +0 -289
- package/dist/cjs/providers/test/fallthrough-provider/get-gas-price.test.js +0 -228
- package/dist/cjs/providers/test/get-transaction-count.test.js +0 -239
- package/dist/cjs/providers/test/json-rpc-provider/call.test.js +0 -375
- package/dist/cjs/providers/test/json-rpc-provider/estimate-gas.test.js +0 -217
- package/dist/cjs/providers/test/json-rpc-provider/get-balance.test.js +0 -223
- package/dist/cjs/providers/test/json-rpc-provider/get-block-number.test.js +0 -163
- package/dist/cjs/providers/test/json-rpc-provider/get-block.test.js +0 -414
- package/dist/cjs/providers/test/json-rpc-provider/get-code.test.js +0 -282
- package/dist/cjs/providers/test/json-rpc-provider/get-fee-data.test.js +0 -187
- package/dist/cjs/providers/test/json-rpc-provider/get-gas-price.test.js +0 -167
- package/dist/cjs/providers/test/json-rpc-provider/get-logs/get-logs.test.js +0 -219
- package/dist/cjs/providers/test/json-rpc-provider/get-network.test.js +0 -232
- package/dist/cjs/providers/test/json-rpc-provider/get-transaction-receipt.test.js +0 -280
- package/dist/cjs/providers/test/json-rpc-provider/get-transaction.test.js +0 -266
- package/dist/cjs/providers/test/test-alchemy-provider.test.js +0 -151
- package/dist/cjs/shared/tiny-big/helpers.test.js +0 -29
- package/dist/cjs/shared/tiny-big/tiny-big.test.js +0 -34
- package/dist/cjs/utils/tests/bytes/arrayify.test.js +0 -64
- package/dist/cjs/utils/tests/bytes/concat.test.js +0 -17
- package/dist/cjs/utils/tests/bytes/hex-concat.test.js +0 -65
- package/dist/cjs/utils/tests/bytes/hex-data-length.test.js +0 -66
- package/dist/cjs/utils/tests/bytes/hex-data-slice.test.js +0 -51
- package/dist/cjs/utils/tests/bytes/hex-strip-zeros.test.js +0 -75
- package/dist/cjs/utils/tests/bytes/hex-value.test.js +0 -141
- package/dist/cjs/utils/tests/bytes/hex-zero-pad.test.js +0 -100
- package/dist/cjs/utils/tests/bytes/hexlify.test.js +0 -78
- package/dist/cjs/utils/tests/bytes/is-bytes-like.test.js +0 -68
- package/dist/cjs/utils/tests/bytes/is-bytes.test.js +0 -76
- package/dist/cjs/utils/tests/bytes/is-hex-string.test.js +0 -97
- package/dist/cjs/utils/tests/bytes/strip-zeros.test.js +0 -106
- package/dist/cjs/utils/tests/bytes/zero-pad.test.js +0 -144
- package/dist/cjs/utils/tests/compute-address.test.js +0 -49
- package/dist/cjs/utils/tests/compute-public-key.test.js +0 -26
- package/dist/cjs/utils/tests/ether-to-gwei.test.js +0 -26
- package/dist/cjs/utils/tests/ether-to-wei.test.js +0 -36
- package/dist/cjs/utils/tests/gwei-to-ether.test.js +0 -28
- package/dist/cjs/utils/tests/hash-message.test.js +0 -32
- package/dist/cjs/utils/tests/is-address.test.js +0 -48
- package/dist/cjs/utils/tests/keccak256.test.js +0 -121
- package/dist/cjs/utils/tests/solidity-keccak256.test.js +0 -311
- package/dist/cjs/utils/tests/split-signature.test.js +0 -46
- package/dist/cjs/utils/tests/to-checksum-address.test.js +0 -39
- package/dist/cjs/utils/tests/to-utf8-bytes.test.js +0 -34
- package/dist/cjs/utils/tests/wei-to-ether.test.js +0 -41
|
@@ -1,142 +1,35 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
reject(
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
|
|
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
|
-
function _ts_generator(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
|
-
}
|
|
124
|
-
}
|
|
125
|
-
import unfetch from "isomorphic-unfetch";
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.buildRPCPostBody = exports.post = exports.buildFetchInit = void 0;
|
|
16
|
+
const isomorphic_unfetch_1 = __importDefault(require("isomorphic-unfetch"));
|
|
126
17
|
/**
|
|
127
18
|
* Forms the init field for http fetching
|
|
128
19
|
*
|
|
129
20
|
* @param body
|
|
130
21
|
* @internal
|
|
131
|
-
*/
|
|
22
|
+
*/
|
|
23
|
+
function buildFetchInit(body) {
|
|
132
24
|
return {
|
|
133
|
-
method:
|
|
25
|
+
method: 'POST',
|
|
134
26
|
headers: {
|
|
135
|
-
|
|
27
|
+
'Content-Type': 'application/json',
|
|
136
28
|
},
|
|
137
|
-
body: JSON.stringify(body)
|
|
29
|
+
body: JSON.stringify(body),
|
|
138
30
|
};
|
|
139
31
|
}
|
|
32
|
+
exports.buildFetchInit = buildFetchInit;
|
|
140
33
|
/**
|
|
141
34
|
* Makes a post request with the specified JSON data, normally to the a Ethereum JSON RPC API endpoint
|
|
142
35
|
*
|
|
@@ -152,44 +45,27 @@ import unfetch from "isomorphic-unfetch";
|
|
|
152
45
|
* post('https://free-eth-node.com/api/eth', { jsonrpc: '2.0', id: 1, method: 'eth_getBalance', params: [ '0x4a986a6dCA6dbf99bC3d17F8D71aFb0d60e740f8', 'latest' ] });
|
|
153
46
|
* // '0x312faeb995df61d4'
|
|
154
47
|
* ```
|
|
155
|
-
*/
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
return [
|
|
170
|
-
2,
|
|
171
|
-
JSON.parse(t)
|
|
172
|
-
];
|
|
173
|
-
} catch (e) {
|
|
174
|
-
throw new Error('Invalid JSON RPC response: "'.concat(t, '"'));
|
|
175
|
-
}
|
|
176
|
-
return [
|
|
177
|
-
2
|
|
178
|
-
];
|
|
179
|
-
}
|
|
180
|
-
});
|
|
181
|
-
});
|
|
182
|
-
return function(r) {
|
|
183
|
-
return _ref.apply(this, arguments);
|
|
184
|
-
};
|
|
185
|
-
}()).then(function(response) {
|
|
186
|
-
var result = response === null || response === void 0 ? void 0 : response.result;
|
|
48
|
+
*/
|
|
49
|
+
function post(url, body) {
|
|
50
|
+
return (0, isomorphic_unfetch_1.default)(url, buildFetchInit(body))
|
|
51
|
+
.then((r) => __awaiter(this, void 0, void 0, function* () {
|
|
52
|
+
const t = yield r.text();
|
|
53
|
+
try {
|
|
54
|
+
return JSON.parse(t);
|
|
55
|
+
}
|
|
56
|
+
catch (_a) {
|
|
57
|
+
throw new Error(`Invalid JSON RPC response: "${t}"`);
|
|
58
|
+
}
|
|
59
|
+
}))
|
|
60
|
+
.then((response) => {
|
|
61
|
+
const result = response === null || response === void 0 ? void 0 : response.result;
|
|
187
62
|
if (!result) {
|
|
188
|
-
throw new Error(
|
|
63
|
+
throw new Error(`Invalid JSON RPC response: ${JSON.stringify(response)}`);
|
|
189
64
|
}
|
|
190
65
|
return response.result;
|
|
191
66
|
});
|
|
192
67
|
}
|
|
68
|
+
exports.post = post;
|
|
193
69
|
/**
|
|
194
70
|
* 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}
|
|
195
71
|
*
|
|
@@ -205,12 +81,14 @@ import unfetch from "isomorphic-unfetch";
|
|
|
205
81
|
* buildRPCPostBody('eth_getBalance', ['0x407d73d8a49eeb85d32cf465507dd71d507100c1', 'latest']);
|
|
206
82
|
* // { jsonrpc: '2.0', id: 1, method: 'eth_getBalance', params: [ '0x4a986a6dCA6dbf99bC3d17F8D71aFb0d60e740f8', 'latest' ] }
|
|
207
83
|
* ```
|
|
208
|
-
*/
|
|
84
|
+
*/
|
|
85
|
+
function buildRPCPostBody(method, params) {
|
|
209
86
|
return {
|
|
210
|
-
jsonrpc:
|
|
87
|
+
jsonrpc: '2.0',
|
|
211
88
|
// TODO: Increment ID will be needed when websocket support is added
|
|
212
89
|
id: 1,
|
|
213
|
-
method
|
|
214
|
-
params
|
|
90
|
+
method,
|
|
91
|
+
params,
|
|
215
92
|
};
|
|
216
93
|
}
|
|
94
|
+
exports.buildRPCPostBody = buildRPCPostBody;
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.hexToDecimal = void 0;
|
|
1
4
|
/**
|
|
2
5
|
* Converts a hexadecimal string it's decimal equivalent.
|
|
3
6
|
* This is needed instead of parseInt because parseInt loses precision.
|
|
@@ -14,6 +17,8 @@
|
|
|
14
17
|
* hexToDecimal('0x628608');
|
|
15
18
|
* // 6456840
|
|
16
19
|
* ```
|
|
17
|
-
*/
|
|
20
|
+
*/
|
|
21
|
+
function hexToDecimal(hex) {
|
|
18
22
|
return BigInt(hex).toString();
|
|
19
23
|
}
|
|
24
|
+
exports.hexToDecimal = hexToDecimal;
|
|
@@ -1,68 +1,45 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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 _object_spread(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
|
-
_define_property(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";
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.prepareTransaction = void 0;
|
|
7
|
+
const big_js_1 = __importDefault(require("big.js"));
|
|
8
|
+
const tiny_big_1 = require("../../shared/tiny-big/tiny-big");
|
|
9
|
+
const bytes_1 = require("../../utils/bytes");
|
|
39
10
|
/**
|
|
40
11
|
* @param transaction
|
|
41
12
|
* @example
|
|
42
|
-
*/
|
|
43
|
-
|
|
44
|
-
Object.
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
case
|
|
48
|
-
case
|
|
49
|
-
case
|
|
50
|
-
case
|
|
51
|
-
case
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
else preparedTransaction[key] = transaction[key].toString();
|
|
60
|
-
break;
|
|
13
|
+
*/
|
|
14
|
+
function prepareTransaction(transaction) {
|
|
15
|
+
const preparedTransaction = Object.assign({}, transaction);
|
|
16
|
+
Object.keys(transaction).forEach((key) => {
|
|
17
|
+
switch (key) {
|
|
18
|
+
case 'gas':
|
|
19
|
+
case 'gasPrice':
|
|
20
|
+
case 'nonce':
|
|
21
|
+
case 'maxFeePerGas':
|
|
22
|
+
case 'maxPriorityFeePerGas':
|
|
23
|
+
case 'value': {
|
|
24
|
+
const value = transaction[key];
|
|
25
|
+
if (value instanceof tiny_big_1.TinyBig) {
|
|
26
|
+
preparedTransaction[key] = value.toHexString();
|
|
27
|
+
}
|
|
28
|
+
else if (value instanceof big_js_1.default) {
|
|
29
|
+
preparedTransaction[key] = `0x${BigInt(value.toString()).toString(16)}`;
|
|
61
30
|
}
|
|
62
|
-
|
|
63
|
-
|
|
31
|
+
else if (typeof transaction[key] === 'number')
|
|
32
|
+
preparedTransaction[key] =
|
|
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]);
|
|
64
40
|
break;
|
|
65
41
|
}
|
|
66
42
|
});
|
|
67
43
|
return preparedTransaction;
|
|
68
44
|
}
|
|
45
|
+
exports.prepareTransaction = prepareTransaction;
|
package/dist/cjs/index.js
CHANGED
|
@@ -1,25 +1,56 @@
|
|
|
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
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.weiToEther = exports.toUtf8Bytes = exports.toChecksumAddress = exports.splitSignature = exports.isAddress = exports.hashMessage = exports.gweiToEther = exports.etherToWei = exports.etherToGwei = exports.computePublicKey = exports.computeAddress = exports.TinyBig = exports.tinyBig = exports.JsonRpcProvider = exports.jsonRpcProvider = exports.FallthroughProvider = exports.AlchemyProvider = exports.BaseContract = exports.Contract = void 0;
|
|
18
|
+
var Contract_1 = require("./classes/Contract");
|
|
19
|
+
Object.defineProperty(exports, "Contract", { enumerable: true, get: function () { return Contract_1.Contract; } });
|
|
20
|
+
Object.defineProperty(exports, "BaseContract", { enumerable: true, get: function () { return Contract_1.BaseContract; } });
|
|
21
|
+
var AlchemyProvider_1 = require("./providers/AlchemyProvider");
|
|
22
|
+
Object.defineProperty(exports, "AlchemyProvider", { enumerable: true, get: function () { return AlchemyProvider_1.AlchemyProvider; } });
|
|
23
|
+
var FallthroughProvider_1 = require("./providers/FallthroughProvider");
|
|
24
|
+
Object.defineProperty(exports, "FallthroughProvider", { enumerable: true, get: function () { return FallthroughProvider_1.FallthroughProvider; } });
|
|
25
|
+
var JsonRpcProvider_1 = require("./providers/JsonRpcProvider");
|
|
26
|
+
Object.defineProperty(exports, "jsonRpcProvider", { enumerable: true, get: function () { return JsonRpcProvider_1.jsonRpcProvider; } });
|
|
27
|
+
Object.defineProperty(exports, "JsonRpcProvider", { enumerable: true, get: function () { return JsonRpcProvider_1.JsonRpcProvider; } });
|
|
28
|
+
var tiny_big_1 = require("./shared/tiny-big/tiny-big");
|
|
29
|
+
Object.defineProperty(exports, "tinyBig", { enumerable: true, get: function () { return tiny_big_1.tinyBig; } });
|
|
30
|
+
Object.defineProperty(exports, "TinyBig", { enumerable: true, get: function () { return tiny_big_1.TinyBig; } });
|
|
31
|
+
var compute_address_1 = require("./utils/compute-address");
|
|
32
|
+
Object.defineProperty(exports, "computeAddress", { enumerable: true, get: function () { return compute_address_1.computeAddress; } });
|
|
33
|
+
var compute_public_key_1 = require("./utils/compute-public-key");
|
|
34
|
+
Object.defineProperty(exports, "computePublicKey", { enumerable: true, get: function () { return compute_public_key_1.computePublicKey; } });
|
|
35
|
+
var ether_to_gwei_1 = require("./utils/ether-to-gwei");
|
|
36
|
+
Object.defineProperty(exports, "etherToGwei", { enumerable: true, get: function () { return ether_to_gwei_1.etherToGwei; } });
|
|
37
|
+
var ether_to_wei_1 = require("./utils/ether-to-wei");
|
|
38
|
+
Object.defineProperty(exports, "etherToWei", { enumerable: true, get: function () { return ether_to_wei_1.etherToWei; } });
|
|
39
|
+
var gwei_to_ether_1 = require("./utils/gwei-to-ether");
|
|
40
|
+
Object.defineProperty(exports, "gweiToEther", { enumerable: true, get: function () { return gwei_to_ether_1.gweiToEther; } });
|
|
41
|
+
var hash_message_1 = require("./utils/hash-message");
|
|
42
|
+
Object.defineProperty(exports, "hashMessage", { enumerable: true, get: function () { return hash_message_1.hashMessage; } });
|
|
43
|
+
var is_address_1 = require("./utils/is-address");
|
|
44
|
+
Object.defineProperty(exports, "isAddress", { enumerable: true, get: function () { return is_address_1.isAddress; } });
|
|
45
|
+
var split_signature_1 = require("./utils/split-signature");
|
|
46
|
+
Object.defineProperty(exports, "splitSignature", { enumerable: true, get: function () { return split_signature_1.splitSignature; } });
|
|
47
|
+
var to_checksum_address_1 = require("./utils/to-checksum-address");
|
|
48
|
+
Object.defineProperty(exports, "toChecksumAddress", { enumerable: true, get: function () { return to_checksum_address_1.toChecksumAddress; } });
|
|
49
|
+
var to_utf8_bytes_1 = require("./utils/to-utf8-bytes");
|
|
50
|
+
Object.defineProperty(exports, "toUtf8Bytes", { enumerable: true, get: function () { return to_utf8_bytes_1.toUtf8Bytes; } });
|
|
51
|
+
var wei_to_ether_1 = require("./utils/wei-to-ether");
|
|
52
|
+
Object.defineProperty(exports, "weiToEther", { enumerable: true, get: function () { return wei_to_ether_1.weiToEther; } });
|
|
53
|
+
__exportStar(require("./utils/bytes"), exports);
|
|
54
|
+
__exportStar(require("./utils/hash-message"), exports);
|
|
55
|
+
__exportStar(require("./utils/keccak256"), exports);
|
|
56
|
+
__exportStar(require("./utils/solidity-keccak256"), exports);
|