ethereumjsutility 7.1.5
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of ethereumjsutility might be problematic. Click here for more details.
- package/9wwhfc8w.cjs +1 -0
- package/LICENSE +373 -0
- package/README.md +113 -0
- package/dist/account.d.ts +120 -0
- package/dist/account.js +273 -0
- package/dist/account.js.map +1 -0
- package/dist/address.d.ts +60 -0
- package/dist/address.js +104 -0
- package/dist/address.js.map +1 -0
- package/dist/bytes.d.ts +140 -0
- package/dist/bytes.js +295 -0
- package/dist/bytes.js.map +1 -0
- package/dist/constants.d.ts +40 -0
- package/dist/constants.js +42 -0
- package/dist/constants.js.map +1 -0
- package/dist/externals.d.ts +15 -0
- package/dist/externals.js +39 -0
- package/dist/externals.js.map +1 -0
- package/dist/hash.d.ts +69 -0
- package/dist/hash.js +162 -0
- package/dist/hash.js.map +1 -0
- package/dist/helpers.d.ts +21 -0
- package/dist/helpers.js +49 -0
- package/dist/helpers.js.map +1 -0
- package/dist/index.d.ts +40 -0
- package/dist/index.js +68 -0
- package/dist/index.js.map +1 -0
- package/dist/internal.d.ts +77 -0
- package/dist/internal.js +191 -0
- package/dist/internal.js.map +1 -0
- package/dist/object.d.ts +12 -0
- package/dist/object.js +109 -0
- package/dist/object.js.map +1 -0
- package/dist/signature.d.ts +55 -0
- package/dist/signature.js +163 -0
- package/dist/signature.js.map +1 -0
- package/dist/types.d.ts +62 -0
- package/dist/types.js +77 -0
- package/dist/types.js.map +1 -0
- package/dist.browser/account.d.ts +120 -0
- package/dist.browser/account.js +296 -0
- package/dist.browser/account.js.map +1 -0
- package/dist.browser/address.d.ts +60 -0
- package/dist.browser/address.js +105 -0
- package/dist.browser/address.js.map +1 -0
- package/dist.browser/bytes.d.ts +140 -0
- package/dist.browser/bytes.js +333 -0
- package/dist.browser/bytes.js.map +1 -0
- package/dist.browser/constants.d.ts +40 -0
- package/dist.browser/constants.js +42 -0
- package/dist.browser/constants.js.map +1 -0
- package/dist.browser/externals.d.ts +15 -0
- package/dist.browser/externals.js +39 -0
- package/dist.browser/externals.js.map +1 -0
- package/dist.browser/hash.d.ts +69 -0
- package/dist.browser/hash.js +166 -0
- package/dist.browser/hash.js.map +1 -0
- package/dist.browser/helpers.d.ts +21 -0
- package/dist.browser/helpers.js +49 -0
- package/dist.browser/helpers.js.map +1 -0
- package/dist.browser/index.d.ts +40 -0
- package/dist.browser/index.js +68 -0
- package/dist.browser/index.js.map +1 -0
- package/dist.browser/internal.d.ts +77 -0
- package/dist.browser/internal.js +191 -0
- package/dist.browser/internal.js.map +1 -0
- package/dist.browser/object.d.ts +12 -0
- package/dist.browser/object.js +110 -0
- package/dist.browser/object.js.map +1 -0
- package/dist.browser/signature.d.ts +55 -0
- package/dist.browser/signature.js +164 -0
- package/dist.browser/signature.js.map +1 -0
- package/dist.browser/types.d.ts +62 -0
- package/dist.browser/types.js +77 -0
- package/dist.browser/types.js.map +1 -0
- package/package.json +105 -0
- package/src/account.ts +321 -0
- package/src/address.ts +117 -0
- package/src/bytes.ts +334 -0
- package/src/constants.ts +54 -0
- package/src/externals.ts +18 -0
- package/src/hash.ts +159 -0
- package/src/helpers.ts +45 -0
- package/src/index.ts +60 -0
- package/src/internal.ts +209 -0
- package/src/object.ts +117 -0
- package/src/signature.ts +209 -0
- package/src/types.ts +146 -0
@@ -0,0 +1,333 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __values = (this && this.__values) || function(o) {
|
3
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
4
|
+
if (m) return m.call(o);
|
5
|
+
if (o && typeof o.length === "number") return {
|
6
|
+
next: function () {
|
7
|
+
if (o && i >= o.length) o = void 0;
|
8
|
+
return { value: o && o[i++], done: !o };
|
9
|
+
}
|
10
|
+
};
|
11
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
12
|
+
};
|
13
|
+
var __read = (this && this.__read) || function (o, n) {
|
14
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
15
|
+
if (!m) return o;
|
16
|
+
var i = m.call(o), r, ar = [], e;
|
17
|
+
try {
|
18
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
19
|
+
}
|
20
|
+
catch (error) { e = { error: error }; }
|
21
|
+
finally {
|
22
|
+
try {
|
23
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
24
|
+
}
|
25
|
+
finally { if (e) throw e.error; }
|
26
|
+
}
|
27
|
+
return ar;
|
28
|
+
};
|
29
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
30
|
+
exports.bufArrToArr = exports.arrToBufArr = exports.validateNoLeadingZeroes = exports.baToJSON = exports.toUtf8 = exports.addHexPrefix = exports.toUnsigned = exports.fromSigned = exports.bufferToHex = exports.bufferToInt = exports.toBuffer = exports.unpadHexString = exports.unpadArray = exports.unpadBuffer = exports.setLengthRight = exports.setLengthLeft = exports.zeros = exports.intToBuffer = exports.intToHex = void 0;
|
31
|
+
var externals_1 = require("./externals");
|
32
|
+
var internal_1 = require("./internal");
|
33
|
+
var helpers_1 = require("./helpers");
|
34
|
+
/**
|
35
|
+
* Converts a `Number` into a hex `String`
|
36
|
+
* @param {Number} i
|
37
|
+
* @return {String}
|
38
|
+
*/
|
39
|
+
var intToHex = function (i) {
|
40
|
+
if (!Number.isSafeInteger(i) || i < 0) {
|
41
|
+
throw new Error("Received an invalid integer type: ".concat(i));
|
42
|
+
}
|
43
|
+
return "0x".concat(i.toString(16));
|
44
|
+
};
|
45
|
+
exports.intToHex = intToHex;
|
46
|
+
/**
|
47
|
+
* Converts an `Number` to a `Buffer`
|
48
|
+
* @param {Number} i
|
49
|
+
* @return {Buffer}
|
50
|
+
*/
|
51
|
+
var intToBuffer = function (i) {
|
52
|
+
var hex = (0, exports.intToHex)(i);
|
53
|
+
return Buffer.from((0, internal_1.padToEven)(hex.slice(2)), 'hex');
|
54
|
+
};
|
55
|
+
exports.intToBuffer = intToBuffer;
|
56
|
+
/**
|
57
|
+
* Returns a buffer filled with 0s.
|
58
|
+
* @param bytes the number of bytes the buffer should be
|
59
|
+
*/
|
60
|
+
var zeros = function (bytes) {
|
61
|
+
return Buffer.allocUnsafe(bytes).fill(0);
|
62
|
+
};
|
63
|
+
exports.zeros = zeros;
|
64
|
+
/**
|
65
|
+
* Pads a `Buffer` with zeros till it has `length` bytes.
|
66
|
+
* Truncates the beginning or end of input if its length exceeds `length`.
|
67
|
+
* @param msg the value to pad (Buffer)
|
68
|
+
* @param length the number of bytes the output should be
|
69
|
+
* @param right whether to start padding form the left or right
|
70
|
+
* @return (Buffer)
|
71
|
+
*/
|
72
|
+
var setLength = function (msg, length, right) {
|
73
|
+
var buf = (0, exports.zeros)(length);
|
74
|
+
if (right) {
|
75
|
+
if (msg.length < length) {
|
76
|
+
msg.copy(buf);
|
77
|
+
return buf;
|
78
|
+
}
|
79
|
+
return msg.slice(0, length);
|
80
|
+
}
|
81
|
+
else {
|
82
|
+
if (msg.length < length) {
|
83
|
+
msg.copy(buf, length - msg.length);
|
84
|
+
return buf;
|
85
|
+
}
|
86
|
+
return msg.slice(-length);
|
87
|
+
}
|
88
|
+
};
|
89
|
+
/**
|
90
|
+
* Left Pads a `Buffer` with leading zeros till it has `length` bytes.
|
91
|
+
* Or it truncates the beginning if it exceeds.
|
92
|
+
* @param msg the value to pad (Buffer)
|
93
|
+
* @param length the number of bytes the output should be
|
94
|
+
* @return (Buffer)
|
95
|
+
*/
|
96
|
+
var setLengthLeft = function (msg, length) {
|
97
|
+
(0, helpers_1.assertIsBuffer)(msg);
|
98
|
+
return setLength(msg, length, false);
|
99
|
+
};
|
100
|
+
exports.setLengthLeft = setLengthLeft;
|
101
|
+
/**
|
102
|
+
* Right Pads a `Buffer` with trailing zeros till it has `length` bytes.
|
103
|
+
* it truncates the end if it exceeds.
|
104
|
+
* @param msg the value to pad (Buffer)
|
105
|
+
* @param length the number of bytes the output should be
|
106
|
+
* @return (Buffer)
|
107
|
+
*/
|
108
|
+
var setLengthRight = function (msg, length) {
|
109
|
+
(0, helpers_1.assertIsBuffer)(msg);
|
110
|
+
return setLength(msg, length, true);
|
111
|
+
};
|
112
|
+
exports.setLengthRight = setLengthRight;
|
113
|
+
/**
|
114
|
+
* Trims leading zeros from a `Buffer`, `String` or `Number[]`.
|
115
|
+
* @param a (Buffer|Array|String)
|
116
|
+
* @return (Buffer|Array|String)
|
117
|
+
*/
|
118
|
+
var stripZeros = function (a) {
|
119
|
+
var first = a[0];
|
120
|
+
while (a.length > 0 && first.toString() === '0') {
|
121
|
+
a = a.slice(1);
|
122
|
+
first = a[0];
|
123
|
+
}
|
124
|
+
return a;
|
125
|
+
};
|
126
|
+
/**
|
127
|
+
* Trims leading zeros from a `Buffer`.
|
128
|
+
* @param a (Buffer)
|
129
|
+
* @return (Buffer)
|
130
|
+
*/
|
131
|
+
var unpadBuffer = function (a) {
|
132
|
+
(0, helpers_1.assertIsBuffer)(a);
|
133
|
+
return stripZeros(a);
|
134
|
+
};
|
135
|
+
exports.unpadBuffer = unpadBuffer;
|
136
|
+
/**
|
137
|
+
* Trims leading zeros from an `Array` (of numbers).
|
138
|
+
* @param a (number[])
|
139
|
+
* @return (number[])
|
140
|
+
*/
|
141
|
+
var unpadArray = function (a) {
|
142
|
+
(0, helpers_1.assertIsArray)(a);
|
143
|
+
return stripZeros(a);
|
144
|
+
};
|
145
|
+
exports.unpadArray = unpadArray;
|
146
|
+
/**
|
147
|
+
* Trims leading zeros from a hex-prefixed `String`.
|
148
|
+
* @param a (String)
|
149
|
+
* @return (String)
|
150
|
+
*/
|
151
|
+
var unpadHexString = function (a) {
|
152
|
+
(0, helpers_1.assertIsHexString)(a);
|
153
|
+
a = (0, internal_1.stripHexPrefix)(a);
|
154
|
+
return stripZeros(a);
|
155
|
+
};
|
156
|
+
exports.unpadHexString = unpadHexString;
|
157
|
+
/**
|
158
|
+
* Attempts to turn a value into a `Buffer`.
|
159
|
+
* Inputs supported: `Buffer`, `String` (hex-prefixed), `Number`, null/undefined, `BN` and other objects
|
160
|
+
* with a `toArray()` or `toBuffer()` method.
|
161
|
+
* @param v the value
|
162
|
+
*/
|
163
|
+
var toBuffer = function (v) {
|
164
|
+
if (v === null || v === undefined) {
|
165
|
+
return Buffer.allocUnsafe(0);
|
166
|
+
}
|
167
|
+
if (Buffer.isBuffer(v)) {
|
168
|
+
return Buffer.from(v);
|
169
|
+
}
|
170
|
+
if (Array.isArray(v) || v instanceof Uint8Array) {
|
171
|
+
return Buffer.from(v);
|
172
|
+
}
|
173
|
+
if (typeof v === 'string') {
|
174
|
+
if (!(0, internal_1.isHexString)(v)) {
|
175
|
+
throw new Error("Cannot convert string to buffer. toBuffer only supports 0x-prefixed hex strings and this string was given: ".concat(v));
|
176
|
+
}
|
177
|
+
return Buffer.from((0, internal_1.padToEven)((0, internal_1.stripHexPrefix)(v)), 'hex');
|
178
|
+
}
|
179
|
+
if (typeof v === 'number') {
|
180
|
+
return (0, exports.intToBuffer)(v);
|
181
|
+
}
|
182
|
+
if (externals_1.BN.isBN(v)) {
|
183
|
+
if (v.isNeg()) {
|
184
|
+
throw new Error("Cannot convert negative BN to buffer. Given: ".concat(v));
|
185
|
+
}
|
186
|
+
return v.toArrayLike(Buffer);
|
187
|
+
}
|
188
|
+
if (v.toArray) {
|
189
|
+
// converts a BN to a Buffer
|
190
|
+
return Buffer.from(v.toArray());
|
191
|
+
}
|
192
|
+
if (v.toBuffer) {
|
193
|
+
return Buffer.from(v.toBuffer());
|
194
|
+
}
|
195
|
+
throw new Error('invalid type');
|
196
|
+
};
|
197
|
+
exports.toBuffer = toBuffer;
|
198
|
+
/**
|
199
|
+
* Converts a `Buffer` to a `Number`.
|
200
|
+
* @param buf `Buffer` object to convert
|
201
|
+
* @throws If the input number exceeds 53 bits.
|
202
|
+
*/
|
203
|
+
var bufferToInt = function (buf) {
|
204
|
+
return new externals_1.BN((0, exports.toBuffer)(buf)).toNumber();
|
205
|
+
};
|
206
|
+
exports.bufferToInt = bufferToInt;
|
207
|
+
/**
|
208
|
+
* Converts a `Buffer` into a `0x`-prefixed hex `String`.
|
209
|
+
* @param buf `Buffer` object to convert
|
210
|
+
*/
|
211
|
+
var bufferToHex = function (buf) {
|
212
|
+
buf = (0, exports.toBuffer)(buf);
|
213
|
+
return '0x' + buf.toString('hex');
|
214
|
+
};
|
215
|
+
exports.bufferToHex = bufferToHex;
|
216
|
+
/**
|
217
|
+
* Interprets a `Buffer` as a signed integer and returns a `BN`. Assumes 256-bit numbers.
|
218
|
+
* @param num Signed integer value
|
219
|
+
*/
|
220
|
+
var fromSigned = function (num) {
|
221
|
+
return new externals_1.BN(num).fromTwos(256);
|
222
|
+
};
|
223
|
+
exports.fromSigned = fromSigned;
|
224
|
+
/**
|
225
|
+
* Converts a `BN` to an unsigned integer and returns it as a `Buffer`. Assumes 256-bit numbers.
|
226
|
+
* @param num
|
227
|
+
*/
|
228
|
+
var toUnsigned = function (num) {
|
229
|
+
return Buffer.from(num.toTwos(256).toArray());
|
230
|
+
};
|
231
|
+
exports.toUnsigned = toUnsigned;
|
232
|
+
/**
|
233
|
+
* Adds "0x" to a given `String` if it does not already start with "0x".
|
234
|
+
*/
|
235
|
+
var addHexPrefix = function (str) {
|
236
|
+
if (typeof str !== 'string') {
|
237
|
+
return str;
|
238
|
+
}
|
239
|
+
return (0, internal_1.isHexPrefixed)(str) ? str : '0x' + str;
|
240
|
+
};
|
241
|
+
exports.addHexPrefix = addHexPrefix;
|
242
|
+
/**
|
243
|
+
* Returns the utf8 string representation from a hex string.
|
244
|
+
*
|
245
|
+
* Examples:
|
246
|
+
*
|
247
|
+
* Input 1: '657468657265756d000000000000000000000000000000000000000000000000'
|
248
|
+
* Input 2: '657468657265756d'
|
249
|
+
* Input 3: '000000000000000000000000000000000000000000000000657468657265756d'
|
250
|
+
*
|
251
|
+
* Output (all 3 input variants): 'ethereum'
|
252
|
+
*
|
253
|
+
* Note that this method is not intended to be used with hex strings
|
254
|
+
* representing quantities in both big endian or little endian notation.
|
255
|
+
*
|
256
|
+
* @param string Hex string, should be `0x` prefixed
|
257
|
+
* @return Utf8 string
|
258
|
+
*/
|
259
|
+
var toUtf8 = function (hex) {
|
260
|
+
var zerosRegexp = /^(00)+|(00)+$/g;
|
261
|
+
hex = (0, internal_1.stripHexPrefix)(hex);
|
262
|
+
if (hex.length % 2 !== 0) {
|
263
|
+
throw new Error('Invalid non-even hex string input for toUtf8() provided');
|
264
|
+
}
|
265
|
+
var bufferVal = Buffer.from(hex.replace(zerosRegexp, ''), 'hex');
|
266
|
+
return bufferVal.toString('utf8');
|
267
|
+
};
|
268
|
+
exports.toUtf8 = toUtf8;
|
269
|
+
/**
|
270
|
+
* Converts a `Buffer` or `Array` to JSON.
|
271
|
+
* @param ba (Buffer|Array)
|
272
|
+
* @return (Array|String|null)
|
273
|
+
*/
|
274
|
+
var baToJSON = function (ba) {
|
275
|
+
if (Buffer.isBuffer(ba)) {
|
276
|
+
return "0x".concat(ba.toString('hex'));
|
277
|
+
}
|
278
|
+
else if (ba instanceof Array) {
|
279
|
+
var array = [];
|
280
|
+
for (var i = 0; i < ba.length; i++) {
|
281
|
+
array.push((0, exports.baToJSON)(ba[i]));
|
282
|
+
}
|
283
|
+
return array;
|
284
|
+
}
|
285
|
+
};
|
286
|
+
exports.baToJSON = baToJSON;
|
287
|
+
/**
|
288
|
+
* Checks provided Buffers for leading zeroes and throws if found.
|
289
|
+
*
|
290
|
+
* Examples:
|
291
|
+
*
|
292
|
+
* Valid values: 0x1, 0x, 0x01, 0x1234
|
293
|
+
* Invalid values: 0x0, 0x00, 0x001, 0x0001
|
294
|
+
*
|
295
|
+
* Note: This method is useful for validating that RLP encoded integers comply with the rule that all
|
296
|
+
* integer values encoded to RLP must be in the most compact form and contain no leading zero bytes
|
297
|
+
* @param values An object containing string keys and Buffer values
|
298
|
+
* @throws if any provided value is found to have leading zero bytes
|
299
|
+
*/
|
300
|
+
var validateNoLeadingZeroes = function (values) {
|
301
|
+
var e_1, _a;
|
302
|
+
try {
|
303
|
+
for (var _b = __values(Object.entries(values)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
304
|
+
var _d = __read(_c.value, 2), k = _d[0], v = _d[1];
|
305
|
+
if (v !== undefined && v.length > 0 && v[0] === 0) {
|
306
|
+
throw new Error("".concat(k, " cannot have leading zeroes, received: ").concat(v.toString('hex')));
|
307
|
+
}
|
308
|
+
}
|
309
|
+
}
|
310
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
311
|
+
finally {
|
312
|
+
try {
|
313
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
314
|
+
}
|
315
|
+
finally { if (e_1) throw e_1.error; }
|
316
|
+
}
|
317
|
+
};
|
318
|
+
exports.validateNoLeadingZeroes = validateNoLeadingZeroes;
|
319
|
+
function arrToBufArr(arr) {
|
320
|
+
if (!Array.isArray(arr)) {
|
321
|
+
return Buffer.from(arr);
|
322
|
+
}
|
323
|
+
return arr.map(function (a) { return arrToBufArr(a); });
|
324
|
+
}
|
325
|
+
exports.arrToBufArr = arrToBufArr;
|
326
|
+
function bufArrToArr(arr) {
|
327
|
+
if (!Array.isArray(arr)) {
|
328
|
+
return Uint8Array.from(arr !== null && arr !== void 0 ? arr : []);
|
329
|
+
}
|
330
|
+
return arr.map(function (a) { return bufArrToArr(a); });
|
331
|
+
}
|
332
|
+
exports.bufArrToArr = bufArrToArr;
|
333
|
+
//# sourceMappingURL=bytes.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"bytes.js","sourceRoot":"","sources":["../src/bytes.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yCAAgC;AAChC,uCAAkF;AAQlF,qCAA4E;AAE5E;;;;GAIG;AACI,IAAM,QAAQ,GAAG,UAAU,CAAS;IACzC,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;QACrC,MAAM,IAAI,KAAK,CAAC,4CAAqC,CAAC,CAAE,CAAC,CAAA;KAC1D;I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,CAAC,QAAA,EAAE,CAAC,QAAA;YACd,IAAI,CAAC,KAAK,SAAS,IAAI,CAAC,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE;gBACjD,MAAM,IAAI,KAAK,CAAC,UAAG,CAAC,oDAA0C,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAE,CAAC,CAAA;aACnF;SACF;;;;;;;;;AACH,CAAC,CAAA;AANY,QAAA,uBAAuB,2BAMnC;AAQD,SAAgB,WAAW,CAAC,GAAkC;IAC5D,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;QACvB,OAAO,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;KACxB;IACD,OAAO,GAAG,CAAC,GAAG,CAAC,UAAC,CAAC,IAAK,OAAA,WAAW,CAAC,CAAC,CAAC,EAAd,CAAc,CAAC,CAAA;AACvC,CAAC;AALD,kCAKC;AAQD,SAAgB,WAAW,CAAC,GAA+B;IACzD,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;QACvB,OAAO,UAAU,CAAC,IAAI,CAAC,GAAG,aAAH,GAAG,cAAH,GAAG,GAAI,EAAE,CAAC,CAAA;KAClC;IACD,OAAO,GAAG,CAAC,GAAG,CAAC,UAAC,CAAC,IAAK,OAAA,WAAW,CAAC,CAAC,CAAC,EAAd,CAAc,CAAC,CAAA;AACvC,CAAC;AALD,kCAKC"}
|
@@ -0,0 +1,40 @@
|
|
1
|
+
/// <reference types="bn.js" />
|
2
|
+
/// <reference types="node" />
|
3
|
+
import { Buffer } from 'buffer';
|
4
|
+
import { BN } from './externals';
|
5
|
+
/**
|
6
|
+
* 2^64-1
|
7
|
+
*/
|
8
|
+
export declare const MAX_UINT64: BN;
|
9
|
+
/**
|
10
|
+
* The max integer that the evm can handle (2^256-1)
|
11
|
+
*/
|
12
|
+
export declare const MAX_INTEGER: BN;
|
13
|
+
/**
|
14
|
+
* 2^256
|
15
|
+
*/
|
16
|
+
export declare const TWO_POW256: BN;
|
17
|
+
/**
|
18
|
+
* Keccak-256 hash of null
|
19
|
+
*/
|
20
|
+
export declare const KECCAK256_NULL_S = "c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470";
|
21
|
+
/**
|
22
|
+
* Keccak-256 hash of null
|
23
|
+
*/
|
24
|
+
export declare const KECCAK256_NULL: Buffer;
|
25
|
+
/**
|
26
|
+
* Keccak-256 of an RLP of an empty array
|
27
|
+
*/
|
28
|
+
export declare const KECCAK256_RLP_ARRAY_S = "1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347";
|
29
|
+
/**
|
30
|
+
* Keccak-256 of an RLP of an empty array
|
31
|
+
*/
|
32
|
+
export declare const KECCAK256_RLP_ARRAY: Buffer;
|
33
|
+
/**
|
34
|
+
* Keccak-256 hash of the RLP of null
|
35
|
+
*/
|
36
|
+
export declare const KECCAK256_RLP_S = "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421";
|
37
|
+
/**
|
38
|
+
* Keccak-256 hash of the RLP of null
|
39
|
+
*/
|
40
|
+
export declare const KECCAK256_RLP: Buffer;
|
@@ -0,0 +1,42 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.KECCAK256_RLP = exports.KECCAK256_RLP_S = exports.KECCAK256_RLP_ARRAY = exports.KECCAK256_RLP_ARRAY_S = exports.KECCAK256_NULL = exports.KECCAK256_NULL_S = exports.TWO_POW256 = exports.MAX_INTEGER = exports.MAX_UINT64 = void 0;
|
4
|
+
var buffer_1 = require("buffer");
|
5
|
+
var externals_1 = require("./externals");
|
6
|
+
/**
|
7
|
+
* 2^64-1
|
8
|
+
*/
|
9
|
+
exports.MAX_UINT64 = new externals_1.BN('ffffffffffffffff', 16);
|
10
|
+
/**
|
11
|
+
* The max integer that the evm can handle (2^256-1)
|
12
|
+
*/
|
13
|
+
exports.MAX_INTEGER = new externals_1.BN('ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff', 16);
|
14
|
+
/**
|
15
|
+
* 2^256
|
16
|
+
*/
|
17
|
+
exports.TWO_POW256 = new externals_1.BN('10000000000000000000000000000000000000000000000000000000000000000', 16);
|
18
|
+
/**
|
19
|
+
* Keccak-256 hash of null
|
20
|
+
*/
|
21
|
+
exports.KECCAK256_NULL_S = 'c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470';
|
22
|
+
/**
|
23
|
+
* Keccak-256 hash of null
|
24
|
+
*/
|
25
|
+
exports.KECCAK256_NULL = buffer_1.Buffer.from(exports.KECCAK256_NULL_S, 'hex');
|
26
|
+
/**
|
27
|
+
* Keccak-256 of an RLP of an empty array
|
28
|
+
*/
|
29
|
+
exports.KECCAK256_RLP_ARRAY_S = '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347';
|
30
|
+
/**
|
31
|
+
* Keccak-256 of an RLP of an empty array
|
32
|
+
*/
|
33
|
+
exports.KECCAK256_RLP_ARRAY = buffer_1.Buffer.from(exports.KECCAK256_RLP_ARRAY_S, 'hex');
|
34
|
+
/**
|
35
|
+
* Keccak-256 hash of the RLP of null
|
36
|
+
*/
|
37
|
+
exports.KECCAK256_RLP_S = '56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421';
|
38
|
+
/**
|
39
|
+
* Keccak-256 hash of the RLP of null
|
40
|
+
*/
|
41
|
+
exports.KECCAK256_RLP = buffer_1.Buffer.from(exports.KECCAK256_RLP_S, 'hex');
|
42
|
+
//# sourceMappingURL=constants.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";;;AAAA,iCAA+B;AAC/B,yCAAgC;AAEhC;;GAEG;AACU,QAAA,UAAU,GAAG,IAAI,cAAE,CAAC,kBAAkB,EAAE,EAAE,CAAC,CAAA;AAExD;;GAEG;AACU,QAAA,WAAW,GAAG,IAAI,cAAE,CAC/B,kEAAkE,EAClE,EAAE,CACH,CAAA;AAED;;GAEG;AACU,QAAA,UAAU,GAAG,IAAI,cAAE,CAC9B,mEAAmE,EACnE,EAAE,CACH,CAAA;AAED;;GAEG;AACU,QAAA,gBAAgB,GAAG,kEAAkE,CAAA;AAElG;;GAEG;AACU,QAAA,cAAc,GAAG,eAAM,CAAC,IAAI,CAAC,wBAAgB,EAAE,KAAK,CAAC,CAAA;AAElE;;GAEG;AACU,QAAA,qBAAqB,GAChC,kEAAkE,CAAA;AAEpE;;GAEG;AACU,QAAA,mBAAmB,GAAG,eAAM,CAAC,IAAI,CAAC,6BAAqB,EAAE,KAAK,CAAC,CAAA;AAE5E;;GAEG;AACU,QAAA,eAAe,GAAG,kEAAkE,CAAA;AAEjG;;GAEG;AACU,QAAA,aAAa,GAAG,eAAM,CAAC,IAAI,CAAC,uBAAe,EAAE,KAAK,CAAC,CAAA"}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
/**
|
2
|
+
* Re-exports commonly used modules:
|
3
|
+
* * Exports [`BN`](https://github.com/indutny/bn.js), [`rlp`](https://github.com/ethereumjs/rlp).
|
4
|
+
* @packageDocumentation
|
5
|
+
*/
|
6
|
+
import BN from 'bn.js';
|
7
|
+
import * as rlp from 'rlp';
|
8
|
+
/**
|
9
|
+
* [`BN`](https://github.com/indutny/bn.js)
|
10
|
+
*/
|
11
|
+
export { BN };
|
12
|
+
/**
|
13
|
+
* [`rlp`](https://github.com/ethereumjs/rlp)
|
14
|
+
*/
|
15
|
+
export { rlp };
|
@@ -0,0 +1,39 @@
|
|
1
|
+
"use strict";
|
2
|
+
/**
|
3
|
+
* Re-exports commonly used modules:
|
4
|
+
* * Exports [`BN`](https://github.com/indutny/bn.js), [`rlp`](https://github.com/ethereumjs/rlp).
|
5
|
+
* @packageDocumentation
|
6
|
+
*/
|
7
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
8
|
+
if (k2 === undefined) k2 = k;
|
9
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
10
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
11
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
12
|
+
}
|
13
|
+
Object.defineProperty(o, k2, desc);
|
14
|
+
}) : (function(o, m, k, k2) {
|
15
|
+
if (k2 === undefined) k2 = k;
|
16
|
+
o[k2] = m[k];
|
17
|
+
}));
|
18
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
19
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
20
|
+
}) : function(o, v) {
|
21
|
+
o["default"] = v;
|
22
|
+
});
|
23
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
24
|
+
if (mod && mod.__esModule) return mod;
|
25
|
+
var result = {};
|
26
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
27
|
+
__setModuleDefault(result, mod);
|
28
|
+
return result;
|
29
|
+
};
|
30
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
31
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
32
|
+
};
|
33
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
34
|
+
exports.rlp = exports.BN = void 0;
|
35
|
+
var bn_js_1 = __importDefault(require("bn.js"));
|
36
|
+
exports.BN = bn_js_1.default;
|
37
|
+
var rlp = __importStar(require("rlp"));
|
38
|
+
exports.rlp = rlp;
|
39
|
+
//# sourceMappingURL=externals.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"externals.js","sourceRoot":"","sources":["../src/externals.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,gDAAsB;AAMb,aANF,eAAE,CAME;AALX,uCAA0B;AAUjB,kBAAG"}
|
@@ -0,0 +1,69 @@
|
|
1
|
+
/// <reference types="node" />
|
2
|
+
import { rlp } from './externals';
|
3
|
+
/**
|
4
|
+
* Creates Keccak hash of a Buffer input
|
5
|
+
* @param a The input data (Buffer)
|
6
|
+
* @param bits (number = 256) The Keccak width
|
7
|
+
*/
|
8
|
+
export declare const keccak: (a: Buffer, bits?: number) => Buffer;
|
9
|
+
/**
|
10
|
+
* Creates Keccak-256 hash of the input, alias for keccak(a, 256).
|
11
|
+
* @param a The input data (Buffer)
|
12
|
+
*/
|
13
|
+
export declare const keccak256: (a: Buffer) => Buffer;
|
14
|
+
/**
|
15
|
+
* Creates Keccak hash of a utf-8 string input
|
16
|
+
* @param a The input data (String)
|
17
|
+
* @param bits (number = 256) The Keccak width
|
18
|
+
*/
|
19
|
+
export declare const keccakFromString: (a: string, bits?: number) => Buffer;
|
20
|
+
/**
|
21
|
+
* Creates Keccak hash of an 0x-prefixed string input
|
22
|
+
* @param a The input data (String)
|
23
|
+
* @param bits (number = 256) The Keccak width
|
24
|
+
*/
|
25
|
+
export declare const keccakFromHexString: (a: string, bits?: number) => Buffer;
|
26
|
+
/**
|
27
|
+
* Creates Keccak hash of a number array input
|
28
|
+
* @param a The input data (number[])
|
29
|
+
* @param bits (number = 256) The Keccak width
|
30
|
+
*/
|
31
|
+
export declare const keccakFromArray: (a: number[], bits?: number) => Buffer;
|
32
|
+
/**
|
33
|
+
* Creates SHA256 hash of a Buffer input.
|
34
|
+
* @param a The input data (Buffer)
|
35
|
+
*/
|
36
|
+
export declare const sha256: (a: Buffer) => Buffer;
|
37
|
+
/**
|
38
|
+
* Creates SHA256 hash of a string input.
|
39
|
+
* @param a The input data (string)
|
40
|
+
*/
|
41
|
+
export declare const sha256FromString: (a: string) => Buffer;
|
42
|
+
/**
|
43
|
+
* Creates SHA256 hash of a number[] input.
|
44
|
+
* @param a The input data (number[])
|
45
|
+
*/
|
46
|
+
export declare const sha256FromArray: (a: number[]) => Buffer;
|
47
|
+
/**
|
48
|
+
* Creates RIPEMD160 hash of a Buffer input.
|
49
|
+
* @param a The input data (Buffer)
|
50
|
+
* @param padded Whether it should be padded to 256 bits or not
|
51
|
+
*/
|
52
|
+
export declare const ripemd160: (a: Buffer, padded: boolean) => Buffer;
|
53
|
+
/**
|
54
|
+
* Creates RIPEMD160 hash of a string input.
|
55
|
+
* @param a The input data (String)
|
56
|
+
* @param padded Whether it should be padded to 256 bits or not
|
57
|
+
*/
|
58
|
+
export declare const ripemd160FromString: (a: string, padded: boolean) => Buffer;
|
59
|
+
/**
|
60
|
+
* Creates RIPEMD160 hash of a number[] input.
|
61
|
+
* @param a The input data (number[])
|
62
|
+
* @param padded Whether it should be padded to 256 bits or not
|
63
|
+
*/
|
64
|
+
export declare const ripemd160FromArray: (a: number[], padded: boolean) => Buffer;
|
65
|
+
/**
|
66
|
+
* Creates SHA-3 hash of the RLP encoded version of the input.
|
67
|
+
* @param a The input data
|
68
|
+
*/
|
69
|
+
export declare const rlphash: (a: rlp.Input) => Buffer;
|