@leofcoin/messages 1.1.2 → 1.1.3

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/messages.esm CHANGED
@@ -1,599 +1,1377 @@
1
1
  /******/ var __webpack_modules__ = ({
2
2
 
3
- /***/ 7187:
4
- /***/ ((module) => {
5
-
6
- // Copyright Joyent, Inc. and other Node contributors.
7
- //
8
- // Permission is hereby granted, free of charge, to any person obtaining a
9
- // copy of this software and associated documentation files (the
10
- // "Software"), to deal in the Software without restriction, including
11
- // without limitation the rights to use, copy, modify, merge, publish,
12
- // distribute, sublicense, and/or sell copies of the Software, and to permit
13
- // persons to whom the Software is furnished to do so, subject to the
14
- // following conditions:
15
- //
16
- // The above copyright notice and this permission notice shall be included
17
- // in all copies or substantial portions of the Software.
18
- //
19
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
20
- // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21
- // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
22
- // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
23
- // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
24
- // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
25
- // USE OR OTHER DEALINGS IN THE SOFTWARE.
26
-
27
-
28
-
29
- var R = typeof Reflect === 'object' ? Reflect : null
30
- var ReflectApply = R && typeof R.apply === 'function'
31
- ? R.apply
32
- : function ReflectApply(target, receiver, args) {
33
- return Function.prototype.apply.call(target, receiver, args);
34
- }
35
-
36
- var ReflectOwnKeys
37
- if (R && typeof R.ownKeys === 'function') {
38
- ReflectOwnKeys = R.ownKeys
39
- } else if (Object.getOwnPropertySymbols) {
40
- ReflectOwnKeys = function ReflectOwnKeys(target) {
41
- return Object.getOwnPropertyNames(target)
42
- .concat(Object.getOwnPropertySymbols(target));
43
- };
44
- } else {
45
- ReflectOwnKeys = function ReflectOwnKeys(target) {
46
- return Object.getOwnPropertyNames(target);
47
- };
48
- }
3
+ /***/ 427:
4
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
49
5
 
50
- function ProcessEmitWarning(warning) {
51
- if (console && console.warn) console.warn(warning);
52
- }
6
+ var __webpack_unused_export__;
53
7
 
54
- var NumberIsNaN = Number.isNaN || function NumberIsNaN(value) {
55
- return value !== value;
56
- }
57
8
 
58
- function EventEmitter() {
59
- EventEmitter.init.call(this);
60
- }
61
- module.exports = EventEmitter;
62
- module.exports.once = once;
9
+ __webpack_unused_export__ = ({ value: true });
63
10
 
64
- // Backwards-compat with node 0.10.x
65
- EventEmitter.EventEmitter = EventEmitter;
11
+ var bs32 = __webpack_require__(894);
12
+ var bs58 = __webpack_require__(158);
13
+ var isHex = __webpack_require__(187);
14
+ var varint = __webpack_require__(676);
15
+ var createKeccakHash = __webpack_require__(811);
66
16
 
67
- EventEmitter.prototype._events = undefined;
68
- EventEmitter.prototype._eventsCount = 0;
69
- EventEmitter.prototype._maxListeners = undefined;
17
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
70
18
 
71
- // By default EventEmitters will print a warning if more than 10 listeners are
72
- // added to it. This is a useful default which helps finding memory leaks.
73
- var defaultMaxListeners = 10;
19
+ var bs32__default = /*#__PURE__*/_interopDefaultLegacy(bs32);
20
+ var bs58__default = /*#__PURE__*/_interopDefaultLegacy(bs58);
21
+ var isHex__default = /*#__PURE__*/_interopDefaultLegacy(isHex);
22
+ var varint__default = /*#__PURE__*/_interopDefaultLegacy(varint);
23
+ var createKeccakHash__default = /*#__PURE__*/_interopDefaultLegacy(createKeccakHash);
74
24
 
75
- function checkListener(listener) {
76
- if (typeof listener !== 'function') {
77
- throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof listener);
78
- }
25
+ class BasicInterface$1 {
26
+ handleDecode() {
27
+ if (!this.decode) throw new Error('bad implementation: needs decode func')
28
+ return this.decode()
29
+ }
30
+
31
+ handleEncode() {
32
+ if (!this.encode) throw new Error('bad implementation: needs encode func')
33
+ return this.encode()
34
+ }
35
+ isHex(string) {
36
+ return isHex__default["default"](string)
37
+ }
38
+ isBase32(string) {
39
+ return bs32__default["default"].isBase32(string)
40
+ }
41
+ isBase58(string) {
42
+ return bs58__default["default"].isBase58(string)
43
+ }
44
+ /**
45
+ * @param {String} encoded
46
+ */
47
+ fromBs32(encoded) {
48
+ this.encoded = bs32__default["default"].decode(encoded);
49
+ return this.handleDecode()
50
+ }
51
+
52
+ /**
53
+ * @param {String} encoded
54
+ */
55
+ fromBs58(encoded) {
56
+ this.encoded = bs58__default["default"].decode(encoded);
57
+ return this.handleDecode()
58
+ }
59
+
60
+ async toArray() {
61
+ const array = [];
62
+ for await (const value of this.encoded.values()) {
63
+ array.push(value);
64
+ }
65
+ return array
66
+ }
67
+
68
+ fromString(string) {
69
+ this.encoded = new Uint8Array(string.split(','));
70
+ return this.handleDecode()
71
+ }
72
+
73
+ fromArray(array) {
74
+ this.encoded = new Uint8Array([...array]);
75
+ return this.handleDecode()
76
+ }
77
+
78
+ /**
79
+ * @param {Buffer} encoded
80
+ */
81
+ fromEncoded(encoded) {
82
+ this.encoded = encoded;
83
+ return this.handleDecode()
84
+ }
85
+
86
+ /**
87
+ * @param {String} encoded
88
+ */
89
+ fromHex(encoded) {
90
+ this.encoded = Buffer.from(encoded, 'hex');
91
+ return this.handleDecode()
92
+ }
93
+
94
+ async toString(encoding = 'utf8') {
95
+ if (!this.encoded) await this.handleEncode();
96
+ return this.encoded.toString(encoding)
97
+ }
98
+
99
+ /**
100
+ * @return {String} encoded
101
+ */
102
+ toHex() {
103
+ return this.toString('hex')
104
+ }
105
+
106
+ /**
107
+ * @return {String} encoded
108
+ */
109
+ async toBs32() {
110
+ if (!this.encoded) await this.handleEncode();
111
+ return bs32__default["default"].encode(this.encoded)
112
+ }
113
+
114
+ /**
115
+ * @return {String} encoded
116
+ */
117
+ async toBs58() {
118
+ if (!this.encoded) await this.handleEncode();
119
+ return bs58__default["default"].encode(this.encoded)
120
+ }
121
+
122
+ /**
123
+ * @param {Object} data
124
+ */
125
+ create(data) {
126
+ const decoded = {};
127
+ if (this.keys?.length > 0) {
128
+ for (const key of this.keys) {
129
+ Object.defineProperties(decoded, {
130
+ [key]: {
131
+ enumerable: true,
132
+ configurable: true,
133
+ set: (val) => value = data[key],
134
+ get: () => data[key]
135
+ }
136
+ });
137
+ }
138
+
139
+ this.decoded = decoded;
140
+ return this.encode()
141
+ }
142
+ }
79
143
  }
80
144
 
81
- Object.defineProperty(EventEmitter, 'defaultMaxListeners', {
82
- enumerable: true,
83
- get: function() {
84
- return defaultMaxListeners;
85
- },
86
- set: function(arg) {
87
- if (typeof arg !== 'number' || arg < 0 || NumberIsNaN(arg)) {
88
- throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + arg + '.');
89
- }
90
- defaultMaxListeners = arg;
91
- }
92
- });
93
-
94
- EventEmitter.init = function() {
145
+ var codecs = {
146
+ // just a hash
147
+ 'disco-hash': {
148
+ codec: parseInt('30', 16),
149
+ hashAlg: 'dbl-keccak-256', // ,
150
+ // testnet: 'olivia'
151
+ },
152
+ 'peernet-peer-response': {
153
+ codec: parseInt('707072', 16),
154
+ hashAlg: 'keccak-256',
155
+ },
156
+ 'peernet-peer': {
157
+ codec: parseInt('7070', 16),
158
+ hashAlg: 'keccak-256',
159
+ },
160
+ 'peernet-dht': {
161
+ codec: parseInt('706468', 16),
162
+ hashAlg: 'keccak-256',
163
+ },
164
+ 'peernet-dht-response': {
165
+ codec: parseInt('706472', 16),
166
+ hashAlg: 'keccak-256',
167
+ },
168
+ // data
169
+ 'peernet-data': {
170
+ codec: parseInt('706461', 16),
171
+ hashAlg: 'keccak-256',
172
+ },
173
+ 'peernet-data-response': {
174
+ codec: parseInt('70646172', 16),
175
+ hashAlg: 'keccak-256',
176
+ },
177
+ // message
178
+ 'peernet-message': {
179
+ codec: parseInt('706d65', 16),
180
+ hashAlg: 'keccak-256',
181
+ },
182
+ // pubsub
183
+ 'peernet-ps': {
184
+ codec: parseInt('707073', 16),
185
+ hashAlg: 'keccak-256',
186
+ },
187
+ 'peernet-response': {
188
+ codec: parseInt('7072', 16),
189
+ hashAlg: 'keccak-256',
190
+ },
191
+ 'peernet-request': {
192
+ codec: parseInt('707271', 16),
193
+ hashAlg: 'keccak-256',
194
+ },
195
+ // normal block
196
+ 'leofcoin-block': {
197
+ codec: parseInt('6c62', 16),
198
+ hashAlg: 'dbl-keccak-512', // ,
199
+ // testnet: 'olivia'
200
+ },
201
+ 'leofcoin-tx': {
202
+ codec: parseInt('6c74', 16),
203
+ hashAlg: 'dbl-keccak-512', // ,
204
+ // testnet: 'olivia'
205
+ },
206
+ // itx
207
+ 'leofcoin-itx': {
208
+ codec: parseInt('6c69', 16),
209
+ hashAlg: 'keccak-512', // ,
210
+ // testnet: 'olivia'
211
+ },
212
+ // peer reputation
213
+ 'leofcoin-pr': {
214
+ codec: parseInt('6c70', 16),
215
+ hashAlg: 'keccak-256', // ,
216
+ // testnet: 'olivia'
217
+ },
218
+ // chat message
219
+ 'chat-message': {
220
+ codec: parseInt('636d', 16),
221
+ hashAlg: 'dbl-keccak-256',
222
+ },
223
+ 'peernet-file' : {
224
+ codec: parseInt('7066', 16),
225
+ hashAlg: 'keccak-256',
226
+ },
227
+ 'peernet-file-response' : {
228
+ codec: parseInt('706672', 16),
229
+ hashAlg: 'keccak-256',
230
+ }
231
+ };
95
232
 
96
- if (this._events === undefined ||
97
- this._events === Object.getPrototypeOf(this)._events) {
98
- this._events = Object.create(null);
99
- this._eventsCount = 0;
100
- }
101
-
102
- this._maxListeners = this._maxListeners || undefined;
103
- };
104
-
105
- // Obviously not all Emitters should be limited to 10. This function allows
106
- // that to be increased. Set to zero for unlimited.
107
- EventEmitter.prototype.setMaxListeners = function setMaxListeners(n) {
108
- if (typeof n !== 'number' || n < 0 || NumberIsNaN(n)) {
109
- throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + n + '.');
110
- }
111
- this._maxListeners = n;
112
- return this;
113
- };
233
+ class PeernetCodec extends BasicInterface$1 {
234
+ get codecs() {
235
+ return {...globalThis.peernet.codecs, ...codecs}
236
+ }
237
+ constructor(buffer) {
238
+ super();
239
+ if (buffer) {
240
+ if (buffer instanceof Uint8Array) {
241
+ const codec = varint__default["default"].decode(buffer);
242
+ const name = this.getCodecName(codec);
243
+ if (name) {
244
+ this.name = name;
245
+ this.encoded = buffer;
246
+ this.decode(buffer);
247
+ } else {
248
+ this.encode(buffer);
249
+ }
250
+ } else if (buffer instanceof ArrayBuffer) {
251
+ const encoded = new Uint8Array(buffer.byteLength);
252
+
253
+ for (let i = 0; i < buffer.byteLength; i++) {
254
+ encoded[i] = buffer[i];
255
+ }
256
+ this.encoded = encoded;
257
+ // this.encoded = new Uint8Array(buffer, buffer.byteOffset, buffer.byteLength)
258
+ this.decode(buffer);
259
+ return
260
+ }
261
+ if (typeof buffer === 'string') {
262
+ if (this.codecs[buffer]) this.fromName(buffer);
263
+ else if (this.isHex(buffer)) this.fromHex(buffer);
264
+ else if (this.isBase32(buffer)) this.fromBs32(buffer);
265
+ else if (this.isBase58(buffer)) this.fromBs58(buffer);
266
+ else throw new Error(`unsupported string ${buffer}`)
267
+ }
268
+ if (!isNaN(buffer)) if (this.codecs[this.getCodecName(buffer)]) this.fromCodec(buffer);
269
+ }
270
+ }
271
+
272
+ fromEncoded(encoded) {
273
+ const codec = varint__default["default"].decode(encoded);
274
+ const name = this.getCodecName(codec);
275
+ this.name = name;
276
+ this.encoded = encoded;
277
+ this.decode(encoded);
278
+ }
279
+
280
+ getCodec(name) {
281
+ return this.codecs[name].codec
282
+ }
283
+
284
+ getCodecName(codec) {
285
+ return Object.keys(this.codecs).reduce((p, c) => {
286
+ const item = this.codecs[c];
287
+ if (item.codec === codec) return c;
288
+ else return p;
289
+ }, undefined)
290
+ }
291
+
292
+ getHashAlg(name) {
293
+ return this.codecs[name].hashAlg
294
+ }
295
+
296
+ fromCodec(codec) {
297
+ this.name = this.getCodecName(codec);
298
+ this.hashAlg = this.getHashAlg(this.name);
299
+
300
+ this.codec = this.getCodec(this.name);
301
+ this.codecBuffer = varint__default["default"].encode(codec);
302
+ }
303
+
304
+ fromName(name) {
305
+ const codec = this.getCodec(name);
306
+ this.name = name;
307
+ this.codec = codec;
308
+ this.hashAlg = this.getHashAlg(name);
309
+ this.codecBuffer = varint__default["default"].encode(codec);
310
+ }
311
+
312
+ decode() {
313
+ const codec = varint__default["default"].decode(this.encoded);
314
+ this.fromCodec(codec);
315
+ }
316
+
317
+ encode() {
318
+ const codec = varint__default["default"].encode(this.decoded);
319
+ this.encoded = codec;
320
+ return this.encoded
321
+ }
322
+ }
114
323
 
115
- function _getMaxListeners(that) {
116
- if (that._maxListeners === undefined)
117
- return EventEmitter.defaultMaxListeners;
118
- return that._maxListeners;
324
+ class CodecHash$1 extends BasicInterface$1 {
325
+ constructor(buffer, options = {}) {
326
+ super();
327
+ if (options.name) this.name = options.name;
328
+ else this.name = 'disco-hash';
329
+ if (options.codecs) this.codecs = options.codecs;
330
+ if (buffer) {
331
+ if (buffer instanceof Uint8Array) {
332
+ this.discoCodec = new PeernetCodec(buffer, this.codecs);
333
+ const name = this.discoCodec.name;
334
+
335
+ if (name) {
336
+ this.name = name;
337
+ this.decode(buffer);
338
+ } else {
339
+ this.encode(buffer);
340
+ }
341
+ }
342
+
343
+ if (typeof buffer === 'string') {
344
+ if (this.isHex(buffer)) this.fromHex(buffer);
345
+ if (this.isBase32(buffer)) this.fromBs32(buffer);
346
+ else if (this.isBase58(buffer)) this.fromBs58(buffer);
347
+ else throw new Error(`unsupported string ${buffer}`)
348
+ } else if (typeof buffer === 'object') this.fromJSON(buffer);
349
+ }
350
+ }
351
+
352
+ get prefix() {
353
+ const length = this.length;
354
+ const uint8Array = new Uint8Array(length.length + this.discoCodec.codecBuffer.length);
355
+ uint8Array.set(length);
356
+ uint8Array.set(this.discoCodec.codecBuffer, length.length);
357
+
358
+ return uint8Array
359
+ }
360
+
361
+ get length() {
362
+ return varint__default["default"].encode(this.size)
363
+ }
364
+
365
+ get buffer() {
366
+ return this.encoded
367
+ }
368
+
369
+ get hash() {
370
+ return this.encoded
371
+ }
372
+
373
+ fromJSON(json) {
374
+ return this.encode(Buffer.from(JSON.stringify(json)))
375
+ }
376
+
377
+ encode(buffer, name) {
378
+ if (!this.name && name) this.name = name;
379
+ if (!buffer) buffer = this.buffer;
380
+ this.discoCodec = new PeernetCodec(this.name, this.codecs);
381
+ this.discoCodec.fromName(this.name);
382
+ let hashAlg = this.discoCodec.hashAlg;
383
+ if (hashAlg.includes('dbl')) {
384
+ hashAlg = hashAlg.replace('dbl-', '');
385
+ buffer = createKeccakHash__default["default"](hashAlg.replace('-', '')).update(buffer).digest();
386
+ }
387
+ this.digest = createKeccakHash__default["default"](hashAlg.replace('-', '')).update(buffer).digest();
388
+ this.size = this.digest.length;
389
+
390
+ this.codec = this.discoCodec.encode();
391
+ this.codec = this.discoCodec.codecBuffer;
392
+ const uint8Array = new Uint8Array(this.digest.length + this.prefix.length);
393
+ uint8Array.set(this.prefix);
394
+ uint8Array.set(this.digest, this.prefix.length);
395
+
396
+ this.encoded = uint8Array;
397
+
398
+ return this.encoded
399
+ }
400
+
401
+ validate(buffer) {
402
+ if (Buffer.isBuffer(buffer)) {
403
+ const codec = varint__default["default"].decode(buffer);
404
+ if (this.codecs[codec]) {
405
+ this.decode(buffer);
406
+ } else {
407
+ this.encode(buffer);
408
+ }
409
+ }
410
+ if (typeof buffer === 'string') {
411
+ if (this.isHex(buffer)) this.fromHex(buffer);
412
+ if (this.isBase32(buffer)) this.fromBs32(buffer);
413
+ }
414
+ if (typeof buffer === 'object') this.fromJSON(buffer);
415
+ }
416
+
417
+ decode(buffer) {
418
+ this.encoded = buffer;
419
+ const codec = varint__default["default"].decode(buffer);
420
+
421
+ this.discoCodec = new PeernetCodec(codec, this.codecs);
422
+ // TODO: validate codec
423
+ buffer = buffer.slice(varint__default["default"].decode.bytes);
424
+ this.size = varint__default["default"].decode(buffer);
425
+ this.digest = buffer.slice(varint__default["default"].decode.bytes);
426
+ if (this.digest.length !== this.size) {
427
+ throw new Error(`hash length inconsistent: 0x${this.encoded.toString('hex')}`)
428
+ }
429
+
430
+ // const discoCodec = new Codec(codec, this.codecs)
431
+
432
+ this.name = this.discoCodec.name;
433
+
434
+
435
+ this.size = this.digest.length;
436
+
437
+ return {
438
+ codec: this.codec,
439
+ name: this.name,
440
+ size: this.size,
441
+ length: this.length,
442
+ digest: this.digest,
443
+ }
444
+ }
119
445
  }
120
446
 
121
- EventEmitter.prototype.getMaxListeners = function getMaxListeners() {
122
- return _getMaxListeners(this);
123
- };
447
+ class FormatInterface$1 extends BasicInterface$1 {
448
+
449
+ async protoEncode(data) {
450
+ // check schema
451
+ return new TextEncoder().encode(data)
452
+ }
453
+
454
+ async protoDecode(data) {
455
+ // check schema
456
+ return new TextDecoder().decode(data)
457
+ }
458
+
459
+ async init(buffer) {
460
+ if (buffer instanceof Uint8Array) await this.fromUint8Array(buffer);
461
+ else if (buffer instanceof ArrayBuffer) await this.fromArrayBuffer(buffer);
462
+ else if (buffer?.name === this.name) return buffer
463
+ else if (buffer instanceof String) {
464
+ if (this.isHex(buffer)) await this.fromHex(buffer);
465
+ else if (this.isBase32(buffer)) await this.fromBs32(buffer);
466
+ else if (this.isBase58(buffer)) await this.fromBs58(buffer);
467
+ else throw new Error(`unsupported string ${buffer}`)
468
+ } else {
469
+ await this.create(buffer);
470
+ }
471
+ return this
472
+ }
473
+
474
+ /**
475
+ * @param {Buffer|String|Object} buffer - data - The data needed to create the desired message
476
+ * @param {Object} proto - {encode, decode}
477
+ * @param {Object} options - {hashFormat, name}
478
+ */
479
+ constructor(buffer, proto, options = {}) {
480
+ super();
481
+ this.proto = proto;
482
+ this.hashFormat = options.hashFormat || 'bs32';
483
+ if (options.name) this.name = options.name;
484
+ return this.init(buffer)
485
+ }
486
+
487
+ /**
488
+ * @return {PeernetHash}
489
+ */
490
+ get peernetHash() {
491
+ return new CodecHash$1(this.decoded, {name: this.name})
492
+ }
493
+
494
+ /**
495
+ * @return {peernetHash}
496
+ */
497
+ get hash() {
498
+ const upper = this.hashFormat.charAt(0).toUpperCase();
499
+ const format = `${upper}${this.hashFormat.substring(1, this.hashFormat.length)}`;
500
+ return this.peernetHash[`to${format}`]()
501
+ }
502
+
503
+ /**
504
+ * @return {Object}
505
+ */
506
+ async decode() {
507
+ let encoded = this.encoded;
508
+ const discoCodec = new PeernetCodec(this.encoded);
509
+ encoded = encoded.slice(discoCodec.codecBuffer.length);
510
+ this.name = discoCodec.name;
511
+ this.decoded = await this.protoDecode(encoded);
512
+ try {
513
+ this.decoded = JSON.parse(this.decoded);
514
+ } catch {
515
+
516
+ }
517
+ return this.decoded
518
+ }
519
+
520
+ /**
521
+ * @return {Buffer}
522
+ */
523
+ async encode(decoded) {
524
+ if (!decoded) decoded = this.decoded;
525
+ const codec = new PeernetCodec(this.name);
526
+ const encoded = await this.protoEncode(typeof decoded === 'object' ? JSON.stringify(decoded) : decoded);
527
+ const uint8Array = new Uint8Array(encoded.length + codec.codecBuffer.length);
528
+ uint8Array.set(codec.codecBuffer);
529
+ uint8Array.set(encoded, codec.codecBuffer.length);
530
+ this.encoded = uint8Array;
531
+ return this.encoded
532
+ }
533
+
534
+ hasCodec() {
535
+ if (!this.encoded) return false
536
+ const codec = new PeernetCodec(this.encoded);
537
+ if (codec.name) return true
538
+ }
539
+
540
+ fromUint8Array(buffer) {
541
+ this.encoded = buffer;
542
+ return this.hasCodec() ? this.decode() : this.create(
543
+ JSON.parse(new TextDecoder().decode(this.encoded))
544
+ )
545
+ }
546
+
547
+ fromArrayBuffer(buffer) {
548
+ this.encoded = new Uint8Array(buffer, buffer.byteOffset, buffer.byteLength);
549
+ return this.hasCodec() ? this.decode() : this.create(
550
+ JSON.parse(new TextDecoder().decode(this.encoded))
551
+ )
552
+ }
553
+ }
124
554
 
125
- EventEmitter.prototype.emit = function emit(type) {
126
- var args = [];
127
- for (var i = 1; i < arguments.length; i++) args.push(arguments[i]);
128
- var doError = (type === 'error');
555
+ const BasicInterface = BasicInterface$1;
556
+ const FormatInterface = FormatInterface$1;
557
+ const CodecHash = CodecHash$1;
558
+ const Codec = PeernetCodec;
559
+ const Codecs = codecs;
129
560
 
130
- var events = this._events;
131
- if (events !== undefined)
132
- doError = (doError && events.error === undefined);
133
- else if (!doError)
134
- return false;
561
+ __webpack_unused_export__ = BasicInterface;
562
+ __webpack_unused_export__ = Codec;
563
+ __webpack_unused_export__ = CodecHash;
564
+ __webpack_unused_export__ = Codecs;
565
+ exports.L1 = FormatInterface;
135
566
 
136
- // If there is no 'error' event listener then throw.
137
- if (doError) {
138
- var er;
139
- if (args.length > 0)
140
- er = args[0];
141
- if (er instanceof Error) {
142
- // Note: The comments on the `throw` lines are intentional, they show
143
- // up in Node's output if this results in an unhandled exception.
144
- throw er; // Unhandled 'error' event
145
- }
146
- // At least give some kind of context to the user
147
- var err = new Error('Unhandled error.' + (er ? ' (' + er.message + ')' : ''));
148
- err.context = er;
149
- throw err; // Unhandled 'error' event
150
- }
151
567
 
152
- var handler = events[type];
568
+ /***/ }),
153
569
 
154
- if (handler === undefined)
155
- return false;
570
+ /***/ 353:
571
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
156
572
 
157
- if (typeof handler === 'function') {
158
- ReflectApply(handler, this, args);
159
- } else {
160
- var len = handler.length;
161
- var listeners = arrayClone(handler, len);
162
- for (var i = 0; i < len; ++i)
163
- ReflectApply(listeners[i], this, args);
164
- }
573
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
574
+ /* harmony export */ "Z": () => (__WEBPACK_DEFAULT_EXPORT__)
575
+ /* harmony export */ });
576
+ // base-x encoding / decoding
577
+ // Copyright (c) 2018 base-x contributors
578
+ // Copyright (c) 2014-2018 The Bitcoin Core developers (base58.cpp)
579
+ // Distributed under the MIT software license, see the accompanying
580
+ // file LICENSE or http://www.opensource.org/licenses/mit-license.php.
581
+ const base = ALPHABET => {
582
+ if (ALPHABET.length >= 255) { throw new TypeError('Alphabet too long') }
583
+ const BASE_MAP = new Uint8Array(256)
584
+ for (let j = 0; j < BASE_MAP.length; j++) {
585
+ BASE_MAP[j] = 255
586
+ }
587
+ for (let i = 0; i < ALPHABET.length; i++) {
588
+ const x = ALPHABET.charAt(i)
589
+ const xc = x.charCodeAt(0)
590
+ if (BASE_MAP[xc] !== 255) { throw new TypeError(x + ' is ambiguous') }
591
+ BASE_MAP[xc] = i
592
+ }
593
+ const BASE = ALPHABET.length
594
+ const LEADER = ALPHABET.charAt(0)
595
+ const FACTOR = Math.log(BASE) / Math.log(256) // log(BASE) / log(256), rounded up
596
+ const iFACTOR = Math.log(256) / Math.log(BASE) // log(256) / log(BASE), rounded up
597
+
598
+ const encode = source => {
599
+ if (source instanceof Uint8Array) {
600
+ } else if (ArrayBuffer.isView(source)) {
601
+ source = new Uint8Array(source.buffer, source.byteOffset, source.byteLength)
602
+ } else if (Array.isArray(source)) {
603
+ source = Uint8Array.from(source)
604
+ }
605
+ if (!(source instanceof Uint8Array)) { throw new TypeError('Expected Uint8Array') }
606
+ if (source.length === 0) { return '' }
607
+ // Skip & count leading zeroes.
608
+ let zeroes = 0
609
+ let length = 0
610
+ let pbegin = 0
611
+ const pend = source.length
612
+ while (pbegin !== pend && source[pbegin] === 0) {
613
+ pbegin++
614
+ zeroes++
615
+ }
616
+ // Allocate enough space in big-endian base58 representation.
617
+ const size = ((pend - pbegin) * iFACTOR + 1) >>> 0
618
+ const b58 = new Uint8Array(size)
619
+ // Process the bytes.
620
+ while (pbegin !== pend) {
621
+ let carry = source[pbegin]
622
+ // Apply "b58 = b58 * 256 + ch".
623
+ let i = 0
624
+ for (let it1 = size - 1; (carry !== 0 || i < length) && (it1 !== -1); it1--, i++) {
625
+ carry += (256 * b58[it1]) >>> 0
626
+ b58[it1] = (carry % BASE) >>> 0
627
+ carry = (carry / BASE) >>> 0
628
+ }
629
+ if (carry !== 0) { throw new Error('Non-zero carry') }
630
+ length = i
631
+ pbegin++
632
+ }
633
+ // Skip leading zeroes in base58 result.
634
+ let it2 = size - length
635
+ while (it2 !== size && b58[it2] === 0) {
636
+ it2++
637
+ }
638
+ // Translate the result into a string.
639
+ let str = LEADER.repeat(zeroes)
640
+ for (; it2 < size; ++it2) { str += ALPHABET.charAt(b58[it2]) }
641
+ return str
642
+ }
643
+ const decodeUnsafe = source => {
644
+ if (typeof source !== 'string') { throw new TypeError('Expected String') }
645
+ if (source.length === 0) { return new Uint8Array() }
646
+ let psz = 0
647
+ // Skip and count leading '1's.
648
+ let zeroes = 0
649
+ let length = 0
650
+ while (source[psz] === LEADER) {
651
+ zeroes++
652
+ psz++
653
+ }
654
+ // Allocate enough space in big-endian base256 representation.
655
+ const size = (((source.length - psz) * FACTOR) + 1) >>> 0 // log(58) / log(256), rounded up.
656
+ let b256 = new Uint8Array(size)
657
+ // Process the characters.
658
+ while (source[psz]) {
659
+ // Decode character
660
+ let carry = BASE_MAP[source.charCodeAt(psz)]
661
+ // Invalid character
662
+ if (carry === 255) { return }
663
+ let i = 0
664
+ for (let it3 = size - 1; (carry !== 0 || i < length) && (it3 !== -1); it3--, i++) {
665
+ carry += (BASE * b256[it3]) >>> 0
666
+ b256[it3] = (carry % 256) >>> 0
667
+ carry = (carry / 256) >>> 0
668
+ }
669
+ if (carry !== 0) { throw new Error('Non-zero carry') }
670
+ length = i
671
+ psz++
672
+ }
673
+ // Skip leading zeroes in b256.
674
+ let it4 = size - length
675
+ while (it4 !== size && b256[it4] === 0) {
676
+ it4++
677
+ }
678
+ let vch = new Uint8Array(zeroes + (size - it4))
679
+ let j = zeroes
680
+ while (it4 !== size) {
681
+ vch[j++] = b256[it4++]
682
+ }
683
+ return vch
684
+ }
685
+ const decode = string => {
686
+ const buffer = decodeUnsafe(string)
687
+ if (buffer) { return buffer }
688
+ throw new Error('Non-base' + BASE + ' character')
689
+ }
690
+ return {
691
+ encode: encode,
692
+ decodeUnsafe: decodeUnsafe,
693
+ decode: decode
694
+ }
695
+ }
696
+
697
+ /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (base);
165
698
 
166
- return true;
167
- };
168
699
 
169
- function _addListener(target, type, listener, prepend) {
170
- var m;
171
- var events;
172
- var existing;
700
+ /***/ }),
173
701
 
174
- checkListener(listener);
702
+ /***/ 894:
703
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
175
704
 
176
- events = target._events;
177
- if (events === undefined) {
178
- events = target._events = Object.create(null);
179
- target._eventsCount = 0;
180
- } else {
181
- // To avoid recursion in the case that type === "newListener"! Before
182
- // adding it to the listeners, first emit "newListener".
183
- if (events.newListener !== undefined) {
184
- target.emit('newListener', type,
185
- listener.listener ? listener.listener : listener);
705
+ __webpack_require__.r(__webpack_exports__);
706
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
707
+ /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
708
+ /* harmony export */ });
709
+ /* harmony import */ var _vandeurenglenn_base_x__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(353);
186
710
 
187
- // Re-assign `events` because a newListener handler could have caused the
188
- // this._events to be assigned to a new object
189
- events = target._events;
190
- }
191
- existing = events[type];
192
- }
193
711
 
194
- if (existing === undefined) {
195
- // Optimize the case of one listener. Don't need the extra array object.
196
- existing = events[type] = listener;
197
- ++target._eventsCount;
198
- } else {
199
- if (typeof existing === 'function') {
200
- // Adding the second element, need to change to array.
201
- existing = events[type] =
202
- prepend ? [listener, existing] : [existing, listener];
203
- // If we've already got an array, just append.
204
- } else if (prepend) {
205
- existing.unshift(listener);
206
- } else {
207
- existing.push(listener);
208
- }
712
+ const base32 = 'abcdefghijklmnopqrstuvwxyz234567'
713
+ const base32Hex = '0123456789abcdefghijklmnopqrstuv'
209
714
 
210
- // Check for listener leak
211
- m = _getMaxListeners(target);
212
- if (m > 0 && existing.length > m && !existing.warned) {
213
- existing.warned = true;
214
- // No error code for this since it is a Warning
215
- // eslint-disable-next-line no-restricted-syntax
216
- var w = new Error('Possible EventEmitter memory leak detected. ' +
217
- existing.length + ' ' + String(type) + ' listeners ' +
218
- 'added. Use emitter.setMaxListeners() to ' +
219
- 'increase limit');
220
- w.name = 'MaxListenersExceededWarning';
221
- w.emitter = target;
222
- w.type = type;
223
- w.count = existing.length;
224
- ProcessEmitWarning(w);
715
+ const decode = (uint8Array, hex = false) => {
716
+ const decoder = hex ? (0,_vandeurenglenn_base_x__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z)(base32Hex) : (0,_vandeurenglenn_base_x__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z)(base32)
717
+ return decoder.decode(uint8Array)
718
+ }
719
+
720
+ /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
721
+ encode: (uint8Array, hex = false) => {
722
+ const encoder = hex ? (0,_vandeurenglenn_base_x__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z)(base32Hex) : (0,_vandeurenglenn_base_x__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z)(base32)
723
+ return encoder.encode(uint8Array)
724
+ },
725
+ decode,
726
+ isBase32: (uint8Array, hex = false) => {
727
+ try {
728
+ decode(uint8Array, hex)
729
+ return true;
730
+ } catch (e) {
731
+ return false;
225
732
  }
226
733
  }
734
+ });
227
735
 
228
- return target;
229
- }
230
736
 
231
- EventEmitter.prototype.addListener = function addListener(type, listener) {
232
- return _addListener(this, type, listener, false);
233
- };
737
+ /***/ }),
234
738
 
235
- EventEmitter.prototype.on = EventEmitter.prototype.addListener;
739
+ /***/ 158:
740
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
236
741
 
237
- EventEmitter.prototype.prependListener =
238
- function prependListener(type, listener) {
239
- return _addListener(this, type, listener, true);
240
- };
742
+ __webpack_require__.r(__webpack_exports__);
743
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
744
+ /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
745
+ /* harmony export */ });
746
+ /* harmony import */ var _vandeurenglenn_base_x__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(353);
241
747
 
242
- function onceWrapper() {
243
- if (!this.fired) {
244
- this.target.removeListener(this.type, this.wrapFn);
245
- this.fired = true;
246
- if (arguments.length === 0)
247
- return this.listener.call(this.target);
248
- return this.listener.apply(this.target, arguments);
249
- }
250
- }
251
748
 
252
- function _onceWrap(target, type, listener) {
253
- var state = { fired: false, wrapFn: undefined, target: target, type: type, listener: listener };
254
- var wrapped = onceWrapper.bind(state);
255
- wrapped.listener = listener;
256
- state.wrapFn = wrapped;
257
- return wrapped;
258
- }
749
+ const base58 = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'
259
750
 
260
- EventEmitter.prototype.once = function once(type, listener) {
261
- checkListener(listener);
262
- this.on(type, _onceWrap(this, type, listener));
263
- return this;
264
- };
751
+ const decode = uint8Array => (0,_vandeurenglenn_base_x__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z)(base58).decode(uint8Array)
265
752
 
266
- EventEmitter.prototype.prependOnceListener =
267
- function prependOnceListener(type, listener) {
268
- checkListener(listener);
269
- this.prependListener(type, _onceWrap(this, type, listener));
270
- return this;
271
- };
753
+ /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
754
+ encode: uint8Array => (0,_vandeurenglenn_base_x__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z)(base58).encode(uint8Array),
755
+ decode,
756
+ isBase58: uint8Array => {
757
+ try {
758
+ decode(uint8Array)
759
+ return true
760
+ } catch (e) {
761
+ return false
762
+ }
763
+ }
764
+ });
272
765
 
273
- // Emits a 'removeListener' event if and only if the listener was removed.
274
- EventEmitter.prototype.removeListener =
275
- function removeListener(type, listener) {
276
- var list, events, position, i, originalListener;
277
766
 
278
- checkListener(listener);
767
+ /***/ }),
279
768
 
280
- events = this._events;
281
- if (events === undefined)
282
- return this;
769
+ /***/ 187:
770
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
283
771
 
284
- list = events[type];
285
- if (list === undefined)
286
- return this;
772
+ __webpack_require__.r(__webpack_exports__);
773
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
774
+ /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
775
+ /* harmony export */ });
776
+ /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (string => /^[A-F0-9]+$/i.test(string));
287
777
 
288
- if (list === listener || list.listener === listener) {
289
- if (--this._eventsCount === 0)
290
- this._events = Object.create(null);
291
- else {
292
- delete events[type];
293
- if (events.removeListener)
294
- this.emit('removeListener', type, list.listener || listener);
295
- }
296
- } else if (typeof list !== 'function') {
297
- position = -1;
298
-
299
- for (i = list.length - 1; i >= 0; i--) {
300
- if (list[i] === listener || list[i].listener === listener) {
301
- originalListener = list[i].listener;
302
- position = i;
303
- break;
304
- }
305
- }
306
778
 
307
- if (position < 0)
308
- return this;
309
-
310
- if (position === 0)
311
- list.shift();
312
- else {
313
- spliceOne(list, position);
314
- }
779
+ /***/ }),
315
780
 
316
- if (list.length === 1)
317
- events[type] = list[0];
781
+ /***/ 370:
782
+ /***/ ((module) => {
318
783
 
319
- if (events.removeListener !== undefined)
320
- this.emit('removeListener', type, originalListener || listener);
321
- }
784
+ // Copyright Joyent, Inc. and other Node contributors.
785
+ //
786
+ // Permission is hereby granted, free of charge, to any person obtaining a
787
+ // copy of this software and associated documentation files (the
788
+ // "Software"), to deal in the Software without restriction, including
789
+ // without limitation the rights to use, copy, modify, merge, publish,
790
+ // distribute, sublicense, and/or sell copies of the Software, and to permit
791
+ // persons to whom the Software is furnished to do so, subject to the
792
+ // following conditions:
793
+ //
794
+ // The above copyright notice and this permission notice shall be included
795
+ // in all copies or substantial portions of the Software.
796
+ //
797
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
798
+ // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
799
+ // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
800
+ // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
801
+ // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
802
+ // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
803
+ // USE OR OTHER DEALINGS IN THE SOFTWARE.
322
804
 
323
- return this;
324
- };
325
805
 
326
- EventEmitter.prototype.off = EventEmitter.prototype.removeListener;
327
806
 
328
- EventEmitter.prototype.removeAllListeners =
329
- function removeAllListeners(type) {
330
- var listeners, events, i;
807
+ var R = typeof Reflect === 'object' ? Reflect : null
808
+ var ReflectApply = R && typeof R.apply === 'function'
809
+ ? R.apply
810
+ : function ReflectApply(target, receiver, args) {
811
+ return Function.prototype.apply.call(target, receiver, args);
812
+ }
331
813
 
332
- events = this._events;
333
- if (events === undefined)
334
- return this;
814
+ var ReflectOwnKeys
815
+ if (R && typeof R.ownKeys === 'function') {
816
+ ReflectOwnKeys = R.ownKeys
817
+ } else if (Object.getOwnPropertySymbols) {
818
+ ReflectOwnKeys = function ReflectOwnKeys(target) {
819
+ return Object.getOwnPropertyNames(target)
820
+ .concat(Object.getOwnPropertySymbols(target));
821
+ };
822
+ } else {
823
+ ReflectOwnKeys = function ReflectOwnKeys(target) {
824
+ return Object.getOwnPropertyNames(target);
825
+ };
826
+ }
335
827
 
336
- // not listening for removeListener, no need to emit
337
- if (events.removeListener === undefined) {
338
- if (arguments.length === 0) {
339
- this._events = Object.create(null);
340
- this._eventsCount = 0;
341
- } else if (events[type] !== undefined) {
342
- if (--this._eventsCount === 0)
343
- this._events = Object.create(null);
344
- else
345
- delete events[type];
346
- }
347
- return this;
348
- }
828
+ function ProcessEmitWarning(warning) {
829
+ if (console && console.warn) console.warn(warning);
830
+ }
349
831
 
350
- // emit removeListener for all listeners on all events
351
- if (arguments.length === 0) {
352
- var keys = Object.keys(events);
353
- var key;
354
- for (i = 0; i < keys.length; ++i) {
355
- key = keys[i];
356
- if (key === 'removeListener') continue;
357
- this.removeAllListeners(key);
358
- }
359
- this.removeAllListeners('removeListener');
360
- this._events = Object.create(null);
361
- this._eventsCount = 0;
362
- return this;
363
- }
832
+ var NumberIsNaN = Number.isNaN || function NumberIsNaN(value) {
833
+ return value !== value;
834
+ }
364
835
 
365
- listeners = events[type];
836
+ function EventEmitter() {
837
+ EventEmitter.init.call(this);
838
+ }
839
+ module.exports = EventEmitter;
840
+ module.exports.once = once;
366
841
 
367
- if (typeof listeners === 'function') {
368
- this.removeListener(type, listeners);
369
- } else if (listeners !== undefined) {
370
- // LIFO order
371
- for (i = listeners.length - 1; i >= 0; i--) {
372
- this.removeListener(type, listeners[i]);
373
- }
374
- }
842
+ // Backwards-compat with node 0.10.x
843
+ EventEmitter.EventEmitter = EventEmitter;
375
844
 
376
- return this;
377
- };
845
+ EventEmitter.prototype._events = undefined;
846
+ EventEmitter.prototype._eventsCount = 0;
847
+ EventEmitter.prototype._maxListeners = undefined;
378
848
 
379
- function _listeners(target, type, unwrap) {
380
- var events = target._events;
849
+ // By default EventEmitters will print a warning if more than 10 listeners are
850
+ // added to it. This is a useful default which helps finding memory leaks.
851
+ var defaultMaxListeners = 10;
381
852
 
382
- if (events === undefined)
383
- return [];
853
+ function checkListener(listener) {
854
+ if (typeof listener !== 'function') {
855
+ throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof listener);
856
+ }
857
+ }
384
858
 
385
- var evlistener = events[type];
386
- if (evlistener === undefined)
387
- return [];
859
+ Object.defineProperty(EventEmitter, 'defaultMaxListeners', {
860
+ enumerable: true,
861
+ get: function() {
862
+ return defaultMaxListeners;
863
+ },
864
+ set: function(arg) {
865
+ if (typeof arg !== 'number' || arg < 0 || NumberIsNaN(arg)) {
866
+ throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + arg + '.');
867
+ }
868
+ defaultMaxListeners = arg;
869
+ }
870
+ });
388
871
 
389
- if (typeof evlistener === 'function')
390
- return unwrap ? [evlistener.listener || evlistener] : [evlistener];
872
+ EventEmitter.init = function() {
391
873
 
392
- return unwrap ?
393
- unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length);
394
- }
874
+ if (this._events === undefined ||
875
+ this._events === Object.getPrototypeOf(this)._events) {
876
+ this._events = Object.create(null);
877
+ this._eventsCount = 0;
878
+ }
395
879
 
396
- EventEmitter.prototype.listeners = function listeners(type) {
397
- return _listeners(this, type, true);
880
+ this._maxListeners = this._maxListeners || undefined;
398
881
  };
399
882
 
400
- EventEmitter.prototype.rawListeners = function rawListeners(type) {
401
- return _listeners(this, type, false);
883
+ // Obviously not all Emitters should be limited to 10. This function allows
884
+ // that to be increased. Set to zero for unlimited.
885
+ EventEmitter.prototype.setMaxListeners = function setMaxListeners(n) {
886
+ if (typeof n !== 'number' || n < 0 || NumberIsNaN(n)) {
887
+ throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + n + '.');
888
+ }
889
+ this._maxListeners = n;
890
+ return this;
402
891
  };
403
892
 
404
- EventEmitter.listenerCount = function(emitter, type) {
405
- if (typeof emitter.listenerCount === 'function') {
406
- return emitter.listenerCount(type);
407
- } else {
408
- return listenerCount.call(emitter, type);
409
- }
893
+ function _getMaxListeners(that) {
894
+ if (that._maxListeners === undefined)
895
+ return EventEmitter.defaultMaxListeners;
896
+ return that._maxListeners;
897
+ }
898
+
899
+ EventEmitter.prototype.getMaxListeners = function getMaxListeners() {
900
+ return _getMaxListeners(this);
410
901
  };
411
902
 
412
- EventEmitter.prototype.listenerCount = listenerCount;
413
- function listenerCount(type) {
414
- var events = this._events;
903
+ EventEmitter.prototype.emit = function emit(type) {
904
+ var args = [];
905
+ for (var i = 1; i < arguments.length; i++) args.push(arguments[i]);
906
+ var doError = (type === 'error');
415
907
 
416
- if (events !== undefined) {
417
- var evlistener = events[type];
908
+ var events = this._events;
909
+ if (events !== undefined)
910
+ doError = (doError && events.error === undefined);
911
+ else if (!doError)
912
+ return false;
418
913
 
419
- if (typeof evlistener === 'function') {
420
- return 1;
421
- } else if (evlistener !== undefined) {
422
- return evlistener.length;
914
+ // If there is no 'error' event listener then throw.
915
+ if (doError) {
916
+ var er;
917
+ if (args.length > 0)
918
+ er = args[0];
919
+ if (er instanceof Error) {
920
+ // Note: The comments on the `throw` lines are intentional, they show
921
+ // up in Node's output if this results in an unhandled exception.
922
+ throw er; // Unhandled 'error' event
423
923
  }
924
+ // At least give some kind of context to the user
925
+ var err = new Error('Unhandled error.' + (er ? ' (' + er.message + ')' : ''));
926
+ err.context = er;
927
+ throw err; // Unhandled 'error' event
424
928
  }
425
929
 
426
- return 0;
427
- }
930
+ var handler = events[type];
428
931
 
429
- EventEmitter.prototype.eventNames = function eventNames() {
430
- return this._eventsCount > 0 ? ReflectOwnKeys(this._events) : [];
431
- };
932
+ if (handler === undefined)
933
+ return false;
432
934
 
433
- function arrayClone(arr, n) {
434
- var copy = new Array(n);
435
- for (var i = 0; i < n; ++i)
436
- copy[i] = arr[i];
437
- return copy;
438
- }
935
+ if (typeof handler === 'function') {
936
+ ReflectApply(handler, this, args);
937
+ } else {
938
+ var len = handler.length;
939
+ var listeners = arrayClone(handler, len);
940
+ for (var i = 0; i < len; ++i)
941
+ ReflectApply(listeners[i], this, args);
942
+ }
439
943
 
440
- function spliceOne(list, index) {
441
- for (; index + 1 < list.length; index++)
442
- list[index] = list[index + 1];
443
- list.pop();
444
- }
944
+ return true;
945
+ };
445
946
 
446
- function unwrapListeners(arr) {
447
- var ret = new Array(arr.length);
448
- for (var i = 0; i < ret.length; ++i) {
449
- ret[i] = arr[i].listener || arr[i];
450
- }
451
- return ret;
452
- }
947
+ function _addListener(target, type, listener, prepend) {
948
+ var m;
949
+ var events;
950
+ var existing;
453
951
 
454
- function once(emitter, name) {
455
- return new Promise(function (resolve, reject) {
456
- function errorListener(err) {
457
- emitter.removeListener(name, resolver);
458
- reject(err);
459
- }
952
+ checkListener(listener);
460
953
 
461
- function resolver() {
462
- if (typeof emitter.removeListener === 'function') {
463
- emitter.removeListener('error', errorListener);
464
- }
465
- resolve([].slice.call(arguments));
466
- };
954
+ events = target._events;
955
+ if (events === undefined) {
956
+ events = target._events = Object.create(null);
957
+ target._eventsCount = 0;
958
+ } else {
959
+ // To avoid recursion in the case that type === "newListener"! Before
960
+ // adding it to the listeners, first emit "newListener".
961
+ if (events.newListener !== undefined) {
962
+ target.emit('newListener', type,
963
+ listener.listener ? listener.listener : listener);
467
964
 
468
- eventTargetAgnosticAddListener(emitter, name, resolver, { once: true });
469
- if (name !== 'error') {
470
- addErrorHandlerIfEventEmitter(emitter, errorListener, { once: true });
965
+ // Re-assign `events` because a newListener handler could have caused the
966
+ // this._events to be assigned to a new object
967
+ events = target._events;
471
968
  }
472
- });
473
- }
474
-
475
- function addErrorHandlerIfEventEmitter(emitter, handler, flags) {
476
- if (typeof emitter.on === 'function') {
477
- eventTargetAgnosticAddListener(emitter, 'error', handler, flags);
969
+ existing = events[type];
478
970
  }
479
- }
480
971
 
481
- function eventTargetAgnosticAddListener(emitter, name, listener, flags) {
482
- if (typeof emitter.on === 'function') {
483
- if (flags.once) {
484
- emitter.once(name, listener);
972
+ if (existing === undefined) {
973
+ // Optimize the case of one listener. Don't need the extra array object.
974
+ existing = events[type] = listener;
975
+ ++target._eventsCount;
976
+ } else {
977
+ if (typeof existing === 'function') {
978
+ // Adding the second element, need to change to array.
979
+ existing = events[type] =
980
+ prepend ? [listener, existing] : [existing, listener];
981
+ // If we've already got an array, just append.
982
+ } else if (prepend) {
983
+ existing.unshift(listener);
485
984
  } else {
486
- emitter.on(name, listener);
985
+ existing.push(listener);
986
+ }
987
+
988
+ // Check for listener leak
989
+ m = _getMaxListeners(target);
990
+ if (m > 0 && existing.length > m && !existing.warned) {
991
+ existing.warned = true;
992
+ // No error code for this since it is a Warning
993
+ // eslint-disable-next-line no-restricted-syntax
994
+ var w = new Error('Possible EventEmitter memory leak detected. ' +
995
+ existing.length + ' ' + String(type) + ' listeners ' +
996
+ 'added. Use emitter.setMaxListeners() to ' +
997
+ 'increase limit');
998
+ w.name = 'MaxListenersExceededWarning';
999
+ w.emitter = target;
1000
+ w.type = type;
1001
+ w.count = existing.length;
1002
+ ProcessEmitWarning(w);
487
1003
  }
488
- } else if (typeof emitter.addEventListener === 'function') {
489
- // EventTarget does not have `error` event semantics like Node
490
- // EventEmitters, we do not listen for `error` events here.
491
- emitter.addEventListener(name, function wrapListener(arg) {
492
- // IE does not have builtin `{ once: true }` support so we
493
- // have to do it manually.
494
- if (flags.once) {
495
- emitter.removeEventListener(name, wrapListener);
496
- }
497
- listener(arg);
498
- });
499
- } else {
500
- throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof emitter);
501
1004
  }
1005
+
1006
+ return target;
502
1007
  }
503
1008
 
1009
+ EventEmitter.prototype.addListener = function addListener(type, listener) {
1010
+ return _addListener(this, type, listener, false);
1011
+ };
504
1012
 
505
- /***/ }),
1013
+ EventEmitter.prototype.on = EventEmitter.prototype.addListener;
506
1014
 
507
- /***/ 5717:
508
- /***/ ((module) => {
1015
+ EventEmitter.prototype.prependListener =
1016
+ function prependListener(type, listener) {
1017
+ return _addListener(this, type, listener, true);
1018
+ };
509
1019
 
510
- if (typeof Object.create === 'function') {
511
- // implementation from standard node.js 'util' module
512
- module.exports = function inherits(ctor, superCtor) {
513
- if (superCtor) {
514
- ctor.super_ = superCtor
515
- ctor.prototype = Object.create(superCtor.prototype, {
516
- constructor: {
517
- value: ctor,
518
- enumerable: false,
519
- writable: true,
520
- configurable: true
521
- }
522
- })
523
- }
524
- };
525
- } else {
526
- // old school shim for old browsers
527
- module.exports = function inherits(ctor, superCtor) {
528
- if (superCtor) {
529
- ctor.super_ = superCtor
530
- var TempCtor = function () {}
531
- TempCtor.prototype = superCtor.prototype
532
- ctor.prototype = new TempCtor()
533
- ctor.prototype.constructor = ctor
534
- }
1020
+ function onceWrapper() {
1021
+ if (!this.fired) {
1022
+ this.target.removeListener(this.type, this.wrapFn);
1023
+ this.fired = true;
1024
+ if (arguments.length === 0)
1025
+ return this.listener.call(this.target);
1026
+ return this.listener.apply(this.target, arguments);
535
1027
  }
536
1028
  }
537
1029
 
1030
+ function _onceWrap(target, type, listener) {
1031
+ var state = { fired: false, wrapFn: undefined, target: target, type: type, listener: listener };
1032
+ var wrapped = onceWrapper.bind(state);
1033
+ wrapped.listener = listener;
1034
+ state.wrapFn = wrapped;
1035
+ return wrapped;
1036
+ }
538
1037
 
539
- /***/ }),
1038
+ EventEmitter.prototype.once = function once(type, listener) {
1039
+ checkListener(listener);
1040
+ this.on(type, _onceWrap(this, type, listener));
1041
+ return this;
1042
+ };
540
1043
 
541
- /***/ 5811:
542
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
1044
+ EventEmitter.prototype.prependOnceListener =
1045
+ function prependOnceListener(type, listener) {
1046
+ checkListener(listener);
1047
+ this.prependListener(type, _onceWrap(this, type, listener));
1048
+ return this;
1049
+ };
543
1050
 
544
- module.exports = __webpack_require__(6066)(__webpack_require__(9653))
1051
+ // Emits a 'removeListener' event if and only if the listener was removed.
1052
+ EventEmitter.prototype.removeListener =
1053
+ function removeListener(type, listener) {
1054
+ var list, events, position, i, originalListener;
545
1055
 
1056
+ checkListener(listener);
546
1057
 
547
- /***/ }),
1058
+ events = this._events;
1059
+ if (events === undefined)
1060
+ return this;
548
1061
 
549
- /***/ 6066:
550
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
1062
+ list = events[type];
1063
+ if (list === undefined)
1064
+ return this;
551
1065
 
552
- const createKeccak = __webpack_require__(7016)
553
- const createShake = __webpack_require__(5675)
1066
+ if (list === listener || list.listener === listener) {
1067
+ if (--this._eventsCount === 0)
1068
+ this._events = Object.create(null);
1069
+ else {
1070
+ delete events[type];
1071
+ if (events.removeListener)
1072
+ this.emit('removeListener', type, list.listener || listener);
1073
+ }
1074
+ } else if (typeof list !== 'function') {
1075
+ position = -1;
554
1076
 
555
- module.exports = function (KeccakState) {
556
- const Keccak = createKeccak(KeccakState)
557
- const Shake = createShake(KeccakState)
1077
+ for (i = list.length - 1; i >= 0; i--) {
1078
+ if (list[i] === listener || list[i].listener === listener) {
1079
+ originalListener = list[i].listener;
1080
+ position = i;
1081
+ break;
1082
+ }
1083
+ }
558
1084
 
559
- return function (algorithm, options) {
560
- const hash = typeof algorithm === 'string' ? algorithm.toLowerCase() : algorithm
561
- switch (hash) {
562
- case 'keccak224': return new Keccak(1152, 448, null, 224, options)
563
- case 'keccak256': return new Keccak(1088, 512, null, 256, options)
564
- case 'keccak384': return new Keccak(832, 768, null, 384, options)
565
- case 'keccak512': return new Keccak(576, 1024, null, 512, options)
1085
+ if (position < 0)
1086
+ return this;
566
1087
 
567
- case 'sha3-224': return new Keccak(1152, 448, 0x06, 224, options)
568
- case 'sha3-256': return new Keccak(1088, 512, 0x06, 256, options)
569
- case 'sha3-384': return new Keccak(832, 768, 0x06, 384, options)
570
- case 'sha3-512': return new Keccak(576, 1024, 0x06, 512, options)
1088
+ if (position === 0)
1089
+ list.shift();
1090
+ else {
1091
+ spliceOne(list, position);
1092
+ }
571
1093
 
572
- case 'shake128': return new Shake(1344, 256, 0x1f, options)
573
- case 'shake256': return new Shake(1088, 512, 0x1f, options)
1094
+ if (list.length === 1)
1095
+ events[type] = list[0];
574
1096
 
575
- default: throw new Error('Invald algorithm: ' + algorithm)
576
- }
577
- }
578
- }
1097
+ if (events.removeListener !== undefined)
1098
+ this.emit('removeListener', type, originalListener || listener);
1099
+ }
579
1100
 
1101
+ return this;
1102
+ };
580
1103
 
581
- /***/ }),
1104
+ EventEmitter.prototype.off = EventEmitter.prototype.removeListener;
582
1105
 
583
- /***/ 7016:
584
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
1106
+ EventEmitter.prototype.removeAllListeners =
1107
+ function removeAllListeners(type) {
1108
+ var listeners, events, i;
585
1109
 
586
- const { Transform } = __webpack_require__(8473)
1110
+ events = this._events;
1111
+ if (events === undefined)
1112
+ return this;
587
1113
 
588
- module.exports = (KeccakState) => class Keccak extends Transform {
589
- constructor (rate, capacity, delimitedSuffix, hashBitLength, options) {
590
- super(options)
1114
+ // not listening for removeListener, no need to emit
1115
+ if (events.removeListener === undefined) {
1116
+ if (arguments.length === 0) {
1117
+ this._events = Object.create(null);
1118
+ this._eventsCount = 0;
1119
+ } else if (events[type] !== undefined) {
1120
+ if (--this._eventsCount === 0)
1121
+ this._events = Object.create(null);
1122
+ else
1123
+ delete events[type];
1124
+ }
1125
+ return this;
1126
+ }
591
1127
 
592
- this._rate = rate
593
- this._capacity = capacity
594
- this._delimitedSuffix = delimitedSuffix
595
- this._hashBitLength = hashBitLength
596
- this._options = options
1128
+ // emit removeListener for all listeners on all events
1129
+ if (arguments.length === 0) {
1130
+ var keys = Object.keys(events);
1131
+ var key;
1132
+ for (i = 0; i < keys.length; ++i) {
1133
+ key = keys[i];
1134
+ if (key === 'removeListener') continue;
1135
+ this.removeAllListeners(key);
1136
+ }
1137
+ this.removeAllListeners('removeListener');
1138
+ this._events = Object.create(null);
1139
+ this._eventsCount = 0;
1140
+ return this;
1141
+ }
1142
+
1143
+ listeners = events[type];
1144
+
1145
+ if (typeof listeners === 'function') {
1146
+ this.removeListener(type, listeners);
1147
+ } else if (listeners !== undefined) {
1148
+ // LIFO order
1149
+ for (i = listeners.length - 1; i >= 0; i--) {
1150
+ this.removeListener(type, listeners[i]);
1151
+ }
1152
+ }
1153
+
1154
+ return this;
1155
+ };
1156
+
1157
+ function _listeners(target, type, unwrap) {
1158
+ var events = target._events;
1159
+
1160
+ if (events === undefined)
1161
+ return [];
1162
+
1163
+ var evlistener = events[type];
1164
+ if (evlistener === undefined)
1165
+ return [];
1166
+
1167
+ if (typeof evlistener === 'function')
1168
+ return unwrap ? [evlistener.listener || evlistener] : [evlistener];
1169
+
1170
+ return unwrap ?
1171
+ unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length);
1172
+ }
1173
+
1174
+ EventEmitter.prototype.listeners = function listeners(type) {
1175
+ return _listeners(this, type, true);
1176
+ };
1177
+
1178
+ EventEmitter.prototype.rawListeners = function rawListeners(type) {
1179
+ return _listeners(this, type, false);
1180
+ };
1181
+
1182
+ EventEmitter.listenerCount = function(emitter, type) {
1183
+ if (typeof emitter.listenerCount === 'function') {
1184
+ return emitter.listenerCount(type);
1185
+ } else {
1186
+ return listenerCount.call(emitter, type);
1187
+ }
1188
+ };
1189
+
1190
+ EventEmitter.prototype.listenerCount = listenerCount;
1191
+ function listenerCount(type) {
1192
+ var events = this._events;
1193
+
1194
+ if (events !== undefined) {
1195
+ var evlistener = events[type];
1196
+
1197
+ if (typeof evlistener === 'function') {
1198
+ return 1;
1199
+ } else if (evlistener !== undefined) {
1200
+ return evlistener.length;
1201
+ }
1202
+ }
1203
+
1204
+ return 0;
1205
+ }
1206
+
1207
+ EventEmitter.prototype.eventNames = function eventNames() {
1208
+ return this._eventsCount > 0 ? ReflectOwnKeys(this._events) : [];
1209
+ };
1210
+
1211
+ function arrayClone(arr, n) {
1212
+ var copy = new Array(n);
1213
+ for (var i = 0; i < n; ++i)
1214
+ copy[i] = arr[i];
1215
+ return copy;
1216
+ }
1217
+
1218
+ function spliceOne(list, index) {
1219
+ for (; index + 1 < list.length; index++)
1220
+ list[index] = list[index + 1];
1221
+ list.pop();
1222
+ }
1223
+
1224
+ function unwrapListeners(arr) {
1225
+ var ret = new Array(arr.length);
1226
+ for (var i = 0; i < ret.length; ++i) {
1227
+ ret[i] = arr[i].listener || arr[i];
1228
+ }
1229
+ return ret;
1230
+ }
1231
+
1232
+ function once(emitter, name) {
1233
+ return new Promise(function (resolve, reject) {
1234
+ function errorListener(err) {
1235
+ emitter.removeListener(name, resolver);
1236
+ reject(err);
1237
+ }
1238
+
1239
+ function resolver() {
1240
+ if (typeof emitter.removeListener === 'function') {
1241
+ emitter.removeListener('error', errorListener);
1242
+ }
1243
+ resolve([].slice.call(arguments));
1244
+ };
1245
+
1246
+ eventTargetAgnosticAddListener(emitter, name, resolver, { once: true });
1247
+ if (name !== 'error') {
1248
+ addErrorHandlerIfEventEmitter(emitter, errorListener, { once: true });
1249
+ }
1250
+ });
1251
+ }
1252
+
1253
+ function addErrorHandlerIfEventEmitter(emitter, handler, flags) {
1254
+ if (typeof emitter.on === 'function') {
1255
+ eventTargetAgnosticAddListener(emitter, 'error', handler, flags);
1256
+ }
1257
+ }
1258
+
1259
+ function eventTargetAgnosticAddListener(emitter, name, listener, flags) {
1260
+ if (typeof emitter.on === 'function') {
1261
+ if (flags.once) {
1262
+ emitter.once(name, listener);
1263
+ } else {
1264
+ emitter.on(name, listener);
1265
+ }
1266
+ } else if (typeof emitter.addEventListener === 'function') {
1267
+ // EventTarget does not have `error` event semantics like Node
1268
+ // EventEmitters, we do not listen for `error` events here.
1269
+ emitter.addEventListener(name, function wrapListener(arg) {
1270
+ // IE does not have builtin `{ once: true }` support so we
1271
+ // have to do it manually.
1272
+ if (flags.once) {
1273
+ emitter.removeEventListener(name, wrapListener);
1274
+ }
1275
+ listener(arg);
1276
+ });
1277
+ } else {
1278
+ throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof emitter);
1279
+ }
1280
+ }
1281
+
1282
+
1283
+ /***/ }),
1284
+
1285
+ /***/ 717:
1286
+ /***/ ((module) => {
1287
+
1288
+ if (typeof Object.create === 'function') {
1289
+ // implementation from standard node.js 'util' module
1290
+ module.exports = function inherits(ctor, superCtor) {
1291
+ if (superCtor) {
1292
+ ctor.super_ = superCtor
1293
+ ctor.prototype = Object.create(superCtor.prototype, {
1294
+ constructor: {
1295
+ value: ctor,
1296
+ enumerable: false,
1297
+ writable: true,
1298
+ configurable: true
1299
+ }
1300
+ })
1301
+ }
1302
+ };
1303
+ } else {
1304
+ // old school shim for old browsers
1305
+ module.exports = function inherits(ctor, superCtor) {
1306
+ if (superCtor) {
1307
+ ctor.super_ = superCtor
1308
+ var TempCtor = function () {}
1309
+ TempCtor.prototype = superCtor.prototype
1310
+ ctor.prototype = new TempCtor()
1311
+ ctor.prototype.constructor = ctor
1312
+ }
1313
+ }
1314
+ }
1315
+
1316
+
1317
+ /***/ }),
1318
+
1319
+ /***/ 811:
1320
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
1321
+
1322
+ module.exports = __webpack_require__(66)(__webpack_require__(653))
1323
+
1324
+
1325
+ /***/ }),
1326
+
1327
+ /***/ 66:
1328
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
1329
+
1330
+ const createKeccak = __webpack_require__(16)
1331
+ const createShake = __webpack_require__(675)
1332
+
1333
+ module.exports = function (KeccakState) {
1334
+ const Keccak = createKeccak(KeccakState)
1335
+ const Shake = createShake(KeccakState)
1336
+
1337
+ return function (algorithm, options) {
1338
+ const hash = typeof algorithm === 'string' ? algorithm.toLowerCase() : algorithm
1339
+ switch (hash) {
1340
+ case 'keccak224': return new Keccak(1152, 448, null, 224, options)
1341
+ case 'keccak256': return new Keccak(1088, 512, null, 256, options)
1342
+ case 'keccak384': return new Keccak(832, 768, null, 384, options)
1343
+ case 'keccak512': return new Keccak(576, 1024, null, 512, options)
1344
+
1345
+ case 'sha3-224': return new Keccak(1152, 448, 0x06, 224, options)
1346
+ case 'sha3-256': return new Keccak(1088, 512, 0x06, 256, options)
1347
+ case 'sha3-384': return new Keccak(832, 768, 0x06, 384, options)
1348
+ case 'sha3-512': return new Keccak(576, 1024, 0x06, 512, options)
1349
+
1350
+ case 'shake128': return new Shake(1344, 256, 0x1f, options)
1351
+ case 'shake256': return new Shake(1088, 512, 0x1f, options)
1352
+
1353
+ default: throw new Error('Invald algorithm: ' + algorithm)
1354
+ }
1355
+ }
1356
+ }
1357
+
1358
+
1359
+ /***/ }),
1360
+
1361
+ /***/ 16:
1362
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
1363
+
1364
+ const { Transform } = __webpack_require__(473)
1365
+
1366
+ module.exports = (KeccakState) => class Keccak extends Transform {
1367
+ constructor (rate, capacity, delimitedSuffix, hashBitLength, options) {
1368
+ super(options)
1369
+
1370
+ this._rate = rate
1371
+ this._capacity = capacity
1372
+ this._delimitedSuffix = delimitedSuffix
1373
+ this._hashBitLength = hashBitLength
1374
+ this._options = options
597
1375
 
598
1376
  this._state = new KeccakState()
599
1377
  this._state.initialize(rate, capacity)
@@ -664,10 +1442,10 @@ module.exports = (KeccakState) => class Keccak extends Transform {
664
1442
 
665
1443
  /***/ }),
666
1444
 
667
- /***/ 5675:
1445
+ /***/ 675:
668
1446
  /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
669
1447
 
670
- const { Transform } = __webpack_require__(8473)
1448
+ const { Transform } = __webpack_require__(473)
671
1449
 
672
1450
  module.exports = (KeccakState) => class Shake extends Transform {
673
1451
  constructor (rate, capacity, delimitedSuffix, options) {
@@ -739,7 +1517,7 @@ module.exports = (KeccakState) => class Shake extends Transform {
739
1517
 
740
1518
  /***/ }),
741
1519
 
742
- /***/ 4040:
1520
+ /***/ 40:
743
1521
  /***/ ((__unused_webpack_module, exports) => {
744
1522
 
745
1523
  const P1600_ROUND_CONSTANTS = [1, 0, 32898, 0, 32906, 2147483648, 2147516416, 2147483648, 32907, 0, 2147483649, 0, 2147516545, 2147483648, 32777, 2147483648, 138, 0, 136, 0, 2147516425, 0, 2147483658, 0, 2147516555, 0, 139, 2147483648, 32905, 2147483648, 32771, 2147483648, 32770, 2147483648, 128, 2147483648, 32778, 0, 2147483658, 2147483648, 2147516545, 2147483648, 32896, 2147483648, 2147483649, 0, 2147516424, 2147483648]
@@ -932,10 +1710,10 @@ exports.p1600 = function (s) {
932
1710
 
933
1711
  /***/ }),
934
1712
 
935
- /***/ 9653:
1713
+ /***/ 653:
936
1714
  /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
937
1715
 
938
- const keccakState = __webpack_require__(4040)
1716
+ const keccakState = __webpack_require__(40)
939
1717
 
940
1718
  function Keccak () {
941
1719
  // much faster than `new Array(50)`
@@ -1007,7 +1785,7 @@ module.exports = Keccak
1007
1785
 
1008
1786
  /***/ }),
1009
1787
 
1010
- /***/ 4281:
1788
+ /***/ 281:
1011
1789
  /***/ ((module) => {
1012
1790
 
1013
1791
 
@@ -1141,7 +1919,7 @@ module.exports.q = codes;
1141
1919
 
1142
1920
  /***/ }),
1143
1921
 
1144
- /***/ 6753:
1922
+ /***/ 753:
1145
1923
  /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
1146
1924
 
1147
1925
  // Copyright Joyent, Inc. and other Node contributors.
@@ -1185,11 +1963,11 @@ var objectKeys = Object.keys || function (obj) {
1185
1963
 
1186
1964
  module.exports = Duplex;
1187
1965
 
1188
- var Readable = __webpack_require__(9481);
1966
+ var Readable = __webpack_require__(481);
1189
1967
 
1190
- var Writable = __webpack_require__(4229);
1968
+ var Writable = __webpack_require__(229);
1191
1969
 
1192
- __webpack_require__(5717)(Duplex, Readable);
1970
+ __webpack_require__(717)(Duplex, Readable);
1193
1971
 
1194
1972
  {
1195
1973
  // Allow the keys array to be GC'ed.
@@ -1286,7 +2064,7 @@ Object.defineProperty(Duplex.prototype, 'destroyed', {
1286
2064
 
1287
2065
  /***/ }),
1288
2066
 
1289
- /***/ 2725:
2067
+ /***/ 725:
1290
2068
  /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
1291
2069
 
1292
2070
  // Copyright Joyent, Inc. and other Node contributors.
@@ -1316,9 +2094,9 @@ Object.defineProperty(Duplex.prototype, 'destroyed', {
1316
2094
 
1317
2095
  module.exports = PassThrough;
1318
2096
 
1319
- var Transform = __webpack_require__(4605);
2097
+ var Transform = __webpack_require__(605);
1320
2098
 
1321
- __webpack_require__(5717)(PassThrough, Transform);
2099
+ __webpack_require__(717)(PassThrough, Transform);
1322
2100
 
1323
2101
  function PassThrough(options) {
1324
2102
  if (!(this instanceof PassThrough)) return new PassThrough(options);
@@ -1331,7 +2109,7 @@ PassThrough.prototype._transform = function (chunk, encoding, cb) {
1331
2109
 
1332
2110
  /***/ }),
1333
2111
 
1334
- /***/ 9481:
2112
+ /***/ 481:
1335
2113
  /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
1336
2114
 
1337
2115
  // Copyright Joyent, Inc. and other Node contributors.
@@ -1365,7 +2143,7 @@ var Duplex;
1365
2143
  Readable.ReadableState = ReadableState;
1366
2144
  /*<replacement>*/
1367
2145
 
1368
- var EE = (__webpack_require__(7187).EventEmitter);
2146
+ var EE = (__webpack_require__(370).EventEmitter);
1369
2147
 
1370
2148
  var EElistenerCount = function EElistenerCount(emitter, type) {
1371
2149
  return emitter.listeners(type).length;
@@ -1375,11 +2153,11 @@ var EElistenerCount = function EElistenerCount(emitter, type) {
1375
2153
  /*<replacement>*/
1376
2154
 
1377
2155
 
1378
- var Stream = __webpack_require__(2503);
2156
+ var Stream = __webpack_require__(503);
1379
2157
  /*</replacement>*/
1380
2158
 
1381
2159
 
1382
- var Buffer = (__webpack_require__(5291).Buffer);
2160
+ var Buffer = (__webpack_require__(291).Buffer);
1383
2161
 
1384
2162
  var OurUint8Array = __webpack_require__.g.Uint8Array || function () {};
1385
2163
 
@@ -1393,7 +2171,7 @@ function _isUint8Array(obj) {
1393
2171
  /*<replacement>*/
1394
2172
 
1395
2173
 
1396
- var debugUtil = __webpack_require__(4616);
2174
+ var debugUtil = __webpack_require__(616);
1397
2175
 
1398
2176
  var debug;
1399
2177
 
@@ -1405,14 +2183,14 @@ if (debugUtil && debugUtil.debuglog) {
1405
2183
  /*</replacement>*/
1406
2184
 
1407
2185
 
1408
- var BufferList = __webpack_require__(7327);
2186
+ var BufferList = __webpack_require__(327);
1409
2187
 
1410
- var destroyImpl = __webpack_require__(1195);
2188
+ var destroyImpl = __webpack_require__(195);
1411
2189
 
1412
- var _require = __webpack_require__(2457),
2190
+ var _require = __webpack_require__(457),
1413
2191
  getHighWaterMark = _require.getHighWaterMark;
1414
2192
 
1415
- var _require$codes = (__webpack_require__(4281)/* .codes */ .q),
2193
+ var _require$codes = (__webpack_require__(281)/* .codes */ .q),
1416
2194
  ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE,
1417
2195
  ERR_STREAM_PUSH_AFTER_EOF = _require$codes.ERR_STREAM_PUSH_AFTER_EOF,
1418
2196
  ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED,
@@ -1423,7 +2201,7 @@ var StringDecoder;
1423
2201
  var createReadableStreamAsyncIterator;
1424
2202
  var from;
1425
2203
 
1426
- __webpack_require__(5717)(Readable, Stream);
2204
+ __webpack_require__(717)(Readable, Stream);
1427
2205
 
1428
2206
  var errorOrDestroy = destroyImpl.errorOrDestroy;
1429
2207
  var kProxyEvents = ['error', 'close', 'destroy', 'pause', 'resume'];
@@ -1440,7 +2218,7 @@ function prependListener(emitter, event, fn) {
1440
2218
  }
1441
2219
 
1442
2220
  function ReadableState(options, stream, isDuplex) {
1443
- Duplex = Duplex || __webpack_require__(6753);
2221
+ Duplex = Duplex || __webpack_require__(753);
1444
2222
  options = options || {}; // Duplex streams are both readable and writable, but share
1445
2223
  // the same options object.
1446
2224
  // However, some cases require setting options to different
@@ -1496,14 +2274,14 @@ function ReadableState(options, stream, isDuplex) {
1496
2274
  this.encoding = null;
1497
2275
 
1498
2276
  if (options.encoding) {
1499
- if (!StringDecoder) StringDecoder = (__webpack_require__(2553)/* .StringDecoder */ .s);
2277
+ if (!StringDecoder) StringDecoder = (__webpack_require__(553)/* .StringDecoder */ .s);
1500
2278
  this.decoder = new StringDecoder(options.encoding);
1501
2279
  this.encoding = options.encoding;
1502
2280
  }
1503
2281
  }
1504
2282
 
1505
2283
  function Readable(options) {
1506
- Duplex = Duplex || __webpack_require__(6753);
2284
+ Duplex = Duplex || __webpack_require__(753);
1507
2285
  if (!(this instanceof Readable)) return new Readable(options); // Checking for a Stream.Duplex instance is faster here instead of inside
1508
2286
  // the ReadableState constructor, at least with V8 6.5
1509
2287
 
@@ -1658,7 +2436,7 @@ Readable.prototype.isPaused = function () {
1658
2436
 
1659
2437
 
1660
2438
  Readable.prototype.setEncoding = function (enc) {
1661
- if (!StringDecoder) StringDecoder = (__webpack_require__(2553)/* .StringDecoder */ .s);
2439
+ if (!StringDecoder) StringDecoder = (__webpack_require__(553)/* .StringDecoder */ .s);
1662
2440
  var decoder = new StringDecoder(enc);
1663
2441
  this._readableState.decoder = decoder; // If setEncoding(null), decoder.encoding equals utf8
1664
2442
 
@@ -2342,7 +3120,7 @@ Readable.prototype.wrap = function (stream) {
2342
3120
  if (typeof Symbol === 'function') {
2343
3121
  Readable.prototype[Symbol.asyncIterator] = function () {
2344
3122
  if (createReadableStreamAsyncIterator === undefined) {
2345
- createReadableStreamAsyncIterator = __webpack_require__(5850);
3123
+ createReadableStreamAsyncIterator = __webpack_require__(850);
2346
3124
  }
2347
3125
 
2348
3126
  return createReadableStreamAsyncIterator(this);
@@ -2444,7 +3222,7 @@ function endReadableNT(state, stream) {
2444
3222
  if (typeof Symbol === 'function') {
2445
3223
  Readable.from = function (iterable, opts) {
2446
3224
  if (from === undefined) {
2447
- from = __webpack_require__(5167);
3225
+ from = __webpack_require__(167);
2448
3226
  }
2449
3227
 
2450
3228
  return from(Readable, iterable, opts);
@@ -2461,7 +3239,7 @@ function indexOf(xs, x) {
2461
3239
 
2462
3240
  /***/ }),
2463
3241
 
2464
- /***/ 4605:
3242
+ /***/ 605:
2465
3243
  /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
2466
3244
 
2467
3245
  // Copyright Joyent, Inc. and other Node contributors.
@@ -2529,15 +3307,15 @@ function indexOf(xs, x) {
2529
3307
 
2530
3308
  module.exports = Transform;
2531
3309
 
2532
- var _require$codes = (__webpack_require__(4281)/* .codes */ .q),
3310
+ var _require$codes = (__webpack_require__(281)/* .codes */ .q),
2533
3311
  ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED,
2534
3312
  ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK,
2535
3313
  ERR_TRANSFORM_ALREADY_TRANSFORMING = _require$codes.ERR_TRANSFORM_ALREADY_TRANSFORMING,
2536
3314
  ERR_TRANSFORM_WITH_LENGTH_0 = _require$codes.ERR_TRANSFORM_WITH_LENGTH_0;
2537
3315
 
2538
- var Duplex = __webpack_require__(6753);
3316
+ var Duplex = __webpack_require__(753);
2539
3317
 
2540
- __webpack_require__(5717)(Transform, Duplex);
3318
+ __webpack_require__(717)(Transform, Duplex);
2541
3319
 
2542
3320
  function afterTransform(er, data) {
2543
3321
  var ts = this._transformState;
@@ -2668,7 +3446,7 @@ function done(stream, er, data) {
2668
3446
 
2669
3447
  /***/ }),
2670
3448
 
2671
- /***/ 4229:
3449
+ /***/ 229:
2672
3450
  /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
2673
3451
 
2674
3452
  // Copyright Joyent, Inc. and other Node contributors.
@@ -2730,17 +3508,17 @@ Writable.WritableState = WritableState;
2730
3508
  /*<replacement>*/
2731
3509
 
2732
3510
  var internalUtil = {
2733
- deprecate: __webpack_require__(4927)
3511
+ deprecate: __webpack_require__(927)
2734
3512
  };
2735
3513
  /*</replacement>*/
2736
3514
 
2737
3515
  /*<replacement>*/
2738
3516
 
2739
- var Stream = __webpack_require__(2503);
3517
+ var Stream = __webpack_require__(503);
2740
3518
  /*</replacement>*/
2741
3519
 
2742
3520
 
2743
- var Buffer = (__webpack_require__(5291).Buffer);
3521
+ var Buffer = (__webpack_require__(291).Buffer);
2744
3522
 
2745
3523
  var OurUint8Array = __webpack_require__.g.Uint8Array || function () {};
2746
3524
 
@@ -2752,12 +3530,12 @@ function _isUint8Array(obj) {
2752
3530
  return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;
2753
3531
  }
2754
3532
 
2755
- var destroyImpl = __webpack_require__(1195);
3533
+ var destroyImpl = __webpack_require__(195);
2756
3534
 
2757
- var _require = __webpack_require__(2457),
3535
+ var _require = __webpack_require__(457),
2758
3536
  getHighWaterMark = _require.getHighWaterMark;
2759
3537
 
2760
- var _require$codes = (__webpack_require__(4281)/* .codes */ .q),
3538
+ var _require$codes = (__webpack_require__(281)/* .codes */ .q),
2761
3539
  ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE,
2762
3540
  ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED,
2763
3541
  ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK,
@@ -2769,12 +3547,12 @@ var _require$codes = (__webpack_require__(4281)/* .codes */ .q),
2769
3547
 
2770
3548
  var errorOrDestroy = destroyImpl.errorOrDestroy;
2771
3549
 
2772
- __webpack_require__(5717)(Writable, Stream);
3550
+ __webpack_require__(717)(Writable, Stream);
2773
3551
 
2774
3552
  function nop() {}
2775
3553
 
2776
3554
  function WritableState(options, stream, isDuplex) {
2777
- Duplex = Duplex || __webpack_require__(6753);
3555
+ Duplex = Duplex || __webpack_require__(753);
2778
3556
  options = options || {}; // Duplex streams are both readable and writable, but share
2779
3557
  // the same options object.
2780
3558
  // However, some cases require setting options to different
@@ -2900,7 +3678,7 @@ if (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.protot
2900
3678
  }
2901
3679
 
2902
3680
  function Writable(options) {
2903
- Duplex = Duplex || __webpack_require__(6753); // Writable ctor is applied to Duplexes, too.
3681
+ Duplex = Duplex || __webpack_require__(753); // Writable ctor is applied to Duplexes, too.
2904
3682
  // `realHasInstance` is necessary because using plain `instanceof`
2905
3683
  // would return false, as no `_writableState` property is attached.
2906
3684
  // Trying to use the custom `instanceof` for Writable here will also break the
@@ -3371,7 +4149,7 @@ Writable.prototype._destroy = function (err, cb) {
3371
4149
 
3372
4150
  /***/ }),
3373
4151
 
3374
- /***/ 5850:
4152
+ /***/ 850:
3375
4153
  /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
3376
4154
 
3377
4155
 
@@ -3380,7 +4158,7 @@ var _Object$setPrototypeO;
3380
4158
 
3381
4159
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
3382
4160
 
3383
- var finished = __webpack_require__(8610);
4161
+ var finished = __webpack_require__(610);
3384
4162
 
3385
4163
  var kLastResolve = Symbol('lastResolve');
3386
4164
  var kLastReject = Symbol('lastReject');
@@ -3584,7 +4362,7 @@ module.exports = createReadableStreamAsyncIterator;
3584
4362
 
3585
4363
  /***/ }),
3586
4364
 
3587
- /***/ 7327:
4365
+ /***/ 327:
3588
4366
  /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
3589
4367
 
3590
4368
 
@@ -3601,10 +4379,10 @@ function _defineProperties(target, props) { for (var i = 0; i < props.length; i+
3601
4379
 
3602
4380
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
3603
4381
 
3604
- var _require = __webpack_require__(5291),
4382
+ var _require = __webpack_require__(291),
3605
4383
  Buffer = _require.Buffer;
3606
4384
 
3607
- var _require2 = __webpack_require__(2361),
4385
+ var _require2 = __webpack_require__(361),
3608
4386
  inspect = _require2.inspect;
3609
4387
 
3610
4388
  var custom = inspect && inspect.custom || 'inspect';
@@ -3800,7 +4578,7 @@ function () {
3800
4578
 
3801
4579
  /***/ }),
3802
4580
 
3803
- /***/ 1195:
4581
+ /***/ 195:
3804
4582
  /***/ ((module) => {
3805
4583
 
3806
4584
  // undocumented cb() API, needed for core, not for public API
@@ -3911,14 +4689,14 @@ module.exports = {
3911
4689
 
3912
4690
  /***/ }),
3913
4691
 
3914
- /***/ 8610:
4692
+ /***/ 610:
3915
4693
  /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
3916
4694
 
3917
4695
  // Ported from https://github.com/mafintosh/end-of-stream with
3918
4696
  // permission from the author, Mathias Buus (@mafintosh).
3919
4697
 
3920
4698
 
3921
- var ERR_STREAM_PREMATURE_CLOSE = (__webpack_require__(4281)/* .codes.ERR_STREAM_PREMATURE_CLOSE */ .q.ERR_STREAM_PREMATURE_CLOSE);
4699
+ var ERR_STREAM_PREMATURE_CLOSE = (__webpack_require__(281)/* .codes.ERR_STREAM_PREMATURE_CLOSE */ .q.ERR_STREAM_PREMATURE_CLOSE);
3922
4700
 
3923
4701
  function once(callback) {
3924
4702
  var called = false;
@@ -4021,7 +4799,7 @@ module.exports = eos;
4021
4799
 
4022
4800
  /***/ }),
4023
4801
 
4024
- /***/ 5167:
4802
+ /***/ 167:
4025
4803
  /***/ ((module) => {
4026
4804
 
4027
4805
  module.exports = function () {
@@ -4031,7 +4809,7 @@ module.exports = function () {
4031
4809
 
4032
4810
  /***/ }),
4033
4811
 
4034
- /***/ 9946:
4812
+ /***/ 946:
4035
4813
  /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
4036
4814
 
4037
4815
  // Ported from https://github.com/mafintosh/pump with
@@ -4049,7 +4827,7 @@ function once(callback) {
4049
4827
  };
4050
4828
  }
4051
4829
 
4052
- var _require$codes = (__webpack_require__(4281)/* .codes */ .q),
4830
+ var _require$codes = (__webpack_require__(281)/* .codes */ .q),
4053
4831
  ERR_MISSING_ARGS = _require$codes.ERR_MISSING_ARGS,
4054
4832
  ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED;
4055
4833
 
@@ -4068,7 +4846,7 @@ function destroyer(stream, reading, writing, callback) {
4068
4846
  stream.on('close', function () {
4069
4847
  closed = true;
4070
4848
  });
4071
- if (eos === undefined) eos = __webpack_require__(8610);
4849
+ if (eos === undefined) eos = __webpack_require__(610);
4072
4850
  eos(stream, {
4073
4851
  readable: reading,
4074
4852
  writable: writing
@@ -4134,12 +4912,12 @@ module.exports = pipeline;
4134
4912
 
4135
4913
  /***/ }),
4136
4914
 
4137
- /***/ 2457:
4915
+ /***/ 457:
4138
4916
  /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
4139
4917
 
4140
4918
 
4141
4919
 
4142
- var ERR_INVALID_OPT_VALUE = (__webpack_require__(4281)/* .codes.ERR_INVALID_OPT_VALUE */ .q.ERR_INVALID_OPT_VALUE);
4920
+ var ERR_INVALID_OPT_VALUE = (__webpack_require__(281)/* .codes.ERR_INVALID_OPT_VALUE */ .q.ERR_INVALID_OPT_VALUE);
4143
4921
 
4144
4922
  function highWaterMarkFrom(options, isDuplex, duplexKey) {
4145
4923
  return options.highWaterMark != null ? options.highWaterMark : isDuplex ? options[duplexKey] : null;
@@ -4167,36 +4945,36 @@ module.exports = {
4167
4945
 
4168
4946
  /***/ }),
4169
4947
 
4170
- /***/ 2503:
4948
+ /***/ 503:
4171
4949
  /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
4172
4950
 
4173
- module.exports = __webpack_require__(7187).EventEmitter;
4951
+ module.exports = __webpack_require__(370).EventEmitter;
4174
4952
 
4175
4953
 
4176
4954
  /***/ }),
4177
4955
 
4178
- /***/ 8473:
4956
+ /***/ 473:
4179
4957
  /***/ ((module, exports, __webpack_require__) => {
4180
4958
 
4181
- exports = module.exports = __webpack_require__(9481);
4959
+ exports = module.exports = __webpack_require__(481);
4182
4960
  exports.Stream = exports;
4183
4961
  exports.Readable = exports;
4184
- exports.Writable = __webpack_require__(4229);
4185
- exports.Duplex = __webpack_require__(6753);
4186
- exports.Transform = __webpack_require__(4605);
4187
- exports.PassThrough = __webpack_require__(2725);
4188
- exports.finished = __webpack_require__(8610);
4189
- exports.pipeline = __webpack_require__(9946);
4962
+ exports.Writable = __webpack_require__(229);
4963
+ exports.Duplex = __webpack_require__(753);
4964
+ exports.Transform = __webpack_require__(605);
4965
+ exports.PassThrough = __webpack_require__(725);
4966
+ exports.finished = __webpack_require__(610);
4967
+ exports.pipeline = __webpack_require__(946);
4190
4968
 
4191
4969
 
4192
4970
  /***/ }),
4193
4971
 
4194
- /***/ 9509:
4972
+ /***/ 509:
4195
4973
  /***/ ((module, exports, __webpack_require__) => {
4196
4974
 
4197
4975
  /*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
4198
4976
  /* eslint-disable node/no-deprecated-api */
4199
- var buffer = __webpack_require__(5291)
4977
+ var buffer = __webpack_require__(291)
4200
4978
  var Buffer = buffer.Buffer
4201
4979
 
4202
4980
  // alternative to using Object.keys for old browsers
@@ -4263,7 +5041,7 @@ SafeBuffer.allocUnsafeSlow = function (size) {
4263
5041
 
4264
5042
  /***/ }),
4265
5043
 
4266
- /***/ 2553:
5044
+ /***/ 553:
4267
5045
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
4268
5046
 
4269
5047
  // Copyright Joyent, Inc. and other Node contributors.
@@ -4291,7 +5069,7 @@ SafeBuffer.allocUnsafeSlow = function (size) {
4291
5069
 
4292
5070
  /*<replacement>*/
4293
5071
 
4294
- var Buffer = (__webpack_require__(9509).Buffer);
5072
+ var Buffer = (__webpack_require__(509).Buffer);
4295
5073
  /*</replacement>*/
4296
5074
 
4297
5075
  var isEncoding = Buffer.isEncoding || function (encoding) {
@@ -4565,7 +5343,7 @@ function simpleEnd(buf) {
4565
5343
 
4566
5344
  /***/ }),
4567
5345
 
4568
- /***/ 4927:
5346
+ /***/ 927:
4569
5347
  /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
4570
5348
 
4571
5349
 
@@ -4639,7 +5417,7 @@ function config (name) {
4639
5417
 
4640
5418
  /***/ }),
4641
5419
 
4642
- /***/ 6988:
5420
+ /***/ 988:
4643
5421
  /***/ ((module) => {
4644
5422
 
4645
5423
  module.exports = read
@@ -4675,7 +5453,7 @@ function read(buf, offset) {
4675
5453
 
4676
5454
  /***/ }),
4677
5455
 
4678
- /***/ 1312:
5456
+ /***/ 312:
4679
5457
  /***/ ((module) => {
4680
5458
 
4681
5459
  module.exports = encode
@@ -4712,12 +5490,12 @@ function encode(num, out, offset) {
4712
5490
 
4713
5491
  /***/ }),
4714
5492
 
4715
- /***/ 4676:
5493
+ /***/ 676:
4716
5494
  /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
4717
5495
 
4718
5496
  module.exports = {
4719
- encode: __webpack_require__(1312)
4720
- , decode: __webpack_require__(6988)
5497
+ encode: __webpack_require__(312)
5498
+ , decode: __webpack_require__(988)
4721
5499
  , encodingLength: __webpack_require__(82)
4722
5500
  }
4723
5501
 
@@ -4756,7 +5534,7 @@ module.exports = function (value) {
4756
5534
 
4757
5535
  /***/ }),
4758
5536
 
4759
- /***/ 5277:
5537
+ /***/ 277:
4760
5538
  /***/ ((__unused_webpack_module, exports) => {
4761
5539
 
4762
5540
 
@@ -4886,9 +5664,7 @@ function fromByteArray (uint8) {
4886
5664
 
4887
5665
  // go through the array every three bytes, we'll deal with trailing stuff later
4888
5666
  for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
4889
- parts.push(encodeChunk(
4890
- uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)
4891
- ))
5667
+ parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)))
4892
5668
  }
4893
5669
 
4894
5670
  // pad the end with zeros, but make sure to not forget the extra bytes
@@ -4915,7 +5691,7 @@ function fromByteArray (uint8) {
4915
5691
 
4916
5692
  /***/ }),
4917
5693
 
4918
- /***/ 5291:
5694
+ /***/ 291:
4919
5695
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
4920
5696
 
4921
5697
  /*!
@@ -4928,11 +5704,11 @@ function fromByteArray (uint8) {
4928
5704
 
4929
5705
 
4930
5706
 
4931
- var base64 = __webpack_require__(5277)
4932
- var ieee754 = __webpack_require__(2608)
5707
+ var base64 = __webpack_require__(277)
5708
+ var ieee754 = __webpack_require__(608)
4933
5709
  var customInspectSymbol =
4934
- (typeof Symbol === 'function' && typeof Symbol.for === 'function')
4935
- ? Symbol.for('nodejs.util.inspect.custom')
5710
+ (typeof Symbol === 'function' && typeof Symbol['for'] === 'function') // eslint-disable-line dot-notation
5711
+ ? Symbol['for']('nodejs.util.inspect.custom') // eslint-disable-line dot-notation
4936
5712
  : null
4937
5713
 
4938
5714
  exports.Buffer = Buffer
@@ -5036,7 +5812,7 @@ function from (value, encodingOrOffset, length) {
5036
5812
  }
5037
5813
 
5038
5814
  if (ArrayBuffer.isView(value)) {
5039
- return fromArrayLike(value)
5815
+ return fromArrayView(value)
5040
5816
  }
5041
5817
 
5042
5818
  if (value == null) {
@@ -5117,7 +5893,7 @@ function alloc (size, fill, encoding) {
5117
5893
  if (fill !== undefined) {
5118
5894
  // Only pay attention to encoding if it's a string. This
5119
5895
  // prevents accidentally sending in a number that would
5120
- // be interpretted as a start offset.
5896
+ // be interpreted as a start offset.
5121
5897
  return typeof encoding === 'string'
5122
5898
  ? createBuffer(size).fill(fill, encoding)
5123
5899
  : createBuffer(size).fill(fill)
@@ -5184,6 +5960,14 @@ function fromArrayLike (array) {
5184
5960
  return buf
5185
5961
  }
5186
5962
 
5963
+ function fromArrayView (arrayView) {
5964
+ if (isInstance(arrayView, Uint8Array)) {
5965
+ var copy = new Uint8Array(arrayView)
5966
+ return fromArrayBuffer(copy.buffer, copy.byteOffset, copy.byteLength)
5967
+ }
5968
+ return fromArrayLike(arrayView)
5969
+ }
5970
+
5187
5971
  function fromArrayBuffer (array, byteOffset, length) {
5188
5972
  if (byteOffset < 0 || array.byteLength < byteOffset) {
5189
5973
  throw new RangeError('"offset" is outside of buffer bounds')
@@ -5323,12 +6107,20 @@ Buffer.concat = function concat (list, length) {
5323
6107
  for (i = 0; i < list.length; ++i) {
5324
6108
  var buf = list[i]
5325
6109
  if (isInstance(buf, Uint8Array)) {
5326
- buf = Buffer.from(buf)
5327
- }
5328
- if (!Buffer.isBuffer(buf)) {
6110
+ if (pos + buf.length > buffer.length) {
6111
+ Buffer.from(buf).copy(buffer, pos)
6112
+ } else {
6113
+ Uint8Array.prototype.set.call(
6114
+ buffer,
6115
+ buf,
6116
+ pos
6117
+ )
6118
+ }
6119
+ } else if (!Buffer.isBuffer(buf)) {
5329
6120
  throw new TypeError('"list" argument must be an Array of Buffers')
6121
+ } else {
6122
+ buf.copy(buffer, pos)
5330
6123
  }
5331
- buf.copy(buffer, pos)
5332
6124
  pos += buf.length
5333
6125
  }
5334
6126
  return buffer
@@ -5410,7 +6202,7 @@ function slowToString (encoding, start, end) {
5410
6202
  return ''
5411
6203
  }
5412
6204
 
5413
- // Force coersion to uint32. This will also coerce falsey/NaN values to 0.
6205
+ // Force coercion to uint32. This will also coerce falsey/NaN values to 0.
5414
6206
  end >>>= 0
5415
6207
  start >>>= 0
5416
6208
 
@@ -5761,10 +6553,6 @@ function asciiWrite (buf, string, offset, length) {
5761
6553
  return blitBuffer(asciiToBytes(string), buf, offset, length)
5762
6554
  }
5763
6555
 
5764
- function latin1Write (buf, string, offset, length) {
5765
- return asciiWrite(buf, string, offset, length)
5766
- }
5767
-
5768
6556
  function base64Write (buf, string, offset, length) {
5769
6557
  return blitBuffer(base64ToBytes(string), buf, offset, length)
5770
6558
  }
@@ -5820,11 +6608,9 @@ Buffer.prototype.write = function write (string, offset, length, encoding) {
5820
6608
  return utf8Write(this, string, offset, length)
5821
6609
 
5822
6610
  case 'ascii':
5823
- return asciiWrite(this, string, offset, length)
5824
-
5825
6611
  case 'latin1':
5826
6612
  case 'binary':
5827
- return latin1Write(this, string, offset, length)
6613
+ return asciiWrite(this, string, offset, length)
5828
6614
 
5829
6615
  case 'base64':
5830
6616
  // Warning: maxLength not taken into account in base64Write
@@ -5867,10 +6653,13 @@ function utf8Slice (buf, start, end) {
5867
6653
  while (i < end) {
5868
6654
  var firstByte = buf[i]
5869
6655
  var codePoint = null
5870
- var bytesPerSequence = (firstByte > 0xEF) ? 4
5871
- : (firstByte > 0xDF) ? 3
5872
- : (firstByte > 0xBF) ? 2
5873
- : 1
6656
+ var bytesPerSequence = (firstByte > 0xEF)
6657
+ ? 4
6658
+ : (firstByte > 0xDF)
6659
+ ? 3
6660
+ : (firstByte > 0xBF)
6661
+ ? 2
6662
+ : 1
5874
6663
 
5875
6664
  if (i + bytesPerSequence <= end) {
5876
6665
  var secondByte, thirdByte, fourthByte, tempCodePoint
@@ -5991,7 +6780,8 @@ function hexSlice (buf, start, end) {
5991
6780
  function utf16leSlice (buf, start, end) {
5992
6781
  var bytes = buf.slice(start, end)
5993
6782
  var res = ''
5994
- for (var i = 0; i < bytes.length; i += 2) {
6783
+ // If bytes.length is odd, the last 8 bits must be ignored (same as node.js)
6784
+ for (var i = 0; i < bytes.length - 1; i += 2) {
5995
6785
  res += String.fromCharCode(bytes[i] + (bytes[i + 1] * 256))
5996
6786
  }
5997
6787
  return res
@@ -6033,6 +6823,7 @@ function checkOffset (offset, ext, length) {
6033
6823
  if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
6034
6824
  }
6035
6825
 
6826
+ Buffer.prototype.readUintLE =
6036
6827
  Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
6037
6828
  offset = offset >>> 0
6038
6829
  byteLength = byteLength >>> 0
@@ -6048,6 +6839,7 @@ Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert)
6048
6839
  return val
6049
6840
  }
6050
6841
 
6842
+ Buffer.prototype.readUintBE =
6051
6843
  Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
6052
6844
  offset = offset >>> 0
6053
6845
  byteLength = byteLength >>> 0
@@ -6064,24 +6856,28 @@ Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert)
6064
6856
  return val
6065
6857
  }
6066
6858
 
6859
+ Buffer.prototype.readUint8 =
6067
6860
  Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
6068
6861
  offset = offset >>> 0
6069
6862
  if (!noAssert) checkOffset(offset, 1, this.length)
6070
6863
  return this[offset]
6071
6864
  }
6072
6865
 
6866
+ Buffer.prototype.readUint16LE =
6073
6867
  Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
6074
6868
  offset = offset >>> 0
6075
6869
  if (!noAssert) checkOffset(offset, 2, this.length)
6076
6870
  return this[offset] | (this[offset + 1] << 8)
6077
6871
  }
6078
6872
 
6873
+ Buffer.prototype.readUint16BE =
6079
6874
  Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
6080
6875
  offset = offset >>> 0
6081
6876
  if (!noAssert) checkOffset(offset, 2, this.length)
6082
6877
  return (this[offset] << 8) | this[offset + 1]
6083
6878
  }
6084
6879
 
6880
+ Buffer.prototype.readUint32LE =
6085
6881
  Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
6086
6882
  offset = offset >>> 0
6087
6883
  if (!noAssert) checkOffset(offset, 4, this.length)
@@ -6092,6 +6888,7 @@ Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
6092
6888
  (this[offset + 3] * 0x1000000)
6093
6889
  }
6094
6890
 
6891
+ Buffer.prototype.readUint32BE =
6095
6892
  Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
6096
6893
  offset = offset >>> 0
6097
6894
  if (!noAssert) checkOffset(offset, 4, this.length)
@@ -6209,6 +7006,7 @@ function checkInt (buf, value, offset, ext, max, min) {
6209
7006
  if (offset + ext > buf.length) throw new RangeError('Index out of range')
6210
7007
  }
6211
7008
 
7009
+ Buffer.prototype.writeUintLE =
6212
7010
  Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
6213
7011
  value = +value
6214
7012
  offset = offset >>> 0
@@ -6228,6 +7026,7 @@ Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength,
6228
7026
  return offset + byteLength
6229
7027
  }
6230
7028
 
7029
+ Buffer.prototype.writeUintBE =
6231
7030
  Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
6232
7031
  value = +value
6233
7032
  offset = offset >>> 0
@@ -6247,6 +7046,7 @@ Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength,
6247
7046
  return offset + byteLength
6248
7047
  }
6249
7048
 
7049
+ Buffer.prototype.writeUint8 =
6250
7050
  Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
6251
7051
  value = +value
6252
7052
  offset = offset >>> 0
@@ -6255,6 +7055,7 @@ Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
6255
7055
  return offset + 1
6256
7056
  }
6257
7057
 
7058
+ Buffer.prototype.writeUint16LE =
6258
7059
  Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
6259
7060
  value = +value
6260
7061
  offset = offset >>> 0
@@ -6264,6 +7065,7 @@ Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert
6264
7065
  return offset + 2
6265
7066
  }
6266
7067
 
7068
+ Buffer.prototype.writeUint16BE =
6267
7069
  Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
6268
7070
  value = +value
6269
7071
  offset = offset >>> 0
@@ -6273,6 +7075,7 @@ Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert
6273
7075
  return offset + 2
6274
7076
  }
6275
7077
 
7078
+ Buffer.prototype.writeUint32LE =
6276
7079
  Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
6277
7080
  value = +value
6278
7081
  offset = offset >>> 0
@@ -6284,6 +7087,7 @@ Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert
6284
7087
  return offset + 4
6285
7088
  }
6286
7089
 
7090
+ Buffer.prototype.writeUint32BE =
6287
7091
  Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
6288
7092
  value = +value
6289
7093
  offset = offset >>> 0
@@ -6463,11 +7267,6 @@ Buffer.prototype.copy = function copy (target, targetStart, start, end) {
6463
7267
  if (this === target && typeof Uint8Array.prototype.copyWithin === 'function') {
6464
7268
  // Use built-in when available, missing from IE11
6465
7269
  this.copyWithin(targetStart, start, end)
6466
- } else if (this === target && start < targetStart && targetStart < end) {
6467
- // descending copy from end
6468
- for (var i = len - 1; i >= 0; --i) {
6469
- target[i + targetStart] = this[i + start]
6470
- }
6471
7270
  } else {
6472
7271
  Uint8Array.prototype.set.call(
6473
7272
  target,
@@ -6716,9 +7515,10 @@ var hexSliceLookupTable = (function () {
6716
7515
 
6717
7516
  /***/ }),
6718
7517
 
6719
- /***/ 2608:
7518
+ /***/ 608:
6720
7519
  /***/ ((__unused_webpack_module, exports) => {
6721
7520
 
7521
+ /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
6722
7522
  exports.read = function (buffer, offset, isLE, mLen, nBytes) {
6723
7523
  var e, m
6724
7524
  var eLen = (nBytes * 8) - mLen - 1
@@ -6807,14 +7607,14 @@ exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
6807
7607
 
6808
7608
  /***/ }),
6809
7609
 
6810
- /***/ 2361:
7610
+ /***/ 361:
6811
7611
  /***/ (() => {
6812
7612
 
6813
7613
  /* (ignored) */
6814
7614
 
6815
7615
  /***/ }),
6816
7616
 
6817
- /***/ 4616:
7617
+ /***/ 616:
6818
7618
  /***/ (() => {
6819
7619
 
6820
7620
  /* (ignored) */
@@ -6847,53 +7647,8 @@ exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
6847
7647
  /******/ return module.exports;
6848
7648
  /******/ }
6849
7649
  /******/
6850
- /******/ // expose the modules object (__webpack_modules__)
6851
- /******/ __webpack_require__.m = __webpack_modules__;
6852
- /******/
6853
7650
  /************************************************************************/
6854
- /******/ /* webpack/runtime/compat get default export */
6855
- /******/ (() => {
6856
- /******/ // getDefaultExport function for compatibility with non-harmony modules
6857
- /******/ __webpack_require__.n = (module) => {
6858
- /******/ var getter = module && module.__esModule ?
6859
- /******/ () => (module['default']) :
6860
- /******/ () => (module);
6861
- /******/ __webpack_require__.d(getter, { a: getter });
6862
- /******/ return getter;
6863
- /******/ };
6864
- /******/ })();
6865
- /******/
6866
- /******/ /* webpack/runtime/create fake namespace object */
6867
- /******/ (() => {
6868
- /******/ var getProto = Object.getPrototypeOf ? (obj) => (Object.getPrototypeOf(obj)) : (obj) => (obj.__proto__);
6869
- /******/ var leafPrototypes;
6870
- /******/ // create a fake namespace object
6871
- /******/ // mode & 1: value is a module id, require it
6872
- /******/ // mode & 2: merge all properties of value into the ns
6873
- /******/ // mode & 4: return value when already ns object
6874
- /******/ // mode & 16: return value when it's Promise-like
6875
- /******/ // mode & 8|1: behave like require
6876
- /******/ __webpack_require__.t = function(value, mode) {
6877
- /******/ if(mode & 1) value = this(value);
6878
- /******/ if(mode & 8) return value;
6879
- /******/ if(typeof value === 'object' && value) {
6880
- /******/ if((mode & 4) && value.__esModule) return value;
6881
- /******/ if((mode & 16) && typeof value.then === 'function') return value;
6882
- /******/ }
6883
- /******/ var ns = Object.create(null);
6884
- /******/ __webpack_require__.r(ns);
6885
- /******/ var def = {};
6886
- /******/ leafPrototypes = leafPrototypes || [null, getProto({}), getProto([]), getProto(getProto)];
6887
- /******/ for(var current = mode & 2 && value; typeof current == 'object' && !~leafPrototypes.indexOf(current); current = getProto(current)) {
6888
- /******/ Object.getOwnPropertyNames(current).forEach((key) => (def[key] = () => (value[key])));
6889
- /******/ }
6890
- /******/ def['default'] = () => (value);
6891
- /******/ __webpack_require__.d(ns, def);
6892
- /******/ return ns;
6893
- /******/ };
6894
- /******/ })();
6895
- /******/
6896
- /******/ /* webpack/runtime/define property getters */
7651
+ /******/ /* webpack/runtime/define property getters */
6897
7652
  /******/ (() => {
6898
7653
  /******/ // define getter functions for harmony exports
6899
7654
  /******/ __webpack_require__.d = (exports, definition) => {
@@ -6905,28 +7660,6 @@ exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
6905
7660
  /******/ };
6906
7661
  /******/ })();
6907
7662
  /******/
6908
- /******/ /* webpack/runtime/ensure chunk */
6909
- /******/ (() => {
6910
- /******/ __webpack_require__.f = {};
6911
- /******/ // This file contains only the entry chunk.
6912
- /******/ // The chunk loading function for additional chunks
6913
- /******/ __webpack_require__.e = (chunkId) => {
6914
- /******/ return Promise.all(Object.keys(__webpack_require__.f).reduce((promises, key) => {
6915
- /******/ __webpack_require__.f[key](chunkId, promises);
6916
- /******/ return promises;
6917
- /******/ }, []));
6918
- /******/ };
6919
- /******/ })();
6920
- /******/
6921
- /******/ /* webpack/runtime/get javascript chunk filename */
6922
- /******/ (() => {
6923
- /******/ // This function allow to reference async chunks
6924
- /******/ __webpack_require__.u = (chunkId) => {
6925
- /******/ // return url for filenames based on template
6926
- /******/ return "" + "protons" + ".esm";
6927
- /******/ };
6928
- /******/ })();
6929
- /******/
6930
7663
  /******/ /* webpack/runtime/global */
6931
7664
  /******/ (() => {
6932
7665
  /******/ __webpack_require__.g = (function() {
@@ -6944,52 +7677,6 @@ exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
6944
7677
  /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
6945
7678
  /******/ })();
6946
7679
  /******/
6947
- /******/ /* webpack/runtime/load script */
6948
- /******/ (() => {
6949
- /******/ var inProgress = {};
6950
- /******/ var dataWebpackPrefix = "@leofcoin/messages:";
6951
- /******/ // loadScript function to load a script via script tag
6952
- /******/ __webpack_require__.l = (url, done, key, chunkId) => {
6953
- /******/ if(inProgress[url]) { inProgress[url].push(done); return; }
6954
- /******/ var script, needAttach;
6955
- /******/ if(key !== undefined) {
6956
- /******/ var scripts = document.getElementsByTagName("script");
6957
- /******/ for(var i = 0; i < scripts.length; i++) {
6958
- /******/ var s = scripts[i];
6959
- /******/ if(s.getAttribute("src") == url || s.getAttribute("data-webpack") == dataWebpackPrefix + key) { script = s; break; }
6960
- /******/ }
6961
- /******/ }
6962
- /******/ if(!script) {
6963
- /******/ needAttach = true;
6964
- /******/ script = document.createElement('script');
6965
- /******/ script.type = "module";
6966
- /******/ script.charset = 'utf-8';
6967
- /******/ script.timeout = 120;
6968
- /******/ if (__webpack_require__.nc) {
6969
- /******/ script.setAttribute("nonce", __webpack_require__.nc);
6970
- /******/ }
6971
- /******/ script.setAttribute("data-webpack", dataWebpackPrefix + key);
6972
- /******/ script.src = url;
6973
- /******/ }
6974
- /******/ inProgress[url] = [done];
6975
- /******/ var onScriptComplete = (prev, event) => {
6976
- /******/ // avoid mem leaks in IE.
6977
- /******/ script.onerror = script.onload = null;
6978
- /******/ clearTimeout(timeout);
6979
- /******/ var doneFns = inProgress[url];
6980
- /******/ delete inProgress[url];
6981
- /******/ script.parentNode && script.parentNode.removeChild(script);
6982
- /******/ doneFns && doneFns.forEach((fn) => (fn(event)));
6983
- /******/ if(prev) return prev(event);
6984
- /******/ }
6985
- /******/ ;
6986
- /******/ var timeout = setTimeout(onScriptComplete.bind(null, undefined, { type: 'timeout', target: script }), 120000);
6987
- /******/ script.onerror = onScriptComplete.bind(null, script.onerror);
6988
- /******/ script.onload = onScriptComplete.bind(null, script.onload);
6989
- /******/ needAttach && document.head.appendChild(script);
6990
- /******/ };
6991
- /******/ })();
6992
- /******/
6993
7680
  /******/ /* webpack/runtime/make namespace object */
6994
7681
  /******/ (() => {
6995
7682
  /******/ // define __esModule on exports
@@ -7001,107 +7688,6 @@ exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
7001
7688
  /******/ };
7002
7689
  /******/ })();
7003
7690
  /******/
7004
- /******/ /* webpack/runtime/publicPath */
7005
- /******/ (() => {
7006
- /******/ var scriptUrl;
7007
- /******/ if (typeof import.meta.url === "string") scriptUrl = import.meta.url
7008
- /******/ // When supporting browsers where an automatic publicPath is not supported you must specify an output.publicPath manually via configuration
7009
- /******/ // or pass an empty string ("") and set the __webpack_public_path__ variable from your code to use your own logic.
7010
- /******/ if (!scriptUrl) throw new Error("Automatic publicPath is not supported in this browser");
7011
- /******/ scriptUrl = scriptUrl.replace(/#.*$/, "").replace(/\?.*$/, "").replace(/\/[^\/]+$/, "/");
7012
- /******/ __webpack_require__.p = scriptUrl;
7013
- /******/ })();
7014
- /******/
7015
- /******/ /* webpack/runtime/jsonp chunk loading */
7016
- /******/ (() => {
7017
- /******/ // no baseURI
7018
- /******/
7019
- /******/ // object to store loaded and loading chunks
7020
- /******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched
7021
- /******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded
7022
- /******/ var installedChunks = {
7023
- /******/ 158: 0
7024
- /******/ };
7025
- /******/
7026
- /******/ __webpack_require__.f.j = (chunkId, promises) => {
7027
- /******/ // JSONP chunk loading for javascript
7028
- /******/ var installedChunkData = __webpack_require__.o(installedChunks, chunkId) ? installedChunks[chunkId] : undefined;
7029
- /******/ if(installedChunkData !== 0) { // 0 means "already installed".
7030
- /******/
7031
- /******/ // a Promise means "currently loading".
7032
- /******/ if(installedChunkData) {
7033
- /******/ promises.push(installedChunkData[2]);
7034
- /******/ } else {
7035
- /******/ if(true) { // all chunks have JS
7036
- /******/ // setup Promise in chunk cache
7037
- /******/ var promise = new Promise((resolve, reject) => (installedChunkData = installedChunks[chunkId] = [resolve, reject]));
7038
- /******/ promises.push(installedChunkData[2] = promise);
7039
- /******/
7040
- /******/ // start chunk loading
7041
- /******/ var url = __webpack_require__.p + __webpack_require__.u(chunkId);
7042
- /******/ // create error before stack unwound to get useful stacktrace later
7043
- /******/ var error = new Error();
7044
- /******/ var loadingEnded = (event) => {
7045
- /******/ if(__webpack_require__.o(installedChunks, chunkId)) {
7046
- /******/ installedChunkData = installedChunks[chunkId];
7047
- /******/ if(installedChunkData !== 0) installedChunks[chunkId] = undefined;
7048
- /******/ if(installedChunkData) {
7049
- /******/ var errorType = event && (event.type === 'load' ? 'missing' : event.type);
7050
- /******/ var realSrc = event && event.target && event.target.src;
7051
- /******/ error.message = 'Loading chunk ' + chunkId + ' failed.\n(' + errorType + ': ' + realSrc + ')';
7052
- /******/ error.name = 'ChunkLoadError';
7053
- /******/ error.type = errorType;
7054
- /******/ error.request = realSrc;
7055
- /******/ installedChunkData[1](error);
7056
- /******/ }
7057
- /******/ }
7058
- /******/ };
7059
- /******/ __webpack_require__.l(url, loadingEnded, "chunk-" + chunkId, chunkId);
7060
- /******/ } else installedChunks[chunkId] = 0;
7061
- /******/ }
7062
- /******/ }
7063
- /******/ };
7064
- /******/
7065
- /******/ // no prefetching
7066
- /******/
7067
- /******/ // no preloaded
7068
- /******/
7069
- /******/ // no HMR
7070
- /******/
7071
- /******/ // no HMR manifest
7072
- /******/
7073
- /******/ // no on chunks loaded
7074
- /******/
7075
- /******/ // install a JSONP callback for chunk loading
7076
- /******/ var webpackJsonpCallback = (parentChunkLoadingFunction, data) => {
7077
- /******/ var [chunkIds, moreModules, runtime] = data;
7078
- /******/ // add "moreModules" to the modules object,
7079
- /******/ // then flag all "chunkIds" as loaded and fire callback
7080
- /******/ var moduleId, chunkId, i = 0;
7081
- /******/ if(chunkIds.some((id) => (installedChunks[id] !== 0))) {
7082
- /******/ for(moduleId in moreModules) {
7083
- /******/ if(__webpack_require__.o(moreModules, moduleId)) {
7084
- /******/ __webpack_require__.m[moduleId] = moreModules[moduleId];
7085
- /******/ }
7086
- /******/ }
7087
- /******/ if(runtime) var result = runtime(__webpack_require__);
7088
- /******/ }
7089
- /******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data);
7090
- /******/ for(;i < chunkIds.length; i++) {
7091
- /******/ chunkId = chunkIds[i];
7092
- /******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {
7093
- /******/ installedChunks[chunkId][0]();
7094
- /******/ }
7095
- /******/ installedChunks[chunkId] = 0;
7096
- /******/ }
7097
- /******/
7098
- /******/ }
7099
- /******/
7100
- /******/ var chunkLoadingGlobal = self["webpackChunk_leofcoin_messages"] = self["webpackChunk_leofcoin_messages"] || [];
7101
- /******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));
7102
- /******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));
7103
- /******/ })();
7104
- /******/
7105
7691
  /************************************************************************/
7106
7692
  var __webpack_exports__ = {};
7107
7693
  // This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
@@ -7125,742 +7711,13 @@ message ContractMessage {
7125
7711
  }
7126
7712
  `);
7127
7713
 
7128
- ;// CONCATENATED MODULE: ./node_modules/@vandeurenglenn/base-x/src/base-x.js
7129
- // base-x encoding / decoding
7130
- // Copyright (c) 2018 base-x contributors
7131
- // Copyright (c) 2014-2018 The Bitcoin Core developers (base58.cpp)
7132
- // Distributed under the MIT software license, see the accompanying
7133
- // file LICENSE or http://www.opensource.org/licenses/mit-license.php.
7134
- const base = ALPHABET => {
7135
- if (ALPHABET.length >= 255) { throw new TypeError('Alphabet too long') }
7136
- const BASE_MAP = new Uint8Array(256)
7137
- for (let j = 0; j < BASE_MAP.length; j++) {
7138
- BASE_MAP[j] = 255
7139
- }
7140
- for (let i = 0; i < ALPHABET.length; i++) {
7141
- const x = ALPHABET.charAt(i)
7142
- const xc = x.charCodeAt(0)
7143
- if (BASE_MAP[xc] !== 255) { throw new TypeError(x + ' is ambiguous') }
7144
- BASE_MAP[xc] = i
7145
- }
7146
- const BASE = ALPHABET.length
7147
- const LEADER = ALPHABET.charAt(0)
7148
- const FACTOR = Math.log(BASE) / Math.log(256) // log(BASE) / log(256), rounded up
7149
- const iFACTOR = Math.log(256) / Math.log(BASE) // log(256) / log(BASE), rounded up
7150
-
7151
- const encode = source => {
7152
- if (source instanceof Uint8Array) {
7153
- } else if (ArrayBuffer.isView(source)) {
7154
- source = new Uint8Array(source.buffer, source.byteOffset, source.byteLength)
7155
- } else if (Array.isArray(source)) {
7156
- source = Uint8Array.from(source)
7157
- }
7158
- if (!(source instanceof Uint8Array)) { throw new TypeError('Expected Uint8Array') }
7159
- if (source.length === 0) { return '' }
7160
- // Skip & count leading zeroes.
7161
- let zeroes = 0
7162
- let length = 0
7163
- let pbegin = 0
7164
- const pend = source.length
7165
- while (pbegin !== pend && source[pbegin] === 0) {
7166
- pbegin++
7167
- zeroes++
7168
- }
7169
- // Allocate enough space in big-endian base58 representation.
7170
- const size = ((pend - pbegin) * iFACTOR + 1) >>> 0
7171
- const b58 = new Uint8Array(size)
7172
- // Process the bytes.
7173
- while (pbegin !== pend) {
7174
- let carry = source[pbegin]
7175
- // Apply "b58 = b58 * 256 + ch".
7176
- let i = 0
7177
- for (let it1 = size - 1; (carry !== 0 || i < length) && (it1 !== -1); it1--, i++) {
7178
- carry += (256 * b58[it1]) >>> 0
7179
- b58[it1] = (carry % BASE) >>> 0
7180
- carry = (carry / BASE) >>> 0
7181
- }
7182
- if (carry !== 0) { throw new Error('Non-zero carry') }
7183
- length = i
7184
- pbegin++
7185
- }
7186
- // Skip leading zeroes in base58 result.
7187
- let it2 = size - length
7188
- while (it2 !== size && b58[it2] === 0) {
7189
- it2++
7190
- }
7191
- // Translate the result into a string.
7192
- let str = LEADER.repeat(zeroes)
7193
- for (; it2 < size; ++it2) { str += ALPHABET.charAt(b58[it2]) }
7194
- return str
7195
- }
7196
- const decodeUnsafe = source => {
7197
- if (typeof source !== 'string') { throw new TypeError('Expected String') }
7198
- if (source.length === 0) { return new Uint8Array() }
7199
- let psz = 0
7200
- // Skip and count leading '1's.
7201
- let zeroes = 0
7202
- let length = 0
7203
- while (source[psz] === LEADER) {
7204
- zeroes++
7205
- psz++
7206
- }
7207
- // Allocate enough space in big-endian base256 representation.
7208
- const size = (((source.length - psz) * FACTOR) + 1) >>> 0 // log(58) / log(256), rounded up.
7209
- let b256 = new Uint8Array(size)
7210
- // Process the characters.
7211
- while (source[psz]) {
7212
- // Decode character
7213
- let carry = BASE_MAP[source.charCodeAt(psz)]
7214
- // Invalid character
7215
- if (carry === 255) { return }
7216
- let i = 0
7217
- for (let it3 = size - 1; (carry !== 0 || i < length) && (it3 !== -1); it3--, i++) {
7218
- carry += (BASE * b256[it3]) >>> 0
7219
- b256[it3] = (carry % 256) >>> 0
7220
- carry = (carry / 256) >>> 0
7221
- }
7222
- if (carry !== 0) { throw new Error('Non-zero carry') }
7223
- length = i
7224
- psz++
7225
- }
7226
- // Skip leading zeroes in b256.
7227
- let it4 = size - length
7228
- while (it4 !== size && b256[it4] === 0) {
7229
- it4++
7230
- }
7231
- let vch = new Uint8Array(zeroes + (size - it4))
7232
- let j = zeroes
7233
- while (it4 !== size) {
7234
- vch[j++] = b256[it4++]
7235
- }
7236
- return vch
7237
- }
7238
- const decode = string => {
7239
- const buffer = decodeUnsafe(string)
7240
- if (buffer) { return buffer }
7241
- throw new Error('Non-base' + BASE + ' character')
7242
- }
7243
- return {
7244
- encode: encode,
7245
- decodeUnsafe: decodeUnsafe,
7246
- decode: decode
7247
- }
7248
- }
7249
-
7250
- /* harmony default export */ const base_x = (base);
7251
-
7252
- ;// CONCATENATED MODULE: ./node_modules/@vandeurenglenn/base32/src/base32.js
7253
-
7254
-
7255
- const base32_base32 = 'abcdefghijklmnopqrstuvwxyz234567'
7256
- const base32Hex = '0123456789abcdefghijklmnopqrstuv'
7257
-
7258
- const decode = (uint8Array, hex = false) => {
7259
- const decoder = hex ? base_x(base32Hex) : base_x(base32_base32)
7260
- return decoder.decode(uint8Array)
7261
- }
7262
-
7263
- /* harmony default export */ const src_base32 = ({
7264
- encode: (uint8Array, hex = false) => {
7265
- const encoder = hex ? base_x(base32Hex) : base_x(base32_base32)
7266
- return encoder.encode(uint8Array)
7267
- },
7268
- decode,
7269
- isBase32: (uint8Array, hex = false) => {
7270
- try {
7271
- decode(uint8Array, hex)
7272
- return true;
7273
- } catch (e) {
7274
- return false;
7275
- }
7276
- }
7277
- });
7278
-
7279
- ;// CONCATENATED MODULE: ./node_modules/@vandeurenglenn/base58/src/base58.js
7280
-
7281
-
7282
- const base58_base58 = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'
7283
-
7284
- const base58_decode = uint8Array => base_x(base58_base58).decode(uint8Array)
7285
-
7286
- /* harmony default export */ const src_base58 = ({
7287
- encode: uint8Array => base_x(base58_base58).encode(uint8Array),
7288
- decode: base58_decode,
7289
- isBase58: uint8Array => {
7290
- try {
7291
- base58_decode(uint8Array)
7292
- return true
7293
- } catch (e) {
7294
- return false
7295
- }
7296
- }
7297
- });
7298
-
7299
- ;// CONCATENATED MODULE: ./node_modules/@vandeurenglenn/is-hex/is-hex.js
7300
- /* harmony default export */ const is_hex = (string => /^[A-F0-9]+$/i.test(string));
7301
-
7302
- ;// CONCATENATED MODULE: ./node_modules/@leofcoin/codec-format-interface/src/basic-interface.js
7303
-
7304
-
7305
-
7306
-
7307
- class BasicInterface {
7308
- #handleDecode() {
7309
- if (!this.decode) throw new Error('bad implementation: needs decode func')
7310
- return this.decode()
7311
- }
7312
-
7313
- #handleEncode() {
7314
- if (!this.encode) throw new Error('bad implementation: needs encode func')
7315
- return this.encode()
7316
- }
7317
- isHex(string) {
7318
- return is_hex(string)
7319
- }
7320
- isBase32(string) {
7321
- return base32.isBase32(string)
7322
- }
7323
- isBase58(string) {
7324
- return base58.isBase32(string)
7325
- }
7326
- /**
7327
- * @param {String} encoded
7328
- */
7329
- fromBs32(encoded) {
7330
- this.encoded = src_base32.decode(encoded)
7331
- return this.#handleDecode()
7332
- }
7333
-
7334
- /**
7335
- * @param {String} encoded
7336
- */
7337
- fromBs58(encoded) {
7338
- this.encoded = src_base58.decode(encoded)
7339
- return this.#handleDecode()
7340
- }
7341
-
7342
- async toArray() {
7343
- const array = []
7344
- for await (const value of this.encoded.values()) {
7345
- array.push(value)
7346
- }
7347
- return array
7348
- }
7349
-
7350
- fromString(string) {
7351
- this.encoded = new Uint8Array(string.split(','))
7352
- return this.#handleDecode()
7353
- }
7354
-
7355
- fromArray(array) {
7356
- this.encoded = new Uint8Array([...array])
7357
- return this.#handleDecode()
7358
- }
7359
-
7360
- /**
7361
- * @param {Buffer} encoded
7362
- */
7363
- fromEncoded(encoded) {
7364
- this.encoded = encoded
7365
- return this.#handleDecode()
7366
- }
7367
-
7368
- /**
7369
- * @param {String} encoded
7370
- */
7371
- fromHex(encoded) {
7372
- this.encoded = Buffer.from(encoded, 'hex')
7373
- return this.#handleDecode()
7374
- }
7375
-
7376
- async toString(encoding = 'utf8') {
7377
- if (!this.encoded) await this.#handleEncode()
7378
- return this.encoded.toString(encoding)
7379
- }
7380
-
7381
- /**
7382
- * @return {String} encoded
7383
- */
7384
- toHex() {
7385
- return this.toString('hex')
7386
- }
7387
-
7388
- /**
7389
- * @return {String} encoded
7390
- */
7391
- async toBs32() {
7392
- if (!this.encoded) await this.#handleEncode()
7393
- return src_base32.encode(this.encoded)
7394
- }
7395
-
7396
- /**
7397
- * @return {String} encoded
7398
- */
7399
- async toBs58() {
7400
- if (!this.encoded) await this.#handleEncode()
7401
- return src_base58.encode(this.encoded)
7402
- }
7403
-
7404
- /**
7405
- * @param {Object} data
7406
- */
7407
- create(data) {
7408
- const decoded = {}
7409
- if (this.keys?.length > 0) {
7410
- for (const key of this.keys) {
7411
- Object.defineProperties(decoded, {
7412
- [key]: {
7413
- enumerable: true,
7414
- configurable: true,
7415
- set: (val) => value = data[key],
7416
- get: () => data[key]
7417
- }
7418
- })
7419
- }
7420
-
7421
- this.decoded = decoded
7422
- return this.encode()
7423
- }
7424
- }
7425
- }
7426
-
7427
- // EXTERNAL MODULE: ./node_modules/varint/index.js
7428
- var varint = __webpack_require__(4676);
7429
- var varint_default = /*#__PURE__*/__webpack_require__.n(varint);
7430
- ;// CONCATENATED MODULE: ./node_modules/@leofcoin/codec-format-interface/src/codecs.js
7431
- /* harmony default export */ const codecs = ({
7432
- // just a hash
7433
- 'disco-hash': {
7434
- codec: parseInt('30', 16),
7435
- hashAlg: 'dbl-keccak-256', // ,
7436
- // testnet: 'olivia'
7437
- },
7438
- 'peernet-peer-response': {
7439
- codec: parseInt('707072', 16),
7440
- hashAlg: 'keccak-256',
7441
- },
7442
- 'peernet-peer': {
7443
- codec: parseInt('7070', 16),
7444
- hashAlg: 'keccak-256',
7445
- },
7446
- 'peernet-dht': {
7447
- codec: parseInt('706468', 16),
7448
- hashAlg: 'keccak-256',
7449
- },
7450
- 'peernet-dht-response': {
7451
- codec: parseInt('706472', 16),
7452
- hashAlg: 'keccak-256',
7453
- },
7454
- // data
7455
- 'peernet-data': {
7456
- codec: parseInt('706461', 16),
7457
- hashAlg: 'keccak-256',
7458
- },
7459
- 'peernet-data-response': {
7460
- codec: parseInt('70646172', 16),
7461
- hashAlg: 'keccak-256',
7462
- },
7463
- // message
7464
- 'peernet-message': {
7465
- codec: parseInt('706d65', 16),
7466
- hashAlg: 'keccak-256',
7467
- },
7468
- // pubsub
7469
- 'peernet-ps': {
7470
- codec: parseInt('707073', 16),
7471
- hashAlg: 'keccak-256',
7472
- },
7473
- 'peernet-response': {
7474
- codec: parseInt('7072', 16),
7475
- hashAlg: 'keccak-256',
7476
- },
7477
- 'peernet-request': {
7478
- codec: parseInt('707271', 16),
7479
- hashAlg: 'keccak-256',
7480
- },
7481
- // normal block
7482
- 'leofcoin-block': {
7483
- codec: parseInt('6c62', 16),
7484
- hashAlg: 'dbl-keccak-512', // ,
7485
- // testnet: 'olivia'
7486
- },
7487
- 'leofcoin-tx': {
7488
- codec: parseInt('6c74', 16),
7489
- hashAlg: 'dbl-keccak-512', // ,
7490
- // testnet: 'olivia'
7491
- },
7492
- // itx
7493
- 'leofcoin-itx': {
7494
- codec: parseInt('6c69', 16),
7495
- hashAlg: 'keccak-512', // ,
7496
- // testnet: 'olivia'
7497
- },
7498
- // peer reputation
7499
- 'leofcoin-pr': {
7500
- codec: parseInt('6c70', 16),
7501
- hashAlg: 'keccak-256', // ,
7502
- // testnet: 'olivia'
7503
- },
7504
- // chat message
7505
- 'chat-message': {
7506
- codec: parseInt('636d', 16),
7507
- hashAlg: 'dbl-keccak-256',
7508
- },
7509
- });
7510
-
7511
- ;// CONCATENATED MODULE: ./node_modules/@leofcoin/codec-format-interface/src/codec.js
7512
-
7513
-
7514
-
7515
-
7516
- class PeernetCodec extends BasicInterface {
7517
- get codecs() {
7518
- return {...globalThis.peernet.codecs, ...codecs}
7519
- }
7520
- constructor(buffer) {
7521
- super()
7522
- if (buffer) {
7523
- if (buffer instanceof Uint8Array) {
7524
- const codec = varint_default().decode(buffer);
7525
- const name = this.getCodecName(codec)
7526
- if (name) {
7527
- this.name = name
7528
- this.encoded = buffer
7529
- this.decode(buffer)
7530
- } else {
7531
- this.encode(buffer)
7532
- }
7533
- } else if (buffer instanceof ArrayBuffer) {
7534
- const encoded = new Uint8Array(buffer.byteLength)
7535
-
7536
- for (let i = 0; i < buffer.byteLength; i++) {
7537
- encoded[i] = buffer[i]
7538
- }
7539
- this.encoded = encoded
7540
- // this.encoded = new Uint8Array(buffer, buffer.byteOffset, buffer.byteLength)
7541
- this.decode(buffer)
7542
- return
7543
- }
7544
- if (typeof buffer === 'string') {
7545
- if (this.codecs[buffer]) this.fromName(buffer)
7546
- else if (this.isHex(buffer)) this.fromHex(buffer)
7547
- else if (this.isBase32(buffer)) this.fromBs32(buffer)
7548
- else if (this.isBase58(buffer)) this.fromBs58(buffer)
7549
- else throw new Error(`unsupported string ${buffer}`)
7550
- }
7551
- if (!isNaN(buffer)) if (this.codecs[this.getCodecName(buffer)]) this.fromCodec(buffer)
7552
- }
7553
- }
7554
-
7555
- fromEncoded(encoded) {
7556
- const codec = varint_default().decode(encoded);
7557
- const name = this.getCodecName(codec)
7558
- this.name = name
7559
- this.encoded = encoded
7560
- this.decode(encoded)
7561
- }
7562
-
7563
- getCodec(name) {
7564
- return this.codecs[name].codec
7565
- }
7566
-
7567
- getCodecName(codec) {
7568
- return Object.keys(this.codecs).reduce((p, c) => {
7569
- const item = this.codecs[c]
7570
- if (item.codec === codec) return c;
7571
- else return p;
7572
- }, undefined)
7573
- }
7574
-
7575
- getHashAlg(name) {
7576
- return this.codecs[name].hashAlg
7577
- }
7578
-
7579
- fromCodec(codec) {
7580
- this.name = this.getCodecName(codec)
7581
- this.hashAlg = this.getHashAlg(this.name)
7582
-
7583
- this.codec = this.getCodec(this.name)
7584
- this.codecBuffer = varint_default().encode(codec)
7585
- }
7586
-
7587
- fromName(name) {
7588
- const codec = this.getCodec(name)
7589
- this.name = name
7590
- this.codec = codec
7591
- this.hashAlg = this.getHashAlg(name)
7592
- this.codecBuffer = varint_default().encode(codec)
7593
- }
7594
-
7595
- decode() {
7596
- const codec = varint_default().decode(this.encoded);
7597
- this.fromCodec(codec)
7598
- }
7599
-
7600
- encode() {
7601
- const codec = varint_default().encode(this.decoded)
7602
- this.encoded = codec
7603
- return this.encoded
7604
- }
7605
- }
7606
-
7607
- // EXTERNAL MODULE: ./node_modules/keccak/js.js
7608
- var js = __webpack_require__(5811);
7609
- var js_default = /*#__PURE__*/__webpack_require__.n(js);
7610
- ;// CONCATENATED MODULE: ./node_modules/@leofcoin/codec-format-interface/src/codec-hash.js
7611
-
7612
-
7613
-
7614
-
7615
-
7616
- class CodecHash extends BasicInterface {
7617
- constructor(buffer, options = {}) {
7618
- super()
7619
- if (options.name) this.name = options.name
7620
- else this.name = 'disco-hash'
7621
- if (options.codecs) this.codecs = options.codecs
7622
- if (buffer) {
7623
- if (buffer instanceof Uint8Array) {
7624
- this.discoCodec = new PeernetCodec(buffer, this.codecs)
7625
- const name = this.discoCodec.name
7626
-
7627
- if (name) {
7628
- this.name = name
7629
- this.decode(buffer)
7630
- } else {
7631
- this.encode(buffer)
7632
- }
7633
- }
7634
-
7635
- if (typeof buffer === 'string') {
7636
- if (this.isHex(buffer)) this.fromHex(buffer)
7637
- if (this.isBase32(buffer)) this.fromBs32(buffer)
7638
- else if (this.isBase58(buffer)) this.fromBs58(buffer)
7639
- else throw new Error(`unsupported string ${buffer}`)
7640
- } else if (typeof buffer === 'object') this.fromJSON(buffer)
7641
- }
7642
- }
7643
-
7644
- get prefix() {
7645
- const length = this.length
7646
- const uint8Array = new Uint8Array(length.length + this.discoCodec.codecBuffer.length)
7647
- uint8Array.set(length)
7648
- uint8Array.set(this.discoCodec.codecBuffer, length.length)
7649
-
7650
- return uint8Array
7651
- }
7652
-
7653
- get length() {
7654
- return varint_default().encode(this.size)
7655
- }
7656
-
7657
- get buffer() {
7658
- return this.encoded
7659
- }
7660
-
7661
- get hash() {
7662
- return this.encoded
7663
- }
7664
-
7665
- fromJSON(json) {
7666
- return this.encode(Buffer.from(JSON.stringify(json)))
7667
- }
7668
-
7669
- encode(buffer, name) {
7670
- if (!this.name && name) this.name = name;
7671
- if (!buffer) buffer = this.buffer;
7672
- this.discoCodec = new PeernetCodec(this.name, this.codecs)
7673
- this.discoCodec.fromName(this.name)
7674
- let hashAlg = this.discoCodec.hashAlg
7675
- if (hashAlg.includes('dbl')) {
7676
- hashAlg = hashAlg.replace('dbl-', '')
7677
- buffer = js_default()(hashAlg.replace('-', '')).update(buffer).digest()
7678
- }
7679
- this.digest = js_default()(hashAlg.replace('-', '')).update(buffer).digest()
7680
- this.size = this.digest.length
7681
-
7682
- this.codec = this.discoCodec.encode();
7683
- this.codec = this.discoCodec.codecBuffer
7684
- const uint8Array = new Uint8Array(this.digest.length + this.prefix.length)
7685
- uint8Array.set(this.prefix)
7686
- uint8Array.set(this.digest, this.prefix.length)
7687
-
7688
- this.encoded = uint8Array
7689
-
7690
- return this.encoded
7691
- }
7692
-
7693
- validate(buffer) {
7694
- if (Buffer.isBuffer(buffer)) {
7695
- const codec = varint_default().decode(buffer);
7696
- if (this.codecs[codec]) {
7697
- this.decode(buffer)
7698
- } else {
7699
- this.encode(buffer)
7700
- }
7701
- }
7702
- if (typeof buffer === 'string') {
7703
- if (this.isHex(buffer)) this.fromHex(buffer)
7704
- if (this.isBase32(buffer)) this.fromBs32(buffer)
7705
- }
7706
- if (typeof buffer === 'object') this.fromJSON(buffer)
7707
- }
7708
-
7709
- decode(buffer) {
7710
- this.encoded = buffer
7711
- const codec = varint_default().decode(buffer);
7712
-
7713
- this.discoCodec = new PeernetCodec(codec, this.codecs)
7714
- // TODO: validate codec
7715
- buffer = buffer.slice((varint_default()).decode.bytes);
7716
- this.size = varint_default().decode(buffer);
7717
- this.digest = buffer.slice((varint_default()).decode.bytes);
7718
- if (this.digest.length !== this.size) {
7719
- throw new Error(`hash length inconsistent: 0x${this.encoded.toString('hex')}`)
7720
- }
7721
-
7722
- // const discoCodec = new Codec(codec, this.codecs)
7723
-
7724
- this.name = this.discoCodec.name
7725
-
7726
-
7727
- this.size = this.digest.length
7728
-
7729
- return {
7730
- codec: this.codec,
7731
- name: this.name,
7732
- size: this.size,
7733
- length: this.length,
7734
- digest: this.digest,
7735
- }
7736
- }
7737
- }
7738
-
7739
- ;// CONCATENATED MODULE: ./node_modules/@leofcoin/codec-format-interface/src/codec-format-interface.js
7740
-
7741
-
7742
-
7743
- let protons
7744
-
7745
- class FormatInterface extends BasicInterface {
7746
- async #importProtons() {
7747
- let importee = await __webpack_require__.e(/* import() | protons */ 397).then(__webpack_require__.t.bind(__webpack_require__, 7160, 23))
7748
- return importee.default
7749
- }
7750
-
7751
- async protoEncode(data) {
7752
- if (!protons) protons = await this.#importProtons()
7753
- return protons(this.proto)[this.messageName].encode(data)
7754
- }
7755
-
7756
- async protoDecode(data) {
7757
- if (!protons) protons = await this.#importProtons()
7758
- return protons(this.proto)[this.messageName].decode(data)
7759
- }
7760
-
7761
- async #init(buffer) {
7762
- if (buffer instanceof Uint8Array) await this.fromUint8Array(buffer)
7763
- else if (buffer instanceof ArrayBuffer) await this.fromArrayBuffer(buffer)
7764
- else if (buffer?.name === this.name) return buffer
7765
- else if (buffer instanceof String) {
7766
- if (this.isHex(buffer)) await this.fromHex(buffer)
7767
- else if (this.isBase32(buffer)) await this.fromBs32(buffer)
7768
- else if (this.isBase58(buffer)) await this.fromBs58(buffer)
7769
- else throw new Error(`unsupported string ${buffer}`)
7770
- } else {
7771
- await this.create(buffer)
7772
- }
7773
- return this
7774
- }
7775
-
7776
- /**
7777
- * @param {Buffer|String|Object} buffer - data - The data needed to create the desired message
7778
- * @param {Object} proto - {encode, decode}
7779
- * @param {Object} options - {hashFormat, name}
7780
- */
7781
- constructor(buffer, proto, options = {}) {
7782
- super()
7783
- this.proto = proto
7784
- this.hashFormat = options.hashFormat || 'bs32'
7785
- if (options.name) this.name = options.name
7786
- return this.#init(buffer)
7787
- }
7788
-
7789
- /**
7790
- * @return {PeernetHash}
7791
- */
7792
- get peernetHash() {
7793
- return new CodecHash(this.decoded, {name: this.name})
7794
- }
7795
-
7796
- /**
7797
- * @return {peernetHash}
7798
- */
7799
- get hash() {
7800
- const upper = this.hashFormat.charAt(0).toUpperCase()
7801
- const format = `${upper}${this.hashFormat.substring(1, this.hashFormat.length)}`
7802
- return this.peernetHash[`to${format}`]()
7803
- }
7804
-
7805
- /**
7806
- * @return {Object}
7807
- */
7808
- async decode() {
7809
- let encoded = this.encoded;
7810
- const discoCodec = new PeernetCodec(this.encoded)
7811
- encoded = encoded.slice(discoCodec.codecBuffer.length)
7812
- this.name = discoCodec.name
7813
- this.decoded = await this.protoDecode(encoded)
7814
- return this.decoded
7815
- }
7816
-
7817
- /**
7818
- * @return {Buffer}
7819
- */
7820
- async encode(decoded) {
7821
- if (!decoded) decoded = this.decoded;
7822
- const codec = new PeernetCodec(this.name)
7823
- const encoded = await this.protoEncode(decoded)
7824
- const uint8Array = new Uint8Array(encoded.length + codec.codecBuffer.length)
7825
- uint8Array.set(codec.codecBuffer)
7826
- uint8Array.set(encoded, codec.codecBuffer.length)
7827
- this.encoded = uint8Array
7828
- return this.encoded
7829
- }
7830
-
7831
- hasCodec() {
7832
- if (!this.encoded) return false
7833
- const codec = new PeernetCodec(this.encoded)
7834
- if (codec.name) return true
7835
- }
7836
-
7837
- fromUint8Array(buffer) {
7838
- this.encoded = buffer
7839
- return this.hasCodec() ? this.decode() : this.create(
7840
- JSON.parse(new TextDecoder().decode(this.encoded))
7841
- )
7842
- }
7843
-
7844
- fromArrayBuffer(buffer) {
7845
- this.encoded = new Uint8Array(buffer, buffer.byteOffset, buffer.byteLength)
7846
- return this.hasCodec() ? this.decode() : this.create(
7847
- JSON.parse(new TextDecoder().decode(this.encoded))
7848
- )
7849
- }
7850
- }
7851
-
7852
- ;// CONCATENATED MODULE: ./node_modules/@leofcoin/codec-format-interface/src/index.js
7853
-
7854
-
7855
-
7856
-
7857
-
7858
-
7714
+ // EXTERNAL MODULE: ./node_modules/@leofcoin/codec-format-interface/dist/index.js
7715
+ var dist = __webpack_require__(427);
7859
7716
  ;// CONCATENATED MODULE: ./src/messages/contract.js
7860
7717
 
7861
7718
 
7862
7719
 
7863
- class ContractMessage extends FormatInterface {
7720
+ class ContractMessage extends dist/* FormatInterface */.L1 {
7864
7721
  get keys() {
7865
7722
  return ['creator', 'contract', 'constructorParameters']
7866
7723
  }
@@ -7884,6 +7741,7 @@ message TransactionMessage {
7884
7741
  required uint64 nonce = 4;
7885
7742
  required string method = 5;
7886
7743
  repeated string params = 6;
7744
+ required string signature = 7;
7887
7745
  }
7888
7746
  `);
7889
7747
 
@@ -7891,9 +7749,9 @@ message TransactionMessage {
7891
7749
 
7892
7750
 
7893
7751
 
7894
- class TransactionMessage extends FormatInterface {
7752
+ class TransactionMessage extends dist/* FormatInterface */.L1 {
7895
7753
  get keys() {
7896
- return ['timestamp', 'from', 'to', 'nonce', 'method', 'params']
7754
+ return ['timestamp', 'from', 'to', 'nonce', 'method', 'params', 'signature']
7897
7755
  }
7898
7756
 
7899
7757
  get messageName() {
@@ -7938,7 +7796,7 @@ message BlockMessage {
7938
7796
 
7939
7797
 
7940
7798
 
7941
- class BlockMessage extends FormatInterface {
7799
+ class BlockMessage extends dist/* FormatInterface */.L1 {
7942
7800
  get keys() {
7943
7801
  return ['index', 'previousHash', 'timestamp', 'reward', 'fees', 'transactions', 'validators']
7944
7802
  }
@@ -7966,7 +7824,7 @@ message BWMessage {
7966
7824
 
7967
7825
 
7968
7826
 
7969
- class BWMessage extends FormatInterface {
7827
+ class BWMessage extends dist/* FormatInterface */.L1 {
7970
7828
  get keys() {
7971
7829
  return ['up', 'down']
7972
7830
  }
@@ -7992,7 +7850,7 @@ message BWRequestMessage {
7992
7850
 
7993
7851
 
7994
7852
 
7995
- class BWRequestMessage extends FormatInterface {
7853
+ class BWRequestMessage extends dist/* FormatInterface */.L1 {
7996
7854
  get keys() {
7997
7855
  return []
7998
7856
  }