@fileverse-dev/formulajs 4.4.46 → 4.4.47-ens-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/lib/cjs/index.cjs CHANGED
@@ -17821,12 +17821,11 @@ var isAddress$1 = {
17821
17821
  /* global ethers */
17822
17822
 
17823
17823
 
17824
-
17825
17824
  async function fromEnsNameToAddress(name) {
17826
17825
  if (typeof ethers === 'undefined') {
17827
17826
  await new Promise((resolve, reject) => {
17828
17827
  const script = document.createElement('script');
17829
- script.src = 'https://cdn.jsdelivr.net/npm/ethers@6.10.0/dist/ethers.umd.min.js';
17828
+ script.src = 'https://cdn.jsdelivr.net/npm/ethers@6.16.0/dist/ethers.umd.min.js';
17830
17829
  script.onload = resolve;
17831
17830
  script.onerror = reject;
17832
17831
  document.head.appendChild(script);
@@ -17849,11 +17848,11 @@ async function fromEnsNameToAddress(name) {
17849
17848
  }
17850
17849
  }
17851
17850
  const validateAndGetAddress = async (address) => {
17852
- if(isAddress$1.isAddress(address)) return address
17851
+ if (isAddress$1.isAddress(address)) return address
17853
17852
 
17854
- const resolvedAddress = await fromEnsNameToAddress(address);
17855
- if(resolvedAddress) return resolvedAddress
17856
- throw new ValidationError("Invalid address")
17853
+ const resolvedAddress = await fromEnsNameToAddress(address);
17854
+ if (resolvedAddress) return resolvedAddress
17855
+ throw new ValidationError('Invalid address')
17857
17856
  };
17858
17857
 
17859
17858
  var fromEnsNameToAddress$1 = {
@@ -18554,88 +18553,6 @@ async function ETHERSCAN() {
18554
18553
  }
18555
18554
  }
18556
18555
 
18557
- const farcasterParamsSchema = objectType({
18558
- contentType: enumType(['posts', 'replies', 'channels']),
18559
- identifier: stringType().nonempty(),
18560
- start: numberType().int().nonnegative().default(0),
18561
- end: numberType().int().nonnegative().max(MAX_PAGE_LIMIT, {message: `"end" must be less than or equal to ${MAX_PAGE_LIMIT}`}).default(10),
18562
- });
18563
-
18564
- /* global window */
18565
-
18566
-
18567
-
18568
-
18569
-
18570
-
18571
-
18572
-
18573
- async function FARCASTER() {
18574
- try {
18575
- const [contentType, identifier, start = 0, end = 10] =
18576
- argsToArray(arguments);
18577
- validateParams(farcasterParamsSchema, {
18578
- contentType,
18579
- identifier,
18580
- start,
18581
- end,
18582
- });
18583
-
18584
- const apiKey = window.localStorage.getItem(
18585
- SERVICES_API_KEY.Firefly
18586
- );
18587
-
18588
- const url = new URL(
18589
- 'https://openapi.firefly.land/v1/fileverse/fetch'
18590
- );
18591
- url.searchParams.set(
18592
- 'query',
18593
- identifier
18594
- .split(',')
18595
- .map(s => s.trim())
18596
- .filter(Boolean)
18597
- .join(',')
18598
- );
18599
- const typeMap = {
18600
- posts: 'farcasterid',
18601
- replies: 'farcasterpostid',
18602
- channels: 'farcasterchannels',
18603
- };
18604
- url.searchParams.set('type', typeMap[contentType]);
18605
- url.searchParams.set('start', String(start));
18606
- url.searchParams.set('end', String(end));
18607
-
18608
- const { URL: finalUrl, HEADERS } = getUrlAndHeaders({ url: url.toString(), serviceName: 'Firefly', headers: { 'x-api-key': apiKey } });
18609
-
18610
- const response = await fetch(finalUrl, {
18611
- method: 'GET',
18612
- headers: HEADERS,
18613
- });
18614
- if (!response.ok) {
18615
- throw new NetworkError(
18616
- SERVICES_API_KEY.Firefly,
18617
- response.status
18618
- )
18619
- }
18620
-
18621
- const { data } = await response.json();
18622
- if (!Array.isArray(data)) return []
18623
-
18624
- return data.map(item => {
18625
- const flat = {};
18626
- for (const [k, v] of Object.entries(item)) {
18627
- if (v == null || typeof v !== 'object') {
18628
- flat[k] = v;
18629
- }
18630
- }
18631
- flat.platform = 'farcaster';
18632
- return flat
18633
- })
18634
- } catch (err) {
18635
- return errorMessageHandler(err, 'FARCASTER')
18636
- }
18637
- }
18638
-
18639
18556
  const farcasterSchema = objectType({
18640
18557
  platform: literalType('farcaster'),
18641
18558
  contentType: enumType(['posts', 'replies', 'channels']),
@@ -18774,165 +18691,6 @@ async function GNOSIS() {
18774
18691
  }
18775
18692
  }
18776
18693
 
18777
- const lensParamsSchema = objectType({
18778
- contentType: enumType(['posts', 'replies']),
18779
- identifier: stringType().nonempty(),
18780
- start: numberType().int().nonnegative().default(0),
18781
- end: numberType().int().nonnegative().max(MAX_PAGE_LIMIT, {message: `"end" must be less than or equal to ${MAX_PAGE_LIMIT}`}).default(10),
18782
- });
18783
-
18784
- /* global window */
18785
-
18786
-
18787
-
18788
-
18789
-
18790
- async function LENS() {
18791
- try {
18792
- const [contentType, identifier, start = 0, end = 10] =
18793
- argsToArray(arguments);
18794
-
18795
- validateParams(lensParamsSchema, {
18796
- contentType,
18797
- identifier,
18798
- start,
18799
- end,
18800
- });
18801
-
18802
- const apiKey = window.localStorage.getItem(
18803
- SERVICES_API_KEY.Firefly
18804
- );
18805
-
18806
- const url = new URL(
18807
- 'https://openapi.firefly.land/v1/fileverse/fetch'
18808
- );
18809
- url.searchParams.set(
18810
- 'query',
18811
- identifier
18812
- .split(',')
18813
- .map((s) => s.trim())
18814
- .filter(Boolean)
18815
- .join(',')
18816
- );
18817
- const typeMap = {
18818
- posts: 'lensid',
18819
- replies: 'lenspostid',
18820
- };
18821
- url.searchParams.set('type', typeMap[contentType]);
18822
- url.searchParams.set('start', String(start));
18823
- url.searchParams.set('end', String(end));
18824
-
18825
- const { URL: finalUrl, HEADERS } = getUrlAndHeaders({ url: url.toString(), serviceName: 'Firefly', headers: { 'x-api-key': apiKey } });
18826
-
18827
- const response = await fetch(finalUrl, {
18828
- method: 'GET',
18829
- headers: HEADERS,
18830
- });
18831
- if (!response.ok) {
18832
- throw new NetworkError(SERVICES_API_KEY.Firefly, response.status)
18833
- }
18834
-
18835
- const { data } = await response.json();
18836
- if (!Array.isArray(data)) return []
18837
-
18838
- return data.map((item) => {
18839
- const flat = {};
18840
- for (const [key, value] of Object.entries(item)) {
18841
- if (value == null || typeof value !== 'object') {
18842
- flat[key] = value;
18843
- }
18844
- }
18845
- flat.platform = 'lens';
18846
- return flat
18847
- })
18848
- } catch (err) {
18849
- return errorMessageHandler(err, 'LENS')
18850
- }
18851
- }
18852
-
18853
- const neynarParamsSchema = objectType({
18854
- username: stringType().nonempty()
18855
- });
18856
-
18857
- const fromUsernameToFid = async (username, apiKey) => {
18858
- if (!username) return null
18859
- const url = `https://api.neynar.com/v2/farcaster/user/search/?q=${username}&limit=5`;
18860
- const { URL: finalUrl, HEADERS } = getUrlAndHeaders({
18861
- url, serviceName: 'Neynar', headers: {
18862
- 'x-api-key': apiKey,
18863
- 'x-neynar-experimental': 'false'
18864
- }
18865
- });
18866
-
18867
- const res = await fetch(finalUrl, {
18868
- method: 'GET',
18869
- headers: HEADERS,
18870
- });
18871
- const json = await res.json();
18872
- const users = json.result ? json.result.users : [];
18873
- const user = users.find(user => user.username === username);
18874
- return user && user.fid || null;
18875
- };
18876
- var fromUsernameToFid$1 = {
18877
- fromUsernameToFid
18878
- };
18879
-
18880
- /* global window */
18881
-
18882
-
18883
-
18884
-
18885
-
18886
-
18887
-
18888
- async function NEYNAR() {
18889
- try {
18890
-
18891
-
18892
- const [username] = argsToArray(arguments);
18893
-
18894
- validateParams(neynarParamsSchema, { username });
18895
-
18896
- const apiKey = window.localStorage.getItem(SERVICES_API_KEY.Neynar);
18897
-
18898
- const fid = await fromUsernameToFid$1.fromUsernameToFid(username, apiKey);
18899
- if (!fid) throw new ValidationError(`Invalid username: ${username}`)
18900
-
18901
- const url = `https://api.neynar.com/v2/farcaster/followers?fid=${fid}`;
18902
-
18903
- const { URL: finalUrl, HEADERS } = getUrlAndHeaders({
18904
- url: url.toString(), serviceName: 'Neynar',
18905
- headers: {
18906
- 'x-api-key': apiKey,
18907
- 'x-neynar-experimental': 'false'
18908
- }
18909
-
18910
- });
18911
-
18912
- const response = await fetch(finalUrl, {
18913
- method: 'GET',
18914
- headers: HEADERS,
18915
- });
18916
- if (!response.ok) {
18917
- throw new NetworkError(SERVICES_API_KEY.Neynar, response.status)
18918
- }
18919
-
18920
- const json = await response.json();
18921
- const users = json?.users || [];
18922
- if (!users.length) return []
18923
-
18924
- return users.map(({ user }) => ({
18925
- username: user.username,
18926
- custody_address: user.custody_address,
18927
- follower_count: user.follower_count,
18928
- country: user.profile?.location?.address?.country || '',
18929
- city: user.profile?.location?.address?.city || '',
18930
- }))
18931
- } catch (err) {
18932
- return errorMessageHandler(err, 'NEYNAR')
18933
- }
18934
- }
18935
-
18936
18694
  const safeParamsSchema = objectType({
18937
18695
  address: stringType().nonempty(),
18938
18696
  utility: literalType('txns'),
@@ -30203,7 +29961,6 @@ exports.F = F;
30203
29961
  exports.FACT = FACT;
30204
29962
  exports.FACTDOUBLE = FACTDOUBLE;
30205
29963
  exports.FALSE = FALSE;
30206
- exports.FARCASTER = FARCASTER;
30207
29964
  exports.FDIST = FDIST;
30208
29965
  exports.FDISTRT = FDISTRT;
30209
29966
  exports.FIND = FIND;
@@ -30294,7 +30051,6 @@ exports.LARGE = LARGE;
30294
30051
  exports.LCM = LCM;
30295
30052
  exports.LEFT = LEFT;
30296
30053
  exports.LEN = LEN;
30297
- exports.LENS = LENS;
30298
30054
  exports.LINEST = LINEST;
30299
30055
  exports.LN = LN;
30300
30056
  exports.LOG = LOG;
@@ -30336,7 +30092,6 @@ exports.NEGBINOMDIST = NEGBINOMDIST;
30336
30092
  exports.NETWORKDAYS = NETWORKDAYS;
30337
30093
  exports.NETWORKDAYSINTL = NETWORKDAYSINTL;
30338
30094
  exports.NETWORKDAYS_INTL = NETWORKDAYS_INTL;
30339
- exports.NEYNAR = NEYNAR;
30340
30095
  exports.NOMINAL = NOMINAL;
30341
30096
  exports.NORM = NORM;
30342
30097
  exports.NORMDIST = NORMDIST;
@@ -824,116 +824,6 @@ var AAVE_metadata = {
824
824
  ]
825
825
  };
826
826
 
827
- // src/crypto/lens/metadata.js
828
- var LENS_metadata = {
829
- API_KEY: SERVICES_API_KEY.Firefly,
830
- LOGO: "https://tse3.mm.bing.net/th?id=OIP.1TANdvYNcEadCk6CO1bCcgAAAA&r=0&w=440&h=440&c=7",
831
- SECONDARY_LOGO: "https://firefly.social/android-chrome-192x192.png",
832
- BRAND_COLOR: "#f8f5fc",
833
- BRAND_SECONDARY_COLOR: "#855dcd",
834
- n: "LENS",
835
- t: 20,
836
- d: "Fetches content from Lens.",
837
- a: "Retrieves posts or replies from Lens by usernames, IDs, or hashes.",
838
- p: [
839
- {
840
- name: "contentType",
841
- detail: "Type of content to fetch. Supports 'posts' or 'replies'.",
842
- example: `"posts"`,
843
- require: "m",
844
- type: "string"
845
- },
846
- {
847
- name: "identifier",
848
- detail: "Comma-separated usernames, IDs, or post hashes depending on platform and contentType.",
849
- example: `"toka,miroyato"`,
850
- require: "m",
851
- type: "string"
852
- },
853
- {
854
- name: "start",
855
- detail: "Pagination start index (default is 0).",
856
- example: `0`,
857
- require: "o",
858
- type: "number"
859
- },
860
- {
861
- name: "end",
862
- detail: "Pagination end index (default is 10).",
863
- example: `10`,
864
- require: "o",
865
- type: "number"
866
- }
867
- ],
868
- examples: [
869
- {
870
- title: "LENS",
871
- argumentString: '"posts", "toka,miroyato"',
872
- description: "returns posts made by the users with the usernames toka and miroyato on Lens."
873
- },
874
- {
875
- title: "LENS",
876
- argumentString: '"replies", "0x123abc456def789ghi012jkl345mno678pqr901stu234vwx567yz890abc123d"',
877
- description: "returns replies to the post with the specified hash on Lens."
878
- }
879
- ]
880
- };
881
-
882
- // src/crypto/farcaster/metadata.js
883
- var FARCASTER_metadata = {
884
- API_KEY: SERVICES_API_KEY.Firefly,
885
- LOGO: "https://farcaster.xyz/favicon.ico",
886
- SECONDARY_LOGO: "https://firefly.social/android-chrome-192x192.png",
887
- BRAND_COLOR: "#f8f5fc",
888
- BRAND_SECONDARY_COLOR: "#855dcd",
889
- n: "FARCASTER",
890
- t: 20,
891
- d: "Fetches content from Farcaster.",
892
- a: "Retrieves posts, replies, or channels from Farcaster by usernames, IDs, or hashes.",
893
- p: [
894
- {
895
- name: "contentType",
896
- detail: "Type of content to fetch. Supports 'posts', 'replies', and 'channels'.",
897
- example: `"posts"`,
898
- require: "m",
899
- type: "string"
900
- },
901
- {
902
- name: "identifier",
903
- detail: "Comma-separated usernames, IDs, or post hashes depending on contentType.",
904
- example: `"miroyato"`,
905
- require: "m",
906
- type: "string"
907
- },
908
- {
909
- name: "start",
910
- detail: "Pagination start index (default is 0).",
911
- example: `0`,
912
- require: "o",
913
- type: "number"
914
- },
915
- {
916
- name: "end",
917
- detail: "Pagination end index (default is 10).",
918
- example: `10`,
919
- require: "o",
920
- type: "number"
921
- }
922
- ],
923
- examples: [
924
- {
925
- title: "FARCASTER",
926
- argumentString: '"posts", "miroyato"',
927
- description: "returns posts made by the user with the username miroyato."
928
- },
929
- {
930
- title: "FARCASTER",
931
- argumentString: '"replies", "0x123abc456def789ghi012jkl345mno678pqr901stu234vwx567yz890abc123d"',
932
- description: "returns replies to the post with the specified hash."
933
- }
934
- ]
935
- };
936
-
937
827
  // src/crypto/firefly/metadata.js
938
828
  var FIREFLY_metadata = {
939
829
  API_KEY: SERVICES_API_KEY.Firefly,
@@ -995,36 +885,6 @@ var FIREFLY_metadata = {
995
885
  ]
996
886
  };
997
887
 
998
- // src/crypto/neynar/metadata.js
999
- var Neynar_metadata = {
1000
- API_KEY: SERVICES_API_KEY.Neynar,
1001
- LOGO: "https://framerusercontent.com/images/OS5YeZ2Y7DmszAxL6Zf06pXtKzc.svg",
1002
- BRAND_COLOR: "#e8e6ff",
1003
- BRAND_SECONDARY_COLOR: "#28204A",
1004
- n: "NEYNAR",
1005
- t: 20,
1006
- d: "Fetches followers for a given Farcaster username using Neynar's API.",
1007
- a: "Retrieves followers of a Farcaster user, with support for sorting, pagination, and optional viewer context.",
1008
- p: [
1009
- {
1010
- name: "username",
1011
- detail: "The Farcaster username whose followers should be fetched.",
1012
- example: `"miroyato"`,
1013
- require: "m",
1014
- type: "number"
1015
- }
1016
- ],
1017
- examples: [{
1018
- title: "NEYNAR",
1019
- argumentString: '"miroyato"',
1020
- description: "returns followers for the Farcaster user with the username miroyato."
1021
- }, {
1022
- title: "NEYNAR",
1023
- argumentString: '"alice"',
1024
- description: "returns followers for the Farcaster user with the username alice."
1025
- }]
1026
- };
1027
-
1028
888
  // src/crypto/smart-contract/metadata.js
1029
889
  var SMARTCONTRACT_metadata = {
1030
890
  n: "SMARTCONTRACT",
@@ -1343,10 +1203,7 @@ var FUNCTION_LOCALE = [
1343
1203
  SAFE_metadata,
1344
1204
  BLOCKSCOUT_metadata,
1345
1205
  AAVE_metadata,
1346
- LENS_metadata,
1347
- FARCASTER_metadata,
1348
1206
  FIREFLY_metadata,
1349
- Neynar_metadata,
1350
1207
  SMARTCONTRACT_metadata,
1351
1208
  TALLY_metadata,
1352
1209
  DUNESIM_metadata,