@fileverse-dev/fortune-react 1.0.2-mod-48 → 1.0.2-mod-48-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.
package/dist/index.umd.js CHANGED
@@ -36916,7 +36916,9 @@
36916
36916
 
36917
36917
  const SERVICE_API_KEY = {
36918
36918
  Etherscan: "ETHERSCAN_API_KEY",
36919
- Coingecko: "COINGECKO_API_KEY"
36919
+ Coingecko: "COINGECKO_API_KEY",
36920
+ Gnosisscan: 'GNOSISSSCAN',
36921
+ BASESCAN: 'Basescan'
36920
36922
  };
36921
36923
 
36922
36924
  async function ETHERSCAN(address, page, offset) {
@@ -36978,6 +36980,59 @@
36978
36980
  }
36979
36981
  }
36980
36982
 
36983
+ async function OX(address, categories, chain, startTime, endTime) {
36984
+ const API_KEYS = {
36985
+ ethereum: window.localStorage.getItem(SERVICE_API_KEY.Etherscan),
36986
+ gnosis: window.localStorage.getItem(SERVICE_API_KEY.Gnosisscan),
36987
+ base: window.localStorage.getItem(SERVICE_API_KEY.Basescan),
36988
+ };
36989
+
36990
+ const CHAIN_API_BASE = {
36991
+ ethereum: 'https://api.etherscan.io/api',
36992
+ gnosis: 'https://api.gnosisscan.io/api',
36993
+ base: 'https://api.basescan.org/api',
36994
+ };
36995
+
36996
+ const apiKey = API_KEYS[chain];
36997
+ const baseUrl = CHAIN_API_BASE[chain];
36998
+
36999
+ const timeToBlock = async (timestamp) => {
37000
+ try {
37001
+ const url = `${baseUrl}?module=block&action=getblocknobytime&timestamp=${timestamp}&closest=before&apikey=${apiKey}`;
37002
+ const res = await fetch(url);
37003
+ const json = await res.json();
37004
+ return parseInt(json.result);
37005
+ } catch {
37006
+ return 0;
37007
+ }
37008
+ };
37009
+
37010
+ const startBlock = await timeToBlock(startTime);
37011
+ const endBlock = await timeToBlock(endTime);
37012
+
37013
+ let action = '';
37014
+ if (categories === 'txns') action = 'txlist';
37015
+ else if (categories === 'balances') action = 'balance';
37016
+ else if (categories === 'portfolio') action = 'tokentx';
37017
+
37018
+ let url = `${baseUrl}?module=account&action=${action}&address=${address}&startblock=${startBlock}&endblock=${endBlock}&sort=asc&apikey=${apiKey}`;
37019
+
37020
+ try {
37021
+ const response = await fetch(url);
37022
+ if (!response.ok) throw new Error(`HTTP error! Status: ${response.status}`);
37023
+ const json = await response.json();
37024
+ if (json.result?.includes?.("Invalid API Key")) {
37025
+ return `${SERVICE_API_KEY[chain.charAt(0).toUpperCase() + chain.slice(1)]}_MISSING`;
37026
+ }
37027
+
37028
+ console.log({ANSWER: json.result });
37029
+ return json.result;
37030
+ } catch (e) {
37031
+ return "ERROR IN FETCHING";
37032
+ }
37033
+ }
37034
+
37035
+
36981
37036
  async function FLVURL(token, vs_currencies) {
36982
37037
  return new Promise((resolve) => {
36983
37038
  setTimeout(() => {
@@ -37259,6 +37314,7 @@
37259
37314
  OCT2HEX: OCT2HEX,
37260
37315
  ODD: ODD,
37261
37316
  OR: OR,
37317
+ OX: OX,
37262
37318
  PDURATION: PDURATION,
37263
37319
  PEARSON: PEARSON,
37264
37320
  PERCENTILE: PERCENTILE,
@@ -60293,13 +60349,13 @@ React keys must be passed directly to JSX without using spread:
60293
60349
  * This source code is licensed under the ISC license.
60294
60350
  * See the LICENSE file in the root directory of this source tree.
60295
60351
  */
60296
- const OX = [
60352
+ const OX$1 = [
60297
60353
  ["path", { d: "M10 3v11", key: "o3l5kj" }],
60298
60354
  ["path", { d: "M10 9H7a1 1 0 0 1 0-6h8", key: "1wb1nc" }],
60299
60355
  ["path", { d: "M14 3v11", key: "mlfb7b" }],
60300
60356
  ["path", { d: "m18 14 4 4H2", key: "4r8io1" }],
60301
60357
  ["path", { d: "m22 18-4 4", key: "1hjjrd" }]
60302
- ], qX = i$2("PilcrowRight", OX);
60358
+ ], qX = i$2("PilcrowRight", OX$1);
60303
60359
  /**
60304
60360
  * @license lucide-react v0.475.0 - ISC
60305
60361
  *