@fileverse-dev/fortune-react 1.0.2-mod-98 → 1.0.2-mod-100

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/dist/index.esm.js CHANGED
@@ -1555,18 +1555,11 @@ var InputBox = function InputBox() {
1555
1555
  e.preventDefault();
1556
1556
  }
1557
1557
  }, [clearSearchItemActiveClass, context.luckysheetCellUpdate.length, selectActiveFormula, setContext, firstSelection]);
1558
- var _useState3 = useState(false),
1559
- _useState4 = _slicedToArray(_useState3, 2),
1560
- showCrypoModal = _useState4[0],
1561
- setShowCryptoModal = _useState4[1];
1562
1558
  var onChange = useCallback(function (__, isBlur) {
1563
1559
  var e = lastKeyDownEventRef.current;
1564
1560
  if (!e) return;
1565
1561
  var kcode = e.keyCode;
1566
1562
  if (!kcode) return;
1567
- if (!document.getElementById("luckysheet-formula-search-c")) {
1568
- setShowCryptoModal(!document.getElementById("luckysheet-formula-search-c"));
1569
- }
1570
1563
  if (!(kcode >= 112 && kcode <= 123 || kcode <= 46 || kcode === 144 || kcode === 108 || e.ctrlKey || e.altKey || e.shiftKey && (kcode === 37 || kcode === 38 || kcode === 39 || kcode === 40)) || kcode === 8 || kcode === 32 || kcode === 46 || e.ctrlKey && kcode === 86) {
1571
1564
  setContext(function (draftCtx) {
1572
1565
  if ((draftCtx.formulaCache.rangestart || draftCtx.formulaCache.rangedrag_column_start || draftCtx.formulaCache.rangedrag_row_start || israngeseleciton(draftCtx)) && isBlur) return;
@@ -1628,7 +1621,7 @@ var InputBox = function InputBox() {
1628
1621
  onKeyDown: onKeyDown,
1629
1622
  onPaste: onPaste,
1630
1623
  allowEdit: edit ? !isHidenRC : edit
1631
- })), (context.functionCandidates.length > 0 || context.functionHint || context.defaultCandidates.length > 0) && showCrypoModal && (/*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(FormulaSearch, {
1624
+ })), (context.functionCandidates.length > 0 || context.functionHint || context.defaultCandidates.length > 0) && (/*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(FormulaSearch, {
1632
1625
  onMouseOver: function onMouseOver(e) {
1633
1626
  if (document.getElementById("luckysheet-formula-search-c")) {
1634
1627
  var hoveredItem = e.target.closest(".luckysheet-formula-search-item");
package/dist/index.js CHANGED
@@ -1565,18 +1565,11 @@ var InputBox = function InputBox() {
1565
1565
  e.preventDefault();
1566
1566
  }
1567
1567
  }, [clearSearchItemActiveClass, context.luckysheetCellUpdate.length, selectActiveFormula, setContext, firstSelection]);
1568
- var _useState3 = React.useState(false),
1569
- _useState4 = _slicedToArray(_useState3, 2),
1570
- showCrypoModal = _useState4[0],
1571
- setShowCryptoModal = _useState4[1];
1572
1568
  var onChange = React.useCallback(function (__, isBlur) {
1573
1569
  var e = lastKeyDownEventRef.current;
1574
1570
  if (!e) return;
1575
1571
  var kcode = e.keyCode;
1576
1572
  if (!kcode) return;
1577
- if (!document.getElementById("luckysheet-formula-search-c")) {
1578
- setShowCryptoModal(!document.getElementById("luckysheet-formula-search-c"));
1579
- }
1580
1573
  if (!(kcode >= 112 && kcode <= 123 || kcode <= 46 || kcode === 144 || kcode === 108 || e.ctrlKey || e.altKey || e.shiftKey && (kcode === 37 || kcode === 38 || kcode === 39 || kcode === 40)) || kcode === 8 || kcode === 32 || kcode === 46 || e.ctrlKey && kcode === 86) {
1581
1574
  setContext(function (draftCtx) {
1582
1575
  if ((draftCtx.formulaCache.rangestart || draftCtx.formulaCache.rangedrag_column_start || draftCtx.formulaCache.rangedrag_row_start || fortuneCore.israngeseleciton(draftCtx)) && isBlur) return;
@@ -1638,7 +1631,7 @@ var InputBox = function InputBox() {
1638
1631
  onKeyDown: onKeyDown,
1639
1632
  onPaste: onPaste,
1640
1633
  allowEdit: edit ? !isHidenRC : edit
1641
- })), (context.functionCandidates.length > 0 || context.functionHint || context.defaultCandidates.length > 0) && showCrypoModal && (/*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement(FormulaSearch, {
1634
+ })), (context.functionCandidates.length > 0 || context.functionHint || context.defaultCandidates.length > 0) && (/*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement(FormulaSearch, {
1642
1635
  onMouseOver: function onMouseOver(e) {
1643
1636
  if (document.getElementById("luckysheet-formula-search-c")) {
1644
1637
  var hoveredItem = e.target.closest(".luckysheet-formula-search-item");
package/dist/index.umd.js CHANGED
@@ -37057,7 +37057,8 @@
37057
37057
  Firefly: "FIRE_FLY_API_KEY",
37058
37058
  GnosisPay: 'GNOSIS_API_KEY',
37059
37059
  Neynar: 'NEYNAR_API_KEY',
37060
- Defillama: 'DEFILLAMA_API_KEY'
37060
+ Defillama: 'DEFILLAMA_API_KEY',
37061
+ Uniswap: 'UNISWAP_API_KEY'
37061
37062
  };
37062
37063
 
37063
37064
  const fromTimeStampToBlock = async (timestamp, chain, apiKey) => {
@@ -37181,13 +37182,10 @@
37181
37182
  }
37182
37183
  }
37183
37184
 
37184
- const fromUsernameToFid = async (username) => {
37185
+ const fromUsernameToFid = async (username, apiKey) => {
37185
37186
  if(!username) return null
37186
- const url = `https://api.neynar.com/v2/farcaster/user/search/`;
37187
+ const url = `https://api.neynar.com/v2/farcaster/user/search/?q=${username}&limit=5`;
37187
37188
  const res = await fetch(url, {
37188
- query: {
37189
- q: username
37190
- },
37191
37189
  headers: {
37192
37190
  'x-api-key': API_KEY,
37193
37191
  'x-neynar-experimental': 'false'
@@ -37313,7 +37311,7 @@
37313
37311
  flat[key] = value;
37314
37312
  }
37315
37313
  }
37316
- flat.platform = platform;
37314
+ flat.platform = 'lens';
37317
37315
  return flat;
37318
37316
  });
37319
37317
 
@@ -37366,7 +37364,7 @@
37366
37364
  flat[key] = value;
37367
37365
  }
37368
37366
  }
37369
- flat.platform = platform;
37367
+ flat.platform = "farcaster";
37370
37368
  return flat;
37371
37369
  });
37372
37370
 
@@ -37698,8 +37696,25 @@
37698
37696
  if (json.length > 200) {
37699
37697
  data = json.slice(0, 200);
37700
37698
  }
37701
- if (json && json.tickers && json.tickers.tickers) {
37702
- data = json.tickers.tickers.slice(0, 200);
37699
+
37700
+ if(param1 !== 'all' && json && json.tickers){
37701
+ const exchangeDetails = {
37702
+ exchange_id: param1,
37703
+ exchange_name: json.name,
37704
+ exchange_logo: json.logo,
37705
+ exchange_url: json.url,
37706
+ exchange_trade_volume_24h_btc: json.trade_volume_24h_btc,
37707
+ exchange_number_of_futures_pairs: json.number_of_futures_pairs,
37708
+ exchange_number_of_perpetual_pairs: json.number_of_perpetual_pairs,
37709
+ exchange_open_interest_btc: json.open_interest_btc,
37710
+ };
37711
+ data = json.tickers.slice(0, 200).map(item => {
37712
+ return {
37713
+ ...item,
37714
+ ...exchangeDetails,
37715
+ usd_volume: item.converted_volume && item.converted_volume.usd,
37716
+ }
37717
+ });
37703
37718
  }
37704
37719
  }
37705
37720
 
@@ -37719,28 +37734,23 @@
37719
37734
  }
37720
37735
  }
37721
37736
 
37722
- async function EOA(
37723
- ) {
37737
+ async function EOA() {
37724
37738
  const API_KEY = window.localStorage.getItem(SERVICE_API_KEY.Etherscan);
37725
37739
  if (!API_KEY) return `${SERVICE_API_KEY.Etherscan}${ERROR_MESSAGES_FLAG.MISSING_KEY}`;
37726
-
37727
37740
  let [
37728
- addresses,
37729
- category,
37730
- chains,
37731
- startTime,
37732
- endTime,
37733
- page = 1,
37734
- offset = 10,
37741
+ addresses,
37742
+ category,
37743
+ chains,
37744
+ startTime,
37745
+ endTime,
37746
+ page = 1,
37747
+ offset = 10,
37735
37748
  ] = argsToArray(arguments);
37736
-
37737
37749
  const INPUTS = addresses.split(",").map(a => a.trim()).filter(Boolean);
37738
37750
  const CHAINS = chains.split(",").map(c => c.trim()).filter(Boolean);
37739
37751
  const out = [];
37740
-
37741
37752
  // Map: finalAddress => ENS name (if applicable)
37742
37753
  const ADDRESS_MAP = {};
37743
-
37744
37754
  for (const input of INPUTS) {
37745
37755
  if (isAddress(input)) {
37746
37756
  ADDRESS_MAP[input.toLowerCase()] = null; // it's a direct address
@@ -37753,51 +37763,42 @@
37753
37763
  }
37754
37764
  }
37755
37765
  }
37756
-
37757
37766
  const ADDRS = Object.keys(ADDRESS_MAP);
37758
-
37759
37767
  for (const chain of CHAINS) {
37760
37768
  const chainId = CHAIN_ID_MAP[chain];
37761
37769
  if (!chainId) return ERROR_MESSAGES_FLAG.UNSUPPORTED_CHAIN;
37762
-
37763
37770
  if (category === "balance") {
37764
37771
  for (let i = 0; i < ADDRS.length; i += 20) {
37765
37772
  const slice = ADDRS.slice(i, i + 20).join(",");
37766
- const action = ADDRS.length > 1 ? "balancemulti" : "balance";
37767
-
37773
+ const action = 'addresstokenbalance';
37768
37774
  const url =
37769
37775
  `https://api.etherscan.io/v2/api?chainid=${chainId}` +
37770
37776
  `&module=account&action=${action}&address=${slice}` +
37771
- `&tag=latest&apikey=${API_KEY}`;
37772
-
37777
+ `&page=${page}&offset=${offset}&apikey=${API_KEY}`;
37773
37778
  const data = await fetchJSON(url);
37774
37779
  if (typeof data === "string") return data;
37775
-
37776
- (Array.isArray(data) ? data : [data]).forEach(r =>
37780
+ data.forEach(tx =>
37777
37781
  out.push({
37778
37782
  chain,
37779
- ...r,
37780
- name: ADDRESS_MAP[(r.account || r.address || "").toLowerCase()] || null,
37783
+ address: ADDRS[i],
37784
+ name: ADDRESS_MAP[ADDRS[i]],
37785
+ ...tx,
37781
37786
  }),
37782
37787
  );
37783
37788
  }
37784
37789
  continue;
37785
37790
  }
37786
-
37787
37791
  if (category === "txns") {
37788
37792
  const startBlock = await fromTimeStampToBlock(toTimestamp(startTime), chain, API_KEY);
37789
37793
  const endBlock = await fromTimeStampToBlock(toTimestamp(endTime), chain, API_KEY);
37790
-
37791
37794
  for (const addr of ADDRS) {
37792
37795
  const url =
37793
37796
  `https://api.etherscan.io/v2/api?chainid=${chainId}` +
37794
37797
  `&module=account&action=txlist&address=${addr}` +
37795
37798
  `&startblock=${startBlock}&endblock=${endBlock}` +
37796
37799
  `&page=${page}&offset=${offset}&sort=asc&apikey=${API_KEY}`;
37797
-
37798
37800
  const data = await fetchJSON(url);
37799
37801
  if (typeof data === "string") return data;
37800
-
37801
37802
  data.forEach(tx =>
37802
37803
  out.push({
37803
37804
  chain,
@@ -37809,7 +37810,6 @@
37809
37810
  }
37810
37811
  continue;
37811
37812
  }
37812
-
37813
37813
  return ERROR_MESSAGES_FLAG.INVALID_CATEGORY;
37814
37814
  }
37815
37815
 
@@ -37891,33 +37891,45 @@
37891
37891
  }
37892
37892
 
37893
37893
  async function DEFILLAMA() {
37894
- let [category, param1] = argsToArray(arguments);
37894
+ let [category] = argsToArray(arguments);
37895
37895
  const apiKey = window.localStorage.getItem(SERVICE_API_KEY.Defillama);
37896
37896
  if (!apiKey) return `${SERVICE_API_KEY.Defillama}_MISSING`;
37897
- const baseUrl = 'https://api.llama.fi/';
37898
37897
  const categoryList = ['protocols', 'yields', 'dex'];
37899
37898
  const categoryMap = {
37900
- [categoryList[0]]: 'protocols',
37901
- [categoryList[1]]: 'pools',
37902
- [categoryList[2]]: 'overview/dexs?excludeTotalDataChart=true&excludeTotalDataChartBreakdown=true'
37899
+ [categoryList[0]]: 'https://api.llama.fi/protocols',
37900
+ [categoryList[1]]: 'https://yields.llama.fi/pools',
37901
+ [categoryList[2]]: 'https://api.llama.fi/overview/dexs?excludeTotalDataChart=true&excludeTotalDataChartBreakdown=true'
37903
37902
  };
37904
- let url = `${baseUrl}/${categoryMap[category]}`;
37905
- if(categoryMap[category] === categoryList[0] && param1){
37906
- url += `/${param1}`;
37907
- }
37903
+ let url = categoryMap[category];
37904
+
37908
37905
  try {
37909
37906
  const response = await fetch(url);
37910
37907
  if (!response.ok) throw new Error(`HTTP error! Status: ${response.status}`);
37911
37908
  let json = await response.json();
37912
- if(json.length > 300){
37913
- json = json.slice(0, 300);
37909
+ switch(category){
37910
+ case categoryList[0]: {
37911
+ if(json.length > 500){
37912
+ json = json.slice(0, 500);
37913
+ }
37914
+ break;
37915
+ }
37916
+ case categoryList[1]: {
37917
+ json = json.data.slice(0, 500);
37918
+ break;
37919
+ }
37920
+ case categoryList[2]: {
37921
+ json = json.protocols.slice(0, 500);
37922
+ break;
37923
+ }
37914
37924
  }
37915
- return removeNestedStructure(json);
37925
+
37926
+ return removeNestedStructure(Array.isArray(json) ? json : [json]);
37916
37927
  } catch (e) {
37917
37928
  console.log(e);
37918
37929
  return "ERROR IN FETCHING";
37919
37930
  }
37920
37931
  }
37932
+
37921
37933
  function POLYMARKET() {
37922
37934
  return "Coming Soon"
37923
37935
  }
@@ -106305,18 +106317,11 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
106305
106317
  e.preventDefault();
106306
106318
  }
106307
106319
  }, [clearSearchItemActiveClass, context.luckysheetCellUpdate.length, selectActiveFormula, setContext, firstSelection]);
106308
- var _useState3 = React.useState(false),
106309
- _useState4 = _slicedToArray(_useState3, 2),
106310
- showCrypoModal = _useState4[0],
106311
- setShowCryptoModal = _useState4[1];
106312
106320
  var onChange = React.useCallback(function (__, isBlur) {
106313
106321
  var e = lastKeyDownEventRef.current;
106314
106322
  if (!e) return;
106315
106323
  var kcode = e.keyCode;
106316
106324
  if (!kcode) return;
106317
- if (!document.getElementById("luckysheet-formula-search-c")) {
106318
- setShowCryptoModal(!document.getElementById("luckysheet-formula-search-c"));
106319
- }
106320
106325
  if (!(kcode >= 112 && kcode <= 123 || kcode <= 46 || kcode === 144 || kcode === 108 || e.ctrlKey || e.altKey || e.shiftKey && (kcode === 37 || kcode === 38 || kcode === 39 || kcode === 40)) || kcode === 8 || kcode === 32 || kcode === 46 || e.ctrlKey && kcode === 86) {
106321
106326
  setContext(function (draftCtx) {
106322
106327
  if ((draftCtx.formulaCache.rangestart || draftCtx.formulaCache.rangedrag_column_start || draftCtx.formulaCache.rangedrag_row_start || israngeseleciton(draftCtx)) && isBlur) return;
@@ -106378,7 +106383,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
106378
106383
  onKeyDown: onKeyDown,
106379
106384
  onPaste: onPaste,
106380
106385
  allowEdit: edit ? !isHidenRC : edit
106381
- })), (context.functionCandidates.length > 0 || context.functionHint || context.defaultCandidates.length > 0) && showCrypoModal && (/*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement(FormulaSearch, {
106386
+ })), (context.functionCandidates.length > 0 || context.functionHint || context.defaultCandidates.length > 0) && (/*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement(FormulaSearch, {
106382
106387
  onMouseOver: function onMouseOver(e) {
106383
106388
  if (document.getElementById("luckysheet-formula-search-c")) {
106384
106389
  var hoveredItem = e.target.closest(".luckysheet-formula-search-item");