@startbahn/startrail-sdk-js 1.30.3-beta.1 → 1.30.4-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/startrail-sdk.js +109 -1449
- package/package.json +1 -1
package/dist/startrail-sdk.js
CHANGED
|
@@ -305,12 +305,12 @@ const version = "address/5.7.0";
|
|
|
305
305
|
/* harmony export */ getAddress: () => (/* binding */ getAddress)
|
|
306
306
|
/* harmony export */ });
|
|
307
307
|
/* unused harmony exports isAddress, getIcapAddress, getContractAddress, getCreate2Address */
|
|
308
|
-
/* harmony import */ var
|
|
309
|
-
/* harmony import */ var
|
|
310
|
-
/* harmony import */ var
|
|
308
|
+
/* harmony import */ var _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @ethersproject/bytes */ "./node_modules/@ethersproject/bytes/lib.esm/index.js");
|
|
309
|
+
/* harmony import */ var _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @ethersproject/bignumber */ "./node_modules/@ethersproject/bignumber/lib.esm/bignumber.js");
|
|
310
|
+
/* harmony import */ var _ethersproject_keccak256__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @ethersproject/keccak256 */ "./node_modules/@ethersproject/address/node_modules/@ethersproject/keccak256/lib.esm/index.js");
|
|
311
311
|
/* harmony import */ var _ethersproject_rlp__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @ethersproject/rlp */ "./node_modules/@ethersproject/address/node_modules/@ethersproject/rlp/lib.esm/index.js");
|
|
312
|
-
/* harmony import */ var
|
|
313
|
-
/* harmony import */ var
|
|
312
|
+
/* harmony import */ var _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ethersproject/logger */ "./node_modules/@ethersproject/logger/lib.esm/index.js");
|
|
313
|
+
/* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./_version */ "./node_modules/@ethersproject/address/lib.esm/_version.js");
|
|
314
314
|
|
|
315
315
|
|
|
316
316
|
|
|
@@ -318,9 +318,9 @@ const version = "address/5.7.0";
|
|
|
318
318
|
|
|
319
319
|
|
|
320
320
|
|
|
321
|
-
const logger = new
|
|
321
|
+
const logger = new _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger(_version__WEBPACK_IMPORTED_MODULE_1__.version);
|
|
322
322
|
function getChecksumAddress(address) {
|
|
323
|
-
if (!(0,
|
|
323
|
+
if (!(0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__.isHexString)(address, 20)) {
|
|
324
324
|
logger.throwArgumentError("invalid address", "address", address);
|
|
325
325
|
}
|
|
326
326
|
address = address.toLowerCase();
|
|
@@ -329,7 +329,7 @@ function getChecksumAddress(address) {
|
|
|
329
329
|
for (let i = 0; i < 40; i++) {
|
|
330
330
|
expanded[i] = chars[i].charCodeAt(0);
|
|
331
331
|
}
|
|
332
|
-
const hashed = (0,
|
|
332
|
+
const hashed = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__.arrayify)((0,_ethersproject_keccak256__WEBPACK_IMPORTED_MODULE_3__.keccak256)(expanded));
|
|
333
333
|
for (let i = 0; i < 40; i += 2) {
|
|
334
334
|
if ((hashed[i >> 1] >> 4) >= 8) {
|
|
335
335
|
chars[i] = chars[i].toUpperCase();
|
|
@@ -370,1128 +370,81 @@ function ibanChecksum(address) {
|
|
|
370
370
|
}
|
|
371
371
|
let checksum = String(98 - (parseInt(expanded, 10) % 97));
|
|
372
372
|
while (checksum.length < 2) {
|
|
373
|
-
checksum = "0" + checksum;
|
|
374
|
-
}
|
|
375
|
-
return checksum;
|
|
376
|
-
}
|
|
377
|
-
;
|
|
378
|
-
function getAddress(address) {
|
|
379
|
-
let result = null;
|
|
380
|
-
if (typeof (address) !== "string") {
|
|
381
|
-
logger.throwArgumentError("invalid address", "address", address);
|
|
382
|
-
}
|
|
383
|
-
if (address.match(/^(0x)?[0-9a-fA-F]{40}$/)) {
|
|
384
|
-
// Missing the 0x prefix
|
|
385
|
-
if (address.substring(0, 2) !== "0x") {
|
|
386
|
-
address = "0x" + address;
|
|
387
|
-
}
|
|
388
|
-
result = getChecksumAddress(address);
|
|
389
|
-
// It is a checksummed address with a bad checksum
|
|
390
|
-
if (address.match(/([A-F].*[a-f])|([a-f].*[A-F])/) && result !== address) {
|
|
391
|
-
logger.throwArgumentError("bad address checksum", "address", address);
|
|
392
|
-
}
|
|
393
|
-
// Maybe ICAP? (we only support direct mode)
|
|
394
|
-
}
|
|
395
|
-
else if (address.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)) {
|
|
396
|
-
// It is an ICAP address with a bad checksum
|
|
397
|
-
if (address.substring(2, 4) !== ibanChecksum(address)) {
|
|
398
|
-
logger.throwArgumentError("bad icap checksum", "address", address);
|
|
399
|
-
}
|
|
400
|
-
result = (0,_ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_1__._base36To16)(address.substring(4));
|
|
401
|
-
while (result.length < 40) {
|
|
402
|
-
result = "0" + result;
|
|
403
|
-
}
|
|
404
|
-
result = getChecksumAddress("0x" + result);
|
|
405
|
-
}
|
|
406
|
-
else {
|
|
407
|
-
logger.throwArgumentError("invalid address", "address", address);
|
|
408
|
-
}
|
|
409
|
-
return result;
|
|
410
|
-
}
|
|
411
|
-
function isAddress(address) {
|
|
412
|
-
try {
|
|
413
|
-
getAddress(address);
|
|
414
|
-
return true;
|
|
415
|
-
}
|
|
416
|
-
catch (error) { }
|
|
417
|
-
return false;
|
|
418
|
-
}
|
|
419
|
-
function getIcapAddress(address) {
|
|
420
|
-
let base36 = (0,_ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_1__._base16To36)(getAddress(address).substring(2)).toUpperCase();
|
|
421
|
-
while (base36.length < 30) {
|
|
422
|
-
base36 = "0" + base36;
|
|
423
|
-
}
|
|
424
|
-
return "XE" + ibanChecksum("XE00" + base36) + base36;
|
|
425
|
-
}
|
|
426
|
-
// http://ethereum.stackexchange.com/questions/760/how-is-the-address-of-an-ethereum-contract-computed
|
|
427
|
-
function getContractAddress(transaction) {
|
|
428
|
-
let from = null;
|
|
429
|
-
try {
|
|
430
|
-
from = getAddress(transaction.from);
|
|
431
|
-
}
|
|
432
|
-
catch (error) {
|
|
433
|
-
logger.throwArgumentError("missing from address", "transaction", transaction);
|
|
434
|
-
}
|
|
435
|
-
const nonce = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__.stripZeros)((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__.arrayify)(_ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_1__.BigNumber.from(transaction.nonce).toHexString()));
|
|
436
|
-
return getAddress((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__.hexDataSlice)((0,_ethersproject_keccak256__WEBPACK_IMPORTED_MODULE_4__.keccak256)((0,_ethersproject_rlp__WEBPACK_IMPORTED_MODULE_5__.encode)([from, nonce])), 12));
|
|
437
|
-
}
|
|
438
|
-
function getCreate2Address(from, salt, initCodeHash) {
|
|
439
|
-
if ((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__.hexDataLength)(salt) !== 32) {
|
|
440
|
-
logger.throwArgumentError("salt must be 32 bytes", "salt", salt);
|
|
441
|
-
}
|
|
442
|
-
if ((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__.hexDataLength)(initCodeHash) !== 32) {
|
|
443
|
-
logger.throwArgumentError("initCodeHash must be 32 bytes", "initCodeHash", initCodeHash);
|
|
444
|
-
}
|
|
445
|
-
return getAddress((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__.hexDataSlice)((0,_ethersproject_keccak256__WEBPACK_IMPORTED_MODULE_4__.keccak256)((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__.concat)(["0xff", getAddress(from), salt, initCodeHash])), 12));
|
|
446
|
-
}
|
|
447
|
-
//# sourceMappingURL=index.js.map
|
|
448
|
-
|
|
449
|
-
/***/ }),
|
|
450
|
-
|
|
451
|
-
/***/ "./node_modules/@ethersproject/address/node_modules/@ethersproject/bignumber/lib.esm/_version.js":
|
|
452
|
-
/*!*******************************************************************************************************!*\
|
|
453
|
-
!*** ./node_modules/@ethersproject/address/node_modules/@ethersproject/bignumber/lib.esm/_version.js ***!
|
|
454
|
-
\*******************************************************************************************************/
|
|
455
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
456
|
-
|
|
457
|
-
"use strict";
|
|
458
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
459
|
-
/* harmony export */ version: () => (/* binding */ version)
|
|
460
|
-
/* harmony export */ });
|
|
461
|
-
const version = "bignumber/5.0.1";
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
/***/ }),
|
|
465
|
-
|
|
466
|
-
/***/ "./node_modules/@ethersproject/address/node_modules/@ethersproject/bignumber/lib.esm/bignumber.js":
|
|
467
|
-
/*!********************************************************************************************************!*\
|
|
468
|
-
!*** ./node_modules/@ethersproject/address/node_modules/@ethersproject/bignumber/lib.esm/bignumber.js ***!
|
|
469
|
-
\********************************************************************************************************/
|
|
470
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
471
|
-
|
|
472
|
-
"use strict";
|
|
473
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
474
|
-
/* harmony export */ BigNumber: () => (/* binding */ BigNumber),
|
|
475
|
-
/* harmony export */ isBigNumberish: () => (/* binding */ isBigNumberish)
|
|
476
|
-
/* harmony export */ });
|
|
477
|
-
/* harmony import */ var bn_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! bn.js */ "./node_modules/bn.js/lib/bn.js");
|
|
478
|
-
/* harmony import */ var bn_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(bn_js__WEBPACK_IMPORTED_MODULE_0__);
|
|
479
|
-
/* harmony import */ var _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @ethersproject/bytes */ "./node_modules/@ethersproject/address/node_modules/@ethersproject/bytes/lib.esm/index.js");
|
|
480
|
-
/* harmony import */ var _ethersproject_logger__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @ethersproject/logger */ "./node_modules/@ethersproject/address/node_modules/@ethersproject/logger/lib.esm/index.js");
|
|
481
|
-
/* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./_version */ "./node_modules/@ethersproject/address/node_modules/@ethersproject/bignumber/lib.esm/_version.js");
|
|
482
|
-
|
|
483
|
-
/**
|
|
484
|
-
* BigNumber
|
|
485
|
-
*
|
|
486
|
-
* A wrapper around the BN.js object. We use the BN.js library
|
|
487
|
-
* because it is used by elliptic, so it is required regardles.
|
|
488
|
-
*
|
|
489
|
-
*/
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
const logger = new _ethersproject_logger__WEBPACK_IMPORTED_MODULE_2__.Logger(_version__WEBPACK_IMPORTED_MODULE_3__.version);
|
|
495
|
-
const _constructorGuard = {};
|
|
496
|
-
const MAX_SAFE = 0x1fffffffffffff;
|
|
497
|
-
function isBigNumberish(value) {
|
|
498
|
-
return (value != null) && (BigNumber.isBigNumber(value) ||
|
|
499
|
-
(typeof (value) === "number" && (value % 1) === 0) ||
|
|
500
|
-
(typeof (value) === "string" && !!value.match(/^-?[0-9]+$/)) ||
|
|
501
|
-
(0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__.isHexString)(value) ||
|
|
502
|
-
(typeof (value) === "bigint") ||
|
|
503
|
-
(0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__.isBytes)(value));
|
|
504
|
-
}
|
|
505
|
-
class BigNumber {
|
|
506
|
-
constructor(constructorGuard, hex) {
|
|
507
|
-
logger.checkNew(new.target, BigNumber);
|
|
508
|
-
if (constructorGuard !== _constructorGuard) {
|
|
509
|
-
logger.throwError("cannot call constructor directly; use BigNumber.from", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_2__.Logger.errors.UNSUPPORTED_OPERATION, {
|
|
510
|
-
operation: "new (BigNumber)"
|
|
511
|
-
});
|
|
512
|
-
}
|
|
513
|
-
this._hex = hex;
|
|
514
|
-
this._isBigNumber = true;
|
|
515
|
-
Object.freeze(this);
|
|
516
|
-
}
|
|
517
|
-
fromTwos(value) {
|
|
518
|
-
return toBigNumber(toBN(this).fromTwos(value));
|
|
519
|
-
}
|
|
520
|
-
toTwos(value) {
|
|
521
|
-
return toBigNumber(toBN(this).toTwos(value));
|
|
522
|
-
}
|
|
523
|
-
abs() {
|
|
524
|
-
if (this._hex[0] === "-") {
|
|
525
|
-
return BigNumber.from(this._hex.substring(1));
|
|
526
|
-
}
|
|
527
|
-
return this;
|
|
528
|
-
}
|
|
529
|
-
add(other) {
|
|
530
|
-
return toBigNumber(toBN(this).add(toBN(other)));
|
|
531
|
-
}
|
|
532
|
-
sub(other) {
|
|
533
|
-
return toBigNumber(toBN(this).sub(toBN(other)));
|
|
534
|
-
}
|
|
535
|
-
div(other) {
|
|
536
|
-
const o = BigNumber.from(other);
|
|
537
|
-
if (o.isZero()) {
|
|
538
|
-
throwFault("division by zero", "div");
|
|
539
|
-
}
|
|
540
|
-
return toBigNumber(toBN(this).div(toBN(other)));
|
|
541
|
-
}
|
|
542
|
-
mul(other) {
|
|
543
|
-
return toBigNumber(toBN(this).mul(toBN(other)));
|
|
544
|
-
}
|
|
545
|
-
mod(other) {
|
|
546
|
-
const value = toBN(other);
|
|
547
|
-
if (value.isNeg()) {
|
|
548
|
-
throwFault("cannot modulo negative values", "mod");
|
|
549
|
-
}
|
|
550
|
-
return toBigNumber(toBN(this).umod(value));
|
|
551
|
-
}
|
|
552
|
-
pow(other) {
|
|
553
|
-
return toBigNumber(toBN(this).pow(toBN(other)));
|
|
554
|
-
}
|
|
555
|
-
and(other) {
|
|
556
|
-
const value = toBN(other);
|
|
557
|
-
if (this.isNegative() || value.isNeg()) {
|
|
558
|
-
throwFault("cannot 'and' negative values", "and");
|
|
559
|
-
}
|
|
560
|
-
return toBigNumber(toBN(this).and(value));
|
|
561
|
-
}
|
|
562
|
-
or(other) {
|
|
563
|
-
const value = toBN(other);
|
|
564
|
-
if (this.isNegative() || value.isNeg()) {
|
|
565
|
-
throwFault("cannot 'or' negative values", "or");
|
|
566
|
-
}
|
|
567
|
-
return toBigNumber(toBN(this).or(value));
|
|
568
|
-
}
|
|
569
|
-
xor(other) {
|
|
570
|
-
const value = toBN(other);
|
|
571
|
-
if (this.isNegative() || value.isNeg()) {
|
|
572
|
-
throwFault("cannot 'xor' negative values", "xor");
|
|
573
|
-
}
|
|
574
|
-
return toBigNumber(toBN(this).xor(value));
|
|
575
|
-
}
|
|
576
|
-
mask(value) {
|
|
577
|
-
if (this.isNegative() || value < 0) {
|
|
578
|
-
throwFault("cannot mask negative values", "mask");
|
|
579
|
-
}
|
|
580
|
-
return toBigNumber(toBN(this).maskn(value));
|
|
581
|
-
}
|
|
582
|
-
shl(value) {
|
|
583
|
-
if (this.isNegative() || value < 0) {
|
|
584
|
-
throwFault("cannot shift negative values", "shl");
|
|
585
|
-
}
|
|
586
|
-
return toBigNumber(toBN(this).shln(value));
|
|
587
|
-
}
|
|
588
|
-
shr(value) {
|
|
589
|
-
if (this.isNegative() || value < 0) {
|
|
590
|
-
throwFault("cannot shift negative values", "shr");
|
|
591
|
-
}
|
|
592
|
-
return toBigNumber(toBN(this).shrn(value));
|
|
593
|
-
}
|
|
594
|
-
eq(other) {
|
|
595
|
-
return toBN(this).eq(toBN(other));
|
|
596
|
-
}
|
|
597
|
-
lt(other) {
|
|
598
|
-
return toBN(this).lt(toBN(other));
|
|
599
|
-
}
|
|
600
|
-
lte(other) {
|
|
601
|
-
return toBN(this).lte(toBN(other));
|
|
602
|
-
}
|
|
603
|
-
gt(other) {
|
|
604
|
-
return toBN(this).gt(toBN(other));
|
|
605
|
-
}
|
|
606
|
-
gte(other) {
|
|
607
|
-
return toBN(this).gte(toBN(other));
|
|
608
|
-
}
|
|
609
|
-
isNegative() {
|
|
610
|
-
return (this._hex[0] === "-");
|
|
611
|
-
}
|
|
612
|
-
isZero() {
|
|
613
|
-
return toBN(this).isZero();
|
|
614
|
-
}
|
|
615
|
-
toNumber() {
|
|
616
|
-
try {
|
|
617
|
-
return toBN(this).toNumber();
|
|
618
|
-
}
|
|
619
|
-
catch (error) {
|
|
620
|
-
throwFault("overflow", "toNumber", this.toString());
|
|
621
|
-
}
|
|
622
|
-
return null;
|
|
623
|
-
}
|
|
624
|
-
toString() {
|
|
625
|
-
// Lots of people expect this, which we do not support, so check
|
|
626
|
-
if (arguments.length !== 0) {
|
|
627
|
-
logger.throwError("bigNumber.toString does not accept parameters", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_2__.Logger.errors.UNEXPECTED_ARGUMENT, {});
|
|
628
|
-
}
|
|
629
|
-
return toBN(this).toString(10);
|
|
630
|
-
}
|
|
631
|
-
toHexString() {
|
|
632
|
-
return this._hex;
|
|
633
|
-
}
|
|
634
|
-
static from(value) {
|
|
635
|
-
if (value instanceof BigNumber) {
|
|
636
|
-
return value;
|
|
637
|
-
}
|
|
638
|
-
if (typeof (value) === "string") {
|
|
639
|
-
if (value.match(/-?0x[0-9a-f]+/i)) {
|
|
640
|
-
return new BigNumber(_constructorGuard, toHex(value));
|
|
641
|
-
}
|
|
642
|
-
if (value.match(/^-?[0-9]+$/)) {
|
|
643
|
-
return new BigNumber(_constructorGuard, toHex(new bn_js__WEBPACK_IMPORTED_MODULE_0__.BN(value)));
|
|
644
|
-
}
|
|
645
|
-
return logger.throwArgumentError("invalid BigNumber string", "value", value);
|
|
646
|
-
}
|
|
647
|
-
if (typeof (value) === "number") {
|
|
648
|
-
if (value % 1) {
|
|
649
|
-
throwFault("underflow", "BigNumber.from", value);
|
|
650
|
-
}
|
|
651
|
-
if (value >= MAX_SAFE || value <= -MAX_SAFE) {
|
|
652
|
-
throwFault("overflow", "BigNumber.from", value);
|
|
653
|
-
}
|
|
654
|
-
return BigNumber.from(String(value));
|
|
655
|
-
}
|
|
656
|
-
if (typeof (value) === "bigint") {
|
|
657
|
-
return BigNumber.from(value.toString());
|
|
658
|
-
}
|
|
659
|
-
if ((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__.isBytes)(value)) {
|
|
660
|
-
return BigNumber.from((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__.hexlify)(value));
|
|
661
|
-
}
|
|
662
|
-
if (value._hex && (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__.isHexString)(value._hex)) {
|
|
663
|
-
return BigNumber.from(value._hex);
|
|
664
|
-
}
|
|
665
|
-
if (value.toHexString) {
|
|
666
|
-
value = value.toHexString();
|
|
667
|
-
if (typeof (value) === "string") {
|
|
668
|
-
return BigNumber.from(value);
|
|
669
|
-
}
|
|
670
|
-
}
|
|
671
|
-
return logger.throwArgumentError("invalid BigNumber value", "value", value);
|
|
672
|
-
}
|
|
673
|
-
static isBigNumber(value) {
|
|
674
|
-
return !!(value && value._isBigNumber);
|
|
675
|
-
}
|
|
676
|
-
}
|
|
677
|
-
// Normalize the hex string
|
|
678
|
-
function toHex(value) {
|
|
679
|
-
// For BN, call on the hex string
|
|
680
|
-
if (typeof (value) !== "string") {
|
|
681
|
-
return toHex(value.toString(16));
|
|
682
|
-
}
|
|
683
|
-
// If negative, prepend the negative sign to the normalized positive value
|
|
684
|
-
if (value[0] === "-") {
|
|
685
|
-
// Strip off the negative sign
|
|
686
|
-
value = value.substring(1);
|
|
687
|
-
// Cannot have mulitple negative signs (e.g. "--0x04")
|
|
688
|
-
if (value[0] === "-") {
|
|
689
|
-
logger.throwArgumentError("invalid hex", "value", value);
|
|
690
|
-
}
|
|
691
|
-
// Call toHex on the positive component
|
|
692
|
-
value = toHex(value);
|
|
693
|
-
// Do not allow "-0x00"
|
|
694
|
-
if (value === "0x00") {
|
|
695
|
-
return value;
|
|
696
|
-
}
|
|
697
|
-
// Negate the value
|
|
698
|
-
return "-" + value;
|
|
699
|
-
}
|
|
700
|
-
// Add a "0x" prefix if missing
|
|
701
|
-
if (value.substring(0, 2) !== "0x") {
|
|
702
|
-
value = "0x" + value;
|
|
703
|
-
}
|
|
704
|
-
// Normalize zero
|
|
705
|
-
if (value === "0x") {
|
|
706
|
-
return "0x00";
|
|
707
|
-
}
|
|
708
|
-
// Make the string even length
|
|
709
|
-
if (value.length % 2) {
|
|
710
|
-
value = "0x0" + value.substring(2);
|
|
711
|
-
}
|
|
712
|
-
// Trim to smallest even-length string
|
|
713
|
-
while (value.length > 4 && value.substring(0, 4) === "0x00") {
|
|
714
|
-
value = "0x" + value.substring(4);
|
|
715
|
-
}
|
|
716
|
-
return value;
|
|
717
|
-
}
|
|
718
|
-
function toBigNumber(value) {
|
|
719
|
-
return BigNumber.from(toHex(value));
|
|
720
|
-
}
|
|
721
|
-
function toBN(value) {
|
|
722
|
-
const hex = BigNumber.from(value).toHexString();
|
|
723
|
-
if (hex[0] === "-") {
|
|
724
|
-
return (new bn_js__WEBPACK_IMPORTED_MODULE_0__.BN("-" + hex.substring(3), 16));
|
|
725
|
-
}
|
|
726
|
-
return new bn_js__WEBPACK_IMPORTED_MODULE_0__.BN(hex.substring(2), 16);
|
|
727
|
-
}
|
|
728
|
-
function throwFault(fault, operation, value) {
|
|
729
|
-
const params = { fault: fault, operation: operation };
|
|
730
|
-
if (value != null) {
|
|
731
|
-
params.value = value;
|
|
732
|
-
}
|
|
733
|
-
return logger.throwError(fault, _ethersproject_logger__WEBPACK_IMPORTED_MODULE_2__.Logger.errors.NUMERIC_FAULT, params);
|
|
734
|
-
}
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
/***/ }),
|
|
738
|
-
|
|
739
|
-
/***/ "./node_modules/@ethersproject/address/node_modules/@ethersproject/bignumber/lib.esm/fixednumber.js":
|
|
740
|
-
/*!**********************************************************************************************************!*\
|
|
741
|
-
!*** ./node_modules/@ethersproject/address/node_modules/@ethersproject/bignumber/lib.esm/fixednumber.js ***!
|
|
742
|
-
\**********************************************************************************************************/
|
|
743
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
744
|
-
|
|
745
|
-
"use strict";
|
|
746
|
-
/* unused harmony exports formatFixed, parseFixed, FixedFormat, FixedNumber */
|
|
747
|
-
/* harmony import */ var _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ethersproject/bytes */ "./node_modules/@ethersproject/address/node_modules/@ethersproject/bytes/lib.esm/index.js");
|
|
748
|
-
/* harmony import */ var _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @ethersproject/logger */ "./node_modules/@ethersproject/address/node_modules/@ethersproject/logger/lib.esm/index.js");
|
|
749
|
-
/* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./_version */ "./node_modules/@ethersproject/address/node_modules/@ethersproject/bignumber/lib.esm/_version.js");
|
|
750
|
-
/* harmony import */ var _bignumber__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./bignumber */ "./node_modules/@ethersproject/address/node_modules/@ethersproject/bignumber/lib.esm/bignumber.js");
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
const logger = new _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__.Logger(_version__WEBPACK_IMPORTED_MODULE_2__.version);
|
|
756
|
-
|
|
757
|
-
const _constructorGuard = {};
|
|
758
|
-
const Zero = _bignumber__WEBPACK_IMPORTED_MODULE_3__.BigNumber.from(0);
|
|
759
|
-
const NegativeOne = _bignumber__WEBPACK_IMPORTED_MODULE_3__.BigNumber.from(-1);
|
|
760
|
-
function throwFault(message, fault, operation, value) {
|
|
761
|
-
const params = { fault: fault, operation: operation };
|
|
762
|
-
if (value !== undefined) {
|
|
763
|
-
params.value = value;
|
|
764
|
-
}
|
|
765
|
-
return logger.throwError(message, _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__.Logger.errors.NUMERIC_FAULT, params);
|
|
766
|
-
}
|
|
767
|
-
// Constant to pull zeros from for multipliers
|
|
768
|
-
let zeros = "0";
|
|
769
|
-
while (zeros.length < 256) {
|
|
770
|
-
zeros += zeros;
|
|
771
|
-
}
|
|
772
|
-
// Returns a string "1" followed by decimal "0"s
|
|
773
|
-
function getMultiplier(decimals) {
|
|
774
|
-
if (typeof (decimals) !== "number") {
|
|
775
|
-
try {
|
|
776
|
-
decimals = _bignumber__WEBPACK_IMPORTED_MODULE_3__.BigNumber.from(decimals).toNumber();
|
|
777
|
-
}
|
|
778
|
-
catch (e) { }
|
|
779
|
-
}
|
|
780
|
-
if (typeof (decimals) === "number" && decimals >= 0 && decimals <= 256 && !(decimals % 1)) {
|
|
781
|
-
return ("1" + zeros.substring(0, decimals));
|
|
782
|
-
}
|
|
783
|
-
return logger.throwArgumentError("invalid decimal size", "decimals", decimals);
|
|
784
|
-
}
|
|
785
|
-
function formatFixed(value, decimals) {
|
|
786
|
-
if (decimals == null) {
|
|
787
|
-
decimals = 0;
|
|
788
|
-
}
|
|
789
|
-
const multiplier = getMultiplier(decimals);
|
|
790
|
-
// Make sure wei is a big number (convert as necessary)
|
|
791
|
-
value = _bignumber__WEBPACK_IMPORTED_MODULE_3__.BigNumber.from(value);
|
|
792
|
-
const negative = value.lt(Zero);
|
|
793
|
-
if (negative) {
|
|
794
|
-
value = value.mul(NegativeOne);
|
|
795
|
-
}
|
|
796
|
-
let fraction = value.mod(multiplier).toString();
|
|
797
|
-
while (fraction.length < multiplier.length - 1) {
|
|
798
|
-
fraction = "0" + fraction;
|
|
799
|
-
}
|
|
800
|
-
// Strip training 0
|
|
801
|
-
fraction = fraction.match(/^([0-9]*[1-9]|0)(0*)/)[1];
|
|
802
|
-
const whole = value.div(multiplier).toString();
|
|
803
|
-
value = whole + "." + fraction;
|
|
804
|
-
if (negative) {
|
|
805
|
-
value = "-" + value;
|
|
806
|
-
}
|
|
807
|
-
return value;
|
|
808
|
-
}
|
|
809
|
-
function parseFixed(value, decimals) {
|
|
810
|
-
if (decimals == null) {
|
|
811
|
-
decimals = 0;
|
|
812
|
-
}
|
|
813
|
-
const multiplier = getMultiplier(decimals);
|
|
814
|
-
if (typeof (value) !== "string" || !value.match(/^-?[0-9.,]+$/)) {
|
|
815
|
-
logger.throwArgumentError("invalid decimal value", "value", value);
|
|
816
|
-
}
|
|
817
|
-
if (multiplier.length - 1 === 0) {
|
|
818
|
-
return _bignumber__WEBPACK_IMPORTED_MODULE_3__.BigNumber.from(value);
|
|
819
|
-
}
|
|
820
|
-
// Is it negative?
|
|
821
|
-
const negative = (value.substring(0, 1) === "-");
|
|
822
|
-
if (negative) {
|
|
823
|
-
value = value.substring(1);
|
|
824
|
-
}
|
|
825
|
-
if (value === ".") {
|
|
826
|
-
logger.throwArgumentError("missing value", "value", value);
|
|
827
|
-
}
|
|
828
|
-
// Split it into a whole and fractional part
|
|
829
|
-
const comps = value.split(".");
|
|
830
|
-
if (comps.length > 2) {
|
|
831
|
-
logger.throwArgumentError("too many decimal points", "value", value);
|
|
832
|
-
}
|
|
833
|
-
let whole = comps[0], fraction = comps[1];
|
|
834
|
-
if (!whole) {
|
|
835
|
-
whole = "0";
|
|
836
|
-
}
|
|
837
|
-
if (!fraction) {
|
|
838
|
-
fraction = "0";
|
|
839
|
-
}
|
|
840
|
-
// Prevent underflow
|
|
841
|
-
if (fraction.length > multiplier.length - 1) {
|
|
842
|
-
throwFault("fractional component exceeds decimals", "underflow", "parseFixed");
|
|
843
|
-
}
|
|
844
|
-
// Fully pad the string with zeros to get to wei
|
|
845
|
-
while (fraction.length < multiplier.length - 1) {
|
|
846
|
-
fraction += "0";
|
|
847
|
-
}
|
|
848
|
-
const wholeValue = _bignumber__WEBPACK_IMPORTED_MODULE_3__.BigNumber.from(whole);
|
|
849
|
-
const fractionValue = _bignumber__WEBPACK_IMPORTED_MODULE_3__.BigNumber.from(fraction);
|
|
850
|
-
let wei = (wholeValue.mul(multiplier)).add(fractionValue);
|
|
851
|
-
if (negative) {
|
|
852
|
-
wei = wei.mul(NegativeOne);
|
|
853
|
-
}
|
|
854
|
-
return wei;
|
|
855
|
-
}
|
|
856
|
-
class FixedFormat {
|
|
857
|
-
constructor(constructorGuard, signed, width, decimals) {
|
|
858
|
-
this.signed = signed;
|
|
859
|
-
this.width = width;
|
|
860
|
-
this.decimals = decimals;
|
|
861
|
-
this.name = (signed ? "" : "u") + "fixed" + String(width) + "x" + String(decimals);
|
|
862
|
-
this._multiplier = getMultiplier(decimals);
|
|
863
|
-
Object.freeze(this);
|
|
864
|
-
}
|
|
865
|
-
static from(value) {
|
|
866
|
-
if (value instanceof FixedFormat) {
|
|
867
|
-
return value;
|
|
868
|
-
}
|
|
869
|
-
let signed = true;
|
|
870
|
-
let width = 128;
|
|
871
|
-
let decimals = 18;
|
|
872
|
-
if (typeof (value) === "string") {
|
|
873
|
-
if (value === "fixed") {
|
|
874
|
-
// defaults...
|
|
875
|
-
}
|
|
876
|
-
else if (value === "ufixed") {
|
|
877
|
-
signed = false;
|
|
878
|
-
}
|
|
879
|
-
else if (value != null) {
|
|
880
|
-
const match = value.match(/^(u?)fixed([0-9]+)x([0-9]+)$/);
|
|
881
|
-
if (!match) {
|
|
882
|
-
logger.throwArgumentError("invalid fixed format", "format", value);
|
|
883
|
-
}
|
|
884
|
-
signed = (match[1] !== "u");
|
|
885
|
-
width = parseInt(match[2]);
|
|
886
|
-
decimals = parseInt(match[3]);
|
|
887
|
-
}
|
|
888
|
-
}
|
|
889
|
-
else if (value) {
|
|
890
|
-
const check = (key, type, defaultValue) => {
|
|
891
|
-
if (value[key] == null) {
|
|
892
|
-
return defaultValue;
|
|
893
|
-
}
|
|
894
|
-
if (typeof (value[key]) !== type) {
|
|
895
|
-
logger.throwArgumentError("invalid fixed format (" + key + " not " + type + ")", "format." + key, value[key]);
|
|
896
|
-
}
|
|
897
|
-
return value[key];
|
|
898
|
-
};
|
|
899
|
-
signed = check("signed", "boolean", signed);
|
|
900
|
-
width = check("width", "number", width);
|
|
901
|
-
decimals = check("decimals", "number", decimals);
|
|
902
|
-
}
|
|
903
|
-
if (width % 8) {
|
|
904
|
-
logger.throwArgumentError("invalid fixed format width (not byte aligned)", "format.width", width);
|
|
905
|
-
}
|
|
906
|
-
if (decimals > 80) {
|
|
907
|
-
logger.throwArgumentError("invalid fixed format (decimals too large)", "format.decimals", decimals);
|
|
908
|
-
}
|
|
909
|
-
return new FixedFormat(_constructorGuard, signed, width, decimals);
|
|
910
|
-
}
|
|
911
|
-
}
|
|
912
|
-
class FixedNumber {
|
|
913
|
-
constructor(constructorGuard, hex, value, format) {
|
|
914
|
-
logger.checkNew(new.target, FixedNumber);
|
|
915
|
-
this.format = format;
|
|
916
|
-
this._hex = hex;
|
|
917
|
-
this._value = value;
|
|
918
|
-
this._isFixedNumber = true;
|
|
919
|
-
Object.freeze(this);
|
|
920
|
-
}
|
|
921
|
-
_checkFormat(other) {
|
|
922
|
-
if (this.format.name !== other.format.name) {
|
|
923
|
-
logger.throwArgumentError("incompatible format; use fixedNumber.toFormat", "other", other);
|
|
924
|
-
}
|
|
925
|
-
}
|
|
926
|
-
addUnsafe(other) {
|
|
927
|
-
this._checkFormat(other);
|
|
928
|
-
const a = parseFixed(this._value, this.format.decimals);
|
|
929
|
-
const b = parseFixed(other._value, other.format.decimals);
|
|
930
|
-
return FixedNumber.fromValue(a.add(b), this.format.decimals, this.format);
|
|
931
|
-
}
|
|
932
|
-
subUnsafe(other) {
|
|
933
|
-
this._checkFormat(other);
|
|
934
|
-
const a = parseFixed(this._value, this.format.decimals);
|
|
935
|
-
const b = parseFixed(other._value, other.format.decimals);
|
|
936
|
-
return FixedNumber.fromValue(a.sub(b), this.format.decimals, this.format);
|
|
937
|
-
}
|
|
938
|
-
mulUnsafe(other) {
|
|
939
|
-
this._checkFormat(other);
|
|
940
|
-
const a = parseFixed(this._value, this.format.decimals);
|
|
941
|
-
const b = parseFixed(other._value, other.format.decimals);
|
|
942
|
-
return FixedNumber.fromValue(a.mul(b).div(this.format._multiplier), this.format.decimals, this.format);
|
|
943
|
-
}
|
|
944
|
-
divUnsafe(other) {
|
|
945
|
-
this._checkFormat(other);
|
|
946
|
-
const a = parseFixed(this._value, this.format.decimals);
|
|
947
|
-
const b = parseFixed(other._value, other.format.decimals);
|
|
948
|
-
return FixedNumber.fromValue(a.mul(this.format._multiplier).div(b), this.format.decimals, this.format);
|
|
949
|
-
}
|
|
950
|
-
// @TODO: Support other rounding algorithms
|
|
951
|
-
round(decimals) {
|
|
952
|
-
if (decimals == null) {
|
|
953
|
-
decimals = 0;
|
|
954
|
-
}
|
|
955
|
-
if (decimals < 0 || decimals > 80 || (decimals % 1)) {
|
|
956
|
-
logger.throwArgumentError("invalid decimal count", "decimals", decimals);
|
|
957
|
-
}
|
|
958
|
-
// If we are already in range, we're done
|
|
959
|
-
let comps = this.toString().split(".");
|
|
960
|
-
if (comps[1].length <= decimals) {
|
|
961
|
-
return this;
|
|
962
|
-
}
|
|
963
|
-
// Bump the value up by the 0.00...0005
|
|
964
|
-
const bump = "0." + zeros.substring(0, decimals) + "5";
|
|
965
|
-
comps = this.addUnsafe(FixedNumber.fromString(bump, this.format))._value.split(".");
|
|
966
|
-
// Now it is safe to truncate
|
|
967
|
-
return FixedNumber.fromString(comps[0] + "." + comps[1].substring(0, decimals));
|
|
968
|
-
}
|
|
969
|
-
toString() { return this._value; }
|
|
970
|
-
toHexString(width) {
|
|
971
|
-
if (width == null) {
|
|
972
|
-
return this._hex;
|
|
973
|
-
}
|
|
974
|
-
if (width % 8) {
|
|
975
|
-
logger.throwArgumentError("invalid byte width", "width", width);
|
|
976
|
-
}
|
|
977
|
-
const hex = _bignumber__WEBPACK_IMPORTED_MODULE_3__.BigNumber.from(this._hex).fromTwos(this.format.width).toTwos(width).toHexString();
|
|
978
|
-
return (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__.hexZeroPad)(hex, width / 8);
|
|
979
|
-
}
|
|
980
|
-
toUnsafeFloat() { return parseFloat(this.toString()); }
|
|
981
|
-
toFormat(format) {
|
|
982
|
-
return FixedNumber.fromString(this._value, format);
|
|
983
|
-
}
|
|
984
|
-
static fromValue(value, decimals, format) {
|
|
985
|
-
// If decimals looks more like a format, and there is no format, shift the parameters
|
|
986
|
-
if (format == null && decimals != null && !(0,_bignumber__WEBPACK_IMPORTED_MODULE_3__.isBigNumberish)(decimals)) {
|
|
987
|
-
format = decimals;
|
|
988
|
-
decimals = null;
|
|
989
|
-
}
|
|
990
|
-
if (decimals == null) {
|
|
991
|
-
decimals = 0;
|
|
992
|
-
}
|
|
993
|
-
if (format == null) {
|
|
994
|
-
format = "fixed";
|
|
995
|
-
}
|
|
996
|
-
return FixedNumber.fromString(formatFixed(value, decimals), FixedFormat.from(format));
|
|
997
|
-
}
|
|
998
|
-
static fromString(value, format) {
|
|
999
|
-
if (format == null) {
|
|
1000
|
-
format = "fixed";
|
|
1001
|
-
}
|
|
1002
|
-
const fixedFormat = FixedFormat.from(format);
|
|
1003
|
-
const numeric = parseFixed(value, fixedFormat.decimals);
|
|
1004
|
-
if (!fixedFormat.signed && numeric.lt(Zero)) {
|
|
1005
|
-
throwFault("unsigned value cannot be negative", "overflow", "value", value);
|
|
1006
|
-
}
|
|
1007
|
-
let hex = null;
|
|
1008
|
-
if (fixedFormat.signed) {
|
|
1009
|
-
hex = numeric.toTwos(fixedFormat.width).toHexString();
|
|
1010
|
-
}
|
|
1011
|
-
else {
|
|
1012
|
-
hex = numeric.toHexString();
|
|
1013
|
-
hex = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__.hexZeroPad)(hex, fixedFormat.width / 8);
|
|
1014
|
-
}
|
|
1015
|
-
const decimal = formatFixed(numeric, fixedFormat.decimals);
|
|
1016
|
-
return new FixedNumber(_constructorGuard, hex, decimal, fixedFormat);
|
|
1017
|
-
}
|
|
1018
|
-
static fromBytes(value, format) {
|
|
1019
|
-
if (format == null) {
|
|
1020
|
-
format = "fixed";
|
|
1021
|
-
}
|
|
1022
|
-
const fixedFormat = FixedFormat.from(format);
|
|
1023
|
-
if ((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__.arrayify)(value).length > fixedFormat.width / 8) {
|
|
1024
|
-
throw new Error("overflow");
|
|
1025
|
-
}
|
|
1026
|
-
let numeric = _bignumber__WEBPACK_IMPORTED_MODULE_3__.BigNumber.from(value);
|
|
1027
|
-
if (fixedFormat.signed) {
|
|
1028
|
-
numeric = numeric.fromTwos(fixedFormat.width);
|
|
1029
|
-
}
|
|
1030
|
-
const hex = numeric.toTwos((fixedFormat.signed ? 0 : 1) + fixedFormat.width).toHexString();
|
|
1031
|
-
const decimal = formatFixed(numeric, fixedFormat.decimals);
|
|
1032
|
-
return new FixedNumber(_constructorGuard, hex, decimal, fixedFormat);
|
|
1033
|
-
}
|
|
1034
|
-
static from(value, format) {
|
|
1035
|
-
if (typeof (value) === "string") {
|
|
1036
|
-
return FixedNumber.fromString(value, format);
|
|
1037
|
-
}
|
|
1038
|
-
if ((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__.isBytes)(value)) {
|
|
1039
|
-
return FixedNumber.fromBytes(value, format);
|
|
1040
|
-
}
|
|
1041
|
-
try {
|
|
1042
|
-
return FixedNumber.fromValue(value, 0, format);
|
|
1043
|
-
}
|
|
1044
|
-
catch (error) {
|
|
1045
|
-
// Allow NUMERIC_FAULT to bubble up
|
|
1046
|
-
if (error.code !== _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__.Logger.errors.INVALID_ARGUMENT) {
|
|
1047
|
-
throw error;
|
|
1048
|
-
}
|
|
1049
|
-
}
|
|
1050
|
-
return logger.throwArgumentError("invalid FixedNumber value", "value", value);
|
|
1051
|
-
}
|
|
1052
|
-
static isFixedNumber(value) {
|
|
1053
|
-
return !!(value && value._isFixedNumber);
|
|
1054
|
-
}
|
|
1055
|
-
}
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
/***/ }),
|
|
1059
|
-
|
|
1060
|
-
/***/ "./node_modules/@ethersproject/address/node_modules/@ethersproject/bignumber/lib.esm/index.js":
|
|
1061
|
-
/*!****************************************************************************************************!*\
|
|
1062
|
-
!*** ./node_modules/@ethersproject/address/node_modules/@ethersproject/bignumber/lib.esm/index.js ***!
|
|
1063
|
-
\****************************************************************************************************/
|
|
1064
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
1065
|
-
|
|
1066
|
-
"use strict";
|
|
1067
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1068
|
-
/* harmony export */ BigNumber: () => (/* reexport safe */ _bignumber__WEBPACK_IMPORTED_MODULE_0__.BigNumber)
|
|
1069
|
-
/* harmony export */ });
|
|
1070
|
-
/* harmony import */ var _bignumber__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./bignumber */ "./node_modules/@ethersproject/address/node_modules/@ethersproject/bignumber/lib.esm/bignumber.js");
|
|
1071
|
-
/* harmony import */ var _fixednumber__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./fixednumber */ "./node_modules/@ethersproject/address/node_modules/@ethersproject/bignumber/lib.esm/fixednumber.js");
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
/***/ }),
|
|
1077
|
-
|
|
1078
|
-
/***/ "./node_modules/@ethersproject/address/node_modules/@ethersproject/bytes/lib.esm/_version.js":
|
|
1079
|
-
/*!***************************************************************************************************!*\
|
|
1080
|
-
!*** ./node_modules/@ethersproject/address/node_modules/@ethersproject/bytes/lib.esm/_version.js ***!
|
|
1081
|
-
\***************************************************************************************************/
|
|
1082
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
1083
|
-
|
|
1084
|
-
"use strict";
|
|
1085
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1086
|
-
/* harmony export */ version: () => (/* binding */ version)
|
|
1087
|
-
/* harmony export */ });
|
|
1088
|
-
const version = "bytes/5.0.1";
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
/***/ }),
|
|
1092
|
-
|
|
1093
|
-
/***/ "./node_modules/@ethersproject/address/node_modules/@ethersproject/bytes/lib.esm/index.js":
|
|
1094
|
-
/*!************************************************************************************************!*\
|
|
1095
|
-
!*** ./node_modules/@ethersproject/address/node_modules/@ethersproject/bytes/lib.esm/index.js ***!
|
|
1096
|
-
\************************************************************************************************/
|
|
1097
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
1098
|
-
|
|
1099
|
-
"use strict";
|
|
1100
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1101
|
-
/* harmony export */ arrayify: () => (/* binding */ arrayify),
|
|
1102
|
-
/* harmony export */ concat: () => (/* binding */ concat),
|
|
1103
|
-
/* harmony export */ hexDataLength: () => (/* binding */ hexDataLength),
|
|
1104
|
-
/* harmony export */ hexDataSlice: () => (/* binding */ hexDataSlice),
|
|
1105
|
-
/* harmony export */ hexZeroPad: () => (/* binding */ hexZeroPad),
|
|
1106
|
-
/* harmony export */ hexlify: () => (/* binding */ hexlify),
|
|
1107
|
-
/* harmony export */ isBytes: () => (/* binding */ isBytes),
|
|
1108
|
-
/* harmony export */ isBytesLike: () => (/* binding */ isBytesLike),
|
|
1109
|
-
/* harmony export */ isHexString: () => (/* binding */ isHexString),
|
|
1110
|
-
/* harmony export */ stripZeros: () => (/* binding */ stripZeros)
|
|
1111
|
-
/* harmony export */ });
|
|
1112
|
-
/* unused harmony exports zeroPad, hexConcat, hexValue, hexStripZeros, splitSignature, joinSignature */
|
|
1113
|
-
/* harmony import */ var _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ethersproject/logger */ "./node_modules/@ethersproject/address/node_modules/@ethersproject/logger/lib.esm/index.js");
|
|
1114
|
-
/* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./_version */ "./node_modules/@ethersproject/address/node_modules/@ethersproject/bytes/lib.esm/_version.js");
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
const logger = new _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger(_version__WEBPACK_IMPORTED_MODULE_1__.version);
|
|
1119
|
-
///////////////////////////////
|
|
1120
|
-
function isHexable(value) {
|
|
1121
|
-
return !!(value.toHexString);
|
|
1122
|
-
}
|
|
1123
|
-
function addSlice(array) {
|
|
1124
|
-
if (array.slice) {
|
|
1125
|
-
return array;
|
|
1126
|
-
}
|
|
1127
|
-
array.slice = function () {
|
|
1128
|
-
const args = Array.prototype.slice.call(arguments);
|
|
1129
|
-
return addSlice(new Uint8Array(Array.prototype.slice.apply(array, args)));
|
|
1130
|
-
};
|
|
1131
|
-
return array;
|
|
1132
|
-
}
|
|
1133
|
-
function isBytesLike(value) {
|
|
1134
|
-
return ((isHexString(value) && !(value.length % 2)) || isBytes(value));
|
|
1135
|
-
}
|
|
1136
|
-
function isBytes(value) {
|
|
1137
|
-
if (value == null) {
|
|
1138
|
-
return false;
|
|
1139
|
-
}
|
|
1140
|
-
if (value.constructor === Uint8Array) {
|
|
1141
|
-
return true;
|
|
1142
|
-
}
|
|
1143
|
-
if (typeof (value) === "string") {
|
|
1144
|
-
return false;
|
|
1145
|
-
}
|
|
1146
|
-
if (value.length == null) {
|
|
1147
|
-
return false;
|
|
1148
|
-
}
|
|
1149
|
-
for (let i = 0; i < value.length; i++) {
|
|
1150
|
-
const v = value[i];
|
|
1151
|
-
if (v < 0 || v >= 256 || (v % 1)) {
|
|
1152
|
-
return false;
|
|
1153
|
-
}
|
|
1154
|
-
}
|
|
1155
|
-
return true;
|
|
1156
|
-
}
|
|
1157
|
-
function arrayify(value, options) {
|
|
1158
|
-
if (!options) {
|
|
1159
|
-
options = {};
|
|
1160
|
-
}
|
|
1161
|
-
if (typeof (value) === "number") {
|
|
1162
|
-
logger.checkSafeUint53(value, "invalid arrayify value");
|
|
1163
|
-
const result = [];
|
|
1164
|
-
while (value) {
|
|
1165
|
-
result.unshift(value & 0xff);
|
|
1166
|
-
value = parseInt(String(value / 256));
|
|
1167
|
-
}
|
|
1168
|
-
if (result.length === 0) {
|
|
1169
|
-
result.push(0);
|
|
1170
|
-
}
|
|
1171
|
-
return addSlice(new Uint8Array(result));
|
|
1172
|
-
}
|
|
1173
|
-
if (options.allowMissingPrefix && typeof (value) === "string" && value.substring(0, 2) !== "0x") {
|
|
1174
|
-
value = "0x" + value;
|
|
1175
|
-
}
|
|
1176
|
-
if (isHexable(value)) {
|
|
1177
|
-
value = value.toHexString();
|
|
1178
|
-
}
|
|
1179
|
-
if (isHexString(value)) {
|
|
1180
|
-
let hex = value.substring(2);
|
|
1181
|
-
if (hex.length % 2) {
|
|
1182
|
-
if (options.hexPad === "left") {
|
|
1183
|
-
hex = "0x0" + hex.substring(2);
|
|
1184
|
-
}
|
|
1185
|
-
else if (options.hexPad === "right") {
|
|
1186
|
-
hex += "0";
|
|
1187
|
-
}
|
|
1188
|
-
else {
|
|
1189
|
-
logger.throwArgumentError("hex data is odd-length", "value", value);
|
|
1190
|
-
}
|
|
1191
|
-
}
|
|
1192
|
-
const result = [];
|
|
1193
|
-
for (let i = 0; i < hex.length; i += 2) {
|
|
1194
|
-
result.push(parseInt(hex.substring(i, i + 2), 16));
|
|
1195
|
-
}
|
|
1196
|
-
return addSlice(new Uint8Array(result));
|
|
1197
|
-
}
|
|
1198
|
-
if (isBytes(value)) {
|
|
1199
|
-
return addSlice(new Uint8Array(value));
|
|
1200
|
-
}
|
|
1201
|
-
return logger.throwArgumentError("invalid arrayify value", "value", value);
|
|
1202
|
-
}
|
|
1203
|
-
function concat(items) {
|
|
1204
|
-
const objects = items.map(item => arrayify(item));
|
|
1205
|
-
const length = objects.reduce((accum, item) => (accum + item.length), 0);
|
|
1206
|
-
const result = new Uint8Array(length);
|
|
1207
|
-
objects.reduce((offset, object) => {
|
|
1208
|
-
result.set(object, offset);
|
|
1209
|
-
return offset + object.length;
|
|
1210
|
-
}, 0);
|
|
1211
|
-
return addSlice(result);
|
|
1212
|
-
}
|
|
1213
|
-
function stripZeros(value) {
|
|
1214
|
-
let result = arrayify(value);
|
|
1215
|
-
if (result.length === 0) {
|
|
1216
|
-
return result;
|
|
1217
|
-
}
|
|
1218
|
-
// Find the first non-zero entry
|
|
1219
|
-
let start = 0;
|
|
1220
|
-
while (start < result.length && result[start] === 0) {
|
|
1221
|
-
start++;
|
|
1222
|
-
}
|
|
1223
|
-
// If we started with zeros, strip them
|
|
1224
|
-
if (start) {
|
|
1225
|
-
result = result.slice(start);
|
|
1226
|
-
}
|
|
1227
|
-
return result;
|
|
1228
|
-
}
|
|
1229
|
-
function zeroPad(value, length) {
|
|
1230
|
-
value = arrayify(value);
|
|
1231
|
-
if (value.length > length) {
|
|
1232
|
-
logger.throwArgumentError("value out of range", "value", arguments[0]);
|
|
1233
|
-
}
|
|
1234
|
-
const result = new Uint8Array(length);
|
|
1235
|
-
result.set(value, length - value.length);
|
|
1236
|
-
return addSlice(result);
|
|
1237
|
-
}
|
|
1238
|
-
function isHexString(value, length) {
|
|
1239
|
-
if (typeof (value) !== "string" || !value.match(/^0x[0-9A-Fa-f]*$/)) {
|
|
1240
|
-
return false;
|
|
1241
|
-
}
|
|
1242
|
-
if (length && value.length !== 2 + 2 * length) {
|
|
1243
|
-
return false;
|
|
1244
|
-
}
|
|
1245
|
-
return true;
|
|
1246
|
-
}
|
|
1247
|
-
const HexCharacters = "0123456789abcdef";
|
|
1248
|
-
function hexlify(value, options) {
|
|
1249
|
-
if (!options) {
|
|
1250
|
-
options = {};
|
|
1251
|
-
}
|
|
1252
|
-
if (typeof (value) === "number") {
|
|
1253
|
-
logger.checkSafeUint53(value, "invalid hexlify value");
|
|
1254
|
-
let hex = "";
|
|
1255
|
-
while (value) {
|
|
1256
|
-
hex = HexCharacters[value & 0x0f] + hex;
|
|
1257
|
-
value = Math.floor(value / 16);
|
|
1258
|
-
}
|
|
1259
|
-
if (hex.length) {
|
|
1260
|
-
if (hex.length % 2) {
|
|
1261
|
-
hex = "0" + hex;
|
|
1262
|
-
}
|
|
1263
|
-
return "0x" + hex;
|
|
1264
|
-
}
|
|
1265
|
-
return "0x00";
|
|
1266
|
-
}
|
|
1267
|
-
if (options.allowMissingPrefix && typeof (value) === "string" && value.substring(0, 2) !== "0x") {
|
|
1268
|
-
value = "0x" + value;
|
|
1269
|
-
}
|
|
1270
|
-
if (isHexable(value)) {
|
|
1271
|
-
return value.toHexString();
|
|
1272
|
-
}
|
|
1273
|
-
if (isHexString(value)) {
|
|
1274
|
-
if (value.length % 2) {
|
|
1275
|
-
if (options.hexPad === "left") {
|
|
1276
|
-
value = "0x0" + value.substring(2);
|
|
1277
|
-
}
|
|
1278
|
-
else if (options.hexPad === "right") {
|
|
1279
|
-
value += "0";
|
|
1280
|
-
}
|
|
1281
|
-
else {
|
|
1282
|
-
logger.throwArgumentError("hex data is odd-length", "value", value);
|
|
1283
|
-
}
|
|
1284
|
-
}
|
|
1285
|
-
return value.toLowerCase();
|
|
1286
|
-
}
|
|
1287
|
-
if (isBytes(value)) {
|
|
1288
|
-
let result = "0x";
|
|
1289
|
-
for (let i = 0; i < value.length; i++) {
|
|
1290
|
-
let v = value[i];
|
|
1291
|
-
result += HexCharacters[(v & 0xf0) >> 4] + HexCharacters[v & 0x0f];
|
|
1292
|
-
}
|
|
1293
|
-
return result;
|
|
1294
|
-
}
|
|
1295
|
-
return logger.throwArgumentError("invalid hexlify value", "value", value);
|
|
1296
|
-
}
|
|
1297
|
-
/*
|
|
1298
|
-
function unoddify(value: BytesLike | Hexable | number): BytesLike | Hexable | number {
|
|
1299
|
-
if (typeof(value) === "string" && value.length % 2 && value.substring(0, 2) === "0x") {
|
|
1300
|
-
return "0x0" + value.substring(2);
|
|
1301
|
-
}
|
|
1302
|
-
return value;
|
|
1303
|
-
}
|
|
1304
|
-
*/
|
|
1305
|
-
function hexDataLength(data) {
|
|
1306
|
-
if (typeof (data) !== "string") {
|
|
1307
|
-
data = hexlify(data);
|
|
1308
|
-
}
|
|
1309
|
-
else if (!isHexString(data) || (data.length % 2)) {
|
|
1310
|
-
return null;
|
|
1311
|
-
}
|
|
1312
|
-
return (data.length - 2) / 2;
|
|
1313
|
-
}
|
|
1314
|
-
function hexDataSlice(data, offset, endOffset) {
|
|
1315
|
-
if (typeof (data) !== "string") {
|
|
1316
|
-
data = hexlify(data);
|
|
1317
|
-
}
|
|
1318
|
-
else if (!isHexString(data) || (data.length % 2)) {
|
|
1319
|
-
logger.throwArgumentError("invalid hexData", "value", data);
|
|
1320
|
-
}
|
|
1321
|
-
offset = 2 + 2 * offset;
|
|
1322
|
-
if (endOffset != null) {
|
|
1323
|
-
return "0x" + data.substring(offset, 2 + 2 * endOffset);
|
|
373
|
+
checksum = "0" + checksum;
|
|
1324
374
|
}
|
|
1325
|
-
return
|
|
1326
|
-
}
|
|
1327
|
-
function hexConcat(items) {
|
|
1328
|
-
let result = "0x";
|
|
1329
|
-
items.forEach((item) => {
|
|
1330
|
-
result += hexlify(item).substring(2);
|
|
1331
|
-
});
|
|
1332
|
-
return result;
|
|
375
|
+
return checksum;
|
|
1333
376
|
}
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
377
|
+
;
|
|
378
|
+
function getAddress(address) {
|
|
379
|
+
let result = null;
|
|
380
|
+
if (typeof (address) !== "string") {
|
|
381
|
+
logger.throwArgumentError("invalid address", "address", address);
|
|
1338
382
|
}
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
383
|
+
if (address.match(/^(0x)?[0-9a-fA-F]{40}$/)) {
|
|
384
|
+
// Missing the 0x prefix
|
|
385
|
+
if (address.substring(0, 2) !== "0x") {
|
|
386
|
+
address = "0x" + address;
|
|
387
|
+
}
|
|
388
|
+
result = getChecksumAddress(address);
|
|
389
|
+
// It is a checksummed address with a bad checksum
|
|
390
|
+
if (address.match(/([A-F].*[a-f])|([a-f].*[A-F])/) && result !== address) {
|
|
391
|
+
logger.throwArgumentError("bad address checksum", "address", address);
|
|
392
|
+
}
|
|
393
|
+
// Maybe ICAP? (we only support direct mode)
|
|
1344
394
|
}
|
|
1345
|
-
if (
|
|
1346
|
-
|
|
395
|
+
else if (address.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)) {
|
|
396
|
+
// It is an ICAP address with a bad checksum
|
|
397
|
+
if (address.substring(2, 4) !== ibanChecksum(address)) {
|
|
398
|
+
logger.throwArgumentError("bad icap checksum", "address", address);
|
|
399
|
+
}
|
|
400
|
+
result = (0,_ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_4__._base36To16)(address.substring(4));
|
|
401
|
+
while (result.length < 40) {
|
|
402
|
+
result = "0" + result;
|
|
403
|
+
}
|
|
404
|
+
result = getChecksumAddress("0x" + result);
|
|
1347
405
|
}
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
while (offset < value.length && value[offset] === "0") {
|
|
1351
|
-
offset++;
|
|
406
|
+
else {
|
|
407
|
+
logger.throwArgumentError("invalid address", "address", address);
|
|
1352
408
|
}
|
|
1353
|
-
return
|
|
409
|
+
return result;
|
|
1354
410
|
}
|
|
1355
|
-
function
|
|
1356
|
-
|
|
1357
|
-
|
|
411
|
+
function isAddress(address) {
|
|
412
|
+
try {
|
|
413
|
+
getAddress(address);
|
|
414
|
+
return true;
|
|
1358
415
|
}
|
|
1359
|
-
|
|
1360
|
-
|
|
416
|
+
catch (error) { }
|
|
417
|
+
return false;
|
|
418
|
+
}
|
|
419
|
+
function getIcapAddress(address) {
|
|
420
|
+
let base36 = (0,_ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_4__._base16To36)(getAddress(address).substring(2)).toUpperCase();
|
|
421
|
+
while (base36.length < 30) {
|
|
422
|
+
base36 = "0" + base36;
|
|
1361
423
|
}
|
|
1362
|
-
|
|
1363
|
-
|
|
424
|
+
return "XE" + ibanChecksum("XE00" + base36) + base36;
|
|
425
|
+
}
|
|
426
|
+
// http://ethereum.stackexchange.com/questions/760/how-is-the-address-of-an-ethereum-contract-computed
|
|
427
|
+
function getContractAddress(transaction) {
|
|
428
|
+
let from = null;
|
|
429
|
+
try {
|
|
430
|
+
from = getAddress(transaction.from);
|
|
1364
431
|
}
|
|
1365
|
-
|
|
1366
|
-
|
|
432
|
+
catch (error) {
|
|
433
|
+
logger.throwArgumentError("missing from address", "transaction", transaction);
|
|
1367
434
|
}
|
|
1368
|
-
|
|
435
|
+
const nonce = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__.stripZeros)((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__.arrayify)(_ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_4__.BigNumber.from(transaction.nonce).toHexString()));
|
|
436
|
+
return getAddress((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__.hexDataSlice)((0,_ethersproject_keccak256__WEBPACK_IMPORTED_MODULE_3__.keccak256)((0,_ethersproject_rlp__WEBPACK_IMPORTED_MODULE_5__.encode)([from, nonce])), 12));
|
|
1369
437
|
}
|
|
1370
|
-
function
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
s: "0x",
|
|
1374
|
-
_vs: "0x",
|
|
1375
|
-
recoveryParam: 0,
|
|
1376
|
-
v: 0
|
|
1377
|
-
};
|
|
1378
|
-
if (isBytesLike(signature)) {
|
|
1379
|
-
const bytes = arrayify(signature);
|
|
1380
|
-
if (bytes.length !== 65) {
|
|
1381
|
-
logger.throwArgumentError("invalid signature string; must be 65 bytes", "signature", signature);
|
|
1382
|
-
}
|
|
1383
|
-
// Get the r, s and v
|
|
1384
|
-
result.r = hexlify(bytes.slice(0, 32));
|
|
1385
|
-
result.s = hexlify(bytes.slice(32, 64));
|
|
1386
|
-
result.v = bytes[64];
|
|
1387
|
-
// Compute recoveryParam from v
|
|
1388
|
-
result.recoveryParam = 1 - (result.v % 2);
|
|
1389
|
-
// Allow a recid to be used as the v
|
|
1390
|
-
if (result.v < 27) {
|
|
1391
|
-
if (result.v === 0 || result.v === 1) {
|
|
1392
|
-
result.v += 27;
|
|
1393
|
-
}
|
|
1394
|
-
else {
|
|
1395
|
-
logger.throwArgumentError("signature invalid v byte", "signature", signature);
|
|
1396
|
-
}
|
|
1397
|
-
}
|
|
1398
|
-
// Compute _vs from recoveryParam and s
|
|
1399
|
-
if (result.recoveryParam) {
|
|
1400
|
-
bytes[32] |= 0x80;
|
|
1401
|
-
}
|
|
1402
|
-
result._vs = hexlify(bytes.slice(32, 64));
|
|
438
|
+
function getCreate2Address(from, salt, initCodeHash) {
|
|
439
|
+
if ((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__.hexDataLength)(salt) !== 32) {
|
|
440
|
+
logger.throwArgumentError("salt must be 32 bytes", "salt", salt);
|
|
1403
441
|
}
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
result.s = signature.s;
|
|
1407
|
-
result.v = signature.v;
|
|
1408
|
-
result.recoveryParam = signature.recoveryParam;
|
|
1409
|
-
result._vs = signature._vs;
|
|
1410
|
-
// If the _vs is available, use it to populate missing s, v and recoveryParam
|
|
1411
|
-
// and verify non-missing s, v and recoveryParam
|
|
1412
|
-
if (result._vs != null) {
|
|
1413
|
-
const vs = zeroPad(arrayify(result._vs), 32);
|
|
1414
|
-
result._vs = hexlify(vs);
|
|
1415
|
-
// Set or check the recid
|
|
1416
|
-
const recoveryParam = ((vs[0] >= 128) ? 1 : 0);
|
|
1417
|
-
if (result.recoveryParam == null) {
|
|
1418
|
-
result.recoveryParam = recoveryParam;
|
|
1419
|
-
}
|
|
1420
|
-
else if (result.recoveryParam !== recoveryParam) {
|
|
1421
|
-
logger.throwArgumentError("signature recoveryParam mismatch _vs", "signature", signature);
|
|
1422
|
-
}
|
|
1423
|
-
// Set or check the s
|
|
1424
|
-
vs[0] &= 0x7f;
|
|
1425
|
-
const s = hexlify(vs);
|
|
1426
|
-
if (result.s == null) {
|
|
1427
|
-
result.s = s;
|
|
1428
|
-
}
|
|
1429
|
-
else if (result.s !== s) {
|
|
1430
|
-
logger.throwArgumentError("signature v mismatch _vs", "signature", signature);
|
|
1431
|
-
}
|
|
1432
|
-
}
|
|
1433
|
-
// Use recid and v to populate each other
|
|
1434
|
-
if (result.recoveryParam == null) {
|
|
1435
|
-
if (result.v == null) {
|
|
1436
|
-
logger.throwArgumentError("signature missing v and recoveryParam", "signature", signature);
|
|
1437
|
-
}
|
|
1438
|
-
else {
|
|
1439
|
-
result.recoveryParam = 1 - (result.v % 2);
|
|
1440
|
-
}
|
|
1441
|
-
}
|
|
1442
|
-
else {
|
|
1443
|
-
if (result.v == null) {
|
|
1444
|
-
result.v = 27 + result.recoveryParam;
|
|
1445
|
-
}
|
|
1446
|
-
else if (result.recoveryParam !== (1 - (result.v % 2))) {
|
|
1447
|
-
logger.throwArgumentError("signature recoveryParam mismatch v", "signature", signature);
|
|
1448
|
-
}
|
|
1449
|
-
}
|
|
1450
|
-
if (result.r == null || !isHexString(result.r)) {
|
|
1451
|
-
logger.throwArgumentError("signature missing or invalid r", "signature", signature);
|
|
1452
|
-
}
|
|
1453
|
-
else {
|
|
1454
|
-
result.r = hexZeroPad(result.r, 32);
|
|
1455
|
-
}
|
|
1456
|
-
if (result.s == null || !isHexString(result.s)) {
|
|
1457
|
-
logger.throwArgumentError("signature missing or invalid s", "signature", signature);
|
|
1458
|
-
}
|
|
1459
|
-
else {
|
|
1460
|
-
result.s = hexZeroPad(result.s, 32);
|
|
1461
|
-
}
|
|
1462
|
-
const vs = arrayify(result.s);
|
|
1463
|
-
if (vs[0] >= 128) {
|
|
1464
|
-
logger.throwArgumentError("signature s out of range", "signature", signature);
|
|
1465
|
-
}
|
|
1466
|
-
if (result.recoveryParam) {
|
|
1467
|
-
vs[0] |= 0x80;
|
|
1468
|
-
}
|
|
1469
|
-
const _vs = hexlify(vs);
|
|
1470
|
-
if (result._vs) {
|
|
1471
|
-
if (!isHexString(result._vs)) {
|
|
1472
|
-
logger.throwArgumentError("signature invalid _vs", "signature", signature);
|
|
1473
|
-
}
|
|
1474
|
-
result._vs = hexZeroPad(result._vs, 32);
|
|
1475
|
-
}
|
|
1476
|
-
// Set or check the _vs
|
|
1477
|
-
if (result._vs == null) {
|
|
1478
|
-
result._vs = _vs;
|
|
1479
|
-
}
|
|
1480
|
-
else if (result._vs !== _vs) {
|
|
1481
|
-
logger.throwArgumentError("signature _vs mismatch v and s", "signature", signature);
|
|
1482
|
-
}
|
|
442
|
+
if ((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__.hexDataLength)(initCodeHash) !== 32) {
|
|
443
|
+
logger.throwArgumentError("initCodeHash must be 32 bytes", "initCodeHash", initCodeHash);
|
|
1483
444
|
}
|
|
1484
|
-
return
|
|
1485
|
-
}
|
|
1486
|
-
function joinSignature(signature) {
|
|
1487
|
-
signature = splitSignature(signature);
|
|
1488
|
-
return hexlify(concat([
|
|
1489
|
-
signature.r,
|
|
1490
|
-
signature.s,
|
|
1491
|
-
(signature.recoveryParam ? "0x1c" : "0x1b")
|
|
1492
|
-
]));
|
|
445
|
+
return getAddress((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__.hexDataSlice)((0,_ethersproject_keccak256__WEBPACK_IMPORTED_MODULE_3__.keccak256)((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__.concat)(["0xff", getAddress(from), salt, initCodeHash])), 12));
|
|
1493
446
|
}
|
|
1494
|
-
|
|
447
|
+
//# sourceMappingURL=index.js.map
|
|
1495
448
|
|
|
1496
449
|
/***/ }),
|
|
1497
450
|
|
|
@@ -1507,7 +460,7 @@ function joinSignature(signature) {
|
|
|
1507
460
|
/* harmony export */ });
|
|
1508
461
|
/* harmony import */ var js_sha3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! js-sha3 */ "./node_modules/@ethersproject/address/node_modules/js-sha3/src/sha3.js");
|
|
1509
462
|
/* harmony import */ var js_sha3__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(js_sha3__WEBPACK_IMPORTED_MODULE_0__);
|
|
1510
|
-
/* harmony import */ var _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @ethersproject/bytes */ "./node_modules/@ethersproject/
|
|
463
|
+
/* harmony import */ var _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @ethersproject/bytes */ "./node_modules/@ethersproject/bytes/lib.esm/index.js");
|
|
1511
464
|
|
|
1512
465
|
|
|
1513
466
|
|
|
@@ -1516,318 +469,6 @@ function keccak256(data) {
|
|
|
1516
469
|
}
|
|
1517
470
|
//# sourceMappingURL=index.js.map
|
|
1518
471
|
|
|
1519
|
-
/***/ }),
|
|
1520
|
-
|
|
1521
|
-
/***/ "./node_modules/@ethersproject/address/node_modules/@ethersproject/logger/lib.esm/_version.js":
|
|
1522
|
-
/*!****************************************************************************************************!*\
|
|
1523
|
-
!*** ./node_modules/@ethersproject/address/node_modules/@ethersproject/logger/lib.esm/_version.js ***!
|
|
1524
|
-
\****************************************************************************************************/
|
|
1525
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
1526
|
-
|
|
1527
|
-
"use strict";
|
|
1528
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1529
|
-
/* harmony export */ version: () => (/* binding */ version)
|
|
1530
|
-
/* harmony export */ });
|
|
1531
|
-
const version = "logger/5.0.2";
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
/***/ }),
|
|
1535
|
-
|
|
1536
|
-
/***/ "./node_modules/@ethersproject/address/node_modules/@ethersproject/logger/lib.esm/index.js":
|
|
1537
|
-
/*!*************************************************************************************************!*\
|
|
1538
|
-
!*** ./node_modules/@ethersproject/address/node_modules/@ethersproject/logger/lib.esm/index.js ***!
|
|
1539
|
-
\*************************************************************************************************/
|
|
1540
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
1541
|
-
|
|
1542
|
-
"use strict";
|
|
1543
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1544
|
-
/* harmony export */ Logger: () => (/* binding */ Logger)
|
|
1545
|
-
/* harmony export */ });
|
|
1546
|
-
/* unused harmony exports LogLevel, ErrorCode */
|
|
1547
|
-
/* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./_version */ "./node_modules/@ethersproject/address/node_modules/@ethersproject/logger/lib.esm/_version.js");
|
|
1548
|
-
|
|
1549
|
-
let _permanentCensorErrors = false;
|
|
1550
|
-
let _censorErrors = false;
|
|
1551
|
-
const LogLevels = { debug: 1, "default": 2, info: 2, warning: 3, error: 4, off: 5 };
|
|
1552
|
-
let _logLevel = LogLevels["default"];
|
|
1553
|
-
|
|
1554
|
-
let _globalLogger = null;
|
|
1555
|
-
function _checkNormalize() {
|
|
1556
|
-
try {
|
|
1557
|
-
const missing = [];
|
|
1558
|
-
// Make sure all forms of normalization are supported
|
|
1559
|
-
["NFD", "NFC", "NFKD", "NFKC"].forEach((form) => {
|
|
1560
|
-
try {
|
|
1561
|
-
if ("test".normalize(form) !== "test") {
|
|
1562
|
-
throw new Error("bad normalize");
|
|
1563
|
-
}
|
|
1564
|
-
;
|
|
1565
|
-
}
|
|
1566
|
-
catch (error) {
|
|
1567
|
-
missing.push(form);
|
|
1568
|
-
}
|
|
1569
|
-
});
|
|
1570
|
-
if (missing.length) {
|
|
1571
|
-
throw new Error("missing " + missing.join(", "));
|
|
1572
|
-
}
|
|
1573
|
-
if (String.fromCharCode(0xe9).normalize("NFD") !== String.fromCharCode(0x65, 0x0301)) {
|
|
1574
|
-
throw new Error("broken implementation");
|
|
1575
|
-
}
|
|
1576
|
-
}
|
|
1577
|
-
catch (error) {
|
|
1578
|
-
return error.message;
|
|
1579
|
-
}
|
|
1580
|
-
return null;
|
|
1581
|
-
}
|
|
1582
|
-
const _normalizeError = _checkNormalize();
|
|
1583
|
-
var LogLevel;
|
|
1584
|
-
(function (LogLevel) {
|
|
1585
|
-
LogLevel["DEBUG"] = "DEBUG";
|
|
1586
|
-
LogLevel["INFO"] = "INFO";
|
|
1587
|
-
LogLevel["WARNING"] = "WARNING";
|
|
1588
|
-
LogLevel["ERROR"] = "ERROR";
|
|
1589
|
-
LogLevel["OFF"] = "OFF";
|
|
1590
|
-
})(LogLevel || (LogLevel = {}));
|
|
1591
|
-
var ErrorCode;
|
|
1592
|
-
(function (ErrorCode) {
|
|
1593
|
-
///////////////////
|
|
1594
|
-
// Generic Errors
|
|
1595
|
-
// Unknown Error
|
|
1596
|
-
ErrorCode["UNKNOWN_ERROR"] = "UNKNOWN_ERROR";
|
|
1597
|
-
// Not Implemented
|
|
1598
|
-
ErrorCode["NOT_IMPLEMENTED"] = "NOT_IMPLEMENTED";
|
|
1599
|
-
// Unsupported Operation
|
|
1600
|
-
// - operation
|
|
1601
|
-
ErrorCode["UNSUPPORTED_OPERATION"] = "UNSUPPORTED_OPERATION";
|
|
1602
|
-
// Network Error (i.e. Ethereum Network, such as an invalid chain ID)
|
|
1603
|
-
// - event ("noNetwork" is not re-thrown in provider.ready; otherwise thrown)
|
|
1604
|
-
ErrorCode["NETWORK_ERROR"] = "NETWORK_ERROR";
|
|
1605
|
-
// Some sort of bad response from the server
|
|
1606
|
-
ErrorCode["SERVER_ERROR"] = "SERVER_ERROR";
|
|
1607
|
-
// Timeout
|
|
1608
|
-
ErrorCode["TIMEOUT"] = "TIMEOUT";
|
|
1609
|
-
///////////////////
|
|
1610
|
-
// Operational Errors
|
|
1611
|
-
// Buffer Overrun
|
|
1612
|
-
ErrorCode["BUFFER_OVERRUN"] = "BUFFER_OVERRUN";
|
|
1613
|
-
// Numeric Fault
|
|
1614
|
-
// - operation: the operation being executed
|
|
1615
|
-
// - fault: the reason this faulted
|
|
1616
|
-
ErrorCode["NUMERIC_FAULT"] = "NUMERIC_FAULT";
|
|
1617
|
-
///////////////////
|
|
1618
|
-
// Argument Errors
|
|
1619
|
-
// Missing new operator to an object
|
|
1620
|
-
// - name: The name of the class
|
|
1621
|
-
ErrorCode["MISSING_NEW"] = "MISSING_NEW";
|
|
1622
|
-
// Invalid argument (e.g. value is incompatible with type) to a function:
|
|
1623
|
-
// - argument: The argument name that was invalid
|
|
1624
|
-
// - value: The value of the argument
|
|
1625
|
-
ErrorCode["INVALID_ARGUMENT"] = "INVALID_ARGUMENT";
|
|
1626
|
-
// Missing argument to a function:
|
|
1627
|
-
// - count: The number of arguments received
|
|
1628
|
-
// - expectedCount: The number of arguments expected
|
|
1629
|
-
ErrorCode["MISSING_ARGUMENT"] = "MISSING_ARGUMENT";
|
|
1630
|
-
// Too many arguments
|
|
1631
|
-
// - count: The number of arguments received
|
|
1632
|
-
// - expectedCount: The number of arguments expected
|
|
1633
|
-
ErrorCode["UNEXPECTED_ARGUMENT"] = "UNEXPECTED_ARGUMENT";
|
|
1634
|
-
///////////////////
|
|
1635
|
-
// Blockchain Errors
|
|
1636
|
-
// Call exception
|
|
1637
|
-
// - transaction: the transaction
|
|
1638
|
-
// - address?: the contract address
|
|
1639
|
-
// - args?: The arguments passed into the function
|
|
1640
|
-
// - method?: The Solidity method signature
|
|
1641
|
-
// - errorSignature?: The EIP848 error signature
|
|
1642
|
-
// - errorArgs?: The EIP848 error parameters
|
|
1643
|
-
// - reason: The reason (only for EIP848 "Error(string)")
|
|
1644
|
-
ErrorCode["CALL_EXCEPTION"] = "CALL_EXCEPTION";
|
|
1645
|
-
// Insufficien funds (< value + gasLimit * gasPrice)
|
|
1646
|
-
// - transaction: the transaction attempted
|
|
1647
|
-
ErrorCode["INSUFFICIENT_FUNDS"] = "INSUFFICIENT_FUNDS";
|
|
1648
|
-
// Nonce has already been used
|
|
1649
|
-
// - transaction: the transaction attempted
|
|
1650
|
-
ErrorCode["NONCE_EXPIRED"] = "NONCE_EXPIRED";
|
|
1651
|
-
// The replacement fee for the transaction is too low
|
|
1652
|
-
// - transaction: the transaction attempted
|
|
1653
|
-
ErrorCode["REPLACEMENT_UNDERPRICED"] = "REPLACEMENT_UNDERPRICED";
|
|
1654
|
-
// The gas limit could not be estimated
|
|
1655
|
-
// - transaction: the transaction passed to estimateGas
|
|
1656
|
-
ErrorCode["UNPREDICTABLE_GAS_LIMIT"] = "UNPREDICTABLE_GAS_LIMIT";
|
|
1657
|
-
})(ErrorCode || (ErrorCode = {}));
|
|
1658
|
-
;
|
|
1659
|
-
class Logger {
|
|
1660
|
-
constructor(version) {
|
|
1661
|
-
Object.defineProperty(this, "version", {
|
|
1662
|
-
enumerable: true,
|
|
1663
|
-
value: version,
|
|
1664
|
-
writable: false
|
|
1665
|
-
});
|
|
1666
|
-
}
|
|
1667
|
-
_log(logLevel, args) {
|
|
1668
|
-
const level = logLevel.toLowerCase();
|
|
1669
|
-
if (LogLevels[level] == null) {
|
|
1670
|
-
this.throwArgumentError("invalid log level name", "logLevel", logLevel);
|
|
1671
|
-
}
|
|
1672
|
-
if (_logLevel > LogLevels[level]) {
|
|
1673
|
-
return;
|
|
1674
|
-
}
|
|
1675
|
-
console.log.apply(console, args);
|
|
1676
|
-
}
|
|
1677
|
-
debug(...args) {
|
|
1678
|
-
this._log(Logger.levels.DEBUG, args);
|
|
1679
|
-
}
|
|
1680
|
-
info(...args) {
|
|
1681
|
-
this._log(Logger.levels.INFO, args);
|
|
1682
|
-
}
|
|
1683
|
-
warn(...args) {
|
|
1684
|
-
this._log(Logger.levels.WARNING, args);
|
|
1685
|
-
}
|
|
1686
|
-
makeError(message, code, params) {
|
|
1687
|
-
// Errors are being censored
|
|
1688
|
-
if (_censorErrors) {
|
|
1689
|
-
return this.makeError("censored error", code, {});
|
|
1690
|
-
}
|
|
1691
|
-
if (!code) {
|
|
1692
|
-
code = Logger.errors.UNKNOWN_ERROR;
|
|
1693
|
-
}
|
|
1694
|
-
if (!params) {
|
|
1695
|
-
params = {};
|
|
1696
|
-
}
|
|
1697
|
-
const messageDetails = [];
|
|
1698
|
-
Object.keys(params).forEach((key) => {
|
|
1699
|
-
try {
|
|
1700
|
-
messageDetails.push(key + "=" + JSON.stringify(params[key]));
|
|
1701
|
-
}
|
|
1702
|
-
catch (error) {
|
|
1703
|
-
messageDetails.push(key + "=" + JSON.stringify(params[key].toString()));
|
|
1704
|
-
}
|
|
1705
|
-
});
|
|
1706
|
-
messageDetails.push(`code=${code}`);
|
|
1707
|
-
messageDetails.push(`version=${this.version}`);
|
|
1708
|
-
const reason = message;
|
|
1709
|
-
if (messageDetails.length) {
|
|
1710
|
-
message += " (" + messageDetails.join(", ") + ")";
|
|
1711
|
-
}
|
|
1712
|
-
// @TODO: Any??
|
|
1713
|
-
const error = new Error(message);
|
|
1714
|
-
error.reason = reason;
|
|
1715
|
-
error.code = code;
|
|
1716
|
-
Object.keys(params).forEach(function (key) {
|
|
1717
|
-
error[key] = params[key];
|
|
1718
|
-
});
|
|
1719
|
-
return error;
|
|
1720
|
-
}
|
|
1721
|
-
throwError(message, code, params) {
|
|
1722
|
-
throw this.makeError(message, code, params);
|
|
1723
|
-
}
|
|
1724
|
-
throwArgumentError(message, name, value) {
|
|
1725
|
-
return this.throwError(message, Logger.errors.INVALID_ARGUMENT, {
|
|
1726
|
-
argument: name,
|
|
1727
|
-
value: value
|
|
1728
|
-
});
|
|
1729
|
-
}
|
|
1730
|
-
checkNormalize(message) {
|
|
1731
|
-
if (message == null) {
|
|
1732
|
-
message = "platform missing String.prototype.normalize";
|
|
1733
|
-
}
|
|
1734
|
-
if (_normalizeError) {
|
|
1735
|
-
this.throwError("platform missing String.prototype.normalize", Logger.errors.UNSUPPORTED_OPERATION, {
|
|
1736
|
-
operation: "String.prototype.normalize", form: _normalizeError
|
|
1737
|
-
});
|
|
1738
|
-
}
|
|
1739
|
-
}
|
|
1740
|
-
checkSafeUint53(value, message) {
|
|
1741
|
-
if (typeof (value) !== "number") {
|
|
1742
|
-
return;
|
|
1743
|
-
}
|
|
1744
|
-
if (message == null) {
|
|
1745
|
-
message = "value not safe";
|
|
1746
|
-
}
|
|
1747
|
-
if (value < 0 || value >= 0x1fffffffffffff) {
|
|
1748
|
-
this.throwError(message, Logger.errors.NUMERIC_FAULT, {
|
|
1749
|
-
operation: "checkSafeInteger",
|
|
1750
|
-
fault: "out-of-safe-range",
|
|
1751
|
-
value: value
|
|
1752
|
-
});
|
|
1753
|
-
}
|
|
1754
|
-
if (value % 1) {
|
|
1755
|
-
this.throwError(message, Logger.errors.NUMERIC_FAULT, {
|
|
1756
|
-
operation: "checkSafeInteger",
|
|
1757
|
-
fault: "non-integer",
|
|
1758
|
-
value: value
|
|
1759
|
-
});
|
|
1760
|
-
}
|
|
1761
|
-
}
|
|
1762
|
-
checkArgumentCount(count, expectedCount, message) {
|
|
1763
|
-
if (message) {
|
|
1764
|
-
message = ": " + message;
|
|
1765
|
-
}
|
|
1766
|
-
else {
|
|
1767
|
-
message = "";
|
|
1768
|
-
}
|
|
1769
|
-
if (count < expectedCount) {
|
|
1770
|
-
this.throwError("missing argument" + message, Logger.errors.MISSING_ARGUMENT, {
|
|
1771
|
-
count: count,
|
|
1772
|
-
expectedCount: expectedCount
|
|
1773
|
-
});
|
|
1774
|
-
}
|
|
1775
|
-
if (count > expectedCount) {
|
|
1776
|
-
this.throwError("too many arguments" + message, Logger.errors.UNEXPECTED_ARGUMENT, {
|
|
1777
|
-
count: count,
|
|
1778
|
-
expectedCount: expectedCount
|
|
1779
|
-
});
|
|
1780
|
-
}
|
|
1781
|
-
}
|
|
1782
|
-
checkNew(target, kind) {
|
|
1783
|
-
if (target === Object || target == null) {
|
|
1784
|
-
this.throwError("missing new", Logger.errors.MISSING_NEW, { name: kind.name });
|
|
1785
|
-
}
|
|
1786
|
-
}
|
|
1787
|
-
checkAbstract(target, kind) {
|
|
1788
|
-
if (target === kind) {
|
|
1789
|
-
this.throwError("cannot instantiate abstract class " + JSON.stringify(kind.name) + " directly; use a sub-class", Logger.errors.UNSUPPORTED_OPERATION, { name: target.name, operation: "new" });
|
|
1790
|
-
}
|
|
1791
|
-
else if (target === Object || target == null) {
|
|
1792
|
-
this.throwError("missing new", Logger.errors.MISSING_NEW, { name: kind.name });
|
|
1793
|
-
}
|
|
1794
|
-
}
|
|
1795
|
-
static globalLogger() {
|
|
1796
|
-
if (!_globalLogger) {
|
|
1797
|
-
_globalLogger = new Logger(_version__WEBPACK_IMPORTED_MODULE_0__.version);
|
|
1798
|
-
}
|
|
1799
|
-
return _globalLogger;
|
|
1800
|
-
}
|
|
1801
|
-
static setCensorship(censorship, permanent) {
|
|
1802
|
-
if (!censorship && permanent) {
|
|
1803
|
-
this.globalLogger().throwError("cannot permanently disable censorship", Logger.errors.UNSUPPORTED_OPERATION, {
|
|
1804
|
-
operation: "setCensorship"
|
|
1805
|
-
});
|
|
1806
|
-
}
|
|
1807
|
-
if (_permanentCensorErrors) {
|
|
1808
|
-
if (!censorship) {
|
|
1809
|
-
return;
|
|
1810
|
-
}
|
|
1811
|
-
this.globalLogger().throwError("error censorship permanent", Logger.errors.UNSUPPORTED_OPERATION, {
|
|
1812
|
-
operation: "setCensorship"
|
|
1813
|
-
});
|
|
1814
|
-
}
|
|
1815
|
-
_censorErrors = !!censorship;
|
|
1816
|
-
_permanentCensorErrors = !!permanent;
|
|
1817
|
-
}
|
|
1818
|
-
static setLogLevel(logLevel) {
|
|
1819
|
-
const level = LogLevels[logLevel];
|
|
1820
|
-
if (level == null) {
|
|
1821
|
-
Logger.globalLogger().warn("invalid log level - " + logLevel);
|
|
1822
|
-
return;
|
|
1823
|
-
}
|
|
1824
|
-
_logLevel = level;
|
|
1825
|
-
}
|
|
1826
|
-
}
|
|
1827
|
-
Logger.errors = ErrorCode;
|
|
1828
|
-
Logger.levels = LogLevel;
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
472
|
/***/ }),
|
|
1832
473
|
|
|
1833
474
|
/***/ "./node_modules/@ethersproject/address/node_modules/@ethersproject/rlp/lib.esm/_version.js":
|
|
@@ -1856,15 +497,15 @@ const version = "rlp/5.7.0";
|
|
|
1856
497
|
/* harmony export */ encode: () => (/* binding */ encode)
|
|
1857
498
|
/* harmony export */ });
|
|
1858
499
|
/* unused harmony export decode */
|
|
1859
|
-
/* harmony import */ var
|
|
1860
|
-
/* harmony import */ var
|
|
1861
|
-
/* harmony import */ var
|
|
500
|
+
/* harmony import */ var _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @ethersproject/bytes */ "./node_modules/@ethersproject/bytes/lib.esm/index.js");
|
|
501
|
+
/* harmony import */ var _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ethersproject/logger */ "./node_modules/@ethersproject/logger/lib.esm/index.js");
|
|
502
|
+
/* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./_version */ "./node_modules/@ethersproject/address/node_modules/@ethersproject/rlp/lib.esm/_version.js");
|
|
1862
503
|
|
|
1863
504
|
//See: https://github.com/ethereum/wiki/wiki/RLP
|
|
1864
505
|
|
|
1865
506
|
|
|
1866
507
|
|
|
1867
|
-
const logger = new
|
|
508
|
+
const logger = new _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger(_version__WEBPACK_IMPORTED_MODULE_1__.version);
|
|
1868
509
|
function arrayifyInteger(value) {
|
|
1869
510
|
const result = [];
|
|
1870
511
|
while (value) {
|
|
@@ -1894,10 +535,10 @@ function _encode(object) {
|
|
|
1894
535
|
length.unshift(0xf7 + length.length);
|
|
1895
536
|
return length.concat(payload);
|
|
1896
537
|
}
|
|
1897
|
-
if (!(0,
|
|
538
|
+
if (!(0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__.isBytesLike)(object)) {
|
|
1898
539
|
logger.throwArgumentError("RLP object must be BytesLike", "object", object);
|
|
1899
540
|
}
|
|
1900
|
-
const data = Array.prototype.slice.call((0,
|
|
541
|
+
const data = Array.prototype.slice.call((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__.arrayify)(object));
|
|
1901
542
|
if (data.length === 1 && data[0] <= 0x7f) {
|
|
1902
543
|
return data;
|
|
1903
544
|
}
|
|
@@ -1910,7 +551,7 @@ function _encode(object) {
|
|
|
1910
551
|
return length.concat(data);
|
|
1911
552
|
}
|
|
1912
553
|
function encode(object) {
|
|
1913
|
-
return (0,
|
|
554
|
+
return (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__.hexlify)(_encode(object));
|
|
1914
555
|
}
|
|
1915
556
|
function _decodeChildren(data, offset, childOffset, length) {
|
|
1916
557
|
const result = [];
|
|
@@ -1919,7 +560,7 @@ function _decodeChildren(data, offset, childOffset, length) {
|
|
|
1919
560
|
result.push(decoded.result);
|
|
1920
561
|
childOffset += decoded.consumed;
|
|
1921
562
|
if (childOffset > offset + 1 + length) {
|
|
1922
|
-
logger.throwError("child data too short",
|
|
563
|
+
logger.throwError("child data too short", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger.errors.BUFFER_OVERRUN, {});
|
|
1923
564
|
}
|
|
1924
565
|
}
|
|
1925
566
|
return { consumed: (1 + length), result: result };
|
|
@@ -1927,51 +568,51 @@ function _decodeChildren(data, offset, childOffset, length) {
|
|
|
1927
568
|
// returns { consumed: number, result: Object }
|
|
1928
569
|
function _decode(data, offset) {
|
|
1929
570
|
if (data.length === 0) {
|
|
1930
|
-
logger.throwError("data too short",
|
|
571
|
+
logger.throwError("data too short", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger.errors.BUFFER_OVERRUN, {});
|
|
1931
572
|
}
|
|
1932
573
|
// Array with extra length prefix
|
|
1933
574
|
if (data[offset] >= 0xf8) {
|
|
1934
575
|
const lengthLength = data[offset] - 0xf7;
|
|
1935
576
|
if (offset + 1 + lengthLength > data.length) {
|
|
1936
|
-
logger.throwError("data short segment too short",
|
|
577
|
+
logger.throwError("data short segment too short", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger.errors.BUFFER_OVERRUN, {});
|
|
1937
578
|
}
|
|
1938
579
|
const length = unarrayifyInteger(data, offset + 1, lengthLength);
|
|
1939
580
|
if (offset + 1 + lengthLength + length > data.length) {
|
|
1940
|
-
logger.throwError("data long segment too short",
|
|
581
|
+
logger.throwError("data long segment too short", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger.errors.BUFFER_OVERRUN, {});
|
|
1941
582
|
}
|
|
1942
583
|
return _decodeChildren(data, offset, offset + 1 + lengthLength, lengthLength + length);
|
|
1943
584
|
}
|
|
1944
585
|
else if (data[offset] >= 0xc0) {
|
|
1945
586
|
const length = data[offset] - 0xc0;
|
|
1946
587
|
if (offset + 1 + length > data.length) {
|
|
1947
|
-
logger.throwError("data array too short",
|
|
588
|
+
logger.throwError("data array too short", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger.errors.BUFFER_OVERRUN, {});
|
|
1948
589
|
}
|
|
1949
590
|
return _decodeChildren(data, offset, offset + 1, length);
|
|
1950
591
|
}
|
|
1951
592
|
else if (data[offset] >= 0xb8) {
|
|
1952
593
|
const lengthLength = data[offset] - 0xb7;
|
|
1953
594
|
if (offset + 1 + lengthLength > data.length) {
|
|
1954
|
-
logger.throwError("data array too short",
|
|
595
|
+
logger.throwError("data array too short", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger.errors.BUFFER_OVERRUN, {});
|
|
1955
596
|
}
|
|
1956
597
|
const length = unarrayifyInteger(data, offset + 1, lengthLength);
|
|
1957
598
|
if (offset + 1 + lengthLength + length > data.length) {
|
|
1958
|
-
logger.throwError("data array too short",
|
|
599
|
+
logger.throwError("data array too short", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger.errors.BUFFER_OVERRUN, {});
|
|
1959
600
|
}
|
|
1960
|
-
const result = (0,
|
|
601
|
+
const result = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__.hexlify)(data.slice(offset + 1 + lengthLength, offset + 1 + lengthLength + length));
|
|
1961
602
|
return { consumed: (1 + lengthLength + length), result: result };
|
|
1962
603
|
}
|
|
1963
604
|
else if (data[offset] >= 0x80) {
|
|
1964
605
|
const length = data[offset] - 0x80;
|
|
1965
606
|
if (offset + 1 + length > data.length) {
|
|
1966
|
-
logger.throwError("data too short",
|
|
607
|
+
logger.throwError("data too short", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger.errors.BUFFER_OVERRUN, {});
|
|
1967
608
|
}
|
|
1968
|
-
const result = (0,
|
|
609
|
+
const result = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__.hexlify)(data.slice(offset + 1, offset + 1 + length));
|
|
1969
610
|
return { consumed: (1 + length), result: result };
|
|
1970
611
|
}
|
|
1971
|
-
return { consumed: 1, result: (0,
|
|
612
|
+
return { consumed: 1, result: (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__.hexlify)(data[offset]) };
|
|
1972
613
|
}
|
|
1973
614
|
function decode(data) {
|
|
1974
|
-
const bytes = (0,
|
|
615
|
+
const bytes = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__.arrayify)(data);
|
|
1975
616
|
const decoded = _decode(bytes, 0);
|
|
1976
617
|
if (decoded.consumed !== bytes.length) {
|
|
1977
618
|
logger.throwArgumentError("invalid rlp data", "data", data);
|
|
@@ -8811,6 +7452,7 @@ exports.base64 = base64;
|
|
|
8811
7452
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
8812
7453
|
|
|
8813
7454
|
"use strict";
|
|
7455
|
+
/* provided dependency */ var Buffer = __webpack_require__(/*! buffer */ "./node_modules/buffer/index.js")["Buffer"];
|
|
8814
7456
|
|
|
8815
7457
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
8816
7458
|
exports.createDataView = exports.concatBytes = exports.valueToBytes = exports.stringToBytes = exports.numberToBytes = exports.signedBigIntToBytes = exports.bigIntToBytes = exports.hexToBytes = exports.bytesToString = exports.bytesToNumber = exports.bytesToSignedBigInt = exports.bytesToBigInt = exports.bytesToHex = exports.assertIsBytes = exports.isBytes = void 0;
|
|
@@ -21497,6 +20139,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
21497
20139
|
/* harmony import */ var readable_stream__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(readable_stream__WEBPACK_IMPORTED_MODULE_10__);
|
|
21498
20140
|
/* harmony import */ var events__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! events */ "./node_modules/events/events.js");
|
|
21499
20141
|
/* harmony import */ var events__WEBPACK_IMPORTED_MODULE_11___default = /*#__PURE__*/__webpack_require__.n(events__WEBPACK_IMPORTED_MODULE_11__);
|
|
20142
|
+
/* provided dependency */ var Buffer = __webpack_require__(/*! buffer */ "./node_modules/@toruslabs/torus-embed/node_modules/buffer/index.js")["Buffer"];
|
|
21500
20143
|
|
|
21501
20144
|
|
|
21502
20145
|
|
|
@@ -43351,6 +41994,7 @@ if (typeof self === 'object') {
|
|
|
43351
41994
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
43352
41995
|
|
|
43353
41996
|
"use strict";
|
|
41997
|
+
/* provided dependency */ var Buffer = __webpack_require__(/*! buffer */ "./node_modules/buffer/index.js")["Buffer"];
|
|
43354
41998
|
/* provided dependency */ var process = __webpack_require__(/*! process/browser */ "./node_modules/process/browser.js");
|
|
43355
41999
|
|
|
43356
42000
|
/* eslint camelcase: "off" */
|
|
@@ -51572,6 +50216,7 @@ exports.crypto = (() => {
|
|
|
51572
50216
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
51573
50217
|
|
|
51574
50218
|
"use strict";
|
|
50219
|
+
/* provided dependency */ var Buffer = __webpack_require__(/*! buffer */ "./node_modules/buffer/index.js")["Buffer"];
|
|
51575
50220
|
|
|
51576
50221
|
var __read = (this && this.__read) || function (o, n) {
|
|
51577
50222
|
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
@@ -51878,6 +50523,7 @@ exports.isZeroAddress = isZeroAddress;
|
|
|
51878
50523
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
51879
50524
|
|
|
51880
50525
|
"use strict";
|
|
50526
|
+
/* provided dependency */ var Buffer = __webpack_require__(/*! buffer */ "./node_modules/buffer/index.js")["Buffer"];
|
|
51881
50527
|
|
|
51882
50528
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
51883
50529
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
@@ -51993,6 +50639,7 @@ exports.Address = Address;
|
|
|
51993
50639
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
51994
50640
|
|
|
51995
50641
|
"use strict";
|
|
50642
|
+
/* provided dependency */ var Buffer = __webpack_require__(/*! buffer */ "./node_modules/buffer/index.js")["Buffer"];
|
|
51996
50643
|
|
|
51997
50644
|
var __values = (this && this.__values) || function(o) {
|
|
51998
50645
|
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
@@ -52437,6 +51084,7 @@ exports.rlp = rlp;
|
|
|
52437
51084
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
52438
51085
|
|
|
52439
51086
|
"use strict";
|
|
51087
|
+
/* provided dependency */ var Buffer = __webpack_require__(/*! buffer */ "./node_modules/buffer/index.js")["Buffer"];
|
|
52440
51088
|
|
|
52441
51089
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
52442
51090
|
exports.rlphash = exports.ripemd160FromArray = exports.ripemd160FromString = exports.ripemd160 = exports.sha256FromArray = exports.sha256FromString = exports.sha256 = exports.keccakFromArray = exports.keccakFromHexString = exports.keccakFromString = exports.keccak256 = exports.keccak = void 0;
|
|
@@ -52613,6 +51261,7 @@ exports.rlphash = rlphash;
|
|
|
52613
51261
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
52614
51262
|
|
|
52615
51263
|
"use strict";
|
|
51264
|
+
/* provided dependency */ var Buffer = __webpack_require__(/*! buffer */ "./node_modules/buffer/index.js")["Buffer"];
|
|
52616
51265
|
|
|
52617
51266
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
52618
51267
|
exports.assertIsString = exports.assertIsArray = exports.assertIsBuffer = exports.assertIsHexString = void 0;
|
|
@@ -52747,9 +51396,10 @@ Object.defineProperty(exports, "isHexString", ({ enumerable: true, get: function
|
|
|
52747
51396
|
/*!***************************************************************!*\
|
|
52748
51397
|
!*** ./node_modules/ethereumjs-util/dist.browser/internal.js ***!
|
|
52749
51398
|
\***************************************************************/
|
|
52750
|
-
/***/ ((__unused_webpack_module, exports) => {
|
|
51399
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
52751
51400
|
|
|
52752
51401
|
"use strict";
|
|
51402
|
+
/* provided dependency */ var Buffer = __webpack_require__(/*! buffer */ "./node_modules/buffer/index.js")["Buffer"];
|
|
52753
51403
|
|
|
52754
51404
|
/*
|
|
52755
51405
|
The MIT License
|
|
@@ -52951,6 +51601,7 @@ exports.isHexString = isHexString;
|
|
|
52951
51601
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
52952
51602
|
|
|
52953
51603
|
"use strict";
|
|
51604
|
+
/* provided dependency */ var Buffer = __webpack_require__(/*! buffer */ "./node_modules/buffer/index.js")["Buffer"];
|
|
52954
51605
|
|
|
52955
51606
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
52956
51607
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
@@ -53071,6 +51722,7 @@ exports.defineProperties = defineProperties;
|
|
|
53071
51722
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
53072
51723
|
|
|
53073
51724
|
"use strict";
|
|
51725
|
+
/* provided dependency */ var Buffer = __webpack_require__(/*! buffer */ "./node_modules/buffer/index.js")["Buffer"];
|
|
53074
51726
|
|
|
53075
51727
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
53076
51728
|
exports.hashPersonalMessage = exports.isValidSignature = exports.fromRpcSig = exports.toCompactSig = exports.toRpcSig = exports.ecrecover = exports.ecsign = void 0;
|
|
@@ -53245,6 +51897,7 @@ exports.hashPersonalMessage = hashPersonalMessage;
|
|
|
53245
51897
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
53246
51898
|
|
|
53247
51899
|
"use strict";
|
|
51900
|
+
/* provided dependency */ var Buffer = __webpack_require__(/*! buffer */ "./node_modules/buffer/index.js")["Buffer"];
|
|
53248
51901
|
|
|
53249
51902
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
53250
51903
|
exports.toType = exports.TypeOutput = exports.bnToRlp = exports.bnToUnpaddedBuffer = exports.bnToHex = void 0;
|
|
@@ -56887,9 +55540,10 @@ exports.toType = toType;
|
|
|
56887
55540
|
/*!***************************************************************************************!*\
|
|
56888
55541
|
!*** ./node_modules/ethereumjs-util/node_modules/ethereum-cryptography/hash-utils.js ***!
|
|
56889
55542
|
\***************************************************************************************/
|
|
56890
|
-
/***/ ((__unused_webpack_module, exports) => {
|
|
55543
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
56891
55544
|
|
|
56892
55545
|
"use strict";
|
|
55546
|
+
/* provided dependency */ var Buffer = __webpack_require__(/*! buffer */ "./node_modules/buffer/index.js")["Buffer"];
|
|
56893
55547
|
|
|
56894
55548
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
56895
55549
|
function createHashFunction(hashConstructor) {
|
|
@@ -61061,6 +59715,7 @@ module.exports = function (KeccakState) {
|
|
|
61061
59715
|
\***********************************************/
|
|
61062
59716
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
61063
59717
|
|
|
59718
|
+
/* provided dependency */ var Buffer = __webpack_require__(/*! buffer */ "./node_modules/buffer/index.js")["Buffer"];
|
|
61064
59719
|
const { Transform } = __webpack_require__(/*! stream */ "./node_modules/stream-browserify/index.js")
|
|
61065
59720
|
|
|
61066
59721
|
module.exports = (KeccakState) => class Keccak extends Transform {
|
|
@@ -61148,6 +59803,7 @@ module.exports = (KeccakState) => class Keccak extends Transform {
|
|
|
61148
59803
|
\**********************************************/
|
|
61149
59804
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
61150
59805
|
|
|
59806
|
+
/* provided dependency */ var Buffer = __webpack_require__(/*! buffer */ "./node_modules/buffer/index.js")["Buffer"];
|
|
61151
59807
|
const { Transform } = __webpack_require__(/*! stream */ "./node_modules/stream-browserify/index.js")
|
|
61152
59808
|
|
|
61153
59809
|
module.exports = (KeccakState) => class Shake extends Transform {
|
|
@@ -61422,6 +60078,7 @@ exports.p1600 = function (s) {
|
|
|
61422
60078
|
\*******************************************/
|
|
61423
60079
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
61424
60080
|
|
|
60081
|
+
/* provided dependency */ var Buffer = __webpack_require__(/*! buffer */ "./node_modules/buffer/index.js")["Buffer"];
|
|
61425
60082
|
const keccakState = __webpack_require__(/*! ./keccak-state-unroll */ "./node_modules/keccak/lib/keccak-state-unroll.js")
|
|
61426
60083
|
|
|
61427
60084
|
function Keccak () {
|
|
@@ -75158,6 +73815,7 @@ module.exports = RIPEMD160
|
|
|
75158
73815
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
75159
73816
|
|
|
75160
73817
|
"use strict";
|
|
73818
|
+
/* provided dependency */ var Buffer = __webpack_require__(/*! buffer */ "./node_modules/buffer/index.js")["Buffer"];
|
|
75161
73819
|
|
|
75162
73820
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
75163
73821
|
exports.getLength = exports.decode = exports.encode = void 0;
|
|
@@ -85102,6 +83760,7 @@ module.exports = Transaction;
|
|
|
85102
83760
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
85103
83761
|
|
|
85104
83762
|
"use strict";
|
|
83763
|
+
/* provided dependency */ var Buffer = __webpack_require__(/*! buffer */ "./node_modules/buffer/index.js")["Buffer"];
|
|
85105
83764
|
|
|
85106
83765
|
var __rest = (this && this.__rest) || function (s, e) {
|
|
85107
83766
|
var t = {};
|
|
@@ -102133,6 +100792,7 @@ module.exports = function availableTypedArrays() {
|
|
|
102133
100792
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
102134
100793
|
|
|
102135
100794
|
"use strict";
|
|
100795
|
+
/* provided dependency */ var Buffer = __webpack_require__(/*! buffer */ "./node_modules/buffer/index.js")["Buffer"];
|
|
102136
100796
|
// Axios v1.5.0 Copyright (c) 2023 Matt Zabriskie and contributors
|
|
102137
100797
|
|
|
102138
100798
|
|