@fileverse-dev/formulajs 4.4.11-mod-14 → 4.4.11-mod-15-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,4 @@
1
- /* @fileverse-dev/formulajs v4.4.11-mod-14 */
1
+ /* @fileverse-dev/formulajs v4.4.11-mod-15-patch-1 */
2
2
  function _slicedToArray(r, e) {
3
3
  return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
4
4
  }
@@ -6581,6 +6581,13 @@ function _typeof(o) {
6581
6581
  var n = array.length;
6582
6582
  return 1 - NORM.S.DIST((AVERAGE(array) - x) / (sigma / Math.sqrt(n)), true);
6583
6583
  };
6584
+ function PnL() {
6585
+ console.log({
6586
+ ARR_ARGS: argsToArray(arguments),
6587
+ arguments: arguments
6588
+ });
6589
+ return 12;
6590
+ }
6584
6591
  function ABS(number) {
6585
6592
  number = parseNumber(number);
6586
6593
  if (number instanceof Error) {
@@ -10704,7 +10711,9 @@ function _typeof(o) {
10704
10711
  }
10705
10712
  var SERVICE_API_KEY = {
10706
10713
  Etherscan: "ETHERSCAN_API_KEY",
10707
- Coingecko: "COINGECKO_API_KEY"
10714
+ Coingecko: "COINGECKO_API_KEY",
10715
+ Gnosisscan: "GNOSISSSCAN",
10716
+ BASESCAN: "Basescan"
10708
10717
  };
10709
10718
  function ETHERSCAN(_x, _x2, _x3) {
10710
10719
  return _ETHERSCAN.apply(this, arguments);
@@ -10828,15 +10837,127 @@ function _typeof(o) {
10828
10837
  })));
10829
10838
  return _GETPRICE.apply(this, arguments);
10830
10839
  }
10831
- function FLVURL(_x6, _x7) {
10840
+ function OX(_x6, _x7, _x8, _x9, _x0) {
10841
+ return _OX.apply(this, arguments);
10842
+ }
10843
+ function _OX() {
10844
+ _OX = _asyncToGenerator(_regeneratorRuntime().mark((function _callee4(address, categories, chain, startTime, endTime) {
10845
+ var API_KEYS, CHAIN_API_BASE, apiKey, baseUrl, timeToBlock, startBlock, endBlock, action, url, _json$result, _json$result$includes, response, json;
10846
+ return _regeneratorRuntime().wrap((function _callee4$(_context4) {
10847
+ while (1) switch (_context4.prev = _context4.next) {
10848
+ case 0:
10849
+ API_KEYS = {
10850
+ ethereum: window.localStorage.getItem(SERVICE_API_KEY.Etherscan),
10851
+ gnosis: window.localStorage.getItem(SERVICE_API_KEY.Gnosisscan),
10852
+ base: window.localStorage.getItem(SERVICE_API_KEY.Basescan)
10853
+ };
10854
+ CHAIN_API_BASE = {
10855
+ ethereum: "https://api.etherscan.io/api",
10856
+ gnosis: "https://api.gnosisscan.io/api",
10857
+ base: "https://api.basescan.org/api"
10858
+ };
10859
+ apiKey = API_KEYS[chain];
10860
+ baseUrl = CHAIN_API_BASE[chain];
10861
+ timeToBlock = function() {
10862
+ var _ref = _asyncToGenerator(_regeneratorRuntime().mark((function _callee3(timestamp) {
10863
+ var _url, res, json;
10864
+ return _regeneratorRuntime().wrap((function _callee3$(_context3) {
10865
+ while (1) switch (_context3.prev = _context3.next) {
10866
+ case 0:
10867
+ _context3.prev = 0;
10868
+ _url = "".concat(baseUrl, "?module=block&action=getblocknobytime&timestamp=").concat(timestamp, "&closest=before&apikey=").concat(apiKey);
10869
+ _context3.next = 4;
10870
+ return fetch(_url);
10871
+
10872
+ case 4:
10873
+ res = _context3.sent;
10874
+ _context3.next = 7;
10875
+ return res.json();
10876
+
10877
+ case 7:
10878
+ json = _context3.sent;
10879
+ return _context3.abrupt("return", parseInt(json.result));
10880
+
10881
+ case 11:
10882
+ _context3.prev = 11;
10883
+ _context3.t0 = _context3["catch"](0);
10884
+ return _context3.abrupt("return", 0);
10885
+
10886
+ case 14:
10887
+ case "end":
10888
+ return _context3.stop();
10889
+ }
10890
+ }), _callee3, null, [ [ 0, 11 ] ]);
10891
+ })));
10892
+ return function timeToBlock(_x11) {
10893
+ return _ref.apply(this, arguments);
10894
+ };
10895
+ }();
10896
+ _context4.next = 7;
10897
+ return timeToBlock(startTime);
10898
+
10899
+ case 7:
10900
+ startBlock = _context4.sent;
10901
+ _context4.next = 10;
10902
+ return timeToBlock(endTime);
10903
+
10904
+ case 10:
10905
+ endBlock = _context4.sent;
10906
+ action = "";
10907
+ if (categories === "txns") action = "txlist"; else if (categories === "balances") action = "balance"; else if (categories === "portfolio") action = "tokentx";
10908
+ url = "".concat(baseUrl, "?module=account&action=").concat(action, "&address=").concat(address, "&startblock=").concat(startBlock, "&endblock=").concat(endBlock, "&sort=asc&apikey=").concat(apiKey);
10909
+ _context4.prev = 14;
10910
+ _context4.next = 17;
10911
+ return fetch(url);
10912
+
10913
+ case 17:
10914
+ response = _context4.sent;
10915
+ if (response.ok) {
10916
+ _context4.next = 20;
10917
+ break;
10918
+ }
10919
+ throw new Error("HTTP error! Status: ".concat(response.status));
10920
+
10921
+ case 20:
10922
+ _context4.next = 22;
10923
+ return response.json();
10924
+
10925
+ case 22:
10926
+ json = _context4.sent;
10927
+ if (!((_json$result = json.result) !== null && _json$result !== void 0 && (_json$result$includes = _json$result.includes) !== null && _json$result$includes !== void 0 && _json$result$includes.call(_json$result, "Invalid API Key"))) {
10928
+ _context4.next = 25;
10929
+ break;
10930
+ }
10931
+ return _context4.abrupt("return", "".concat(SERVICE_API_KEY[chain.charAt(0).toUpperCase() + chain.slice(1)], "_MISSING"));
10932
+
10933
+ case 25:
10934
+ console.log({
10935
+ ANSWER: json.result
10936
+ });
10937
+ return _context4.abrupt("return", json.result);
10938
+
10939
+ case 29:
10940
+ _context4.prev = 29;
10941
+ _context4.t0 = _context4["catch"](14);
10942
+ return _context4.abrupt("return", "ERROR IN FETCHING");
10943
+
10944
+ case 32:
10945
+ case "end":
10946
+ return _context4.stop();
10947
+ }
10948
+ }), _callee4, null, [ [ 14, 29 ] ]);
10949
+ })));
10950
+ return _OX.apply(this, arguments);
10951
+ }
10952
+ function FLVURL(_x1, _x10) {
10832
10953
  return _FLVURL.apply(this, arguments);
10833
10954
  }
10834
10955
  function _FLVURL() {
10835
- _FLVURL = _asyncToGenerator(_regeneratorRuntime().mark((function _callee3(token, vs_currencies) {
10836
- return _regeneratorRuntime().wrap((function _callee3$(_context3) {
10837
- while (1) switch (_context3.prev = _context3.next) {
10956
+ _FLVURL = _asyncToGenerator(_regeneratorRuntime().mark((function _callee5(token, vs_currencies) {
10957
+ return _regeneratorRuntime().wrap((function _callee5$(_context5) {
10958
+ while (1) switch (_context5.prev = _context5.next) {
10838
10959
  case 0:
10839
- return _context3.abrupt("return", new Promise((function(resolve) {
10960
+ return _context5.abrupt("return", new Promise((function(resolve) {
10840
10961
  setTimeout((function() {
10841
10962
  resolve([ {
10842
10963
  Yoo: "gotcha"
@@ -10846,9 +10967,9 @@ function _typeof(o) {
10846
10967
 
10847
10968
  case 1:
10848
10969
  case "end":
10849
- return _context3.stop();
10970
+ return _context5.stop();
10850
10971
  }
10851
- }), _callee3);
10972
+ }), _callee5);
10852
10973
  })));
10853
10974
  return _FLVURL.apply(this, arguments);
10854
10975
  }
@@ -11126,6 +11247,7 @@ function _typeof(o) {
11126
11247
  exports.OCT2HEX = OCT2HEX;
11127
11248
  exports.ODD = ODD;
11128
11249
  exports.OR = OR;
11250
+ exports.OX = OX;
11129
11251
  exports.PDURATION = PDURATION;
11130
11252
  exports.PEARSON = PEARSON;
11131
11253
  exports.PERCENTILE = PERCENTILE;
@@ -11148,6 +11270,7 @@ function _typeof(o) {
11148
11270
  exports.PRODUCT = PRODUCT;
11149
11271
  exports.PROPER = PROPER;
11150
11272
  exports.PV = PV;
11273
+ exports.PnL = PnL;
11151
11274
  exports.QUARTILE = QUARTILE;
11152
11275
  exports.QUARTILEEXC = QUARTILEEXC;
11153
11276
  exports.QUARTILEINC = QUARTILEINC;