@fileverse-dev/formulajs 4.4.11-mod-18 → 4.4.11-mod-18-safe-patch-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.
@@ -1,4 +1,26 @@
1
1
  /* @fileverse-dev/formulajs v4.4.11-mod-18 */
2
+ var _excluded = [ "confirmations", "dataDecoded" ];
3
+
4
+ function _objectWithoutProperties(e, t) {
5
+ if (null == e) return {};
6
+ var o, r, i = _objectWithoutPropertiesLoose(e, t);
7
+ if (Object.getOwnPropertySymbols) {
8
+ var n = Object.getOwnPropertySymbols(e);
9
+ for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
10
+ }
11
+ return i;
12
+ }
13
+
14
+ function _objectWithoutPropertiesLoose(r, e) {
15
+ if (null == r) return {};
16
+ var t = {};
17
+ for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
18
+ if (-1 !== e.indexOf(n)) continue;
19
+ t[n] = r[n];
20
+ }
21
+ return t;
22
+ }
23
+
2
24
  function _regeneratorRuntime() {
3
25
  "use strict";
4
26
  /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() {
@@ -10764,13 +10786,18 @@ function _typeof(o) {
10764
10786
  }
10765
10787
  var SERVICE_API_KEY = {
10766
10788
  Etherscan: "ETHERSCAN_API_KEY",
10767
- Coingecko: "COINGECKO_API_KEY"
10789
+ Coingecko: "COINGECKO_API_KEY",
10790
+ Safe: "SAFE_API_KEY"
10768
10791
  };
10769
10792
  var CHAIN_ID_MAP = {
10770
10793
  ethereum: 1,
10771
10794
  gnosis: 100,
10772
10795
  base: 8453
10773
10796
  };
10797
+ var SAFE_CHAIN_MAP = {
10798
+ ethereum: "eth",
10799
+ gnosis: "gno"
10800
+ };
10774
10801
  var fromTimeStampToBlock = function() {
10775
10802
  var _ref = _asyncToGenerator(_regeneratorRuntime().mark((function _callee(timestamp, chain, apiKey) {
10776
10803
  var chainId, url, res, json;
@@ -11055,6 +11082,101 @@ function _typeof(o) {
11055
11082
  })));
11056
11083
  return _FLVURL.apply(this, arguments);
11057
11084
  }
11085
+ function SAFE(_x14, _x15, _x16, _x17, _x18) {
11086
+ return _SAFE.apply(this, arguments);
11087
+ }
11088
+ function _SAFE() {
11089
+ _SAFE = _asyncToGenerator(_regeneratorRuntime().mark((function _callee6(address, utility, chain, limit, offset) {
11090
+ var apiKey, chainIdentifier, url, response, json;
11091
+ return _regeneratorRuntime().wrap((function _callee6$(_context6) {
11092
+ while (1) switch (_context6.prev = _context6.next) {
11093
+ case 0:
11094
+ if (!(typeof limit !== "number" || limit < 0)) {
11095
+ _context6.next = 2;
11096
+ break;
11097
+ }
11098
+ return _context6.abrupt("return", "INVALID_LIMIT");
11099
+
11100
+ case 2:
11101
+ if (!(typeof offset !== "number" || offset < 0)) {
11102
+ _context6.next = 4;
11103
+ break;
11104
+ }
11105
+ return _context6.abrupt("return", "INVALID_OFFSET");
11106
+
11107
+ case 4:
11108
+ if (!(utility !== "txns")) {
11109
+ _context6.next = 6;
11110
+ break;
11111
+ }
11112
+ return _context6.abrupt("return", "UTILITY IS NOT SUPPORTED");
11113
+
11114
+ case 6:
11115
+ apiKey = window.localStorage.getItem(SERVICE_API_KEY.Safe);
11116
+ chainIdentifier = SAFE_CHAIN_MAP[chain];
11117
+ if (apiKey) {
11118
+ _context6.next = 10;
11119
+ break;
11120
+ }
11121
+ return _context6.abrupt("return", "".concat(SERVICE_API_KEY.Safe, "_MISSING"));
11122
+
11123
+ case 10:
11124
+ if (chainIdentifier) {
11125
+ _context6.next = 12;
11126
+ break;
11127
+ }
11128
+ return _context6.abrupt("return", "CHAIN IS NOT SUPPORTED");
11129
+
11130
+ case 12:
11131
+ url = "https://api.safe.global/tx-service/".concat(chainIdentifier, "/api/v2/safes/").concat(address, "/multisig-transactions?limit=").concat(limit, "&offset=").concat(offset);
11132
+ _context6.prev = 13;
11133
+ _context6.next = 16;
11134
+ return fetch(url, {
11135
+ headers: {
11136
+ Authorization: "Bearer ".concat(apiKey)
11137
+ }
11138
+ });
11139
+
11140
+ case 16:
11141
+ response = _context6.sent;
11142
+ if (response.ok) {
11143
+ _context6.next = 19;
11144
+ break;
11145
+ }
11146
+ throw new Error("HTTP error! Status: ".concat(response.status));
11147
+
11148
+ case 19:
11149
+ _context6.next = 21;
11150
+ return response.json();
11151
+
11152
+ case 21:
11153
+ json = _context6.sent;
11154
+ if (Array.isArray(json.results)) {
11155
+ _context6.next = 24;
11156
+ break;
11157
+ }
11158
+ return _context6.abrupt("return", "INVALID API RESPONSE");
11159
+
11160
+ case 24:
11161
+ return _context6.abrupt("return", json.results.map((function(_ref2) {
11162
+ var confirmations = _ref2.confirmations, dataDecoded = _ref2.dataDecoded, rest = _objectWithoutProperties(_ref2, _excluded);
11163
+ return rest;
11164
+ })));
11165
+
11166
+ case 27:
11167
+ _context6.prev = 27;
11168
+ _context6.t0 = _context6["catch"](13);
11169
+ console.log(_context6.t0);
11170
+ return _context6.abrupt("return", "ERROR IN FETCHING");
11171
+
11172
+ case 31:
11173
+ case "end":
11174
+ return _context6.stop();
11175
+ }
11176
+ }), _callee6, null, [ [ 13, 27 ] ]);
11177
+ })));
11178
+ return _SAFE.apply(this, arguments);
11179
+ }
11058
11180
  var utils = {
11059
11181
  errors: errors,
11060
11182
  symbols: symbols,
@@ -11375,6 +11497,7 @@ function _typeof(o) {
11375
11497
  exports.ROWS = ROWS;
11376
11498
  exports.RRI = RRI;
11377
11499
  exports.RSQ = RSQ;
11500
+ exports.SAFE = SAFE;
11378
11501
  exports.SEARCH = SEARCH;
11379
11502
  exports.SEC = SEC;
11380
11503
  exports.SECH = SECH;