@startbahn/startrail-sdk-js 1.30.0 → 1.30.2-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 +207 -798
- package/package.json +1 -1
- package/types/startrail-sdk-js.d.ts +41 -7
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
|
|
|
@@ -136056,24 +135310,8 @@ const metamask_1 = __importDefault(__webpack_require__(/*! ./wallets/metamask */
|
|
|
136056
135310
|
const walletBuilder_1 = __importDefault(__webpack_require__(/*! ./walletBuilder */ "./src/walletBuilder.ts"));
|
|
136057
135311
|
const transaction_1 = __importDefault(__webpack_require__(/*! ./transaction */ "./src/transaction.ts"));
|
|
136058
135312
|
const util_2 = __webpack_require__(/*! ./configContext/util */ "./src/configContext/util.ts");
|
|
135313
|
+
const serviceUtil_1 = __webpack_require__(/*! ./serviceUtil */ "./src/serviceUtil.ts");
|
|
136059
135314
|
const globalThis = __webpack_require__(/*! globalthis */ "./node_modules/globalthis/index.js")();
|
|
136060
|
-
/**
|
|
136061
|
-
* Generate typedData for functions which accepts either from LfUW or EOA tx
|
|
136062
|
-
*/
|
|
136063
|
-
const typedDataProps = (args) => {
|
|
136064
|
-
const base = { requestData: args.body };
|
|
136065
|
-
if (!args.header.startrailLUWContractAddress)
|
|
136066
|
-
return base;
|
|
136067
|
-
return Object.assign(Object.assign({}, base), { fromAddress: args.header.startrailLUWContractAddress });
|
|
136068
|
-
};
|
|
136069
|
-
const buildHashingPreimage = (args) => {
|
|
136070
|
-
return args.isHashPreimageEnabled
|
|
136071
|
-
? { metadata: args.metadata, revealHash: util_1.generateMessageHash(args.preimage) }
|
|
136072
|
-
: { metadata: args.metadata, preimage: args.preimage };
|
|
136073
|
-
};
|
|
136074
|
-
const httpRequestInfo = (path, method) => {
|
|
136075
|
-
return { method, mainPath: path, typedDataPath: `${path}/typedData` };
|
|
136076
|
-
};
|
|
136077
135315
|
/**
|
|
136078
135316
|
* Logic for wallet and api call
|
|
136079
135317
|
*/
|
|
@@ -136192,7 +135430,7 @@ class Service {
|
|
|
136192
135430
|
this._validateEoaMatchFromInitialLogin();
|
|
136193
135431
|
args.lockExternalTransfer = args.lockExternalTransfer || false;
|
|
136194
135432
|
const req = util_1.buildRequestObject(args);
|
|
136195
|
-
return this._handleTypedSignatureAndMainApiRequest(req, httpRequestInfo('/srr', 'post'));
|
|
135433
|
+
return this._handleTypedSignatureAndMainApiRequest(req, serviceUtil_1.httpRequestInfo('/srr', 'post'));
|
|
136196
135434
|
});
|
|
136197
135435
|
}
|
|
136198
135436
|
/**
|
|
@@ -136204,7 +135442,7 @@ class Service {
|
|
|
136204
135442
|
this._validateEoaMatchFromInitialLogin();
|
|
136205
135443
|
const req = util_1.buildRequestObject(args);
|
|
136206
135444
|
const metadata = req.body.metadata;
|
|
136207
|
-
return this._handleTypedSignatureAndMainApiRequest(Object.assign(Object.assign({}, req), { body: metadata, typedDataBody: Object.assign(Object.assign({}, typedDataProps(req)), { requestData: metadata }) }), httpRequestInfo(`/srr/metadata/${args.tokenId.toString()}.json`, 'put'));
|
|
135445
|
+
return this._handleTypedSignatureAndMainApiRequest(Object.assign(Object.assign({}, req), { body: metadata, typedDataBody: Object.assign(Object.assign({}, serviceUtil_1.typedDataProps(req)), { requestData: metadata }) }), serviceUtil_1.httpRequestInfo(`/srr/metadata/${args.tokenId.toString()}.json`, 'put'));
|
|
136208
135446
|
});
|
|
136209
135447
|
}
|
|
136210
135448
|
/**
|
|
@@ -136224,11 +135462,11 @@ class Service {
|
|
|
136224
135462
|
return __awaiter(this, void 0, void 0, function* () {
|
|
136225
135463
|
this._validateEoaMatchFromInitialLogin();
|
|
136226
135464
|
const req = util_1.buildRequestObject(args);
|
|
136227
|
-
return this._handleTypedSignatureAndMainApiRequest(Object.assign(Object.assign({}, req), { body:
|
|
135465
|
+
return this._handleTypedSignatureAndMainApiRequest(Object.assign(Object.assign({}, req), { body: serviceUtil_1.transformCommitmentData(args) }), serviceUtil_1.httpRequestInfo(`/srr/${req.tokenId}/approveByCommitment`, 'put'));
|
|
136228
135466
|
});
|
|
136229
135467
|
}
|
|
136230
135468
|
/**
|
|
136231
|
-
*
|
|
135469
|
+
* @deprecated client will no longer use generate key feature
|
|
136232
135470
|
* Generate signature fro second transfer
|
|
136233
135471
|
* @throws Will throw an error
|
|
136234
135472
|
*/
|
|
@@ -136237,7 +135475,7 @@ class Service {
|
|
|
136237
135475
|
this._validateEoaMatchFromInitialLogin();
|
|
136238
135476
|
const req = util_1.buildRequestObject(args);
|
|
136239
135477
|
const typedData = yield this.tx.sendRequest('put', `/srr/${req.tokenId}/approveByCommitment/typedData`, {
|
|
136240
|
-
body: typedDataProps(Object.assign(Object.assign({}, req), { body: buildHashingPreimage(args) }))
|
|
135478
|
+
body: serviceUtil_1.typedDataProps(Object.assign(Object.assign({}, req), { body: serviceUtil_1.buildHashingPreimage(args) }))
|
|
136241
135479
|
});
|
|
136242
135480
|
const signature = yield this.wallet.signTypedDataMessage(typedData);
|
|
136243
135481
|
return Object.assign({ signature }, util_1.convertToUnpackNonce(typedData.message.nonce));
|
|
@@ -136251,14 +135489,15 @@ class Service {
|
|
|
136251
135489
|
return __awaiter(this, void 0, void 0, function* () {
|
|
136252
135490
|
this._validateEoaMatchFromInitialLogin();
|
|
136253
135491
|
const req = util_1.buildRequestObject(args);
|
|
136254
|
-
return this._handleTypedSignatureAndMainApiRequest(req, httpRequestInfo('/srr/history', 'post'));
|
|
135492
|
+
return this._handleTypedSignatureAndMainApiRequest(req, serviceUtil_1.httpRequestInfo('/srr/history', 'post'));
|
|
136255
135493
|
});
|
|
136256
135494
|
}
|
|
136257
135495
|
transferFromWithProvenance(args) {
|
|
136258
135496
|
return __awaiter(this, void 0, void 0, function* () {
|
|
136259
135497
|
this._validateEoaMatchFromInitialLogin();
|
|
136260
|
-
const
|
|
136261
|
-
|
|
135498
|
+
const argWithMetadataUpdate = Object.assign(Object.assign({}, args), { metadata: serviceUtil_1.updateTransferMetadata(args.metadata) });
|
|
135499
|
+
const req = util_1.buildRequestObject(util_1.convertEthereumAddressToChecksum(argWithMetadataUpdate));
|
|
135500
|
+
return this._handleTypedSignatureAndMainApiRequest(req, serviceUtil_1.httpRequestInfo(`/srr/${req.tokenId}/transferFromWithProvenance`, 'post'));
|
|
136262
135501
|
});
|
|
136263
135502
|
}
|
|
136264
135503
|
bulk(args) {
|
|
@@ -136266,17 +135505,28 @@ class Service {
|
|
|
136266
135505
|
this._validateEoaMatchFromInitialLogin();
|
|
136267
135506
|
// Todo: Refine types later
|
|
136268
135507
|
const formattedReq = util_1.buildRequestObject(util_1.convertEthereumAddressToChecksum(args));
|
|
136269
|
-
// To apply ApproveSRRByCommitmentShared type
|
|
136270
|
-
const getIsApproveSRRByCommitment = (tx) => {
|
|
136271
|
-
return tx.functionType === 'approveSRRByCommitment';
|
|
136272
|
-
};
|
|
136273
135508
|
const req = Object.assign(Object.assign({}, formattedReq), { body: {
|
|
136274
|
-
txs: formattedReq.body.txs
|
|
136275
|
-
return getIsApproveSRRByCommitment(tx)
|
|
136276
|
-
? Object.assign(Object.assign({}, tx), { data: Object.assign(Object.assign({}, buildHashingPreimage(tx.data)), { tokenId: tx.data.tokenId }) }) : tx;
|
|
136277
|
-
})
|
|
135509
|
+
txs: serviceUtil_1.updateBulkBody(formattedReq.body.txs)
|
|
136278
135510
|
} });
|
|
136279
|
-
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'));
|
|
135511
|
+
return this._handleTypedSignatureAndMainApiRequest(Object.assign(Object.assign({}, formattedReq), { body: args.isCompressEnabled ? util_1.compressJsonToBuffer(req.body) : req.body, typedDataBody: args.isCompressEnabled ? util_1.compressJsonToBuffer(serviceUtil_1.typedDataProps(req)) : serviceUtil_1.typedDataProps(req) }), serviceUtil_1.httpRequestInfo('/srr/bulk', 'post'));
|
|
135512
|
+
});
|
|
135513
|
+
}
|
|
135514
|
+
/**
|
|
135515
|
+
* Temporary use fetch function to check with React compatibility
|
|
135516
|
+
*/
|
|
135517
|
+
checkERC2981Royalty(args) {
|
|
135518
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
135519
|
+
const url = this.tx.concatenateUrl('/srr/erc2981/checker');
|
|
135520
|
+
const response = yield fetch(url, {
|
|
135521
|
+
method: 'POST',
|
|
135522
|
+
headers: {
|
|
135523
|
+
'Content-Type': 'application/json'
|
|
135524
|
+
},
|
|
135525
|
+
body: JSON.stringify(args)
|
|
135526
|
+
});
|
|
135527
|
+
const res = yield response.json();
|
|
135528
|
+
return res;
|
|
135529
|
+
// return this.tx.sendRequest('post', '/srr/erc2981/checker', { body: args })
|
|
136280
135530
|
});
|
|
136281
135531
|
}
|
|
136282
135532
|
/**
|
|
@@ -136290,7 +135540,7 @@ class Service {
|
|
|
136290
135540
|
}
|
|
136291
135541
|
_handleTypedSignatureAndMainApiRequest(req, httpRequest) {
|
|
136292
135542
|
return __awaiter(this, void 0, void 0, function* () {
|
|
136293
|
-
const typedData = yield this.tx.sendRequest(httpRequest.method, httpRequest.typedDataPath, { body: req.typedDataBody || typedDataProps(req) });
|
|
135543
|
+
const typedData = yield this.tx.sendRequest(httpRequest.method, httpRequest.typedDataPath, { body: req.typedDataBody || serviceUtil_1.typedDataProps(req) });
|
|
136294
135544
|
const signature = yield this.wallet.signTypedDataMessage(typedData);
|
|
136295
135545
|
const unpackedNonce = util_1.convertToUnpackNonce(typedData.message.nonce);
|
|
136296
135546
|
return this.tx.sendRequest(httpRequest.method, httpRequest.mainPath, {
|
|
@@ -136321,6 +135571,112 @@ class Service {
|
|
|
136321
135571
|
module.exports = Service;
|
|
136322
135572
|
|
|
136323
135573
|
|
|
135574
|
+
/***/ }),
|
|
135575
|
+
|
|
135576
|
+
/***/ "./src/serviceUtil.ts":
|
|
135577
|
+
/*!****************************!*\
|
|
135578
|
+
!*** ./src/serviceUtil.ts ***!
|
|
135579
|
+
\****************************/
|
|
135580
|
+
/*! no static exports found */
|
|
135581
|
+
/*! all exports used */
|
|
135582
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
135583
|
+
|
|
135584
|
+
"use strict";
|
|
135585
|
+
|
|
135586
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
135587
|
+
if (k2 === undefined) k2 = k;
|
|
135588
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
135589
|
+
}) : (function(o, m, k, k2) {
|
|
135590
|
+
if (k2 === undefined) k2 = k;
|
|
135591
|
+
o[k2] = m[k];
|
|
135592
|
+
}));
|
|
135593
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
135594
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
135595
|
+
}) : function(o, v) {
|
|
135596
|
+
o["default"] = v;
|
|
135597
|
+
});
|
|
135598
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
135599
|
+
if (mod && mod.__esModule) return mod;
|
|
135600
|
+
var result = {};
|
|
135601
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
135602
|
+
__setModuleDefault(result, mod);
|
|
135603
|
+
return result;
|
|
135604
|
+
};
|
|
135605
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
135606
|
+
exports.httpRequestInfo = exports.typedDataProps = exports.updateTransferMetadata = exports.updateBulkBody = exports.transformCommitmentData = exports.buildHashingPreimage = void 0;
|
|
135607
|
+
/* eslint-disable no-case-declarations */
|
|
135608
|
+
/* eslint-disable no-unused-vars */
|
|
135609
|
+
const T = __importStar(__webpack_require__(/*! ./types */ "./src/types.ts"));
|
|
135610
|
+
const util_1 = __webpack_require__(/*! ./util */ "./src/util.ts");
|
|
135611
|
+
/**
|
|
135612
|
+
* @deprecated Leaving it only to support deprecate getTypedDataAndSignature function
|
|
135613
|
+
*/
|
|
135614
|
+
exports.buildHashingPreimage = (args) => {
|
|
135615
|
+
return args.isHashPreimageEnabled
|
|
135616
|
+
? { metadata: args.metadata, revealHash: util_1.generateMessageHash(args.preimage) }
|
|
135617
|
+
: { metadata: args.metadata, preimage: args.preimage };
|
|
135618
|
+
};
|
|
135619
|
+
/**
|
|
135620
|
+
* To update transfer metadata based on that in startrail-common-js
|
|
135621
|
+
*/
|
|
135622
|
+
exports.transformCommitmentData = (args) => {
|
|
135623
|
+
// Update Transfer Metadata
|
|
135624
|
+
args.metadata = exports.updateTransferMetadata(args.metadata);
|
|
135625
|
+
// Hash preimage if requested
|
|
135626
|
+
return args.isHashPreimageEnabled
|
|
135627
|
+
? { metadata: args.metadata, revealHash: util_1.generateMessageHash(args.preimage) }
|
|
135628
|
+
: { metadata: args.metadata, preimage: args.preimage };
|
|
135629
|
+
};
|
|
135630
|
+
/**
|
|
135631
|
+
* To define specific bulk data type by generic function
|
|
135632
|
+
*/
|
|
135633
|
+
function getIsBulkFunctionType(tx, functionType) {
|
|
135634
|
+
return tx.functionType === functionType;
|
|
135635
|
+
}
|
|
135636
|
+
/**
|
|
135637
|
+
* Update data body based on a particular bulk function type
|
|
135638
|
+
*/
|
|
135639
|
+
exports.updateBulkBody = (txs) => {
|
|
135640
|
+
return txs.map((tx) => {
|
|
135641
|
+
// approveSrrByCommitment
|
|
135642
|
+
if (getIsBulkFunctionType(tx, T.BulkFunctionType.approveSRRByCommitment)) {
|
|
135643
|
+
return Object.assign(Object.assign({}, tx), { data: Object.assign(Object.assign({}, exports.transformCommitmentData(tx.data)), { tokenId: tx.data.tokenId }) });
|
|
135644
|
+
}
|
|
135645
|
+
// transferFromWithProvenance
|
|
135646
|
+
if (getIsBulkFunctionType(tx, T.BulkFunctionType.transferFromWithProvenance)) {
|
|
135647
|
+
return Object.assign(Object.assign({}, tx), { data: Object.assign(Object.assign({}, tx.data), { metadata: exports.updateTransferMetadata(tx.data.metadata) }) });
|
|
135648
|
+
}
|
|
135649
|
+
// createSrr
|
|
135650
|
+
if (getIsBulkFunctionType(tx, T.BulkFunctionType.createSRR)) {
|
|
135651
|
+
return tx;
|
|
135652
|
+
}
|
|
135653
|
+
throw Error(('Given bulk type is not supported'));
|
|
135654
|
+
});
|
|
135655
|
+
};
|
|
135656
|
+
/**
|
|
135657
|
+
* Update transfer metadata based on Startrail-common-js schema
|
|
135658
|
+
* Current versin is v1.2
|
|
135659
|
+
* https://github.com/startbahn/startrail-common-js/blob/develop/src/metadata-schema/registry-record-transfer-metadata/v1.2.json
|
|
135660
|
+
*/
|
|
135661
|
+
exports.updateTransferMetadata = (metadata) => {
|
|
135662
|
+
if (metadata.$schemaIntegrity)
|
|
135663
|
+
delete metadata.$schemaIntegrity;
|
|
135664
|
+
return Object.assign(Object.assign({}, metadata), { $schema: 'ipfs://bafkreifpemhwxza2n2hkr23xk7ubdxanyig4pblhcgzk5w35dzgjqhrcte' });
|
|
135665
|
+
};
|
|
135666
|
+
/**
|
|
135667
|
+
* Generate typedData for functions which accepts either from LfUW or EOA tx
|
|
135668
|
+
*/
|
|
135669
|
+
exports.typedDataProps = (args) => {
|
|
135670
|
+
const base = { requestData: args.body };
|
|
135671
|
+
if (!args.header.startrailLUWContractAddress)
|
|
135672
|
+
return base;
|
|
135673
|
+
return Object.assign(Object.assign({}, base), { fromAddress: args.header.startrailLUWContractAddress });
|
|
135674
|
+
};
|
|
135675
|
+
exports.httpRequestInfo = (path, method) => {
|
|
135676
|
+
return { method, mainPath: path, typedDataPath: `${path}/typedData` };
|
|
135677
|
+
};
|
|
135678
|
+
|
|
135679
|
+
|
|
136324
135680
|
/***/ }),
|
|
136325
135681
|
|
|
136326
135682
|
/***/ "./src/startrail.ts":
|
|
@@ -136555,6 +135911,24 @@ class Startrail {
|
|
|
136555
135911
|
}
|
|
136556
135912
|
});
|
|
136557
135913
|
}
|
|
135914
|
+
/**
|
|
135915
|
+
* If SRR is already issued, only tokenId is sufficient.
|
|
135916
|
+
* Otherwise, you need to provide metadata and issuerAddress.
|
|
135917
|
+
* Props in metadata are directly referenced to get royalty information.
|
|
135918
|
+
*/
|
|
135919
|
+
checkERC2981Royalty(args) {
|
|
135920
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
135921
|
+
if (this.store.torusStatus.popupInprogress)
|
|
135922
|
+
return false;
|
|
135923
|
+
this.store.switchPopupState();
|
|
135924
|
+
try {
|
|
135925
|
+
return yield this.service.checkERC2981Royalty(args);
|
|
135926
|
+
}
|
|
135927
|
+
finally {
|
|
135928
|
+
this.store.switchPopupState();
|
|
135929
|
+
}
|
|
135930
|
+
});
|
|
135931
|
+
}
|
|
136558
135932
|
/**
|
|
136559
135933
|
* Change language on your browser wallet
|
|
136560
135934
|
* @throws Will throw an error
|
|
@@ -136667,6 +136041,41 @@ class Transaction extends requestAdapter_1.default {
|
|
|
136667
136041
|
module.exports = Transaction;
|
|
136668
136042
|
|
|
136669
136043
|
|
|
136044
|
+
/***/ }),
|
|
136045
|
+
|
|
136046
|
+
/***/ "./src/types.ts":
|
|
136047
|
+
/*!**********************!*\
|
|
136048
|
+
!*** ./src/types.ts ***!
|
|
136049
|
+
\**********************/
|
|
136050
|
+
/*! no static exports found */
|
|
136051
|
+
/*! all exports used */
|
|
136052
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
136053
|
+
|
|
136054
|
+
"use strict";
|
|
136055
|
+
|
|
136056
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
136057
|
+
exports.MetaTxRequestType = exports.BulkFunctionType = void 0;
|
|
136058
|
+
var BulkFunctionType;
|
|
136059
|
+
(function (BulkFunctionType) {
|
|
136060
|
+
BulkFunctionType["createSRR"] = "createSRR";
|
|
136061
|
+
BulkFunctionType["approveSRRByCommitment"] = "approveSRRByCommitment";
|
|
136062
|
+
BulkFunctionType["transferFromWithProvenance"] = "transferFromWithProvenance";
|
|
136063
|
+
})(BulkFunctionType = exports.BulkFunctionType || (exports.BulkFunctionType = {}));
|
|
136064
|
+
var MetaTxRequestType;
|
|
136065
|
+
(function (MetaTxRequestType) {
|
|
136066
|
+
// LicensedUserManager
|
|
136067
|
+
MetaTxRequestType["WalletAddOwner"] = "WalletAddOwner";
|
|
136068
|
+
MetaTxRequestType["WalletRemoveOwner"] = "WalletRemoveOwner";
|
|
136069
|
+
MetaTxRequestType["WalletSwapOwner"] = "WalletSwapOwner";
|
|
136070
|
+
MetaTxRequestType["WalletChangeThreshold"] = "WalletChangeThreshold";
|
|
136071
|
+
// StartrailRegistry
|
|
136072
|
+
MetaTxRequestType["StartrailRegistryCreateSRR"] = "StartrailRegistryCreateSRR";
|
|
136073
|
+
MetaTxRequestType["StartrailRegistryUpdateSRR"] = "StartrailRegistryUpdateSRR";
|
|
136074
|
+
MetaTxRequestType["StartrailRegistryUpdateSRRMetadata"] = "StartrailRegistryUpdateSRRMetadata";
|
|
136075
|
+
MetaTxRequestType["StartrailRegistryApproveSRRByCommitment"] = "StartrailRegistryApproveSRRByCommitment";
|
|
136076
|
+
})(MetaTxRequestType = exports.MetaTxRequestType || (exports.MetaTxRequestType = {}));
|
|
136077
|
+
|
|
136078
|
+
|
|
136670
136079
|
/***/ }),
|
|
136671
136080
|
|
|
136672
136081
|
/***/ "./src/util.ts":
|
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
|
|
@@ -110,6 +116,12 @@ declare module '@startbahn/startrail-sdk-js/types' {
|
|
|
110
116
|
}
|
|
111
117
|
export interface ApproveSRRByCommitment extends ApproveSRRByCommitmentShared, Pick<HTTPHeadersForStartrail, 'startrailLUWContractAddress'> {
|
|
112
118
|
}
|
|
119
|
+
export interface ApproveSRRByCommitmentShared {
|
|
120
|
+
preimage: string;
|
|
121
|
+
tokenId: string;
|
|
122
|
+
metadata: HistoryMetadata;
|
|
123
|
+
isHashPreimageEnabled: boolean;
|
|
124
|
+
}
|
|
113
125
|
export interface ApproveSRRByCommitmentDto {
|
|
114
126
|
metadata: HistoryMetadata;
|
|
115
127
|
preimage?: string;
|
|
@@ -118,12 +130,6 @@ declare module '@startbahn/startrail-sdk-js/types' {
|
|
|
118
130
|
export interface ApproveSRRByCommitmentBulkDto extends ApproveSRRByCommitmentDto {
|
|
119
131
|
tokenId: string;
|
|
120
132
|
}
|
|
121
|
-
export interface ApproveSRRByCommitmentShared {
|
|
122
|
-
preimage: string;
|
|
123
|
-
tokenId: string;
|
|
124
|
-
metadata: HistoryMetadata;
|
|
125
|
-
isHashPreimageEnabled: boolean;
|
|
126
|
-
}
|
|
127
133
|
export enum BulkFunctionType {
|
|
128
134
|
createSRR = "createSRR",
|
|
129
135
|
approveSRRByCommitment = "approveSRRByCommitment",
|
|
@@ -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;
|
|
@@ -206,6 +221,15 @@ declare module '@startbahn/startrail-sdk-js/types' {
|
|
|
206
221
|
remarks?: MultiLanguage;
|
|
207
222
|
customHistoryId?: number;
|
|
208
223
|
}
|
|
224
|
+
export interface UpdatedHistoryMetadata extends HistoryMetadata {
|
|
225
|
+
$schema: string;
|
|
226
|
+
}
|
|
227
|
+
export interface ApproveSRRByCommitmentWithMetadataUpdate extends ApproveSRRByCommitment {
|
|
228
|
+
metadata: UpdatedHistoryMetadata;
|
|
229
|
+
}
|
|
230
|
+
export interface TransferFromWithProvenanceWithMetadataUpdate extends TransferFromWithProvenance {
|
|
231
|
+
metadata: UpdatedHistoryMetadata;
|
|
232
|
+
}
|
|
209
233
|
export interface HTTPConfig {
|
|
210
234
|
method: string;
|
|
211
235
|
url: string;
|
|
@@ -345,6 +369,8 @@ declare module '@startbahn/startrail-sdk-js/types' {
|
|
|
345
369
|
metadata: HistoryMetadata;
|
|
346
370
|
isIntermediary?: boolean;
|
|
347
371
|
}
|
|
372
|
+
export interface TTransferFromWithProvenanceDto extends Omit<TransferFromWithProvenanceShared, 'tokenId'> {
|
|
373
|
+
}
|
|
348
374
|
export interface typedDataProps {
|
|
349
375
|
fromAddress?: string;
|
|
350
376
|
channelId?: string;
|
|
@@ -672,7 +698,7 @@ declare module '@startbahn/startrail-sdk-js/service' {
|
|
|
672
698
|
*/
|
|
673
699
|
approveSRRByCommitment(args: Type.ApproveSRRByCommitment): Promise<Type.ResponseOfEthStateChange | false>;
|
|
674
700
|
/**
|
|
675
|
-
*
|
|
701
|
+
* @deprecated client will no longer use generate key feature
|
|
676
702
|
* Generate signature fro second transfer
|
|
677
703
|
* @throws Will throw an error
|
|
678
704
|
*/
|
|
@@ -684,6 +710,10 @@ declare module '@startbahn/startrail-sdk-js/service' {
|
|
|
684
710
|
addCustomHistoriesToSRRs(args: Type.AddCustomHistoriesToSRRs): Promise<Type.ResponseOfEthStateChange>;
|
|
685
711
|
transferFromWithProvenance(args: Type.TransferFromWithProvenance): Promise<Type.ResponseOfEthStateChange | false>;
|
|
686
712
|
bulk(args: Type.Bulk): Promise<Type.ResponseFromBatch | false>;
|
|
713
|
+
/**
|
|
714
|
+
* Temporary use fetch function to check with React compatibility
|
|
715
|
+
*/
|
|
716
|
+
checkERC2981Royalty(args: Type.IERC2981RoyaltyRequest): Promise<Type.IERC2981RoyaltyResponse>;
|
|
687
717
|
/**
|
|
688
718
|
* Change language on your browser wallet
|
|
689
719
|
* @throws Will throw an error
|
|
@@ -847,6 +877,10 @@ declare module '@startbahn/startrail-sdk-js/transaction' {
|
|
|
847
877
|
baseURL: string;
|
|
848
878
|
constructor(url: string);
|
|
849
879
|
sendRequest(method: RequestMethod, path: string, options?: HTTPRequest): Promise<any>;
|
|
880
|
+
/**
|
|
881
|
+
* Concatenate Request URL
|
|
882
|
+
*/
|
|
883
|
+
concatenateUrl(urlPath: string): string;
|
|
850
884
|
}
|
|
851
885
|
export = Transaction;
|
|
852
886
|
}
|