web3bio-profile-kit 0.1.3 → 0.1.4

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.
Files changed (74) hide show
  1. package/dist/hooks/index.cjs +21 -0
  2. package/dist/hooks/index.js +8 -0
  3. package/dist/hooks/useBaseQuery.cjs +129 -0
  4. package/dist/{types/hooks → hooks}/useBaseQuery.d.ts +1 -2
  5. package/dist/hooks/useBaseQuery.js +127 -0
  6. package/dist/hooks/useBatchNS.cjs +25 -0
  7. package/dist/{types/hooks → hooks}/useBatchNS.d.ts +1 -1
  8. package/dist/hooks/useBatchNS.js +23 -0
  9. package/dist/hooks/useBatchProfile.cjs +25 -0
  10. package/dist/{types/hooks → hooks}/useBatchProfile.d.ts +1 -1
  11. package/dist/hooks/useBatchProfile.js +23 -0
  12. package/dist/hooks/useDomain.cjs +28 -0
  13. package/dist/{types/hooks → hooks}/useDomain.d.ts +1 -1
  14. package/dist/hooks/useDomain.js +26 -0
  15. package/dist/hooks/useNS.cjs +28 -0
  16. package/dist/{types/hooks → hooks}/useNS.d.ts +1 -1
  17. package/dist/hooks/useNS.js +26 -0
  18. package/dist/hooks/useProfile.cjs +28 -0
  19. package/dist/{types/hooks → hooks}/useProfile.d.ts +1 -1
  20. package/dist/hooks/useProfile.js +26 -0
  21. package/dist/hooks/useUniversalNS.cjs +28 -0
  22. package/dist/{types/hooks → hooks}/useUniversalNS.d.ts +1 -1
  23. package/dist/hooks/useUniversalNS.js +26 -0
  24. package/dist/hooks/useUniversalProfile.cjs +28 -0
  25. package/dist/{types/hooks → hooks}/useUniversalProfile.d.ts +1 -1
  26. package/dist/hooks/useUniversalProfile.js +26 -0
  27. package/dist/index.cjs +71 -0
  28. package/dist/index.d.ts +3 -441
  29. package/dist/index.js +18 -2038
  30. package/dist/types/cointype.cjs +29 -0
  31. package/dist/types/cointype.d.ts +26 -0
  32. package/dist/types/cointype.js +29 -0
  33. package/dist/types/hook.cjs +38 -0
  34. package/dist/types/hook.d.ts +195 -0
  35. package/dist/types/hook.js +38 -0
  36. package/dist/types/index.cjs +38 -0
  37. package/dist/types/index.d.ts +5 -7
  38. package/dist/types/index.js +5 -0
  39. package/dist/types/network.cjs +41 -0
  40. package/dist/types/{utils/network.d.ts → network.d.ts} +9 -4
  41. package/dist/types/network.js +41 -0
  42. package/dist/types/platform.cjs +110 -0
  43. package/dist/types/{utils/platform.d.ts → platform.d.ts} +19 -5
  44. package/dist/types/platform.js +110 -0
  45. package/dist/types/source.cjs +44 -0
  46. package/dist/types/{utils/source.d.ts → source.d.ts} +11 -3
  47. package/dist/types/source.js +44 -0
  48. package/dist/utils/helpers.cjs +119 -0
  49. package/dist/{types/utils → utils}/helpers.d.ts +4 -3
  50. package/dist/utils/helpers.js +112 -0
  51. package/dist/utils/index.cjs +27 -0
  52. package/dist/utils/index.d.ts +6 -0
  53. package/dist/utils/index.js +6 -0
  54. package/dist/utils/network.cjs +355 -0
  55. package/dist/utils/network.d.ts +4 -0
  56. package/dist/utils/network.js +353 -0
  57. package/dist/utils/platform.cjs +983 -0
  58. package/dist/utils/platform.d.ts +18 -0
  59. package/dist/utils/platform.js +979 -0
  60. package/dist/utils/regex.cjs +34 -0
  61. package/dist/utils/regex.d.ts +30 -0
  62. package/dist/utils/regex.js +32 -0
  63. package/dist/utils/source.cjs +144 -0
  64. package/dist/utils/source.d.ts +2 -0
  65. package/dist/utils/source.js +142 -0
  66. package/package.json +32 -12
  67. package/dist/index.esm.js +0 -2023
  68. package/dist/index.esm.js.map +0 -1
  69. package/dist/index.js.map +0 -1
  70. package/dist/types/utils/cointype.d.ts +0 -22
  71. package/dist/types/utils/constants.d.ts +0 -36
  72. package/dist/types/utils/types.d.ts +0 -74
  73. /package/dist/{types/hooks → hooks}/index.d.ts +0 -0
  74. /package/dist/{types/setupTests.d.ts → setupTests.d.ts} +0 -0
@@ -1,4 +1,9 @@
1
- export declare enum PlatformType {
1
+ /**
2
+ * Supported platform types for identity and social profiles
3
+ * Includes blockchain networks, name services, and social platforms
4
+ * @public
5
+ */
6
+ export declare enum Platform {
2
7
  ens = "ens",
3
8
  dotbit = "dotbit",
4
9
  lens = "lens",
@@ -89,7 +94,12 @@ export declare enum PlatformType {
89
94
  efp = "efp",
90
95
  gravity = "gravity"
91
96
  }
92
- export type SocialPlatform = {
97
+ /**
98
+ * Platform metadata structure
99
+ * Contains display and functional information about a platform
100
+ * @public
101
+ */
102
+ export interface PlatformType {
93
103
  color?: string;
94
104
  icon?: string;
95
105
  label: string;
@@ -99,10 +109,14 @@ export type SocialPlatform = {
99
109
  registerlink?: string;
100
110
  editUrlPrefix?: string;
101
111
  system: PlatformSystem;
102
- };
112
+ }
113
+ /**
114
+ * Platform system classification
115
+ * @public
116
+ */
103
117
  export declare enum PlatformSystem {
118
+ /** Traditional web platforms */
104
119
  web2 = 0,
120
+ /** Blockchain/decentralized platforms */
105
121
  web3 = 1
106
122
  }
107
- export declare const DEFAULT_PLATFORM: Readonly<SocialPlatform>;
108
- export declare const PLATFORM_DATA: ReadonlyMap<PlatformType, Readonly<SocialPlatform>>;
@@ -0,0 +1,110 @@
1
+ /**
2
+ * Supported platform types for identity and social profiles
3
+ * Includes blockchain networks, name services, and social platforms
4
+ * @public
5
+ */
6
+ var Platform;
7
+ (function (Platform) {
8
+ Platform["ens"] = "ens";
9
+ Platform["dotbit"] = "dotbit";
10
+ Platform["lens"] = "lens";
11
+ Platform["box"] = "box";
12
+ Platform["ethereum"] = "ethereum";
13
+ Platform["twitter"] = "twitter";
14
+ Platform["nextid"] = "nextid";
15
+ Platform["bitcoin"] = "bitcoin";
16
+ Platform["keybase"] = "keybase";
17
+ Platform["reddit"] = "reddit";
18
+ Platform["github"] = "github";
19
+ Platform["unstoppableDomains"] = "unstoppabledomains";
20
+ Platform["basenames"] = "basenames";
21
+ Platform["linea"] = "linea";
22
+ Platform["ckb"] = "ckb";
23
+ Platform["farcaster"] = "farcaster";
24
+ Platform["space_id"] = "space_id";
25
+ Platform["telegram"] = "telegram";
26
+ Platform["instagram"] = "instagram";
27
+ Platform["cyberconnect"] = "cyberconnect";
28
+ Platform["opensea"] = "opensea";
29
+ Platform["discord"] = "discord";
30
+ Platform["calendly"] = "calendly";
31
+ Platform["url"] = "url";
32
+ Platform["website"] = "website";
33
+ Platform["linkedin"] = "linkedin";
34
+ Platform["dns"] = "dns";
35
+ Platform["tron"] = "tron";
36
+ Platform["hey"] = "hey";
37
+ Platform["facebook"] = "facebook";
38
+ Platform["threads"] = "threads";
39
+ Platform["whatsapp"] = "whatsapp";
40
+ Platform["weibo"] = "weibo";
41
+ Platform["youtube"] = "youtube";
42
+ Platform["tiktok"] = "tiktok";
43
+ Platform["bilibili"] = "bilibili";
44
+ Platform["medium"] = "medium";
45
+ Platform["mirror"] = "mirror";
46
+ Platform["zerion"] = "zerion";
47
+ Platform["aave"] = "aave";
48
+ Platform["rainbow"] = "rainbow";
49
+ Platform["bluesky"] = "bluesky";
50
+ Platform["nostr"] = "nostr";
51
+ Platform["poap"] = "poap";
52
+ Platform["uniswap"] = "uniswap";
53
+ Platform["degenscore"] = "degenscore";
54
+ Platform["firefly"] = "firefly";
55
+ Platform["solana"] = "solana";
56
+ Platform["sns"] = "sns";
57
+ Platform["mstdnjp"] = "mstdnjp";
58
+ Platform["lobsters"] = "lobsters";
59
+ Platform["hackernews"] = "hackernews";
60
+ Platform["crossbell"] = "crossbell";
61
+ Platform["minds"] = "minds";
62
+ Platform["paragraph"] = "paragraph";
63
+ Platform["genome"] = "genome";
64
+ Platform["gnosis"] = "gnosis";
65
+ Platform["webacy"] = "webacy";
66
+ Platform["clusters"] = "clusters";
67
+ Platform["guild"] = "guild";
68
+ Platform["ton"] = "ton";
69
+ Platform["snapshot"] = "snapshot";
70
+ Platform["coingecko"] = "coingecko";
71
+ Platform["gitcoin"] = "gitcoin";
72
+ Platform["humanpassport"] = "humanpassport";
73
+ Platform["talent"] = "talentprotocol";
74
+ Platform["doge"] = "doge";
75
+ Platform["bsc"] = "bsc";
76
+ Platform["aptos"] = "aptos";
77
+ Platform["near"] = "near";
78
+ Platform["stacks"] = "stacks";
79
+ Platform["cosmos"] = "cosmos";
80
+ Platform["zeta"] = "zeta";
81
+ Platform["mode"] = "mode";
82
+ Platform["arbitrum"] = "arbitrum";
83
+ Platform["scroll"] = "scroll";
84
+ Platform["taiko"] = "taiko";
85
+ Platform["mint"] = "mint";
86
+ Platform["zkfair"] = "zkfair";
87
+ Platform["manta"] = "manta";
88
+ Platform["lightlink"] = "lightlink";
89
+ Platform["merlin"] = "merlin";
90
+ Platform["alienx"] = "alienx";
91
+ Platform["edgeless"] = "edgeless";
92
+ Platform["tomo"] = "tomo";
93
+ Platform["ailayer"] = "ailayer";
94
+ Platform["philand"] = "philand";
95
+ Platform["efp"] = "efp";
96
+ Platform["gravity"] = "gravity";
97
+ })(Platform || (Platform = {}));
98
+ /**
99
+ * Platform system classification
100
+ * @public
101
+ */
102
+ var PlatformSystem;
103
+ (function (PlatformSystem) {
104
+ /** Traditional web platforms */
105
+ PlatformSystem[PlatformSystem["web2"] = 0] = "web2";
106
+ /** Blockchain/decentralized platforms */
107
+ PlatformSystem[PlatformSystem["web3"] = 1] = "web3";
108
+ })(PlatformSystem || (PlatformSystem = {}));
109
+
110
+ export { Platform, PlatformSystem };
@@ -0,0 +1,44 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * Supported data source types for profile information
5
+ * Includes blockchain networks, name services, social platforms, and aggregators
6
+ * @public
7
+ */
8
+ exports.Source = void 0;
9
+ (function (Source) {
10
+ Source["ethereum"] = "ethereum";
11
+ Source["ens"] = "ens";
12
+ Source["twitter"] = "twitter";
13
+ Source["keybase"] = "keybase";
14
+ Source["nextid"] = "nextid";
15
+ Source["rss3"] = "rss3";
16
+ Source["dotbit"] = "dotbit";
17
+ Source["unstoppabledomains"] = "unstoppabledomains";
18
+ Source["lens"] = "lens";
19
+ Source["farcaster"] = "farcaster";
20
+ Source["space_id"] = "space_id";
21
+ Source["crossbell"] = "crossbell";
22
+ Source["clusters"] = "clusters";
23
+ Source["solana"] = "solana";
24
+ Source["sns"] = "sns";
25
+ Source["opensea"] = "opensea";
26
+ Source["firefly"] = "firefly";
27
+ Source["basenames"] = "basenames";
28
+ Source["dentity"] = "dentity";
29
+ Source["nftd"] = "nftd";
30
+ Source["mirror"] = "mirror";
31
+ Source["paragraph"] = "paragraph";
32
+ Source["foundation"] = "foundation";
33
+ Source["rarible"] = "rarible";
34
+ Source["soundxyz"] = "soundxyz";
35
+ Source["gravity"] = "gravity";
36
+ Source["linea"] = "linea";
37
+ Source["gmgn"] = "gmgn";
38
+ Source["nostr"] = "nostr";
39
+ Source["talentprotocol"] = "talentprotocol";
40
+ Source["crowdsourcing"] = "crowdsourcing";
41
+ Source["particle"] = "particle";
42
+ Source["tally"] = "tally";
43
+ Source["icebreaker"] = "icebreaker";
44
+ })(exports.Source || (exports.Source = {}));
@@ -1,4 +1,9 @@
1
- export declare enum SourceType {
1
+ /**
2
+ * Supported data source types for profile information
3
+ * Includes blockchain networks, name services, social platforms, and aggregators
4
+ * @public
5
+ */
6
+ export declare enum Source {
2
7
  ethereum = "ethereum",
3
8
  ens = "ens",
4
9
  twitter = "twitter",
@@ -34,8 +39,11 @@ export declare enum SourceType {
34
39
  tally = "tally",
35
40
  icebreaker = "icebreaker"
36
41
  }
37
- export interface SourceInfo {
42
+ /**
43
+ * Metadata about a data source
44
+ * @public
45
+ */
46
+ export interface SourceType {
38
47
  name: string;
39
48
  description: string;
40
49
  }
41
- export declare const SOURCE_DATA: Readonly<Record<SourceType, SourceInfo>>;
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Supported data source types for profile information
3
+ * Includes blockchain networks, name services, social platforms, and aggregators
4
+ * @public
5
+ */
6
+ var Source;
7
+ (function (Source) {
8
+ Source["ethereum"] = "ethereum";
9
+ Source["ens"] = "ens";
10
+ Source["twitter"] = "twitter";
11
+ Source["keybase"] = "keybase";
12
+ Source["nextid"] = "nextid";
13
+ Source["rss3"] = "rss3";
14
+ Source["dotbit"] = "dotbit";
15
+ Source["unstoppabledomains"] = "unstoppabledomains";
16
+ Source["lens"] = "lens";
17
+ Source["farcaster"] = "farcaster";
18
+ Source["space_id"] = "space_id";
19
+ Source["crossbell"] = "crossbell";
20
+ Source["clusters"] = "clusters";
21
+ Source["solana"] = "solana";
22
+ Source["sns"] = "sns";
23
+ Source["opensea"] = "opensea";
24
+ Source["firefly"] = "firefly";
25
+ Source["basenames"] = "basenames";
26
+ Source["dentity"] = "dentity";
27
+ Source["nftd"] = "nftd";
28
+ Source["mirror"] = "mirror";
29
+ Source["paragraph"] = "paragraph";
30
+ Source["foundation"] = "foundation";
31
+ Source["rarible"] = "rarible";
32
+ Source["soundxyz"] = "soundxyz";
33
+ Source["gravity"] = "gravity";
34
+ Source["linea"] = "linea";
35
+ Source["gmgn"] = "gmgn";
36
+ Source["nostr"] = "nostr";
37
+ Source["talentprotocol"] = "talentprotocol";
38
+ Source["crowdsourcing"] = "crowdsourcing";
39
+ Source["particle"] = "particle";
40
+ Source["tally"] = "tally";
41
+ Source["icebreaker"] = "icebreaker";
42
+ })(Source || (Source = {}));
43
+
44
+ export { Source };
@@ -0,0 +1,119 @@
1
+ 'use strict';
2
+
3
+ var platform = require('../types/platform.cjs');
4
+ require('../types/network.cjs');
5
+ require('../types/hook.cjs');
6
+ require('../types/source.cjs');
7
+ require('../types/cointype.cjs');
8
+ var regex = require('./regex.cjs');
9
+
10
+ const API_ENDPOINT = "https://api.web3.bio";
11
+ /**
12
+ * Resolves an identity string to a platform and identifier
13
+ * @param input The identity to resolve
14
+ * @returns A formatted identity string or null if invalid
15
+ */
16
+ const resolveIdentity = (input) => {
17
+ if (!input)
18
+ return null;
19
+ const parts = input.split(",");
20
+ let platform;
21
+ let identity;
22
+ if (parts.length === 2) {
23
+ // Format is already "platform,identity"
24
+ platform = parts[0];
25
+ identity = prettify(parts[1]);
26
+ }
27
+ else if (parts.length === 1) {
28
+ // Auto-detect platform from the identity string
29
+ platform = detectPlatform(input);
30
+ identity = prettify(input);
31
+ }
32
+ else {
33
+ return null;
34
+ }
35
+ if (!isSupportedPlatform(platform) || !identity)
36
+ return null;
37
+ // Normalize case except for case-sensitive identities
38
+ const normalizedIdentity = regex.REGEX.LOWERCASE_EXEMPT.test(identity)
39
+ ? identity
40
+ : identity.toLowerCase();
41
+ return `${platform},${normalizedIdentity}`;
42
+ };
43
+ /**
44
+ * Clean up and standardize identity format
45
+ */
46
+ const prettify = (input) => {
47
+ if (!input)
48
+ return "";
49
+ if (input.endsWith(".twitter"))
50
+ return input.replace(".twitter", "");
51
+ if (input.endsWith(".nextid"))
52
+ return input.replace(".nextid", "");
53
+ if (input.startsWith("farcaster,#"))
54
+ return input.replace(/^(farcaster),/, "");
55
+ if (input.endsWith(".farcaster") ||
56
+ input.endsWith(".fcast.id") ||
57
+ input.endsWith(".farcaster.eth")) {
58
+ return input.replace(/(\.farcaster|\.fcast\.id|\.farcaster\.eth)$/, "");
59
+ }
60
+ if (input.endsWith(".base") || input.endsWith(".linea")) {
61
+ return input.split(".")[0] + "." + input.split(".").pop() + ".eth";
62
+ }
63
+ return input;
64
+ };
65
+ /**
66
+ * Check if the platform is supported for API queries
67
+ */
68
+ const isSupportedPlatform = (platform$1) => {
69
+ if (!platform$1)
70
+ return false;
71
+ return Object.values(platform.Platform).includes(platform$1);
72
+ };
73
+ /**
74
+ * Detect platform from identity string based on regex patterns
75
+ */
76
+ const detectPlatform = (term) => {
77
+ if (term.endsWith(".farcaster.eth"))
78
+ return platform.Platform.farcaster;
79
+ const platformMap = [
80
+ [regex.REGEX.BASENAMES, platform.Platform.basenames],
81
+ [regex.REGEX.LINEA, platform.Platform.linea],
82
+ [regex.REGEX.ENS, platform.Platform.ens],
83
+ [regex.REGEX.ETH_ADDRESS, platform.Platform.ethereum],
84
+ [regex.REGEX.LENS, platform.Platform.lens],
85
+ [regex.REGEX.UNSTOPPABLE_DOMAINS, platform.Platform.unstoppableDomains],
86
+ [regex.REGEX.SPACE_ID, platform.Platform.space_id],
87
+ [regex.REGEX.DOTBIT, platform.Platform.dotbit],
88
+ [regex.REGEX.SNS, platform.Platform.sns],
89
+ [regex.REGEX.BTC_ADDRESS, platform.Platform.bitcoin],
90
+ [regex.REGEX.SOLANA_ADDRESS, platform.Platform.solana],
91
+ [regex.REGEX.FARCASTER, platform.Platform.farcaster],
92
+ [regex.REGEX.TWITTER, platform.Platform.twitter],
93
+ [regex.REGEX.NEXT_ID, platform.Platform.nextid],
94
+ ];
95
+ for (const [regex, Platform] of platformMap) {
96
+ if (regex.test(term)) {
97
+ return Platform;
98
+ }
99
+ }
100
+ // Default fallback
101
+ return term.includes(".") ? platform.Platform.ens : platform.Platform.farcaster;
102
+ };
103
+ /**
104
+ * Get API key from various environment sources or user provided value
105
+ */
106
+ const getApiKey = (userProvidedKey) => {
107
+ return (userProvidedKey ||
108
+ process.env.WEB3BIO_API_KEY ||
109
+ process.env.REACT_APP_WEB3BIO_API_KEY ||
110
+ process.env.NEXT_PUBLIC_WEB3BIO_API_KEY ||
111
+ process.env.VITE_WEB3BIO_API_KEY);
112
+ };
113
+
114
+ exports.API_ENDPOINT = API_ENDPOINT;
115
+ exports.detectPlatform = detectPlatform;
116
+ exports.getApiKey = getApiKey;
117
+ exports.isSupportedPlatform = isSupportedPlatform;
118
+ exports.prettify = prettify;
119
+ exports.resolveIdentity = resolveIdentity;
@@ -1,4 +1,5 @@
1
- import { PlatformType } from "./platform";
1
+ import { Platform } from "../types";
2
+ export declare const API_ENDPOINT = "https://api.web3.bio";
2
3
  /**
3
4
  * Resolves an identity string to a platform and identifier
4
5
  * @param input The identity to resolve
@@ -12,11 +13,11 @@ export declare const prettify: (input: string) => string;
12
13
  /**
13
14
  * Check if the platform is supported for API queries
14
15
  */
15
- export declare const isSupportedPlatform: (platform?: PlatformType | null) => boolean;
16
+ export declare const isSupportedPlatform: (platform?: Platform | null) => boolean;
16
17
  /**
17
18
  * Detect platform from identity string based on regex patterns
18
19
  */
19
- export declare const detectPlatform: (term: string) => PlatformType;
20
+ export declare const detectPlatform: (term: string) => Platform;
20
21
  /**
21
22
  * Get API key from various environment sources or user provided value
22
23
  */
@@ -0,0 +1,112 @@
1
+ import { Platform } from '../types/platform.js';
2
+ import '../types/network.js';
3
+ import '../types/hook.js';
4
+ import '../types/source.js';
5
+ import '../types/cointype.js';
6
+ import { REGEX } from './regex.js';
7
+
8
+ const API_ENDPOINT = "https://api.web3.bio";
9
+ /**
10
+ * Resolves an identity string to a platform and identifier
11
+ * @param input The identity to resolve
12
+ * @returns A formatted identity string or null if invalid
13
+ */
14
+ const resolveIdentity = (input) => {
15
+ if (!input)
16
+ return null;
17
+ const parts = input.split(",");
18
+ let platform;
19
+ let identity;
20
+ if (parts.length === 2) {
21
+ // Format is already "platform,identity"
22
+ platform = parts[0];
23
+ identity = prettify(parts[1]);
24
+ }
25
+ else if (parts.length === 1) {
26
+ // Auto-detect platform from the identity string
27
+ platform = detectPlatform(input);
28
+ identity = prettify(input);
29
+ }
30
+ else {
31
+ return null;
32
+ }
33
+ if (!isSupportedPlatform(platform) || !identity)
34
+ return null;
35
+ // Normalize case except for case-sensitive identities
36
+ const normalizedIdentity = REGEX.LOWERCASE_EXEMPT.test(identity)
37
+ ? identity
38
+ : identity.toLowerCase();
39
+ return `${platform},${normalizedIdentity}`;
40
+ };
41
+ /**
42
+ * Clean up and standardize identity format
43
+ */
44
+ const prettify = (input) => {
45
+ if (!input)
46
+ return "";
47
+ if (input.endsWith(".twitter"))
48
+ return input.replace(".twitter", "");
49
+ if (input.endsWith(".nextid"))
50
+ return input.replace(".nextid", "");
51
+ if (input.startsWith("farcaster,#"))
52
+ return input.replace(/^(farcaster),/, "");
53
+ if (input.endsWith(".farcaster") ||
54
+ input.endsWith(".fcast.id") ||
55
+ input.endsWith(".farcaster.eth")) {
56
+ return input.replace(/(\.farcaster|\.fcast\.id|\.farcaster\.eth)$/, "");
57
+ }
58
+ if (input.endsWith(".base") || input.endsWith(".linea")) {
59
+ return input.split(".")[0] + "." + input.split(".").pop() + ".eth";
60
+ }
61
+ return input;
62
+ };
63
+ /**
64
+ * Check if the platform is supported for API queries
65
+ */
66
+ const isSupportedPlatform = (platform) => {
67
+ if (!platform)
68
+ return false;
69
+ return Object.values(Platform).includes(platform);
70
+ };
71
+ /**
72
+ * Detect platform from identity string based on regex patterns
73
+ */
74
+ const detectPlatform = (term) => {
75
+ if (term.endsWith(".farcaster.eth"))
76
+ return Platform.farcaster;
77
+ const platformMap = [
78
+ [REGEX.BASENAMES, Platform.basenames],
79
+ [REGEX.LINEA, Platform.linea],
80
+ [REGEX.ENS, Platform.ens],
81
+ [REGEX.ETH_ADDRESS, Platform.ethereum],
82
+ [REGEX.LENS, Platform.lens],
83
+ [REGEX.UNSTOPPABLE_DOMAINS, Platform.unstoppableDomains],
84
+ [REGEX.SPACE_ID, Platform.space_id],
85
+ [REGEX.DOTBIT, Platform.dotbit],
86
+ [REGEX.SNS, Platform.sns],
87
+ [REGEX.BTC_ADDRESS, Platform.bitcoin],
88
+ [REGEX.SOLANA_ADDRESS, Platform.solana],
89
+ [REGEX.FARCASTER, Platform.farcaster],
90
+ [REGEX.TWITTER, Platform.twitter],
91
+ [REGEX.NEXT_ID, Platform.nextid],
92
+ ];
93
+ for (const [regex, Platform] of platformMap) {
94
+ if (regex.test(term)) {
95
+ return Platform;
96
+ }
97
+ }
98
+ // Default fallback
99
+ return term.includes(".") ? Platform.ens : Platform.farcaster;
100
+ };
101
+ /**
102
+ * Get API key from various environment sources or user provided value
103
+ */
104
+ const getApiKey = (userProvidedKey) => {
105
+ return (userProvidedKey ||
106
+ process.env.WEB3BIO_API_KEY ||
107
+ process.env.REACT_APP_WEB3BIO_API_KEY ||
108
+ process.env.NEXT_PUBLIC_WEB3BIO_API_KEY ||
109
+ process.env.VITE_WEB3BIO_API_KEY);
110
+ };
111
+
112
+ export { API_ENDPOINT, detectPlatform, getApiKey, isSupportedPlatform, prettify, resolveIdentity };
@@ -0,0 +1,27 @@
1
+ 'use strict';
2
+
3
+ var cointype = require('../types/cointype.cjs');
4
+ var regex = require('./regex.cjs');
5
+ var helpers = require('./helpers.cjs');
6
+ var network = require('./network.cjs');
7
+ var platform = require('./platform.cjs');
8
+ var source = require('./source.cjs');
9
+
10
+
11
+
12
+ Object.defineProperty(exports, 'CoinType', {
13
+ enumerable: true,
14
+ get: function () { return cointype.CoinType; }
15
+ });
16
+ exports.REGEX = regex.REGEX;
17
+ exports.API_ENDPOINT = helpers.API_ENDPOINT;
18
+ exports.detectPlatform = helpers.detectPlatform;
19
+ exports.getApiKey = helpers.getApiKey;
20
+ exports.isSupportedPlatform = helpers.isSupportedPlatform;
21
+ exports.prettify = helpers.prettify;
22
+ exports.resolveIdentity = helpers.resolveIdentity;
23
+ exports.NETWORK_DATA = network.NETWORK_DATA;
24
+ exports.DEFAULT_PLATFORM = platform.DEFAULT_PLATFORM;
25
+ exports.PLATFORM_DATA = platform.PLATFORM_DATA;
26
+ exports.getPlatformData = platform.getPlatformData;
27
+ exports.SOURCE_DATA = source.SOURCE_DATA;
@@ -0,0 +1,6 @@
1
+ export * from "../types/cointype";
2
+ export * from "./regex";
3
+ export * from "./helpers";
4
+ export * from "./network";
5
+ export * from "./platform";
6
+ export * from "./source";
@@ -0,0 +1,6 @@
1
+ export { CoinType } from '../types/cointype.js';
2
+ export { REGEX } from './regex.js';
3
+ export { API_ENDPOINT, detectPlatform, getApiKey, isSupportedPlatform, prettify, resolveIdentity } from './helpers.js';
4
+ export { NETWORK_DATA } from './network.js';
5
+ export { DEFAULT_PLATFORM, PLATFORM_DATA, getPlatformData } from './platform.js';
6
+ export { SOURCE_DATA } from './source.js';