@startbahn/startrail-sdk-js 1.28.2 → 1.29.0-beta.2

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.
@@ -15492,11 +15492,11 @@ utils.intFromLE = intFromLE;
15492
15492
  /*!*****************************************************************************!*\
15493
15493
  !*** ./node_modules/@toruslabs/eccrypto/node_modules/elliptic/package.json ***!
15494
15494
  \*****************************************************************************/
15495
- /*! exports provided: _from, _id, _inBundle, _integrity, _location, _phantomChildren, _requested, _requiredBy, _resolved, _shasum, _spec, _where, author, bugs, bundleDependencies, dependencies, deprecated, description, devDependencies, files, homepage, keywords, license, main, name, repository, scripts, version, default */
15495
+ /*! exports provided: _args, _from, _id, _inBundle, _integrity, _location, _phantomChildren, _requested, _requiredBy, _resolved, _spec, _where, author, bugs, dependencies, description, devDependencies, files, homepage, keywords, license, main, name, repository, scripts, version, default */
15496
15496
  /*! all exports used */
15497
15497
  /***/ (function(module) {
15498
15498
 
15499
- module.exports = JSON.parse("{\"_from\":\"elliptic@^6.5.4\",\"_id\":\"elliptic@6.5.4\",\"_inBundle\":false,\"_integrity\":\"sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==\",\"_location\":\"/@toruslabs/eccrypto/elliptic\",\"_phantomChildren\":{},\"_requested\":{\"type\":\"range\",\"registry\":true,\"raw\":\"elliptic@^6.5.4\",\"name\":\"elliptic\",\"escapedName\":\"elliptic\",\"rawSpec\":\"^6.5.4\",\"saveSpec\":null,\"fetchSpec\":\"^6.5.4\"},\"_requiredBy\":[\"/@toruslabs/eccrypto\"],\"_resolved\":\"https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz\",\"_shasum\":\"da37cebd31e79a1367e941b592ed1fbebd58abbb\",\"_spec\":\"elliptic@^6.5.4\",\"_where\":\"/Users/toshiyamatsumoto/Workplace/startbahn/startrail-sdk-js/node_modules/@toruslabs/eccrypto\",\"author\":{\"name\":\"Fedor Indutny\",\"email\":\"fedor@indutny.com\"},\"bugs\":{\"url\":\"https://github.com/indutny/elliptic/issues\"},\"bundleDependencies\":false,\"dependencies\":{\"bn.js\":\"^4.11.9\",\"brorand\":\"^1.1.0\",\"hash.js\":\"^1.0.0\",\"hmac-drbg\":\"^1.0.1\",\"inherits\":\"^2.0.4\",\"minimalistic-assert\":\"^1.0.1\",\"minimalistic-crypto-utils\":\"^1.0.1\"},\"deprecated\":false,\"description\":\"EC cryptography\",\"devDependencies\":{\"brfs\":\"^2.0.2\",\"coveralls\":\"^3.1.0\",\"eslint\":\"^7.6.0\",\"grunt\":\"^1.2.1\",\"grunt-browserify\":\"^5.3.0\",\"grunt-cli\":\"^1.3.2\",\"grunt-contrib-connect\":\"^3.0.0\",\"grunt-contrib-copy\":\"^1.0.0\",\"grunt-contrib-uglify\":\"^5.0.0\",\"grunt-mocha-istanbul\":\"^5.0.2\",\"grunt-saucelabs\":\"^9.0.1\",\"istanbul\":\"^0.4.5\",\"mocha\":\"^8.0.1\"},\"files\":[\"lib\"],\"homepage\":\"https://github.com/indutny/elliptic\",\"keywords\":[\"EC\",\"Elliptic\",\"curve\",\"Cryptography\"],\"license\":\"MIT\",\"main\":\"lib/elliptic.js\",\"name\":\"elliptic\",\"repository\":{\"type\":\"git\",\"url\":\"git+ssh://git@github.com/indutny/elliptic.git\"},\"scripts\":{\"lint\":\"eslint lib test\",\"lint:fix\":\"npm run lint -- --fix\",\"test\":\"npm run lint && npm run unit\",\"unit\":\"istanbul test _mocha --reporter=spec test/index.js\",\"version\":\"grunt dist && git add dist/\"},\"version\":\"6.5.4\"}");
15499
+ module.exports = JSON.parse("{\"_args\":[[\"elliptic@6.5.4\",\"/Users/toshiyamatsumoto/Workplace/startbahn/startrail-sdk-js\"]],\"_from\":\"elliptic@6.5.4\",\"_id\":\"elliptic@6.5.4\",\"_inBundle\":false,\"_integrity\":\"sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==\",\"_location\":\"/@toruslabs/eccrypto/elliptic\",\"_phantomChildren\":{},\"_requested\":{\"type\":\"version\",\"registry\":true,\"raw\":\"elliptic@6.5.4\",\"name\":\"elliptic\",\"escapedName\":\"elliptic\",\"rawSpec\":\"6.5.4\",\"saveSpec\":null,\"fetchSpec\":\"6.5.4\"},\"_requiredBy\":[\"/@toruslabs/eccrypto\"],\"_resolved\":\"https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz\",\"_spec\":\"6.5.4\",\"_where\":\"/Users/toshiyamatsumoto/Workplace/startbahn/startrail-sdk-js\",\"author\":{\"name\":\"Fedor Indutny\",\"email\":\"fedor@indutny.com\"},\"bugs\":{\"url\":\"https://github.com/indutny/elliptic/issues\"},\"dependencies\":{\"bn.js\":\"^4.11.9\",\"brorand\":\"^1.1.0\",\"hash.js\":\"^1.0.0\",\"hmac-drbg\":\"^1.0.1\",\"inherits\":\"^2.0.4\",\"minimalistic-assert\":\"^1.0.1\",\"minimalistic-crypto-utils\":\"^1.0.1\"},\"description\":\"EC cryptography\",\"devDependencies\":{\"brfs\":\"^2.0.2\",\"coveralls\":\"^3.1.0\",\"eslint\":\"^7.6.0\",\"grunt\":\"^1.2.1\",\"grunt-browserify\":\"^5.3.0\",\"grunt-cli\":\"^1.3.2\",\"grunt-contrib-connect\":\"^3.0.0\",\"grunt-contrib-copy\":\"^1.0.0\",\"grunt-contrib-uglify\":\"^5.0.0\",\"grunt-mocha-istanbul\":\"^5.0.2\",\"grunt-saucelabs\":\"^9.0.1\",\"istanbul\":\"^0.4.5\",\"mocha\":\"^8.0.1\"},\"files\":[\"lib\"],\"homepage\":\"https://github.com/indutny/elliptic\",\"keywords\":[\"EC\",\"Elliptic\",\"curve\",\"Cryptography\"],\"license\":\"MIT\",\"main\":\"lib/elliptic.js\",\"name\":\"elliptic\",\"repository\":{\"type\":\"git\",\"url\":\"git+ssh://git@github.com/indutny/elliptic.git\"},\"scripts\":{\"lint\":\"eslint lib test\",\"lint:fix\":\"npm run lint -- --fix\",\"test\":\"npm run lint && npm run unit\",\"unit\":\"istanbul test _mocha --reporter=spec test/index.js\",\"version\":\"grunt dist && git add dist/\"},\"version\":\"6.5.4\"}");
15500
15500
 
15501
15501
  /***/ }),
15502
15502
 
@@ -55139,11 +55139,11 @@ utils.intFromLE = intFromLE;
55139
55139
  /*!*****************************************************************************!*\
55140
55140
  !*** ./node_modules/@toruslabs/torus.js/node_modules/elliptic/package.json ***!
55141
55141
  \*****************************************************************************/
55142
- /*! exports provided: _from, _id, _inBundle, _integrity, _location, _phantomChildren, _requested, _requiredBy, _resolved, _shasum, _spec, _where, author, bugs, bundleDependencies, dependencies, deprecated, description, devDependencies, files, homepage, keywords, license, main, name, repository, scripts, version, default */
55142
+ /*! exports provided: _args, _from, _id, _inBundle, _integrity, _location, _phantomChildren, _requested, _requiredBy, _resolved, _spec, _where, author, bugs, dependencies, description, devDependencies, files, homepage, keywords, license, main, name, repository, scripts, version, default */
55143
55143
  /*! all exports used */
55144
55144
  /***/ (function(module) {
55145
55145
 
55146
- module.exports = JSON.parse("{\"_from\":\"elliptic@^6.5.4\",\"_id\":\"elliptic@6.5.4\",\"_inBundle\":false,\"_integrity\":\"sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==\",\"_location\":\"/@toruslabs/torus.js/elliptic\",\"_phantomChildren\":{},\"_requested\":{\"type\":\"range\",\"registry\":true,\"raw\":\"elliptic@^6.5.4\",\"name\":\"elliptic\",\"escapedName\":\"elliptic\",\"rawSpec\":\"^6.5.4\",\"saveSpec\":null,\"fetchSpec\":\"^6.5.4\"},\"_requiredBy\":[\"/@toruslabs/torus.js\"],\"_resolved\":\"https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz\",\"_shasum\":\"da37cebd31e79a1367e941b592ed1fbebd58abbb\",\"_spec\":\"elliptic@^6.5.4\",\"_where\":\"/Users/toshiyamatsumoto/Workplace/startbahn/startrail-sdk-js/node_modules/@toruslabs/torus.js\",\"author\":{\"name\":\"Fedor Indutny\",\"email\":\"fedor@indutny.com\"},\"bugs\":{\"url\":\"https://github.com/indutny/elliptic/issues\"},\"bundleDependencies\":false,\"dependencies\":{\"bn.js\":\"^4.11.9\",\"brorand\":\"^1.1.0\",\"hash.js\":\"^1.0.0\",\"hmac-drbg\":\"^1.0.1\",\"inherits\":\"^2.0.4\",\"minimalistic-assert\":\"^1.0.1\",\"minimalistic-crypto-utils\":\"^1.0.1\"},\"deprecated\":false,\"description\":\"EC cryptography\",\"devDependencies\":{\"brfs\":\"^2.0.2\",\"coveralls\":\"^3.1.0\",\"eslint\":\"^7.6.0\",\"grunt\":\"^1.2.1\",\"grunt-browserify\":\"^5.3.0\",\"grunt-cli\":\"^1.3.2\",\"grunt-contrib-connect\":\"^3.0.0\",\"grunt-contrib-copy\":\"^1.0.0\",\"grunt-contrib-uglify\":\"^5.0.0\",\"grunt-mocha-istanbul\":\"^5.0.2\",\"grunt-saucelabs\":\"^9.0.1\",\"istanbul\":\"^0.4.5\",\"mocha\":\"^8.0.1\"},\"files\":[\"lib\"],\"homepage\":\"https://github.com/indutny/elliptic\",\"keywords\":[\"EC\",\"Elliptic\",\"curve\",\"Cryptography\"],\"license\":\"MIT\",\"main\":\"lib/elliptic.js\",\"name\":\"elliptic\",\"repository\":{\"type\":\"git\",\"url\":\"git+ssh://git@github.com/indutny/elliptic.git\"},\"scripts\":{\"lint\":\"eslint lib test\",\"lint:fix\":\"npm run lint -- --fix\",\"test\":\"npm run lint && npm run unit\",\"unit\":\"istanbul test _mocha --reporter=spec test/index.js\",\"version\":\"grunt dist && git add dist/\"},\"version\":\"6.5.4\"}");
55146
+ module.exports = JSON.parse("{\"_args\":[[\"elliptic@6.5.4\",\"/Users/toshiyamatsumoto/Workplace/startbahn/startrail-sdk-js\"]],\"_from\":\"elliptic@6.5.4\",\"_id\":\"elliptic@6.5.4\",\"_inBundle\":false,\"_integrity\":\"sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==\",\"_location\":\"/@toruslabs/torus.js/elliptic\",\"_phantomChildren\":{},\"_requested\":{\"type\":\"version\",\"registry\":true,\"raw\":\"elliptic@6.5.4\",\"name\":\"elliptic\",\"escapedName\":\"elliptic\",\"rawSpec\":\"6.5.4\",\"saveSpec\":null,\"fetchSpec\":\"6.5.4\"},\"_requiredBy\":[\"/@toruslabs/torus.js\"],\"_resolved\":\"https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz\",\"_spec\":\"6.5.4\",\"_where\":\"/Users/toshiyamatsumoto/Workplace/startbahn/startrail-sdk-js\",\"author\":{\"name\":\"Fedor Indutny\",\"email\":\"fedor@indutny.com\"},\"bugs\":{\"url\":\"https://github.com/indutny/elliptic/issues\"},\"dependencies\":{\"bn.js\":\"^4.11.9\",\"brorand\":\"^1.1.0\",\"hash.js\":\"^1.0.0\",\"hmac-drbg\":\"^1.0.1\",\"inherits\":\"^2.0.4\",\"minimalistic-assert\":\"^1.0.1\",\"minimalistic-crypto-utils\":\"^1.0.1\"},\"description\":\"EC cryptography\",\"devDependencies\":{\"brfs\":\"^2.0.2\",\"coveralls\":\"^3.1.0\",\"eslint\":\"^7.6.0\",\"grunt\":\"^1.2.1\",\"grunt-browserify\":\"^5.3.0\",\"grunt-cli\":\"^1.3.2\",\"grunt-contrib-connect\":\"^3.0.0\",\"grunt-contrib-copy\":\"^1.0.0\",\"grunt-contrib-uglify\":\"^5.0.0\",\"grunt-mocha-istanbul\":\"^5.0.2\",\"grunt-saucelabs\":\"^9.0.1\",\"istanbul\":\"^0.4.5\",\"mocha\":\"^8.0.1\"},\"files\":[\"lib\"],\"homepage\":\"https://github.com/indutny/elliptic\",\"keywords\":[\"EC\",\"Elliptic\",\"curve\",\"Cryptography\"],\"license\":\"MIT\",\"main\":\"lib/elliptic.js\",\"name\":\"elliptic\",\"repository\":{\"type\":\"git\",\"url\":\"git+ssh://git@github.com/indutny/elliptic.git\"},\"scripts\":{\"lint\":\"eslint lib test\",\"lint:fix\":\"npm run lint -- --fix\",\"test\":\"npm run lint && npm run unit\",\"unit\":\"istanbul test _mocha --reporter=spec test/index.js\",\"version\":\"grunt dist && git add dist/\"},\"version\":\"6.5.4\"}");
55147
55147
 
55148
55148
  /***/ }),
55149
55149
 
@@ -114414,6 +114414,57 @@ module.exports = function isHexPrefixed(str) {
114414
114414
  }
114415
114415
 
114416
114416
 
114417
+ /***/ }),
114418
+
114419
+ /***/ "./node_modules/is-mobile/index.js":
114420
+ /*!*****************************************!*\
114421
+ !*** ./node_modules/is-mobile/index.js ***!
114422
+ \*****************************************/
114423
+ /*! no static exports found */
114424
+ /*! all exports used */
114425
+ /***/ (function(module, exports, __webpack_require__) {
114426
+
114427
+ "use strict";
114428
+
114429
+
114430
+ module.exports = isMobile
114431
+ module.exports.isMobile = isMobile
114432
+ module.exports.default = isMobile
114433
+
114434
+ const mobileRE = /(android|bb\d+|meego).+mobile|armv7l|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series[46]0|samsungbrowser|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i
114435
+ const notMobileRE = /CrOS/
114436
+
114437
+ const tabletRE = /android|ipad|playbook|silk/i
114438
+
114439
+ function isMobile (opts) {
114440
+ if (!opts) opts = {}
114441
+ let ua = opts.ua
114442
+ if (!ua && typeof navigator !== 'undefined') ua = navigator.userAgent
114443
+ if (ua && ua.headers && typeof ua.headers['user-agent'] === 'string') {
114444
+ ua = ua.headers['user-agent']
114445
+ }
114446
+ if (typeof ua !== 'string') return false
114447
+
114448
+ let result =
114449
+ (mobileRE.test(ua) && !notMobileRE.test(ua)) ||
114450
+ (!!opts.tablet && tabletRE.test(ua))
114451
+
114452
+ if (
114453
+ !result &&
114454
+ opts.tablet &&
114455
+ opts.featureDetect &&
114456
+ navigator &&
114457
+ navigator.maxTouchPoints > 1 &&
114458
+ ua.indexOf('Macintosh') !== -1 &&
114459
+ ua.indexOf('Safari') !== -1
114460
+ ) {
114461
+ result = true
114462
+ }
114463
+
114464
+ return result
114465
+ }
114466
+
114467
+
114417
114468
  /***/ }),
114418
114469
 
114419
114470
  /***/ "./node_modules/isarray/index.js":
@@ -166194,6 +166245,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
166194
166245
  return (mod && mod.__esModule) ? mod : { "default": mod };
166195
166246
  };
166196
166247
  /* eslint-disable no-unused-vars */
166248
+ const ethereumjs_util_1 = __webpack_require__(/*! ethereumjs-util */ "./node_modules/ethereumjs-util/dist.browser/index.js");
166197
166249
  const constant_1 = __webpack_require__(/*! ./constant */ "./src/constant.ts");
166198
166250
  const error_1 = __webpack_require__(/*! ./error */ "./src/error.ts");
166199
166251
  const util_1 = __webpack_require__(/*! ./util */ "./src/util.ts");
@@ -166213,7 +166265,7 @@ const typedDataProps = (args) => {
166213
166265
  return Object.assign(Object.assign({}, base), { fromAddress: args.header.startrailLUWContractAddress });
166214
166266
  };
166215
166267
  const buildHashingPreimage = (args) => {
166216
- return args.hashFlag
166268
+ return args.isHashPreimageEnabled
166217
166269
  ? { metadata: args.metadata, revealHash: util_1.generateMessageHash(args.preimage) }
166218
166270
  : { metadata: args.metadata, preimage: args.preimage };
166219
166271
  };
@@ -166246,7 +166298,8 @@ class Service {
166246
166298
  if (overwriteConfig)
166247
166299
  this.wallet.overwriteConfig(overwriteConfig);
166248
166300
  try {
166249
- return yield this.wallet.login();
166301
+ const eoas = yield this.wallet.login();
166302
+ return eoas.length > 0 ? eoas : false;
166250
166303
  }
166251
166304
  catch (error) {
166252
166305
  yield this.wallet.logout();
@@ -166303,7 +166356,7 @@ class Service {
166303
166356
  }
166304
166357
  else {
166305
166358
  paramsToBeSigned = {
166306
- params: [wallet.EOA, util_1.generateMessageHash(message)]
166359
+ params: [wallet.EOA, ethereumjs_util_1.fromUtf8(message)]
166307
166360
  };
166308
166361
  }
166309
166362
  try {
@@ -166364,6 +166417,7 @@ class Service {
166364
166417
  /**
166365
166418
  * Creates and sends a batch of SRRs to be issued providing the same SRRs as /bulk/typedData to prove the same merkle root
166366
166419
  * @throws Will throw an error
166420
+ * @deprecated
166367
166421
  */
166368
166422
  createAndSRRBatch(args) {
166369
166423
  return __awaiter(this, void 0, void 0, function* () {
@@ -166381,6 +166435,7 @@ class Service {
166381
166435
  * Creates and sends a batch of SRRs to be approved and transferred
166382
166436
  * providing the same data as corresponding typedData to prove the same merkle root
166383
166437
  * @throws Will throw an error
166438
+ * @deprecated
166384
166439
  */
166385
166440
  createAndSendSRRTransferBatch(args) {
166386
166441
  return __awaiter(this, void 0, void 0, function* () {
@@ -166444,7 +166499,9 @@ class Service {
166444
166499
  this._validateEoaMatchFromInitialLogin();
166445
166500
  // Todo: Add validation for each functionType ?
166446
166501
  const req = util_1.buildRequestObject(util_1.convertEthereumAddressToChecksum(args));
166447
- return this._handleTypedSignatureAndMainApiRequest(req, httpRequestInfo('/srr/bulk', 'post'));
166502
+ const reqBody = args.isCompressEnabled ? util_1.compressJsonToBuffer(req.body) : req.body;
166503
+ const typedDataReqBody = args.isCompressEnabled ? util_1.compressJsonToBuffer(typedDataProps(req)) : typedDataProps(req);
166504
+ return this._handleTypedSignatureAndMainApiRequest(Object.assign(Object.assign({}, req), { body: reqBody, typedDataBody: typedDataReqBody }), httpRequestInfo('/srr/bulk', 'post'));
166448
166505
  });
166449
166506
  }
166450
166507
  /**
@@ -166632,6 +166689,7 @@ class Startrail {
166632
166689
  /**
166633
166690
  * Creates and sends a batch of SRRs to be issued
166634
166691
  * @throws Will throw an error
166692
+ * @deprecated
166635
166693
  */
166636
166694
  createAndSRRBatch(args) {
166637
166695
  return __awaiter(this, void 0, void 0, function* () {
@@ -166651,6 +166709,7 @@ class Startrail {
166651
166709
  * Creates and sends a batch of SRRs to be approved and transferred
166652
166710
  * providing the same data as corresponding typedData to prove the same merkle root
166653
166711
  * @throws Will throw an error
166712
+ * @deprecated
166654
166713
  */
166655
166714
  createAndSendSRRTransferBatch(args) {
166656
166715
  return __awaiter(this, void 0, void 0, function* () {
@@ -166915,14 +166974,15 @@ exports.extractRequestParam = (arg) => {
166915
166974
  * Separate args into body, header and others for http request
166916
166975
  */
166917
166976
  exports.buildRequestObject = (arg) => {
166918
- const { startrailLUWContractAddress, tokenId, batchId, hashFlag } = arg, requestParam = __rest(arg, ["startrailLUWContractAddress", "tokenId", "batchId", "hashFlag"]);
166977
+ const { startrailLUWContractAddress, tokenId, batchId, isHashPreimageEnabled, isCompressEnabled } = arg, requestParam = __rest(arg, ["startrailLUWContractAddress", "tokenId", "batchId", "isHashPreimageEnabled", "isCompressEnabled"]);
166919
166978
  return {
166920
166979
  header: {
166921
166980
  startrailLUWContractAddress: startrailLUWContractAddress || ''
166922
166981
  },
166923
- tokenId: tokenId,
166924
- batchId: batchId,
166925
- hashFlag: hashFlag,
166982
+ tokenId,
166983
+ batchId,
166984
+ isHashPreimageEnabled,
166985
+ isCompressEnabled,
166926
166986
  body: requestParam
166927
166987
  };
166928
166988
  };
@@ -167066,6 +167126,8 @@ class WalletBuilder {
167066
167126
  if (this.wallet === undefined)
167067
167127
  throw new error_1.CustomError(Error(constant_1.StartrailSdkErrorCodeEnum.WALLET_NOT_INITIALIZED)).sdk();
167068
167128
  const rawEOAs = yield this.wallet.login(partialConfig);
167129
+ if (rawEOAs.length < 1)
167130
+ return [];
167069
167131
  const normalizedEOAs = rawEOAs.map((e) => ethereumjs_util_1.toChecksumAddress(e));
167070
167132
  this.wallet.EOA = normalizedEOAs[0];
167071
167133
  if (!this.wallet.initialEOA)
@@ -167274,17 +167336,28 @@ const error_1 = __webpack_require__(/*! ../error */ "./src/error.ts");
167274
167336
  const util_1 = __webpack_require__(/*! ../configContext/util */ "./src/configContext/util.ts");
167275
167337
  const metamask_1 = __importDefault(__webpack_require__(/*! ../configContext/metamask */ "./src/configContext/metamask.ts"));
167276
167338
  const base_1 = __importDefault(__webpack_require__(/*! ./base */ "./src/wallets/base.ts"));
167339
+ const mobile = __webpack_require__(/*! is-mobile */ "./node_modules/is-mobile/index.js");
167340
+ const globalThis = __webpack_require__(/*! globalthis */ "./node_modules/globalthis/index.js")();
167277
167341
  class Metamask extends base_1.default {
167278
167342
  constructor(config) {
167279
167343
  super();
167280
167344
  this.configContext = new metamask_1.default(config);
167281
167345
  }
167282
167346
  /**
167283
- * NOTE: This is called in service layer at every function call to startrail-api,
167284
- * and overwrite active EOAs
167347
+ * NOTE: MetaMask mobile app is only available inside MetaMask browser.
167348
+ * iOS does not allow opening a new tab or window if there's interval time
167349
+ * after user action. That's why await call is not used for mobile redirect.
167350
+ * Also iOS does not support window.open() in async function.
167285
167351
  */
167286
167352
  login() {
167287
167353
  return __awaiter(this, void 0, void 0, function* () {
167354
+ if (mobile() && !globalThis.ethereum) {
167355
+ const httpRegx = new RegExp('^(http|https)://');
167356
+ const redirectMobileUrl = globalThis.location.href.replace(httpRegx, '');
167357
+ // Deep link generated in https://metamask.github.io/metamask-deeplinks
167358
+ globalThis.location = `https://metamask.app.link/dapp/${redirectMobileUrl}`;
167359
+ return [];
167360
+ }
167288
167361
  try {
167289
167362
  if (!this.provider) {
167290
167363
  const inpageProvider = yield detect_provider_1.default();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@startbahn/startrail-sdk-js",
3
- "version": "1.28.2",
3
+ "version": "1.29.0-beta.2",
4
4
  "description": "Startrail Api for JS SDK",
5
5
  "main": "dist/startrail-sdk.js",
6
6
  "unpkg": "dist/startrail-sdk.js",
@@ -45,6 +45,7 @@
45
45
  "eslint-plugin-promise": "^4.2.1",
46
46
  "eslint-plugin-standard": "^4.0.1",
47
47
  "husky": "^7.0.0",
48
+ "is-mobile": "^3.1.1",
48
49
  "jest": "^25.1.0",
49
50
  "terser-webpack-plugin": "^4.2.3",
50
51
  "ts-jest": "^25.0.0",
@@ -55,12 +55,14 @@ declare module '@startbahn/startrail-sdk-js' {
55
55
  /**
56
56
  * Creates and sends a batch of SRRs to be issued
57
57
  * @throws Will throw an error
58
+ * @deprecated
58
59
  */
59
60
  createAndSRRBatch(args: Type.CreateSRRBatch): Promise<Type.ResponseFromBatch | false>;
60
61
  /**
61
62
  * Creates and sends a batch of SRRs to be approved and transferred
62
63
  * providing the same data as corresponding typedData to prove the same merkle root
63
64
  * @throws Will throw an error
65
+ * @deprecated
64
66
  */
65
67
  createAndSendSRRTransferBatch(args: Type.TransferSRRBatch): Promise<Type.ResponseFromBatch | false>;
66
68
  /**
@@ -112,7 +114,8 @@ declare module '@startbahn/startrail-sdk-js/types' {
112
114
  startrailLUWContractAddress?: string;
113
115
  tokenId?: string;
114
116
  batchId?: string;
115
- hashFlag?: boolean;
117
+ isHashPreimageEnabled?: boolean;
118
+ isCompressEnabled?: boolean;
116
119
  }
117
120
  export interface AuthAction {
118
121
  login: boolean;
@@ -132,7 +135,7 @@ declare module '@startbahn/startrail-sdk-js/types' {
132
135
  preimage: string;
133
136
  tokenId: string;
134
137
  metadata: HistoryMetadata;
135
- hashFlag: boolean;
138
+ isHashPreimageEnabled: boolean;
136
139
  }
137
140
  export enum BulkFunctionType {
138
141
  createSRR = "createSRR",
@@ -192,7 +195,7 @@ declare module '@startbahn/startrail-sdk-js/types' {
192
195
  isPrimaryIssuer: boolean;
193
196
  metadata: object;
194
197
  artistAddress: string;
195
- lockExternalTransfer?: boolean;
198
+ lockExternalTransfer: boolean;
196
199
  }
197
200
  export interface EIP712TypedData {
198
201
  types: Record<string, ReadonlyArray<TypedDataField>>;
@@ -289,7 +292,8 @@ declare module '@startbahn/startrail-sdk-js/types' {
289
292
  body: object;
290
293
  tokenId?: string;
291
294
  batchId?: string;
292
- hashFlag?: boolean;
295
+ isHashPreimageEnabled?: boolean;
296
+ isCompressEnabled?: boolean;
293
297
  }
294
298
  export interface MessageSignature {
295
299
  signature: string;
@@ -342,9 +346,10 @@ declare module '@startbahn/startrail-sdk-js/types' {
342
346
  export interface TransferFromWithProvenance extends TransferFromWithProvenanceShared, Pick<HTTPHeadersForStartrailLUW, 'startrailLUWContractAddress'> {
343
347
  }
344
348
  export interface Bulk extends Pick<HTTPHeadersForStartrailLUW, 'startrailLUWContractAddress'> {
349
+ isCompressEnabled: boolean;
345
350
  txs: {
346
- functionType: BulkFunctionType.transferFromWithProvenance | BulkFunctionType.approveSRRByCommitment;
347
- data: TransferFromWithProvenanceShared | ApproveSRRByCommitmentShared;
351
+ functionType: BulkFunctionType.approveSRRByCommitment | BulkFunctionType.createSRR | BulkFunctionType.transferFromWithProvenance;
352
+ data: ApproveSRRByCommitmentShared | CreateSRRForRequest | TransferFromWithProvenanceShared;
348
353
  }[];
349
354
  }
350
355
  export interface TransferFromWithProvenanceShared {
@@ -677,12 +682,14 @@ declare module '@startbahn/startrail-sdk-js/service' {
677
682
  /**
678
683
  * Creates and sends a batch of SRRs to be issued providing the same SRRs as /bulk/typedData to prove the same merkle root
679
684
  * @throws Will throw an error
685
+ * @deprecated
680
686
  */
681
687
  createAndSRRBatch(args: Type.CreateSRRBatch): Promise<Type.ResponseFromBatch>;
682
688
  /**
683
689
  * Creates and sends a batch of SRRs to be approved and transferred
684
690
  * providing the same data as corresponding typedData to prove the same merkle root
685
691
  * @throws Will throw an error
692
+ * @deprecated
686
693
  */
687
694
  createAndSendSRRTransferBatch(args: Type.TransferSRRBatch): Promise<Type.ResponseFromBatch>;
688
695
  /**