@fileverse-dev/formulajs 4.4.11-mod-38-patch-004 → 4.4.11-mod-41

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/lib/cjs/index.cjs CHANGED
@@ -5618,35 +5618,6 @@ function ATANH(number) {
5618
5618
  return result
5619
5619
  }
5620
5620
 
5621
- /**
5622
- * Converts a number into a text representation with the given radix (base).
5623
- *
5624
- * Category: Math and trigonometry
5625
- *
5626
- * @param {*} number The number that you want to convert. Must be an integer greater than or equal to 0 and less than 2^53.
5627
- * @param {*} radix The base radix that you want to convert the number into. Must be an integer greater than or equal to 2 and less than or equal to 36.
5628
- * @param {*} min_length Optional. The minimum length of the returned string. Must be an integer greater than or equal to 0.
5629
- * @returns
5630
- */
5631
- function BASE(number, radix, min_length) {
5632
- number = parseNumber(number);
5633
- radix = parseNumber(radix);
5634
- min_length = parseNumber(min_length);
5635
- const anyError$1 = anyError(number, radix, min_length);
5636
-
5637
- if (anyError$1) {
5638
- return anyError$1
5639
- }
5640
-
5641
- if (radix === 0) {
5642
- return num
5643
- }
5644
-
5645
- const result = number.toString(radix);
5646
-
5647
- return new Array(Math.max(min_length + 1 - result.length, 0)).join('0') + result
5648
- }
5649
-
5650
5621
  /**
5651
5622
  * Rounds a number to the nearest integer or to the nearest multiple of significance.
5652
5623
  *
@@ -13119,7 +13090,8 @@ const SERVICE_API_KEY = {
13119
13090
  Basescan: "BASESCAN_API_KEY",
13120
13091
  Gnosisscan: "GNOSIS_API_KEY",
13121
13092
  Firefly: "FIRE_FLY_API_KEY",
13122
- GnosisPay: 'GNOSIS_API_KEY'
13093
+ GnosisPay: 'GNOSIS_API_KEY',
13094
+ Neynar: 'NEYNAR_API_KEY'
13123
13095
  };
13124
13096
 
13125
13097
  const fromTimeStampToBlock = async (timestamp, chain, apiKey) => {
@@ -13243,7 +13215,7 @@ if (scanKey === SERVICE_API_KEY.Gnosisscan) chainId = 'gnosis';
13243
13215
  }
13244
13216
  }
13245
13217
 
13246
- async function FIREFLY() {
13218
+ async function FIREFLY(platform, contentType, identifier, start = 0, end = 10) {
13247
13219
  const API_KEY = window.localStorage.getItem(SERVICE_API_KEY.Firefly);
13248
13220
  if (!API_KEY) return `${SERVICE_API_KEY.Firefly}${ERROR_MESSAGES_FLAG.MISSING_KEY}`;
13249
13221
 
@@ -13262,9 +13234,6 @@ async function FIREFLY() {
13262
13234
  }
13263
13235
  };
13264
13236
 
13265
-
13266
- const [platform, contentType, identifier, start = 0, end = 10] = argsToArray(arguments);
13267
-
13268
13237
  const platformType = typeMap[platform]?.[contentType];
13269
13238
  if (!platformType) return `${SERVICE_API_KEY.Firefly}${ERROR_MESSAGES_FLAG.INVALID_TYPE}`;
13270
13239
 
@@ -13308,21 +13277,7 @@ async function FIREFLY() {
13308
13277
 
13309
13278
 
13310
13279
 
13311
- function BLOCKSCOUT () {
13312
- console.log("HUMBLE");
13313
- let args = argsToArray(arguments);
13314
-
13315
- return JSON.stringify({
13316
- args,
13317
- name: "_BLOCKSCOUT"
13318
- })
13319
- }
13320
-
13321
-
13322
-
13323
-
13324
-
13325
- async function _BLOCKSCOUT(address, type, chain, startTimestamp, endTimestamp, page, offset) {
13280
+ async function BLOCKSCOUT(address, type, chain, startTimestamp, endTimestamp, page, offset) {
13326
13281
  if (!chain) {
13327
13282
  chain = 'ethereum';
13328
13283
  }
@@ -13331,8 +13286,6 @@ async function _BLOCKSCOUT(address, type, chain, startTimestamp, endTimestamp, p
13331
13286
  return 'TYPE_MISSING'
13332
13287
  }
13333
13288
 
13334
- // let [] = utils.argsToArray(arguments)
13335
-
13336
13289
  if (!startTimestamp) {
13337
13290
  const currentTimestamp = Date.now();
13338
13291
  startTimestamp = currentTimestamp - 30 * 24 * 60 * 60 * 1000;
@@ -13409,23 +13362,8 @@ async function _BLOCKSCOUT(address, type, chain, startTimestamp, endTimestamp, p
13409
13362
  return 'ERROR IN FETCHING'
13410
13363
  }
13411
13364
  }
13412
-
13413
- async function BASESCAN() {
13414
- const [type, chain, address, startDate, endDate, page, limit] = argsToArray(arguments);
13415
- return handleScanRequest({
13416
- scanKey: SERVICE_API_KEY.Basescan,
13417
- baseUrl: 'https://api.basescan.org/api',
13418
- type,
13419
- chain,
13420
- address,
13421
- startDate,
13422
- endDate,
13423
- page,
13424
- offset:limit
13425
- });
13426
- }
13427
- async function GNOSISSCAN() {
13428
- const [type, chain, address, startDate, endDate, page, limit] = argsToArray(arguments);
13365
+ async function GNOSIS(...args) {
13366
+ const [type, chain, address, startDate, endDate, page, limit] = args;
13429
13367
  return handleScanRequest({
13430
13368
  scanKey: SERVICE_API_KEY.Gnosisscan,
13431
13369
  baseUrl: 'https://api.gnosisscan.io/api',
@@ -13434,24 +13372,22 @@ async function GNOSISSCAN() {
13434
13372
  address,
13435
13373
  startDate,
13436
13374
  endDate,
13437
- page,
13375
+ page,
13438
13376
  offset:limit
13439
13377
  });
13440
13378
  }
13441
13379
 
13442
- async function NEYNAR(
13443
-
13380
+ async function NEYNAR(
13381
+ fid,
13382
+ viewerFid,
13383
+ sortType,
13384
+ limit,
13385
+ cursor
13444
13386
  ) {
13445
13387
  const API_KEY = window.localStorage.getItem(SERVICE_API_KEY.Neynar);
13446
13388
  if (!API_KEY) return `${SERVICE_API_KEY.Neynar}${ERROR_MESSAGES_FLAG.MISSING_KEY}`;
13447
13389
 
13448
- const [
13449
- fid,
13450
- viewerFid,
13451
- sortType,
13452
- limit,
13453
- cursor
13454
- ] = argsToArray(arguments);
13390
+
13455
13391
  const url = new URL('https://api.neynar.com/v2/farcaster/followers');
13456
13392
  url.searchParams.set('fid', fid.toString());
13457
13393
  url.searchParams.set('sort_type', sortType);
@@ -13482,22 +13418,18 @@ const [
13482
13418
  return ERROR_MESSAGES_FLAG.DEFAULT;
13483
13419
  }
13484
13420
  }
13485
- async function GNOSISPAY(
13486
-
13487
- ) {
13421
+ async function GNOSISPAY({
13422
+ cardId,
13423
+ startDate,
13424
+ endDate,
13425
+ limit = 20,
13426
+ offset = 0,
13427
+ }) {
13488
13428
  const apiKeyKey = SERVICE_API_KEY.GnosisPay;
13489
13429
  const API_KEY = window.localStorage.getItem(apiKeyKey);
13490
13430
  if (!API_KEY) return `${apiKeyKey}${ERROR_MESSAGES_FLAG.MISSING_KEY}`;
13491
13431
  if (!cardId) return `${apiKeyKey}${ERROR_MESSAGES_FLAG.INVALID_PARAM}`;
13492
13432
 
13493
-
13494
-
13495
- const [ cardId,
13496
- startDate,
13497
- endDate,
13498
- limit = 20,
13499
- offset = 0] = argsToArray(arguments);
13500
-
13501
13433
  const url = new URL(`https://api.gnosispay.com/cards/${cardId}/transactions`);
13502
13434
  url.searchParams.set('limit', limit.toString());
13503
13435
  url.searchParams.set('offset', offset.toString());
@@ -13546,8 +13478,8 @@ async function GNOSISPAY(
13546
13478
 
13547
13479
 
13548
13480
 
13549
- async function ETHERSCAN() {
13550
- const [type, chain, address, startDate, endDate, page, limit] = argsToArray(arguments);
13481
+ async function ETHERSCAN(...args) {
13482
+ const [type, chain, address, startDate, endDate, page, limit] = args;
13551
13483
  return handleScanRequest({
13552
13484
  scanKey: SERVICE_API_KEY.Etherscan,
13553
13485
  baseUrl: 'https://api.etherscan.io/v2/api',
@@ -13556,13 +13488,13 @@ async function ETHERSCAN() {
13556
13488
  address,
13557
13489
  startDate,
13558
13490
  endDate,
13559
- page,
13491
+ page,
13560
13492
  offset:limit
13561
13493
  });
13562
13494
  }
13563
13495
 
13564
13496
 
13565
- async function COINGECKO() {
13497
+ async function COINGECKO(category, param1, param2, page = 1, perPage = 2) {
13566
13498
  const API_KEY = window.localStorage.getItem(SERVICE_API_KEY.Coingecko);
13567
13499
  if (!API_KEY) return `${SERVICE_API_KEY.Coingecko}${ERROR_MESSAGES_FLAG.MISSING_KEY}`;
13568
13500
 
@@ -13572,25 +13504,25 @@ async function COINGECKO() {
13572
13504
  };
13573
13505
 
13574
13506
  let url = '';
13575
- const [category, param1, param2, page = 1, perPage = 2 ] = argsToArray(arguments);
13576
13507
  const lowerCategory = (category || '').toLowerCase();
13577
13508
 
13578
13509
  switch (lowerCategory) {
13579
13510
  case 'price': {
13580
- const token = param1;
13581
- const vsCurrencies = param2;
13511
+ const vsCurrencies = param1;
13512
+ const token = param2;
13582
13513
  if (!token || !vsCurrencies) {
13583
13514
  return `${SERVICE_API_KEY.Coingecko}${ERROR_MESSAGES_FLAG.INVALID_PARAM}`;
13584
13515
  }
13585
- url = `https://api.coingecko.com/api/v3/simple/price?vs_currencies=${vsCurrencies}&ids=${token}`;
13516
+ url = `https://api.coingecko.com/api/v3/simple/price?vs_currencies=${vsCurrencies ? vsCurrencies : 'usd' }&symbols=${token}`;
13586
13517
  break;
13587
13518
  }
13588
13519
 
13589
13520
  case 'market': {
13590
13521
  const ecosystemMap = {
13591
- eth: 'ethereum-ecosystem',
13522
+ all: '',
13523
+ ethereum: 'ethereum-ecosystem',
13592
13524
  base: 'base-ecosystem',
13593
- sol: 'solana-ecosystem',
13525
+ solana: 'solana-ecosystem',
13594
13526
  gnosis: 'gnosis-chain',
13595
13527
  hyperliquid: 'hyperliquid',
13596
13528
  bitcoin: 'bitcoin-ecosystem',
@@ -13622,10 +13554,10 @@ async function COINGECKO() {
13622
13554
 
13623
13555
  case 'derivatives': {
13624
13556
  const exchange = param1;
13625
- if (exchange) {
13626
- url = `https://api.coingecko.com/api/v3/derivatives/exchanges/${exchange}?include_tickers=all`;
13557
+ if (!exchange || exchange === 'all') {
13558
+ url = `https://api.coingecko.com/api/v3/derivatives`;
13627
13559
  } else {
13628
- url = `https://api.coingecko.com/api/v3/derivatives?page=${page}&per_page=${perPage}`;
13560
+ url = `https://api.coingecko.com/api/v3/derivatives/exchanges/${exchange}?include_tickers=all`;
13629
13561
  }
13630
13562
  break;
13631
13563
  }
@@ -13659,7 +13591,15 @@ async function COINGECKO() {
13659
13591
  return [output];
13660
13592
  }
13661
13593
 
13662
- const flatArray = Array.isArray(json) ? json : [json];
13594
+ const data = json;
13595
+
13596
+ if (lowerCategory === 'derivatives') {
13597
+ if (json && json.tickers && json.tickers.tickers) {
13598
+ data = json.tickers.tickers;
13599
+ }
13600
+ }
13601
+
13602
+ const flatArray = Array.isArray(data) ? data : [data];
13663
13603
  return flatArray.map(item => {
13664
13604
  const flat = {};
13665
13605
  for (const [key, value] of Object.entries(item)) {
@@ -13678,11 +13618,7 @@ async function COINGECKO() {
13678
13618
 
13679
13619
 
13680
13620
 
13681
- async function EOA() {
13682
-
13683
-
13684
-
13685
- const [
13621
+ async function EOA(
13686
13622
  addresses,
13687
13623
  category,
13688
13624
  chains,
@@ -13690,29 +13626,11 @@ async function EOA() {
13690
13626
  endTime,
13691
13627
  page = 1,
13692
13628
  offset = 10,
13693
- ] = argsToArray(arguments);
13694
-
13695
- const someError = anyError(addresses, category, chains, startTime, endTime, page, offset);
13696
-
13697
- if (someError) {
13698
- return someError
13699
- }
13700
-
13701
-
13629
+ ) {
13702
13630
  const API_KEY = window.localStorage.getItem(SERVICE_API_KEY.Etherscan);
13703
13631
  if (!API_KEY) return `${SERVICE_API_KEY.Etherscan}${ERROR_MESSAGES_FLAG.MISSING_KEY}`;
13704
13632
 
13705
-
13706
-
13707
- let INPUTS;
13708
-
13709
- if(typeof addresses === 'string'){
13710
- INPUTS = addresses.split(",").map(a => a.trim()).filter(Boolean);
13711
- } else if (typeof addresses === 'object'){
13712
- INPUTS = addresses;
13713
- }
13714
-
13715
-
13633
+ const INPUTS = addresses.split(",").map(a => a.trim()).filter(Boolean);
13716
13634
  const CHAINS = chains.split(",").map(c => c.trim()).filter(Boolean);
13717
13635
  const out = [];
13718
13636
 
@@ -13824,12 +13742,7 @@ async function FLVURL(token, vs_currencies) {
13824
13742
  });
13825
13743
  }
13826
13744
 
13827
- async function SAFE() {
13828
-
13829
-
13830
-
13831
-
13832
- let [address, utility, chain, limit, offset] = argsToArray(arguments);
13745
+ async function SAFE(address, utility, chain, limit, offset) {
13833
13746
 
13834
13747
  if (typeof limit !== 'number' || limit < 0) return 'INVALID_LIMIT';
13835
13748
  if (typeof offset !== 'number' || offset < 0) return 'INVALID_OFFSET';
@@ -13892,8 +13805,6 @@ exports.AVERAGE = AVERAGE;
13892
13805
  exports.AVERAGEA = AVERAGEA;
13893
13806
  exports.AVERAGEIF = AVERAGEIF;
13894
13807
  exports.AVERAGEIFS = AVERAGEIFS;
13895
- exports.BASE = BASE;
13896
- exports.BASESCAN = BASESCAN;
13897
13808
  exports.BESSELI = BESSELI;
13898
13809
  exports.BESSELJ = BESSELJ;
13899
13810
  exports.BESSELK = BESSELK;
@@ -14032,8 +13943,8 @@ exports.GAUSS = GAUSS;
14032
13943
  exports.GCD = GCD;
14033
13944
  exports.GEOMEAN = GEOMEAN;
14034
13945
  exports.GESTEP = GESTEP;
13946
+ exports.GNOSIS = GNOSIS;
14035
13947
  exports.GNOSISPAY = GNOSISPAY;
14036
- exports.GNOSISSCAN = GNOSISSCAN;
14037
13948
  exports.GROWTH = GROWTH;
14038
13949
  exports.HARMEAN = HARMEAN;
14039
13950
  exports.HEX2BIN = HEX2BIN;
@@ -14279,5 +14190,4 @@ exports.YEAR = YEAR;
14279
14190
  exports.YEARFRAC = YEARFRAC;
14280
14191
  exports.Z = Z;
14281
14192
  exports.ZTEST = ZTEST;
14282
- exports._BLOCKSCOUT = _BLOCKSCOUT;
14283
14193
  exports.utils = utils;