@startbahn/startrail-sdk-js 1.30.0 → 1.30.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 +40 -763
- package/package.json +1 -1
- package/types/startrail-sdk-js.d.ts +16 -0
package/dist/startrail-sdk.js
CHANGED
|
@@ -17698,7 +17698,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
17698
17698
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "serialize", function() { return serialize; });
|
|
17699
17699
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "parse", function() { return parse; });
|
|
17700
17700
|
/* harmony import */ var _ethersproject_address__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ethersproject/address */ "./node_modules/@ethersproject/transactions/node_modules/@ethersproject/address/lib.esm/index.js");
|
|
17701
|
-
/* harmony import */ var _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @ethersproject/bignumber */ "./node_modules/@ethersproject/
|
|
17701
|
+
/* harmony import */ var _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @ethersproject/bignumber */ "./node_modules/@ethersproject/bignumber/lib.esm/index.js");
|
|
17702
17702
|
/* harmony import */ var _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @ethersproject/bytes */ "./node_modules/@ethersproject/bytes/lib.esm/index.js");
|
|
17703
17703
|
/* harmony import */ var _ethersproject_constants__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @ethersproject/constants */ "./node_modules/@ethersproject/transactions/node_modules/@ethersproject/constants/lib.esm/index.js");
|
|
17704
17704
|
/* harmony import */ var _ethersproject_keccak256__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @ethersproject/keccak256 */ "./node_modules/@ethersproject/transactions/node_modules/@ethersproject/keccak256/lib.esm/index.js");
|
|
@@ -17730,7 +17730,7 @@ function handleNumber(value) {
|
|
|
17730
17730
|
if (value === "0x") {
|
|
17731
17731
|
return _ethersproject_constants__WEBPACK_IMPORTED_MODULE_3__[/* Zero */ "a"];
|
|
17732
17732
|
}
|
|
17733
|
-
return _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_1__[
|
|
17733
|
+
return _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_1__["BigNumber"].from(value);
|
|
17734
17734
|
}
|
|
17735
17735
|
const transactionFields = [
|
|
17736
17736
|
{ name: "nonce", maxLength: 32, numeric: true },
|
|
@@ -17837,7 +17837,7 @@ function parse(rawTransaction) {
|
|
|
17837
17837
|
return tx;
|
|
17838
17838
|
}
|
|
17839
17839
|
try {
|
|
17840
|
-
tx.v = _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_1__[
|
|
17840
|
+
tx.v = _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_1__["BigNumber"].from(transaction[6]).toNumber();
|
|
17841
17841
|
}
|
|
17842
17842
|
catch (error) {
|
|
17843
17843
|
console.log(error);
|
|
@@ -17845,7 +17845,7 @@ function parse(rawTransaction) {
|
|
|
17845
17845
|
}
|
|
17846
17846
|
tx.r = Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__["hexZeroPad"])(transaction[7], 32);
|
|
17847
17847
|
tx.s = Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__["hexZeroPad"])(transaction[8], 32);
|
|
17848
|
-
if (_ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_1__[
|
|
17848
|
+
if (_ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_1__["BigNumber"].from(tx.r).isZero() && _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_1__["BigNumber"].from(tx.s).isZero()) {
|
|
17849
17849
|
// EIP-155 unsigned transaction
|
|
17850
17850
|
tx.chainId = tx.v;
|
|
17851
17851
|
tx.v = 0;
|
|
@@ -17909,7 +17909,7 @@ const version = "address/5.7.0";
|
|
|
17909
17909
|
/* unused harmony export getContractAddress */
|
|
17910
17910
|
/* unused harmony export getCreate2Address */
|
|
17911
17911
|
/* harmony import */ var _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ethersproject/bytes */ "./node_modules/@ethersproject/bytes/lib.esm/index.js");
|
|
17912
|
-
/* harmony import */ var _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @ethersproject/bignumber */ "./node_modules/@ethersproject/
|
|
17912
|
+
/* harmony import */ var _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @ethersproject/bignumber */ "./node_modules/@ethersproject/bignumber/lib.esm/index.js");
|
|
17913
17913
|
/* harmony import */ var _ethersproject_keccak256__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @ethersproject/keccak256 */ "./node_modules/@ethersproject/transactions/node_modules/@ethersproject/keccak256/lib.esm/index.js");
|
|
17914
17914
|
/* harmony import */ var _ethersproject_rlp__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @ethersproject/rlp */ "./node_modules/@ethersproject/transactions/node_modules/@ethersproject/rlp/lib.esm/index.js");
|
|
17915
17915
|
/* harmony import */ var _ethersproject_logger__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @ethersproject/logger */ "./node_modules/@ethersproject/logger/lib.esm/index.js");
|
|
@@ -18000,7 +18000,7 @@ function getAddress(address) {
|
|
|
18000
18000
|
if (address.substring(2, 4) !== ibanChecksum(address)) {
|
|
18001
18001
|
logger.throwArgumentError("bad icap checksum", "address", address);
|
|
18002
18002
|
}
|
|
18003
|
-
result = Object(_ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_1__[
|
|
18003
|
+
result = Object(_ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_1__["_base36To16"])(address.substring(4));
|
|
18004
18004
|
while (result.length < 40) {
|
|
18005
18005
|
result = "0" + result;
|
|
18006
18006
|
}
|
|
@@ -18020,7 +18020,7 @@ function isAddress(address) {
|
|
|
18020
18020
|
return false;
|
|
18021
18021
|
}
|
|
18022
18022
|
function getIcapAddress(address) {
|
|
18023
|
-
let base36 = Object(_ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_1__[
|
|
18023
|
+
let base36 = Object(_ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_1__["_base16To36"])(getAddress(address).substring(2)).toUpperCase();
|
|
18024
18024
|
while (base36.length < 30) {
|
|
18025
18025
|
base36 = "0" + base36;
|
|
18026
18026
|
}
|
|
@@ -18035,7 +18035,7 @@ function getContractAddress(transaction) {
|
|
|
18035
18035
|
catch (error) {
|
|
18036
18036
|
logger.throwArgumentError("missing from address", "transaction", transaction);
|
|
18037
18037
|
}
|
|
18038
|
-
const nonce = Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__["stripZeros"])(Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__["arrayify"])(_ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_1__[
|
|
18038
|
+
const nonce = Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__["stripZeros"])(Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__["arrayify"])(_ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_1__["BigNumber"].from(transaction.nonce).toHexString()));
|
|
18039
18039
|
return getAddress(Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__["hexDataSlice"])(Object(_ethersproject_keccak256__WEBPACK_IMPORTED_MODULE_2__[/* keccak256 */ "a"])(Object(_ethersproject_rlp__WEBPACK_IMPORTED_MODULE_3__[/* encode */ "b"])([from, nonce])), 12));
|
|
18040
18040
|
}
|
|
18041
18041
|
function getCreate2Address(from, salt, initCodeHash) {
|
|
@@ -18051,752 +18051,6 @@ function getCreate2Address(from, salt, initCodeHash) {
|
|
|
18051
18051
|
|
|
18052
18052
|
/***/ }),
|
|
18053
18053
|
|
|
18054
|
-
/***/ "./node_modules/@ethersproject/transactions/node_modules/@ethersproject/bignumber/lib.esm/_version.js":
|
|
18055
|
-
/*!************************************************************************************************************!*\
|
|
18056
|
-
!*** ./node_modules/@ethersproject/transactions/node_modules/@ethersproject/bignumber/lib.esm/_version.js ***!
|
|
18057
|
-
\************************************************************************************************************/
|
|
18058
|
-
/*! exports provided: version */
|
|
18059
|
-
/*! exports used: version */
|
|
18060
|
-
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
18061
|
-
|
|
18062
|
-
"use strict";
|
|
18063
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return version; });
|
|
18064
|
-
const version = "bignumber/5.7.0";
|
|
18065
|
-
//# sourceMappingURL=_version.js.map
|
|
18066
|
-
|
|
18067
|
-
/***/ }),
|
|
18068
|
-
|
|
18069
|
-
/***/ "./node_modules/@ethersproject/transactions/node_modules/@ethersproject/bignumber/lib.esm/bignumber.js":
|
|
18070
|
-
/*!*************************************************************************************************************!*\
|
|
18071
|
-
!*** ./node_modules/@ethersproject/transactions/node_modules/@ethersproject/bignumber/lib.esm/bignumber.js ***!
|
|
18072
|
-
\*************************************************************************************************************/
|
|
18073
|
-
/*! exports provided: isBigNumberish, BigNumber, _base36To16, _base16To36 */
|
|
18074
|
-
/*! exports used: BigNumber, _base16To36, _base36To16, isBigNumberish */
|
|
18075
|
-
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
18076
|
-
|
|
18077
|
-
"use strict";
|
|
18078
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return isBigNumberish; });
|
|
18079
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return BigNumber; });
|
|
18080
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return _base36To16; });
|
|
18081
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return _base16To36; });
|
|
18082
|
-
/* harmony import */ var bn_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! bn.js */ "./node_modules/bn.js/lib/bn.js");
|
|
18083
|
-
/* harmony import */ var bn_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(bn_js__WEBPACK_IMPORTED_MODULE_0__);
|
|
18084
|
-
/* harmony import */ var _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @ethersproject/bytes */ "./node_modules/@ethersproject/bytes/lib.esm/index.js");
|
|
18085
|
-
/* harmony import */ var _ethersproject_logger__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @ethersproject/logger */ "./node_modules/@ethersproject/logger/lib.esm/index.js");
|
|
18086
|
-
/* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./_version */ "./node_modules/@ethersproject/transactions/node_modules/@ethersproject/bignumber/lib.esm/_version.js");
|
|
18087
|
-
|
|
18088
|
-
/**
|
|
18089
|
-
* BigNumber
|
|
18090
|
-
*
|
|
18091
|
-
* A wrapper around the BN.js object. We use the BN.js library
|
|
18092
|
-
* because it is used by elliptic, so it is required regardless.
|
|
18093
|
-
*
|
|
18094
|
-
*/
|
|
18095
|
-
|
|
18096
|
-
var BN = bn_js__WEBPACK_IMPORTED_MODULE_0___default.a.BN;
|
|
18097
|
-
|
|
18098
|
-
|
|
18099
|
-
|
|
18100
|
-
const logger = new _ethersproject_logger__WEBPACK_IMPORTED_MODULE_2__[/* Logger */ "a"](_version__WEBPACK_IMPORTED_MODULE_3__[/* version */ "a"]);
|
|
18101
|
-
const _constructorGuard = {};
|
|
18102
|
-
const MAX_SAFE = 0x1fffffffffffff;
|
|
18103
|
-
function isBigNumberish(value) {
|
|
18104
|
-
return (value != null) && (BigNumber.isBigNumber(value) ||
|
|
18105
|
-
(typeof (value) === "number" && (value % 1) === 0) ||
|
|
18106
|
-
(typeof (value) === "string" && !!value.match(/^-?[0-9]+$/)) ||
|
|
18107
|
-
Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__["isHexString"])(value) ||
|
|
18108
|
-
(typeof (value) === "bigint") ||
|
|
18109
|
-
Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__["isBytes"])(value));
|
|
18110
|
-
}
|
|
18111
|
-
// Only warn about passing 10 into radix once
|
|
18112
|
-
let _warnedToStringRadix = false;
|
|
18113
|
-
class BigNumber {
|
|
18114
|
-
constructor(constructorGuard, hex) {
|
|
18115
|
-
if (constructorGuard !== _constructorGuard) {
|
|
18116
|
-
logger.throwError("cannot call constructor directly; use BigNumber.from", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_2__[/* Logger */ "a"].errors.UNSUPPORTED_OPERATION, {
|
|
18117
|
-
operation: "new (BigNumber)"
|
|
18118
|
-
});
|
|
18119
|
-
}
|
|
18120
|
-
this._hex = hex;
|
|
18121
|
-
this._isBigNumber = true;
|
|
18122
|
-
Object.freeze(this);
|
|
18123
|
-
}
|
|
18124
|
-
fromTwos(value) {
|
|
18125
|
-
return toBigNumber(toBN(this).fromTwos(value));
|
|
18126
|
-
}
|
|
18127
|
-
toTwos(value) {
|
|
18128
|
-
return toBigNumber(toBN(this).toTwos(value));
|
|
18129
|
-
}
|
|
18130
|
-
abs() {
|
|
18131
|
-
if (this._hex[0] === "-") {
|
|
18132
|
-
return BigNumber.from(this._hex.substring(1));
|
|
18133
|
-
}
|
|
18134
|
-
return this;
|
|
18135
|
-
}
|
|
18136
|
-
add(other) {
|
|
18137
|
-
return toBigNumber(toBN(this).add(toBN(other)));
|
|
18138
|
-
}
|
|
18139
|
-
sub(other) {
|
|
18140
|
-
return toBigNumber(toBN(this).sub(toBN(other)));
|
|
18141
|
-
}
|
|
18142
|
-
div(other) {
|
|
18143
|
-
const o = BigNumber.from(other);
|
|
18144
|
-
if (o.isZero()) {
|
|
18145
|
-
throwFault("division-by-zero", "div");
|
|
18146
|
-
}
|
|
18147
|
-
return toBigNumber(toBN(this).div(toBN(other)));
|
|
18148
|
-
}
|
|
18149
|
-
mul(other) {
|
|
18150
|
-
return toBigNumber(toBN(this).mul(toBN(other)));
|
|
18151
|
-
}
|
|
18152
|
-
mod(other) {
|
|
18153
|
-
const value = toBN(other);
|
|
18154
|
-
if (value.isNeg()) {
|
|
18155
|
-
throwFault("division-by-zero", "mod");
|
|
18156
|
-
}
|
|
18157
|
-
return toBigNumber(toBN(this).umod(value));
|
|
18158
|
-
}
|
|
18159
|
-
pow(other) {
|
|
18160
|
-
const value = toBN(other);
|
|
18161
|
-
if (value.isNeg()) {
|
|
18162
|
-
throwFault("negative-power", "pow");
|
|
18163
|
-
}
|
|
18164
|
-
return toBigNumber(toBN(this).pow(value));
|
|
18165
|
-
}
|
|
18166
|
-
and(other) {
|
|
18167
|
-
const value = toBN(other);
|
|
18168
|
-
if (this.isNegative() || value.isNeg()) {
|
|
18169
|
-
throwFault("unbound-bitwise-result", "and");
|
|
18170
|
-
}
|
|
18171
|
-
return toBigNumber(toBN(this).and(value));
|
|
18172
|
-
}
|
|
18173
|
-
or(other) {
|
|
18174
|
-
const value = toBN(other);
|
|
18175
|
-
if (this.isNegative() || value.isNeg()) {
|
|
18176
|
-
throwFault("unbound-bitwise-result", "or");
|
|
18177
|
-
}
|
|
18178
|
-
return toBigNumber(toBN(this).or(value));
|
|
18179
|
-
}
|
|
18180
|
-
xor(other) {
|
|
18181
|
-
const value = toBN(other);
|
|
18182
|
-
if (this.isNegative() || value.isNeg()) {
|
|
18183
|
-
throwFault("unbound-bitwise-result", "xor");
|
|
18184
|
-
}
|
|
18185
|
-
return toBigNumber(toBN(this).xor(value));
|
|
18186
|
-
}
|
|
18187
|
-
mask(value) {
|
|
18188
|
-
if (this.isNegative() || value < 0) {
|
|
18189
|
-
throwFault("negative-width", "mask");
|
|
18190
|
-
}
|
|
18191
|
-
return toBigNumber(toBN(this).maskn(value));
|
|
18192
|
-
}
|
|
18193
|
-
shl(value) {
|
|
18194
|
-
if (this.isNegative() || value < 0) {
|
|
18195
|
-
throwFault("negative-width", "shl");
|
|
18196
|
-
}
|
|
18197
|
-
return toBigNumber(toBN(this).shln(value));
|
|
18198
|
-
}
|
|
18199
|
-
shr(value) {
|
|
18200
|
-
if (this.isNegative() || value < 0) {
|
|
18201
|
-
throwFault("negative-width", "shr");
|
|
18202
|
-
}
|
|
18203
|
-
return toBigNumber(toBN(this).shrn(value));
|
|
18204
|
-
}
|
|
18205
|
-
eq(other) {
|
|
18206
|
-
return toBN(this).eq(toBN(other));
|
|
18207
|
-
}
|
|
18208
|
-
lt(other) {
|
|
18209
|
-
return toBN(this).lt(toBN(other));
|
|
18210
|
-
}
|
|
18211
|
-
lte(other) {
|
|
18212
|
-
return toBN(this).lte(toBN(other));
|
|
18213
|
-
}
|
|
18214
|
-
gt(other) {
|
|
18215
|
-
return toBN(this).gt(toBN(other));
|
|
18216
|
-
}
|
|
18217
|
-
gte(other) {
|
|
18218
|
-
return toBN(this).gte(toBN(other));
|
|
18219
|
-
}
|
|
18220
|
-
isNegative() {
|
|
18221
|
-
return (this._hex[0] === "-");
|
|
18222
|
-
}
|
|
18223
|
-
isZero() {
|
|
18224
|
-
return toBN(this).isZero();
|
|
18225
|
-
}
|
|
18226
|
-
toNumber() {
|
|
18227
|
-
try {
|
|
18228
|
-
return toBN(this).toNumber();
|
|
18229
|
-
}
|
|
18230
|
-
catch (error) {
|
|
18231
|
-
throwFault("overflow", "toNumber", this.toString());
|
|
18232
|
-
}
|
|
18233
|
-
return null;
|
|
18234
|
-
}
|
|
18235
|
-
toBigInt() {
|
|
18236
|
-
try {
|
|
18237
|
-
return BigInt(this.toString());
|
|
18238
|
-
}
|
|
18239
|
-
catch (e) { }
|
|
18240
|
-
return logger.throwError("this platform does not support BigInt", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_2__[/* Logger */ "a"].errors.UNSUPPORTED_OPERATION, {
|
|
18241
|
-
value: this.toString()
|
|
18242
|
-
});
|
|
18243
|
-
}
|
|
18244
|
-
toString() {
|
|
18245
|
-
// Lots of people expect this, which we do not support, so check (See: #889)
|
|
18246
|
-
if (arguments.length > 0) {
|
|
18247
|
-
if (arguments[0] === 10) {
|
|
18248
|
-
if (!_warnedToStringRadix) {
|
|
18249
|
-
_warnedToStringRadix = true;
|
|
18250
|
-
logger.warn("BigNumber.toString does not accept any parameters; base-10 is assumed");
|
|
18251
|
-
}
|
|
18252
|
-
}
|
|
18253
|
-
else if (arguments[0] === 16) {
|
|
18254
|
-
logger.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_2__[/* Logger */ "a"].errors.UNEXPECTED_ARGUMENT, {});
|
|
18255
|
-
}
|
|
18256
|
-
else {
|
|
18257
|
-
logger.throwError("BigNumber.toString does not accept parameters", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_2__[/* Logger */ "a"].errors.UNEXPECTED_ARGUMENT, {});
|
|
18258
|
-
}
|
|
18259
|
-
}
|
|
18260
|
-
return toBN(this).toString(10);
|
|
18261
|
-
}
|
|
18262
|
-
toHexString() {
|
|
18263
|
-
return this._hex;
|
|
18264
|
-
}
|
|
18265
|
-
toJSON(key) {
|
|
18266
|
-
return { type: "BigNumber", hex: this.toHexString() };
|
|
18267
|
-
}
|
|
18268
|
-
static from(value) {
|
|
18269
|
-
if (value instanceof BigNumber) {
|
|
18270
|
-
return value;
|
|
18271
|
-
}
|
|
18272
|
-
if (typeof (value) === "string") {
|
|
18273
|
-
if (value.match(/^-?0x[0-9a-f]+$/i)) {
|
|
18274
|
-
return new BigNumber(_constructorGuard, toHex(value));
|
|
18275
|
-
}
|
|
18276
|
-
if (value.match(/^-?[0-9]+$/)) {
|
|
18277
|
-
return new BigNumber(_constructorGuard, toHex(new BN(value)));
|
|
18278
|
-
}
|
|
18279
|
-
return logger.throwArgumentError("invalid BigNumber string", "value", value);
|
|
18280
|
-
}
|
|
18281
|
-
if (typeof (value) === "number") {
|
|
18282
|
-
if (value % 1) {
|
|
18283
|
-
throwFault("underflow", "BigNumber.from", value);
|
|
18284
|
-
}
|
|
18285
|
-
if (value >= MAX_SAFE || value <= -MAX_SAFE) {
|
|
18286
|
-
throwFault("overflow", "BigNumber.from", value);
|
|
18287
|
-
}
|
|
18288
|
-
return BigNumber.from(String(value));
|
|
18289
|
-
}
|
|
18290
|
-
const anyValue = value;
|
|
18291
|
-
if (typeof (anyValue) === "bigint") {
|
|
18292
|
-
return BigNumber.from(anyValue.toString());
|
|
18293
|
-
}
|
|
18294
|
-
if (Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__["isBytes"])(anyValue)) {
|
|
18295
|
-
return BigNumber.from(Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__["hexlify"])(anyValue));
|
|
18296
|
-
}
|
|
18297
|
-
if (anyValue) {
|
|
18298
|
-
// Hexable interface (takes priority)
|
|
18299
|
-
if (anyValue.toHexString) {
|
|
18300
|
-
const hex = anyValue.toHexString();
|
|
18301
|
-
if (typeof (hex) === "string") {
|
|
18302
|
-
return BigNumber.from(hex);
|
|
18303
|
-
}
|
|
18304
|
-
}
|
|
18305
|
-
else {
|
|
18306
|
-
// For now, handle legacy JSON-ified values (goes away in v6)
|
|
18307
|
-
let hex = anyValue._hex;
|
|
18308
|
-
// New-form JSON
|
|
18309
|
-
if (hex == null && anyValue.type === "BigNumber") {
|
|
18310
|
-
hex = anyValue.hex;
|
|
18311
|
-
}
|
|
18312
|
-
if (typeof (hex) === "string") {
|
|
18313
|
-
if (Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__["isHexString"])(hex) || (hex[0] === "-" && Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__["isHexString"])(hex.substring(1)))) {
|
|
18314
|
-
return BigNumber.from(hex);
|
|
18315
|
-
}
|
|
18316
|
-
}
|
|
18317
|
-
}
|
|
18318
|
-
}
|
|
18319
|
-
return logger.throwArgumentError("invalid BigNumber value", "value", value);
|
|
18320
|
-
}
|
|
18321
|
-
static isBigNumber(value) {
|
|
18322
|
-
return !!(value && value._isBigNumber);
|
|
18323
|
-
}
|
|
18324
|
-
}
|
|
18325
|
-
// Normalize the hex string
|
|
18326
|
-
function toHex(value) {
|
|
18327
|
-
// For BN, call on the hex string
|
|
18328
|
-
if (typeof (value) !== "string") {
|
|
18329
|
-
return toHex(value.toString(16));
|
|
18330
|
-
}
|
|
18331
|
-
// If negative, prepend the negative sign to the normalized positive value
|
|
18332
|
-
if (value[0] === "-") {
|
|
18333
|
-
// Strip off the negative sign
|
|
18334
|
-
value = value.substring(1);
|
|
18335
|
-
// Cannot have multiple negative signs (e.g. "--0x04")
|
|
18336
|
-
if (value[0] === "-") {
|
|
18337
|
-
logger.throwArgumentError("invalid hex", "value", value);
|
|
18338
|
-
}
|
|
18339
|
-
// Call toHex on the positive component
|
|
18340
|
-
value = toHex(value);
|
|
18341
|
-
// Do not allow "-0x00"
|
|
18342
|
-
if (value === "0x00") {
|
|
18343
|
-
return value;
|
|
18344
|
-
}
|
|
18345
|
-
// Negate the value
|
|
18346
|
-
return "-" + value;
|
|
18347
|
-
}
|
|
18348
|
-
// Add a "0x" prefix if missing
|
|
18349
|
-
if (value.substring(0, 2) !== "0x") {
|
|
18350
|
-
value = "0x" + value;
|
|
18351
|
-
}
|
|
18352
|
-
// Normalize zero
|
|
18353
|
-
if (value === "0x") {
|
|
18354
|
-
return "0x00";
|
|
18355
|
-
}
|
|
18356
|
-
// Make the string even length
|
|
18357
|
-
if (value.length % 2) {
|
|
18358
|
-
value = "0x0" + value.substring(2);
|
|
18359
|
-
}
|
|
18360
|
-
// Trim to smallest even-length string
|
|
18361
|
-
while (value.length > 4 && value.substring(0, 4) === "0x00") {
|
|
18362
|
-
value = "0x" + value.substring(4);
|
|
18363
|
-
}
|
|
18364
|
-
return value;
|
|
18365
|
-
}
|
|
18366
|
-
function toBigNumber(value) {
|
|
18367
|
-
return BigNumber.from(toHex(value));
|
|
18368
|
-
}
|
|
18369
|
-
function toBN(value) {
|
|
18370
|
-
const hex = BigNumber.from(value).toHexString();
|
|
18371
|
-
if (hex[0] === "-") {
|
|
18372
|
-
return (new BN("-" + hex.substring(3), 16));
|
|
18373
|
-
}
|
|
18374
|
-
return new BN(hex.substring(2), 16);
|
|
18375
|
-
}
|
|
18376
|
-
function throwFault(fault, operation, value) {
|
|
18377
|
-
const params = { fault: fault, operation: operation };
|
|
18378
|
-
if (value != null) {
|
|
18379
|
-
params.value = value;
|
|
18380
|
-
}
|
|
18381
|
-
return logger.throwError(fault, _ethersproject_logger__WEBPACK_IMPORTED_MODULE_2__[/* Logger */ "a"].errors.NUMERIC_FAULT, params);
|
|
18382
|
-
}
|
|
18383
|
-
// value should have no prefix
|
|
18384
|
-
function _base36To16(value) {
|
|
18385
|
-
return (new BN(value, 36)).toString(16);
|
|
18386
|
-
}
|
|
18387
|
-
// value should have no prefix
|
|
18388
|
-
function _base16To36(value) {
|
|
18389
|
-
return (new BN(value, 16)).toString(36);
|
|
18390
|
-
}
|
|
18391
|
-
//# sourceMappingURL=bignumber.js.map
|
|
18392
|
-
|
|
18393
|
-
/***/ }),
|
|
18394
|
-
|
|
18395
|
-
/***/ "./node_modules/@ethersproject/transactions/node_modules/@ethersproject/bignumber/lib.esm/fixednumber.js":
|
|
18396
|
-
/*!***************************************************************************************************************!*\
|
|
18397
|
-
!*** ./node_modules/@ethersproject/transactions/node_modules/@ethersproject/bignumber/lib.esm/fixednumber.js ***!
|
|
18398
|
-
\***************************************************************************************************************/
|
|
18399
|
-
/*! exports provided: formatFixed, parseFixed, FixedFormat, FixedNumber */
|
|
18400
|
-
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
18401
|
-
|
|
18402
|
-
"use strict";
|
|
18403
|
-
/* unused harmony export formatFixed */
|
|
18404
|
-
/* unused harmony export parseFixed */
|
|
18405
|
-
/* unused harmony export FixedFormat */
|
|
18406
|
-
/* unused harmony export FixedNumber */
|
|
18407
|
-
/* harmony import */ var _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ethersproject/bytes */ "./node_modules/@ethersproject/bytes/lib.esm/index.js");
|
|
18408
|
-
/* harmony import */ var _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @ethersproject/logger */ "./node_modules/@ethersproject/logger/lib.esm/index.js");
|
|
18409
|
-
/* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./_version */ "./node_modules/@ethersproject/transactions/node_modules/@ethersproject/bignumber/lib.esm/_version.js");
|
|
18410
|
-
/* harmony import */ var _bignumber__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./bignumber */ "./node_modules/@ethersproject/transactions/node_modules/@ethersproject/bignumber/lib.esm/bignumber.js");
|
|
18411
|
-
|
|
18412
|
-
|
|
18413
|
-
|
|
18414
|
-
|
|
18415
|
-
const logger = new _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__[/* Logger */ "a"](_version__WEBPACK_IMPORTED_MODULE_2__[/* version */ "a"]);
|
|
18416
|
-
|
|
18417
|
-
const _constructorGuard = {};
|
|
18418
|
-
const Zero = _bignumber__WEBPACK_IMPORTED_MODULE_3__[/* BigNumber */ "a"].from(0);
|
|
18419
|
-
const NegativeOne = _bignumber__WEBPACK_IMPORTED_MODULE_3__[/* BigNumber */ "a"].from(-1);
|
|
18420
|
-
function throwFault(message, fault, operation, value) {
|
|
18421
|
-
const params = { fault: fault, operation: operation };
|
|
18422
|
-
if (value !== undefined) {
|
|
18423
|
-
params.value = value;
|
|
18424
|
-
}
|
|
18425
|
-
return logger.throwError(message, _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__[/* Logger */ "a"].errors.NUMERIC_FAULT, params);
|
|
18426
|
-
}
|
|
18427
|
-
// Constant to pull zeros from for multipliers
|
|
18428
|
-
let zeros = "0";
|
|
18429
|
-
while (zeros.length < 256) {
|
|
18430
|
-
zeros += zeros;
|
|
18431
|
-
}
|
|
18432
|
-
// Returns a string "1" followed by decimal "0"s
|
|
18433
|
-
function getMultiplier(decimals) {
|
|
18434
|
-
if (typeof (decimals) !== "number") {
|
|
18435
|
-
try {
|
|
18436
|
-
decimals = _bignumber__WEBPACK_IMPORTED_MODULE_3__[/* BigNumber */ "a"].from(decimals).toNumber();
|
|
18437
|
-
}
|
|
18438
|
-
catch (e) { }
|
|
18439
|
-
}
|
|
18440
|
-
if (typeof (decimals) === "number" && decimals >= 0 && decimals <= 256 && !(decimals % 1)) {
|
|
18441
|
-
return ("1" + zeros.substring(0, decimals));
|
|
18442
|
-
}
|
|
18443
|
-
return logger.throwArgumentError("invalid decimal size", "decimals", decimals);
|
|
18444
|
-
}
|
|
18445
|
-
function formatFixed(value, decimals) {
|
|
18446
|
-
if (decimals == null) {
|
|
18447
|
-
decimals = 0;
|
|
18448
|
-
}
|
|
18449
|
-
const multiplier = getMultiplier(decimals);
|
|
18450
|
-
// Make sure wei is a big number (convert as necessary)
|
|
18451
|
-
value = _bignumber__WEBPACK_IMPORTED_MODULE_3__[/* BigNumber */ "a"].from(value);
|
|
18452
|
-
const negative = value.lt(Zero);
|
|
18453
|
-
if (negative) {
|
|
18454
|
-
value = value.mul(NegativeOne);
|
|
18455
|
-
}
|
|
18456
|
-
let fraction = value.mod(multiplier).toString();
|
|
18457
|
-
while (fraction.length < multiplier.length - 1) {
|
|
18458
|
-
fraction = "0" + fraction;
|
|
18459
|
-
}
|
|
18460
|
-
// Strip training 0
|
|
18461
|
-
fraction = fraction.match(/^([0-9]*[1-9]|0)(0*)/)[1];
|
|
18462
|
-
const whole = value.div(multiplier).toString();
|
|
18463
|
-
if (multiplier.length === 1) {
|
|
18464
|
-
value = whole;
|
|
18465
|
-
}
|
|
18466
|
-
else {
|
|
18467
|
-
value = whole + "." + fraction;
|
|
18468
|
-
}
|
|
18469
|
-
if (negative) {
|
|
18470
|
-
value = "-" + value;
|
|
18471
|
-
}
|
|
18472
|
-
return value;
|
|
18473
|
-
}
|
|
18474
|
-
function parseFixed(value, decimals) {
|
|
18475
|
-
if (decimals == null) {
|
|
18476
|
-
decimals = 0;
|
|
18477
|
-
}
|
|
18478
|
-
const multiplier = getMultiplier(decimals);
|
|
18479
|
-
if (typeof (value) !== "string" || !value.match(/^-?[0-9.]+$/)) {
|
|
18480
|
-
logger.throwArgumentError("invalid decimal value", "value", value);
|
|
18481
|
-
}
|
|
18482
|
-
// Is it negative?
|
|
18483
|
-
const negative = (value.substring(0, 1) === "-");
|
|
18484
|
-
if (negative) {
|
|
18485
|
-
value = value.substring(1);
|
|
18486
|
-
}
|
|
18487
|
-
if (value === ".") {
|
|
18488
|
-
logger.throwArgumentError("missing value", "value", value);
|
|
18489
|
-
}
|
|
18490
|
-
// Split it into a whole and fractional part
|
|
18491
|
-
const comps = value.split(".");
|
|
18492
|
-
if (comps.length > 2) {
|
|
18493
|
-
logger.throwArgumentError("too many decimal points", "value", value);
|
|
18494
|
-
}
|
|
18495
|
-
let whole = comps[0], fraction = comps[1];
|
|
18496
|
-
if (!whole) {
|
|
18497
|
-
whole = "0";
|
|
18498
|
-
}
|
|
18499
|
-
if (!fraction) {
|
|
18500
|
-
fraction = "0";
|
|
18501
|
-
}
|
|
18502
|
-
// Trim trailing zeros
|
|
18503
|
-
while (fraction[fraction.length - 1] === "0") {
|
|
18504
|
-
fraction = fraction.substring(0, fraction.length - 1);
|
|
18505
|
-
}
|
|
18506
|
-
// Check the fraction doesn't exceed our decimals size
|
|
18507
|
-
if (fraction.length > multiplier.length - 1) {
|
|
18508
|
-
throwFault("fractional component exceeds decimals", "underflow", "parseFixed");
|
|
18509
|
-
}
|
|
18510
|
-
// If decimals is 0, we have an empty string for fraction
|
|
18511
|
-
if (fraction === "") {
|
|
18512
|
-
fraction = "0";
|
|
18513
|
-
}
|
|
18514
|
-
// Fully pad the string with zeros to get to wei
|
|
18515
|
-
while (fraction.length < multiplier.length - 1) {
|
|
18516
|
-
fraction += "0";
|
|
18517
|
-
}
|
|
18518
|
-
const wholeValue = _bignumber__WEBPACK_IMPORTED_MODULE_3__[/* BigNumber */ "a"].from(whole);
|
|
18519
|
-
const fractionValue = _bignumber__WEBPACK_IMPORTED_MODULE_3__[/* BigNumber */ "a"].from(fraction);
|
|
18520
|
-
let wei = (wholeValue.mul(multiplier)).add(fractionValue);
|
|
18521
|
-
if (negative) {
|
|
18522
|
-
wei = wei.mul(NegativeOne);
|
|
18523
|
-
}
|
|
18524
|
-
return wei;
|
|
18525
|
-
}
|
|
18526
|
-
class FixedFormat {
|
|
18527
|
-
constructor(constructorGuard, signed, width, decimals) {
|
|
18528
|
-
if (constructorGuard !== _constructorGuard) {
|
|
18529
|
-
logger.throwError("cannot use FixedFormat constructor; use FixedFormat.from", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__[/* Logger */ "a"].errors.UNSUPPORTED_OPERATION, {
|
|
18530
|
-
operation: "new FixedFormat"
|
|
18531
|
-
});
|
|
18532
|
-
}
|
|
18533
|
-
this.signed = signed;
|
|
18534
|
-
this.width = width;
|
|
18535
|
-
this.decimals = decimals;
|
|
18536
|
-
this.name = (signed ? "" : "u") + "fixed" + String(width) + "x" + String(decimals);
|
|
18537
|
-
this._multiplier = getMultiplier(decimals);
|
|
18538
|
-
Object.freeze(this);
|
|
18539
|
-
}
|
|
18540
|
-
static from(value) {
|
|
18541
|
-
if (value instanceof FixedFormat) {
|
|
18542
|
-
return value;
|
|
18543
|
-
}
|
|
18544
|
-
if (typeof (value) === "number") {
|
|
18545
|
-
value = `fixed128x${value}`;
|
|
18546
|
-
}
|
|
18547
|
-
let signed = true;
|
|
18548
|
-
let width = 128;
|
|
18549
|
-
let decimals = 18;
|
|
18550
|
-
if (typeof (value) === "string") {
|
|
18551
|
-
if (value === "fixed") {
|
|
18552
|
-
// defaults...
|
|
18553
|
-
}
|
|
18554
|
-
else if (value === "ufixed") {
|
|
18555
|
-
signed = false;
|
|
18556
|
-
}
|
|
18557
|
-
else {
|
|
18558
|
-
const match = value.match(/^(u?)fixed([0-9]+)x([0-9]+)$/);
|
|
18559
|
-
if (!match) {
|
|
18560
|
-
logger.throwArgumentError("invalid fixed format", "format", value);
|
|
18561
|
-
}
|
|
18562
|
-
signed = (match[1] !== "u");
|
|
18563
|
-
width = parseInt(match[2]);
|
|
18564
|
-
decimals = parseInt(match[3]);
|
|
18565
|
-
}
|
|
18566
|
-
}
|
|
18567
|
-
else if (value) {
|
|
18568
|
-
const check = (key, type, defaultValue) => {
|
|
18569
|
-
if (value[key] == null) {
|
|
18570
|
-
return defaultValue;
|
|
18571
|
-
}
|
|
18572
|
-
if (typeof (value[key]) !== type) {
|
|
18573
|
-
logger.throwArgumentError("invalid fixed format (" + key + " not " + type + ")", "format." + key, value[key]);
|
|
18574
|
-
}
|
|
18575
|
-
return value[key];
|
|
18576
|
-
};
|
|
18577
|
-
signed = check("signed", "boolean", signed);
|
|
18578
|
-
width = check("width", "number", width);
|
|
18579
|
-
decimals = check("decimals", "number", decimals);
|
|
18580
|
-
}
|
|
18581
|
-
if (width % 8) {
|
|
18582
|
-
logger.throwArgumentError("invalid fixed format width (not byte aligned)", "format.width", width);
|
|
18583
|
-
}
|
|
18584
|
-
if (decimals > 80) {
|
|
18585
|
-
logger.throwArgumentError("invalid fixed format (decimals too large)", "format.decimals", decimals);
|
|
18586
|
-
}
|
|
18587
|
-
return new FixedFormat(_constructorGuard, signed, width, decimals);
|
|
18588
|
-
}
|
|
18589
|
-
}
|
|
18590
|
-
class FixedNumber {
|
|
18591
|
-
constructor(constructorGuard, hex, value, format) {
|
|
18592
|
-
if (constructorGuard !== _constructorGuard) {
|
|
18593
|
-
logger.throwError("cannot use FixedNumber constructor; use FixedNumber.from", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__[/* Logger */ "a"].errors.UNSUPPORTED_OPERATION, {
|
|
18594
|
-
operation: "new FixedFormat"
|
|
18595
|
-
});
|
|
18596
|
-
}
|
|
18597
|
-
this.format = format;
|
|
18598
|
-
this._hex = hex;
|
|
18599
|
-
this._value = value;
|
|
18600
|
-
this._isFixedNumber = true;
|
|
18601
|
-
Object.freeze(this);
|
|
18602
|
-
}
|
|
18603
|
-
_checkFormat(other) {
|
|
18604
|
-
if (this.format.name !== other.format.name) {
|
|
18605
|
-
logger.throwArgumentError("incompatible format; use fixedNumber.toFormat", "other", other);
|
|
18606
|
-
}
|
|
18607
|
-
}
|
|
18608
|
-
addUnsafe(other) {
|
|
18609
|
-
this._checkFormat(other);
|
|
18610
|
-
const a = parseFixed(this._value, this.format.decimals);
|
|
18611
|
-
const b = parseFixed(other._value, other.format.decimals);
|
|
18612
|
-
return FixedNumber.fromValue(a.add(b), this.format.decimals, this.format);
|
|
18613
|
-
}
|
|
18614
|
-
subUnsafe(other) {
|
|
18615
|
-
this._checkFormat(other);
|
|
18616
|
-
const a = parseFixed(this._value, this.format.decimals);
|
|
18617
|
-
const b = parseFixed(other._value, other.format.decimals);
|
|
18618
|
-
return FixedNumber.fromValue(a.sub(b), this.format.decimals, this.format);
|
|
18619
|
-
}
|
|
18620
|
-
mulUnsafe(other) {
|
|
18621
|
-
this._checkFormat(other);
|
|
18622
|
-
const a = parseFixed(this._value, this.format.decimals);
|
|
18623
|
-
const b = parseFixed(other._value, other.format.decimals);
|
|
18624
|
-
return FixedNumber.fromValue(a.mul(b).div(this.format._multiplier), this.format.decimals, this.format);
|
|
18625
|
-
}
|
|
18626
|
-
divUnsafe(other) {
|
|
18627
|
-
this._checkFormat(other);
|
|
18628
|
-
const a = parseFixed(this._value, this.format.decimals);
|
|
18629
|
-
const b = parseFixed(other._value, other.format.decimals);
|
|
18630
|
-
return FixedNumber.fromValue(a.mul(this.format._multiplier).div(b), this.format.decimals, this.format);
|
|
18631
|
-
}
|
|
18632
|
-
floor() {
|
|
18633
|
-
const comps = this.toString().split(".");
|
|
18634
|
-
if (comps.length === 1) {
|
|
18635
|
-
comps.push("0");
|
|
18636
|
-
}
|
|
18637
|
-
let result = FixedNumber.from(comps[0], this.format);
|
|
18638
|
-
const hasFraction = !comps[1].match(/^(0*)$/);
|
|
18639
|
-
if (this.isNegative() && hasFraction) {
|
|
18640
|
-
result = result.subUnsafe(ONE.toFormat(result.format));
|
|
18641
|
-
}
|
|
18642
|
-
return result;
|
|
18643
|
-
}
|
|
18644
|
-
ceiling() {
|
|
18645
|
-
const comps = this.toString().split(".");
|
|
18646
|
-
if (comps.length === 1) {
|
|
18647
|
-
comps.push("0");
|
|
18648
|
-
}
|
|
18649
|
-
let result = FixedNumber.from(comps[0], this.format);
|
|
18650
|
-
const hasFraction = !comps[1].match(/^(0*)$/);
|
|
18651
|
-
if (!this.isNegative() && hasFraction) {
|
|
18652
|
-
result = result.addUnsafe(ONE.toFormat(result.format));
|
|
18653
|
-
}
|
|
18654
|
-
return result;
|
|
18655
|
-
}
|
|
18656
|
-
// @TODO: Support other rounding algorithms
|
|
18657
|
-
round(decimals) {
|
|
18658
|
-
if (decimals == null) {
|
|
18659
|
-
decimals = 0;
|
|
18660
|
-
}
|
|
18661
|
-
// If we are already in range, we're done
|
|
18662
|
-
const comps = this.toString().split(".");
|
|
18663
|
-
if (comps.length === 1) {
|
|
18664
|
-
comps.push("0");
|
|
18665
|
-
}
|
|
18666
|
-
if (decimals < 0 || decimals > 80 || (decimals % 1)) {
|
|
18667
|
-
logger.throwArgumentError("invalid decimal count", "decimals", decimals);
|
|
18668
|
-
}
|
|
18669
|
-
if (comps[1].length <= decimals) {
|
|
18670
|
-
return this;
|
|
18671
|
-
}
|
|
18672
|
-
const factor = FixedNumber.from("1" + zeros.substring(0, decimals), this.format);
|
|
18673
|
-
const bump = BUMP.toFormat(this.format);
|
|
18674
|
-
return this.mulUnsafe(factor).addUnsafe(bump).floor().divUnsafe(factor);
|
|
18675
|
-
}
|
|
18676
|
-
isZero() {
|
|
18677
|
-
return (this._value === "0.0" || this._value === "0");
|
|
18678
|
-
}
|
|
18679
|
-
isNegative() {
|
|
18680
|
-
return (this._value[0] === "-");
|
|
18681
|
-
}
|
|
18682
|
-
toString() { return this._value; }
|
|
18683
|
-
toHexString(width) {
|
|
18684
|
-
if (width == null) {
|
|
18685
|
-
return this._hex;
|
|
18686
|
-
}
|
|
18687
|
-
if (width % 8) {
|
|
18688
|
-
logger.throwArgumentError("invalid byte width", "width", width);
|
|
18689
|
-
}
|
|
18690
|
-
const hex = _bignumber__WEBPACK_IMPORTED_MODULE_3__[/* BigNumber */ "a"].from(this._hex).fromTwos(this.format.width).toTwos(width).toHexString();
|
|
18691
|
-
return Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__["hexZeroPad"])(hex, width / 8);
|
|
18692
|
-
}
|
|
18693
|
-
toUnsafeFloat() { return parseFloat(this.toString()); }
|
|
18694
|
-
toFormat(format) {
|
|
18695
|
-
return FixedNumber.fromString(this._value, format);
|
|
18696
|
-
}
|
|
18697
|
-
static fromValue(value, decimals, format) {
|
|
18698
|
-
// If decimals looks more like a format, and there is no format, shift the parameters
|
|
18699
|
-
if (format == null && decimals != null && !Object(_bignumber__WEBPACK_IMPORTED_MODULE_3__[/* isBigNumberish */ "d"])(decimals)) {
|
|
18700
|
-
format = decimals;
|
|
18701
|
-
decimals = null;
|
|
18702
|
-
}
|
|
18703
|
-
if (decimals == null) {
|
|
18704
|
-
decimals = 0;
|
|
18705
|
-
}
|
|
18706
|
-
if (format == null) {
|
|
18707
|
-
format = "fixed";
|
|
18708
|
-
}
|
|
18709
|
-
return FixedNumber.fromString(formatFixed(value, decimals), FixedFormat.from(format));
|
|
18710
|
-
}
|
|
18711
|
-
static fromString(value, format) {
|
|
18712
|
-
if (format == null) {
|
|
18713
|
-
format = "fixed";
|
|
18714
|
-
}
|
|
18715
|
-
const fixedFormat = FixedFormat.from(format);
|
|
18716
|
-
const numeric = parseFixed(value, fixedFormat.decimals);
|
|
18717
|
-
if (!fixedFormat.signed && numeric.lt(Zero)) {
|
|
18718
|
-
throwFault("unsigned value cannot be negative", "overflow", "value", value);
|
|
18719
|
-
}
|
|
18720
|
-
let hex = null;
|
|
18721
|
-
if (fixedFormat.signed) {
|
|
18722
|
-
hex = numeric.toTwos(fixedFormat.width).toHexString();
|
|
18723
|
-
}
|
|
18724
|
-
else {
|
|
18725
|
-
hex = numeric.toHexString();
|
|
18726
|
-
hex = Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__["hexZeroPad"])(hex, fixedFormat.width / 8);
|
|
18727
|
-
}
|
|
18728
|
-
const decimal = formatFixed(numeric, fixedFormat.decimals);
|
|
18729
|
-
return new FixedNumber(_constructorGuard, hex, decimal, fixedFormat);
|
|
18730
|
-
}
|
|
18731
|
-
static fromBytes(value, format) {
|
|
18732
|
-
if (format == null) {
|
|
18733
|
-
format = "fixed";
|
|
18734
|
-
}
|
|
18735
|
-
const fixedFormat = FixedFormat.from(format);
|
|
18736
|
-
if (Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__["arrayify"])(value).length > fixedFormat.width / 8) {
|
|
18737
|
-
throw new Error("overflow");
|
|
18738
|
-
}
|
|
18739
|
-
let numeric = _bignumber__WEBPACK_IMPORTED_MODULE_3__[/* BigNumber */ "a"].from(value);
|
|
18740
|
-
if (fixedFormat.signed) {
|
|
18741
|
-
numeric = numeric.fromTwos(fixedFormat.width);
|
|
18742
|
-
}
|
|
18743
|
-
const hex = numeric.toTwos((fixedFormat.signed ? 0 : 1) + fixedFormat.width).toHexString();
|
|
18744
|
-
const decimal = formatFixed(numeric, fixedFormat.decimals);
|
|
18745
|
-
return new FixedNumber(_constructorGuard, hex, decimal, fixedFormat);
|
|
18746
|
-
}
|
|
18747
|
-
static from(value, format) {
|
|
18748
|
-
if (typeof (value) === "string") {
|
|
18749
|
-
return FixedNumber.fromString(value, format);
|
|
18750
|
-
}
|
|
18751
|
-
if (Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__["isBytes"])(value)) {
|
|
18752
|
-
return FixedNumber.fromBytes(value, format);
|
|
18753
|
-
}
|
|
18754
|
-
try {
|
|
18755
|
-
return FixedNumber.fromValue(value, 0, format);
|
|
18756
|
-
}
|
|
18757
|
-
catch (error) {
|
|
18758
|
-
// Allow NUMERIC_FAULT to bubble up
|
|
18759
|
-
if (error.code !== _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__[/* Logger */ "a"].errors.INVALID_ARGUMENT) {
|
|
18760
|
-
throw error;
|
|
18761
|
-
}
|
|
18762
|
-
}
|
|
18763
|
-
return logger.throwArgumentError("invalid FixedNumber value", "value", value);
|
|
18764
|
-
}
|
|
18765
|
-
static isFixedNumber(value) {
|
|
18766
|
-
return !!(value && value._isFixedNumber);
|
|
18767
|
-
}
|
|
18768
|
-
}
|
|
18769
|
-
const ONE = FixedNumber.from(1);
|
|
18770
|
-
const BUMP = FixedNumber.from("0.5");
|
|
18771
|
-
//# sourceMappingURL=fixednumber.js.map
|
|
18772
|
-
|
|
18773
|
-
/***/ }),
|
|
18774
|
-
|
|
18775
|
-
/***/ "./node_modules/@ethersproject/transactions/node_modules/@ethersproject/bignumber/lib.esm/index.js":
|
|
18776
|
-
/*!*********************************************************************************************************!*\
|
|
18777
|
-
!*** ./node_modules/@ethersproject/transactions/node_modules/@ethersproject/bignumber/lib.esm/index.js ***!
|
|
18778
|
-
\*********************************************************************************************************/
|
|
18779
|
-
/*! exports provided: BigNumber, formatFixed, FixedFormat, FixedNumber, parseFixed, _base16To36, _base36To16 */
|
|
18780
|
-
/*! exports used: BigNumber, _base16To36, _base36To16 */
|
|
18781
|
-
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
18782
|
-
|
|
18783
|
-
"use strict";
|
|
18784
|
-
/* harmony import */ var _bignumber__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./bignumber */ "./node_modules/@ethersproject/transactions/node_modules/@ethersproject/bignumber/lib.esm/bignumber.js");
|
|
18785
|
-
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _bignumber__WEBPACK_IMPORTED_MODULE_0__["a"]; });
|
|
18786
|
-
|
|
18787
|
-
/* harmony import */ var _fixednumber__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./fixednumber */ "./node_modules/@ethersproject/transactions/node_modules/@ethersproject/bignumber/lib.esm/fixednumber.js");
|
|
18788
|
-
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "b", function() { return _bignumber__WEBPACK_IMPORTED_MODULE_0__["b"]; });
|
|
18789
|
-
|
|
18790
|
-
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "c", function() { return _bignumber__WEBPACK_IMPORTED_MODULE_0__["c"]; });
|
|
18791
|
-
|
|
18792
|
-
|
|
18793
|
-
|
|
18794
|
-
// Internal methods used by address
|
|
18795
|
-
|
|
18796
|
-
//# sourceMappingURL=index.js.map
|
|
18797
|
-
|
|
18798
|
-
/***/ }),
|
|
18799
|
-
|
|
18800
18054
|
/***/ "./node_modules/@ethersproject/transactions/node_modules/@ethersproject/constants/lib.esm/addresses.js":
|
|
18801
18055
|
/*!*************************************************************************************************************!*\
|
|
18802
18056
|
!*** ./node_modules/@ethersproject/transactions/node_modules/@ethersproject/constants/lib.esm/addresses.js ***!
|
|
@@ -18828,16 +18082,16 @@ const AddressZero = "0x0000000000000000000000000000000000000000";
|
|
|
18828
18082
|
/* unused harmony export MaxUint256 */
|
|
18829
18083
|
/* unused harmony export MinInt256 */
|
|
18830
18084
|
/* unused harmony export MaxInt256 */
|
|
18831
|
-
/* harmony import */ var _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ethersproject/bignumber */ "./node_modules/@ethersproject/
|
|
18085
|
+
/* harmony import */ var _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ethersproject/bignumber */ "./node_modules/@ethersproject/bignumber/lib.esm/index.js");
|
|
18832
18086
|
|
|
18833
|
-
const NegativeOne = ( /*#__PURE__*/_ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_0__[
|
|
18834
|
-
const Zero = ( /*#__PURE__*/_ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_0__[
|
|
18835
|
-
const One = ( /*#__PURE__*/_ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_0__[
|
|
18836
|
-
const Two = ( /*#__PURE__*/_ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_0__[
|
|
18837
|
-
const WeiPerEther = ( /*#__PURE__*/_ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_0__[
|
|
18838
|
-
const MaxUint256 = ( /*#__PURE__*/_ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_0__[
|
|
18839
|
-
const MinInt256 = ( /*#__PURE__*/_ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_0__[
|
|
18840
|
-
const MaxInt256 = ( /*#__PURE__*/_ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_0__[
|
|
18087
|
+
const NegativeOne = ( /*#__PURE__*/_ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_0__["BigNumber"].from(-1));
|
|
18088
|
+
const Zero = ( /*#__PURE__*/_ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_0__["BigNumber"].from(0));
|
|
18089
|
+
const One = ( /*#__PURE__*/_ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_0__["BigNumber"].from(1));
|
|
18090
|
+
const Two = ( /*#__PURE__*/_ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_0__["BigNumber"].from(2));
|
|
18091
|
+
const WeiPerEther = ( /*#__PURE__*/_ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_0__["BigNumber"].from("1000000000000000000"));
|
|
18092
|
+
const MaxUint256 = ( /*#__PURE__*/_ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_0__["BigNumber"].from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"));
|
|
18093
|
+
const MinInt256 = ( /*#__PURE__*/_ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_0__["BigNumber"].from("-0x8000000000000000000000000000000000000000000000000000000000000000"));
|
|
18094
|
+
const MaxInt256 = ( /*#__PURE__*/_ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_0__["BigNumber"].from("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"));
|
|
18841
18095
|
|
|
18842
18096
|
//# sourceMappingURL=bignumbers.js.map
|
|
18843
18097
|
|
|
@@ -136279,6 +135533,11 @@ class Service {
|
|
|
136279
135533
|
return this._handleTypedSignatureAndMainApiRequest(Object.assign(Object.assign({}, formattedReq), { body: args.isCompressEnabled ? util_1.compressJsonToBuffer(req.body) : req.body, typedDataBody: args.isCompressEnabled ? util_1.compressJsonToBuffer(typedDataProps(req)) : typedDataProps(req) }), httpRequestInfo('/srr/bulk', 'post'));
|
|
136280
135534
|
});
|
|
136281
135535
|
}
|
|
135536
|
+
checkERC2981Royalty(args) {
|
|
135537
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
135538
|
+
return this.tx.sendRequest('post', '/srr/erc2981/checker', { body: args });
|
|
135539
|
+
});
|
|
135540
|
+
}
|
|
136282
135541
|
/**
|
|
136283
135542
|
* Change language on your browser wallet
|
|
136284
135543
|
* @throws Will throw an error
|
|
@@ -136555,6 +135814,24 @@ class Startrail {
|
|
|
136555
135814
|
}
|
|
136556
135815
|
});
|
|
136557
135816
|
}
|
|
135817
|
+
/**
|
|
135818
|
+
* If SRR is already issued, only tokenId is sufficient.
|
|
135819
|
+
* Otherwise, you need to provide metadata and issuerAddress.
|
|
135820
|
+
* Props in metadata are directly referenced to get royalty information.
|
|
135821
|
+
*/
|
|
135822
|
+
checkERC2981Royalty(args) {
|
|
135823
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
135824
|
+
if (this.store.torusStatus.popupInprogress)
|
|
135825
|
+
return false;
|
|
135826
|
+
this.store.switchPopupState();
|
|
135827
|
+
try {
|
|
135828
|
+
return yield this.service.checkERC2981Royalty(args);
|
|
135829
|
+
}
|
|
135830
|
+
finally {
|
|
135831
|
+
this.store.switchPopupState();
|
|
135832
|
+
}
|
|
135833
|
+
});
|
|
135834
|
+
}
|
|
136558
135835
|
/**
|
|
136559
135836
|
* Change language on your browser wallet
|
|
136560
135837
|
* @throws Will throw an error
|
package/package.json
CHANGED
|
@@ -81,6 +81,12 @@ declare module '@startbahn/startrail-sdk-js' {
|
|
|
81
81
|
* @throws Will throw an error
|
|
82
82
|
*/
|
|
83
83
|
bulk(args: Type.Bulk): Promise<Type.ResponseFromBatch | false>;
|
|
84
|
+
/**
|
|
85
|
+
* If SRR is already issued, only tokenId is sufficient.
|
|
86
|
+
* Otherwise, you need to provide metadata and issuerAddress.
|
|
87
|
+
* Props in metadata are directly referenced to get royalty information.
|
|
88
|
+
*/
|
|
89
|
+
checkERC2981Royalty(args: Type.IERC2981RoyaltyRequest): Promise<Type.IERC2981RoyaltyResponse | false>;
|
|
84
90
|
/**
|
|
85
91
|
* Change language on your browser wallet
|
|
86
92
|
* @throws Will throw an error
|
|
@@ -184,6 +190,15 @@ declare module '@startbahn/startrail-sdk-js/types' {
|
|
|
184
190
|
artistAddress: string;
|
|
185
191
|
lockExternalTransfer: boolean;
|
|
186
192
|
}
|
|
193
|
+
export interface IERC2981RoyaltyRequest {
|
|
194
|
+
tokenId?: string;
|
|
195
|
+
metadata?: object;
|
|
196
|
+
issuerAddress?: string;
|
|
197
|
+
}
|
|
198
|
+
export interface IERC2981RoyaltyResponse {
|
|
199
|
+
royaltyReceiver: string | null;
|
|
200
|
+
royaltyBasisPoints: number | null;
|
|
201
|
+
}
|
|
187
202
|
export interface EIP712TypedData {
|
|
188
203
|
types: Record<string, ReadonlyArray<TypedDataField>>;
|
|
189
204
|
primaryType: MetaTxRequestType;
|
|
@@ -684,6 +699,7 @@ declare module '@startbahn/startrail-sdk-js/service' {
|
|
|
684
699
|
addCustomHistoriesToSRRs(args: Type.AddCustomHistoriesToSRRs): Promise<Type.ResponseOfEthStateChange>;
|
|
685
700
|
transferFromWithProvenance(args: Type.TransferFromWithProvenance): Promise<Type.ResponseOfEthStateChange | false>;
|
|
686
701
|
bulk(args: Type.Bulk): Promise<Type.ResponseFromBatch | false>;
|
|
702
|
+
checkERC2981Royalty(args: Type.IERC2981RoyaltyRequest): Promise<Type.IERC2981RoyaltyResponse>;
|
|
687
703
|
/**
|
|
688
704
|
* Change language on your browser wallet
|
|
689
705
|
* @throws Will throw an error
|