@fileverse-dev/formulajs 4.4.11-mod-89 → 4.4.11-mod-89-patch-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.
@@ -1,4 +1,4 @@
1
- /* @fileverse-dev/formulajs v4.4.11-mod-89 */
1
+ /* @fileverse-dev/formulajs v4.4.11-mod-89-patch-2 */
2
2
  var _excluded = [ "confirmations", "dataDecoded" ];
3
3
 
4
4
  function _objectWithoutProperties(e, t) {
@@ -18275,15 +18275,90 @@ function _typeof(o) {
18275
18275
  })));
18276
18276
  return _SMARTCONTRACT.apply(this, arguments);
18277
18277
  }
18278
+ function isExpired(createdAt) {
18279
+ if (!createdAt) return true;
18280
+ var expiryTs = createdAt + 60 * 60 * 1e3;
18281
+ return Date.now() > expiryTs;
18282
+ }
18283
+ function GNOSISPAY() {
18284
+ return _GNOSISPAY.apply(this, arguments);
18285
+ }
18286
+ function _GNOSISPAY() {
18287
+ _GNOSISPAY = _asyncToGenerator(_regeneratorRuntime().mark((function _callee28() {
18288
+ var GNOSIS_PAY_ACCESS, access, url, res, json;
18289
+ return _regeneratorRuntime().wrap((function _callee28$(_context31) {
18290
+ while (1) switch (_context31.prev = _context31.next) {
18291
+ case 0:
18292
+ _context31.prev = 0;
18293
+ GNOSIS_PAY_ACCESS = window.localStorage.getItem("GNOSIS_PAY_ACCESS");
18294
+ if (GNOSIS_PAY_ACCESS) {
18295
+ _context31.next = 4;
18296
+ break;
18297
+ }
18298
+ throw new MissingApiKeyError("GNOSIS_PAY_ACCESS");
18299
+
18300
+ case 4:
18301
+ console.log({
18302
+ GNOSIS_PAY_ACCESS: GNOSIS_PAY_ACCESS
18303
+ });
18304
+ access = JSON.parse(GNOSIS_PAY_ACCESS);
18305
+ console.log({
18306
+ access: access
18307
+ });
18308
+ if (!(!(access !== null && access !== void 0 && access.token) || isExpired(access === null || access === void 0 ? void 0 : access.createdAt))) {
18309
+ _context31.next = 9;
18310
+ break;
18311
+ }
18312
+ throw new ValidationError("Expired or invalid access token");
18313
+
18314
+ case 9:
18315
+ url = new URL("https://api.gnosispay.com/api/v1/transactions");
18316
+ _context31.next = 12;
18317
+ return fetch(url.toString(), {
18318
+ headers: {
18319
+ Authorization: "Bearer ".concat(access.token),
18320
+ "Content-Type": "application/json"
18321
+ }
18322
+ });
18323
+
18324
+ case 12:
18325
+ res = _context31.sent;
18326
+ if (res.ok) {
18327
+ _context31.next = 15;
18328
+ break;
18329
+ }
18330
+ throw new NetworkError("GNOSIS_PAY_ACCESS", res.status);
18331
+
18332
+ case 15:
18333
+ _context31.next = 17;
18334
+ return res.json();
18335
+
18336
+ case 17:
18337
+ json = _context31.sent;
18338
+ return _context31.abrupt("return", json);
18339
+
18340
+ case 21:
18341
+ _context31.prev = 21;
18342
+ _context31.t0 = _context31["catch"](0);
18343
+ return _context31.abrupt("return", errorMessageHandler(_context31.t0, "GNOSISPAY"));
18344
+
18345
+ case 24:
18346
+ case "end":
18347
+ return _context31.stop();
18348
+ }
18349
+ }), _callee28, null, [ [ 0, 21 ] ]);
18350
+ })));
18351
+ return _GNOSISPAY.apply(this, arguments);
18352
+ }
18278
18353
  function FLVURL() {
18279
18354
  return _FLVURL.apply(this, arguments);
18280
18355
  }
18281
18356
  function _FLVURL() {
18282
- _FLVURL = _asyncToGenerator(_regeneratorRuntime().mark((function _callee28() {
18283
- return _regeneratorRuntime().wrap((function _callee28$(_context31) {
18284
- while (1) switch (_context31.prev = _context31.next) {
18357
+ _FLVURL = _asyncToGenerator(_regeneratorRuntime().mark((function _callee29() {
18358
+ return _regeneratorRuntime().wrap((function _callee29$(_context32) {
18359
+ while (1) switch (_context32.prev = _context32.next) {
18285
18360
  case 0:
18286
- return _context31.abrupt("return", new Promise((function(resolve) {
18361
+ return _context32.abrupt("return", new Promise((function(resolve) {
18287
18362
  setTimeout((function() {
18288
18363
  resolve([ {
18289
18364
  Yoo: "gotcha"
@@ -18293,9 +18368,9 @@ function _typeof(o) {
18293
18368
 
18294
18369
  case 1:
18295
18370
  case "end":
18296
- return _context31.stop();
18371
+ return _context32.stop();
18297
18372
  }
18298
- }), _callee28);
18373
+ }), _callee29);
18299
18374
  })));
18300
18375
  return _FLVURL.apply(this, arguments);
18301
18376
  }
@@ -18488,6 +18563,7 @@ function _typeof(o) {
18488
18563
  exports.GEOMEAN = GEOMEAN;
18489
18564
  exports.GESTEP = GESTEP;
18490
18565
  exports.GNOSIS = GNOSIS;
18566
+ exports.GNOSISPAY = GNOSISPAY;
18491
18567
  exports.GROWTH = GROWTH;
18492
18568
  exports.HARMEAN = HARMEAN;
18493
18569
  exports.HEX2BIN = HEX2BIN;