@fileverse-dev/formulajs 4.4.11-mod-73 → 4.4.11-mod-75
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/browser/formula.js +390 -466
- package/lib/browser/formula.min.js +2 -2
- package/lib/browser/formula.min.js.map +1 -1
- package/lib/cjs/index.cjs +61 -76
- package/lib/esm/index.mjs +61 -76
- package/package.json +1 -1
package/lib/cjs/index.cjs
CHANGED
|
@@ -13132,6 +13132,7 @@ const UTILITY = {
|
|
|
13132
13132
|
};
|
|
13133
13133
|
const MAX_PAGE_LIMIT = 250;
|
|
13134
13134
|
|
|
13135
|
+
// if data block need API key
|
|
13135
13136
|
const SERVICES_API_KEY = {
|
|
13136
13137
|
Etherscan: 'Etherscan',
|
|
13137
13138
|
Coingecko: 'Coingecko',
|
|
@@ -13144,44 +13145,88 @@ const SERVICES_API_KEY = {
|
|
|
13144
13145
|
Defillama: 'Defillama'
|
|
13145
13146
|
};
|
|
13146
13147
|
|
|
13147
|
-
|
|
13148
|
+
class ValidationError extends Error {
|
|
13149
|
+
constructor(message) {
|
|
13150
|
+
super(message);
|
|
13151
|
+
}
|
|
13152
|
+
}
|
|
13153
|
+
|
|
13154
|
+
|
|
13155
|
+
|
|
13156
|
+
class MissingApiKeyError extends Error {
|
|
13157
|
+
constructor(apiKeyName){
|
|
13158
|
+
super(`API key for ${apiKeyName} is missing`);
|
|
13159
|
+
}
|
|
13160
|
+
}
|
|
13161
|
+
|
|
13162
|
+
|
|
13163
|
+
class RateLimitError extends Error {
|
|
13164
|
+
constructor(apiKeyName){
|
|
13165
|
+
super( `You have reached the rate limit for ${apiKeyName}`);
|
|
13166
|
+
this.api = apiKeyName;
|
|
13167
|
+
}
|
|
13168
|
+
}
|
|
13169
|
+
|
|
13148
13170
|
|
|
13171
|
+
class NetworkError extends Error {
|
|
13172
|
+
constructor(apiKeyName, status){
|
|
13173
|
+
super(status === 429 ? `You have reached the rate limit for ${apiKeyName}` : `${apiKeyName} API failed with status code: ${status}` );
|
|
13174
|
+
this.status = status;
|
|
13175
|
+
this.api = apiKeyName;
|
|
13176
|
+
}
|
|
13177
|
+
}
|
|
13178
|
+
|
|
13179
|
+
class EnsError extends Error {
|
|
13180
|
+
constructor(ensname) {
|
|
13181
|
+
super(`${ensname} is not a supported ens name`);
|
|
13182
|
+
}
|
|
13183
|
+
}
|
|
13184
|
+
|
|
13185
|
+
class InvalidApiKeyError extends Error {
|
|
13186
|
+
constructor(apiKeyName){
|
|
13187
|
+
super(`Api key is invalid for ${apiKeyName}`);
|
|
13188
|
+
this.api = apiKeyName;
|
|
13189
|
+
}
|
|
13190
|
+
}
|
|
13191
|
+
|
|
13192
|
+
const stagingFileverseProxyUrl = "https://staging-api-proxy-ca4268d7d581.herokuapp.com/proxy";
|
|
13193
|
+
const productionFileverseProxyUrl = `${process.env.NEXT_PUBLIC_PROXY_BASE_URL}/proxy`;
|
|
13149
13194
|
// Proxy map configuration
|
|
13150
13195
|
const PROXY_MAP = {
|
|
13151
13196
|
Etherscan: {
|
|
13152
|
-
url:
|
|
13197
|
+
url: productionFileverseProxyUrl || stagingFileverseProxyUrl,
|
|
13153
13198
|
removeParams: ['apikey']
|
|
13154
13199
|
},
|
|
13155
13200
|
Basescan: {
|
|
13156
|
-
url:
|
|
13201
|
+
url: productionFileverseProxyUrl || stagingFileverseProxyUrl,
|
|
13157
13202
|
removeParams: ['apikey']
|
|
13158
13203
|
},
|
|
13159
13204
|
Gnosisscan: {
|
|
13160
|
-
url:
|
|
13205
|
+
url: productionFileverseProxyUrl || stagingFileverseProxyUrl,
|
|
13161
13206
|
removeParams: ['apikey']
|
|
13162
13207
|
},
|
|
13163
13208
|
Coingecko: {
|
|
13164
|
-
url:
|
|
13209
|
+
url: productionFileverseProxyUrl || stagingFileverseProxyUrl,
|
|
13165
13210
|
removeParams: ['apikey']
|
|
13166
13211
|
},
|
|
13167
13212
|
Firefly: {
|
|
13168
|
-
url:
|
|
13213
|
+
url: productionFileverseProxyUrl || stagingFileverseProxyUrl,
|
|
13169
13214
|
removeParams: ['apikey']
|
|
13170
13215
|
},
|
|
13171
13216
|
Neynar: {
|
|
13172
|
-
url:
|
|
13217
|
+
url: productionFileverseProxyUrl || stagingFileverseProxyUrl,
|
|
13173
13218
|
removeParams: ['api_key']
|
|
13174
13219
|
},
|
|
13175
13220
|
Safe: {
|
|
13176
|
-
url:
|
|
13221
|
+
url: productionFileverseProxyUrl || stagingFileverseProxyUrl,
|
|
13177
13222
|
removeParams: ['api_key']
|
|
13178
13223
|
},
|
|
13179
13224
|
Defillama: {
|
|
13180
|
-
url:
|
|
13225
|
+
url: productionFileverseProxyUrl || stagingFileverseProxyUrl,
|
|
13181
13226
|
removeParams: ['api_key']
|
|
13182
13227
|
},
|
|
13183
13228
|
GnosisPay: {
|
|
13184
|
-
url:
|
|
13229
|
+
url: productionFileverseProxyUrl || stagingFileverseProxyUrl,
|
|
13185
13230
|
removeParams: ['api_key']
|
|
13186
13231
|
},
|
|
13187
13232
|
// Add more services as needed. It can be direct url instead of ENV variable
|
|
@@ -13225,9 +13270,12 @@ function getUrlAndHeaders({ url, serviceName, headers = {} }) {
|
|
|
13225
13270
|
// Check if proxy URL exists for this service
|
|
13226
13271
|
const proxyConfig = PROXY_MAP[serviceName];
|
|
13227
13272
|
|
|
13273
|
+
if (!proxyConfig && SERVICES_API_KEY[serviceName] && (!apiKeyLS || apiKeyLS === '')) {
|
|
13274
|
+
throw new MissingApiKeyError(SERVICES_API_KEY[serviceName])
|
|
13275
|
+
}
|
|
13276
|
+
|
|
13228
13277
|
// If proxy mode is enabled AND proxy URL exists for this service
|
|
13229
|
-
if (isProxyModeEnabledValue
|
|
13230
|
-
console.log('isProxyModeEnabledValue', isProxyModeEnabledValue);
|
|
13278
|
+
if ((isProxyModeEnabledValue || !apiKeyLS || apiKeyLS === '') && proxyConfig) {
|
|
13231
13279
|
// Remove specified parameters from the target URL
|
|
13232
13280
|
const cleanedUrl = removeUrlParams(url, proxyConfig.removeParams);
|
|
13233
13281
|
|
|
@@ -13319,50 +13367,6 @@ var fromEnsNameToAddress$1 = {
|
|
|
13319
13367
|
fromEnsNameToAddress
|
|
13320
13368
|
};
|
|
13321
13369
|
|
|
13322
|
-
class ValidationError extends Error {
|
|
13323
|
-
constructor(message) {
|
|
13324
|
-
super(message);
|
|
13325
|
-
}
|
|
13326
|
-
}
|
|
13327
|
-
|
|
13328
|
-
|
|
13329
|
-
|
|
13330
|
-
class MissingApiKeyError extends Error {
|
|
13331
|
-
constructor(apiKeyName){
|
|
13332
|
-
super(`API key for ${apiKeyName} is missing`);
|
|
13333
|
-
}
|
|
13334
|
-
}
|
|
13335
|
-
|
|
13336
|
-
|
|
13337
|
-
class RateLimitError extends Error {
|
|
13338
|
-
constructor(apiKeyName){
|
|
13339
|
-
super( `You have reached the rate limit for ${apiKeyName}`);
|
|
13340
|
-
this.api = apiKeyName;
|
|
13341
|
-
}
|
|
13342
|
-
}
|
|
13343
|
-
|
|
13344
|
-
|
|
13345
|
-
class NetworkError extends Error {
|
|
13346
|
-
constructor(apiKeyName, status){
|
|
13347
|
-
super(status === 429 ? `You have reached the rate limit for ${apiKeyName}` : `${apiKeyName} API failed with status code: ${status}` );
|
|
13348
|
-
this.status = status;
|
|
13349
|
-
this.api = apiKeyName;
|
|
13350
|
-
}
|
|
13351
|
-
}
|
|
13352
|
-
|
|
13353
|
-
class EnsError extends Error {
|
|
13354
|
-
constructor(ensname) {
|
|
13355
|
-
super(`${ensname} is not a supported ens name`);
|
|
13356
|
-
}
|
|
13357
|
-
}
|
|
13358
|
-
|
|
13359
|
-
class InvalidApiKeyError extends Error {
|
|
13360
|
-
constructor(apiKeyName){
|
|
13361
|
-
super(`Api key is invalid for ${apiKeyName}`);
|
|
13362
|
-
this.api = apiKeyName;
|
|
13363
|
-
}
|
|
13364
|
-
}
|
|
13365
|
-
|
|
13366
13370
|
async function handleScanRequest({
|
|
13367
13371
|
type,
|
|
13368
13372
|
address,
|
|
@@ -17705,9 +17709,6 @@ async function FIREFLY() {
|
|
|
17705
17709
|
});
|
|
17706
17710
|
|
|
17707
17711
|
const apiKey = window.localStorage.getItem(SERVICES_API_KEY.Firefly);
|
|
17708
|
-
if (!apiKey) {
|
|
17709
|
-
throw new MissingApiKeyError(SERVICES_API_KEY.Firefly)
|
|
17710
|
-
}
|
|
17711
17712
|
|
|
17712
17713
|
const url = new URL('https://openapi.firefly.land/v1/fileverse/fetch');
|
|
17713
17714
|
url.searchParams
|
|
@@ -17767,9 +17768,6 @@ async function LENS() {
|
|
|
17767
17768
|
const apiKey = window.localStorage.getItem(
|
|
17768
17769
|
SERVICES_API_KEY.Firefly
|
|
17769
17770
|
);
|
|
17770
|
-
if (!apiKey) {
|
|
17771
|
-
throw new MissingApiKeyError(SERVICES_API_KEY.Firefly)
|
|
17772
|
-
}
|
|
17773
17771
|
|
|
17774
17772
|
const url = new URL(
|
|
17775
17773
|
'https://openapi.firefly.land/v1/fileverse/fetch'
|
|
@@ -17831,9 +17829,6 @@ async function FARCASTER() {
|
|
|
17831
17829
|
const apiKey = window.localStorage.getItem(
|
|
17832
17830
|
SERVICES_API_KEY.Firefly
|
|
17833
17831
|
);
|
|
17834
|
-
if (!apiKey) {
|
|
17835
|
-
throw new MissingApiKeyError(SERVICES_API_KEY.Firefly)
|
|
17836
|
-
}
|
|
17837
17832
|
|
|
17838
17833
|
const url = new URL(
|
|
17839
17834
|
'https://openapi.firefly.land/v1/fileverse/fetch'
|
|
@@ -17972,7 +17967,6 @@ async function BASE() {
|
|
|
17972
17967
|
const [type, address, startDate, endDate, page, limit] = argsToArray(arguments);
|
|
17973
17968
|
validateParams(baseParamsSchema, { type, address, startDate, endDate, page, limit });
|
|
17974
17969
|
const API_KEY = window.localStorage.getItem(SERVICES_API_KEY.Basescan);
|
|
17975
|
-
if (!API_KEY) throw new MissingApiKeyError(SERVICES_API_KEY.Basescan)
|
|
17976
17970
|
|
|
17977
17971
|
return await handleScanRequest({
|
|
17978
17972
|
type,
|
|
@@ -18008,7 +18002,6 @@ async function GNOSIS() {
|
|
|
18008
18002
|
const apiKey = window.localStorage.getItem(
|
|
18009
18003
|
SERVICES_API_KEY.Gnosisscan
|
|
18010
18004
|
);
|
|
18011
|
-
if (!apiKey) throw new MissingApiKeyError(SERVICES_API_KEY.Gnosisscan)
|
|
18012
18005
|
|
|
18013
18006
|
return await handleScanRequest({
|
|
18014
18007
|
type,
|
|
@@ -18038,7 +18031,6 @@ async function NEYNAR() {
|
|
|
18038
18031
|
validateParams(neynarParamsSchema, { username });
|
|
18039
18032
|
|
|
18040
18033
|
const apiKey = window.localStorage.getItem(SERVICES_API_KEY.Neynar);
|
|
18041
|
-
if (!apiKey) throw new MissingApiKeyError(SERVICES_API_KEY.Neynar)
|
|
18042
18034
|
|
|
18043
18035
|
const fid = await fromUsernameToFid$1.fromUsernameToFid(username, apiKey);
|
|
18044
18036
|
if (!fid) throw new ValidationError(`Invalid username: ${username}`)
|
|
@@ -18046,7 +18038,7 @@ async function NEYNAR() {
|
|
|
18046
18038
|
const url = `https://api.neynar.com/v2/farcaster/followers?fid=${fid}`;
|
|
18047
18039
|
|
|
18048
18040
|
const { URL: finalUrl, HEADERS } = getUrlAndHeaders({
|
|
18049
|
-
url: url.toString(), serviceName: '
|
|
18041
|
+
url: url.toString(), serviceName: 'Neynar',
|
|
18050
18042
|
headers: {
|
|
18051
18043
|
'x-api-key': apiKey,
|
|
18052
18044
|
'x-neynar-experimental': 'false'
|
|
@@ -18151,7 +18143,6 @@ async function ETHERSCAN() {
|
|
|
18151
18143
|
if (!chainId) throw new ValidationError(`Invalid chain: ${chain}`)
|
|
18152
18144
|
|
|
18153
18145
|
const apiKey = window.localStorage.getItem(SERVICES_API_KEY.Etherscan);
|
|
18154
|
-
if (!apiKey) throw new MissingApiKeyError(SERVICES_API_KEY.Etherscan)
|
|
18155
18146
|
|
|
18156
18147
|
return await handleScanRequest({
|
|
18157
18148
|
type,
|
|
@@ -18177,7 +18168,6 @@ async function COINGECKO() {
|
|
|
18177
18168
|
validateParams(coingeckoParamsSchema, { category, param1, param2 });
|
|
18178
18169
|
|
|
18179
18170
|
const apiKey = window.localStorage.getItem(SERVICES_API_KEY.Coingecko);
|
|
18180
|
-
if (!apiKey) throw new MissingApiKeyError(SERVICES_API_KEY.Coingecko)
|
|
18181
18171
|
|
|
18182
18172
|
const headers = {
|
|
18183
18173
|
accept: 'application/json',
|
|
@@ -18244,14 +18234,12 @@ async function COINGECKO() {
|
|
|
18244
18234
|
}
|
|
18245
18235
|
|
|
18246
18236
|
async function EOA() {
|
|
18247
|
-
console.log('EOA');
|
|
18248
18237
|
try {
|
|
18249
18238
|
const [addresses, category, chains, startTime, endTime, page = 1, offset = 10] =
|
|
18250
18239
|
argsToArray(arguments);
|
|
18251
18240
|
validateParams(eoaParamsSchema, { addresses, category, chains, startTime, endTime, page, offset });
|
|
18252
18241
|
|
|
18253
18242
|
const apiKey = window.localStorage.getItem(SERVICES_API_KEY.Etherscan);
|
|
18254
|
-
if (!apiKey) throw new MissingApiKeyError(SERVICES_API_KEY.Etherscan)
|
|
18255
18243
|
|
|
18256
18244
|
const INPUTS = addresses.split(',').map(s => s.trim()).filter(Boolean);
|
|
18257
18245
|
const CHAINS = chains.split(',').map(s => s.trim()).filter(Boolean);
|
|
@@ -18268,7 +18256,6 @@ async function EOA() {
|
|
|
18268
18256
|
}
|
|
18269
18257
|
}
|
|
18270
18258
|
const ADDRS = Object.keys(ADDRESS_MAP);
|
|
18271
|
-
console.log('ADDRS', ADDRS);
|
|
18272
18259
|
const out = [];
|
|
18273
18260
|
|
|
18274
18261
|
async function fetchJSON(url) {
|
|
@@ -18343,7 +18330,6 @@ async function SAFE() {
|
|
|
18343
18330
|
validateParams(safeParamsSchema, { address, utility, chain, limit, offset });
|
|
18344
18331
|
|
|
18345
18332
|
const apiKey = window.localStorage.getItem(SERVICES_API_KEY.Safe);
|
|
18346
|
-
if (!apiKey) throw new MissingApiKeyError(SERVICES_API_KEY.Safe)
|
|
18347
18333
|
|
|
18348
18334
|
const chainId = SAFE_CHAIN_MAP[chain];
|
|
18349
18335
|
if (!chainId) throw new ValidationError(`Invalid chain: ${chain}`)
|
|
@@ -18380,7 +18366,6 @@ async function DEFILLAMA() {
|
|
|
18380
18366
|
const [category] = argsToArray(arguments);
|
|
18381
18367
|
validateParams(defillamaParamsSchema, { category });
|
|
18382
18368
|
const apiKey = window.localStorage.getItem(SERVICES_API_KEY.Defillama);
|
|
18383
|
-
if (!apiKey) throw new MissingApiKeyError(SERVICES_API_KEY.Defillama)
|
|
18384
18369
|
const url = CATEGORY_URLS[category];
|
|
18385
18370
|
if (!url) throw new ValidationError(`Invalid category: ${category}`)
|
|
18386
18371
|
const res = await fetch(url);
|
package/lib/esm/index.mjs
CHANGED
|
@@ -13130,6 +13130,7 @@ const UTILITY = {
|
|
|
13130
13130
|
};
|
|
13131
13131
|
const MAX_PAGE_LIMIT = 250;
|
|
13132
13132
|
|
|
13133
|
+
// if data block need API key
|
|
13133
13134
|
const SERVICES_API_KEY = {
|
|
13134
13135
|
Etherscan: 'Etherscan',
|
|
13135
13136
|
Coingecko: 'Coingecko',
|
|
@@ -13142,44 +13143,88 @@ const SERVICES_API_KEY = {
|
|
|
13142
13143
|
Defillama: 'Defillama'
|
|
13143
13144
|
};
|
|
13144
13145
|
|
|
13145
|
-
|
|
13146
|
+
class ValidationError extends Error {
|
|
13147
|
+
constructor(message) {
|
|
13148
|
+
super(message);
|
|
13149
|
+
}
|
|
13150
|
+
}
|
|
13151
|
+
|
|
13152
|
+
|
|
13153
|
+
|
|
13154
|
+
class MissingApiKeyError extends Error {
|
|
13155
|
+
constructor(apiKeyName){
|
|
13156
|
+
super(`API key for ${apiKeyName} is missing`);
|
|
13157
|
+
}
|
|
13158
|
+
}
|
|
13159
|
+
|
|
13160
|
+
|
|
13161
|
+
class RateLimitError extends Error {
|
|
13162
|
+
constructor(apiKeyName){
|
|
13163
|
+
super( `You have reached the rate limit for ${apiKeyName}`);
|
|
13164
|
+
this.api = apiKeyName;
|
|
13165
|
+
}
|
|
13166
|
+
}
|
|
13167
|
+
|
|
13146
13168
|
|
|
13169
|
+
class NetworkError extends Error {
|
|
13170
|
+
constructor(apiKeyName, status){
|
|
13171
|
+
super(status === 429 ? `You have reached the rate limit for ${apiKeyName}` : `${apiKeyName} API failed with status code: ${status}` );
|
|
13172
|
+
this.status = status;
|
|
13173
|
+
this.api = apiKeyName;
|
|
13174
|
+
}
|
|
13175
|
+
}
|
|
13176
|
+
|
|
13177
|
+
class EnsError extends Error {
|
|
13178
|
+
constructor(ensname) {
|
|
13179
|
+
super(`${ensname} is not a supported ens name`);
|
|
13180
|
+
}
|
|
13181
|
+
}
|
|
13182
|
+
|
|
13183
|
+
class InvalidApiKeyError extends Error {
|
|
13184
|
+
constructor(apiKeyName){
|
|
13185
|
+
super(`Api key is invalid for ${apiKeyName}`);
|
|
13186
|
+
this.api = apiKeyName;
|
|
13187
|
+
}
|
|
13188
|
+
}
|
|
13189
|
+
|
|
13190
|
+
const stagingFileverseProxyUrl = "https://staging-api-proxy-ca4268d7d581.herokuapp.com/proxy";
|
|
13191
|
+
const productionFileverseProxyUrl = `${process.env.NEXT_PUBLIC_PROXY_BASE_URL}/proxy`;
|
|
13147
13192
|
// Proxy map configuration
|
|
13148
13193
|
const PROXY_MAP = {
|
|
13149
13194
|
Etherscan: {
|
|
13150
|
-
url:
|
|
13195
|
+
url: productionFileverseProxyUrl || stagingFileverseProxyUrl,
|
|
13151
13196
|
removeParams: ['apikey']
|
|
13152
13197
|
},
|
|
13153
13198
|
Basescan: {
|
|
13154
|
-
url:
|
|
13199
|
+
url: productionFileverseProxyUrl || stagingFileverseProxyUrl,
|
|
13155
13200
|
removeParams: ['apikey']
|
|
13156
13201
|
},
|
|
13157
13202
|
Gnosisscan: {
|
|
13158
|
-
url:
|
|
13203
|
+
url: productionFileverseProxyUrl || stagingFileverseProxyUrl,
|
|
13159
13204
|
removeParams: ['apikey']
|
|
13160
13205
|
},
|
|
13161
13206
|
Coingecko: {
|
|
13162
|
-
url:
|
|
13207
|
+
url: productionFileverseProxyUrl || stagingFileverseProxyUrl,
|
|
13163
13208
|
removeParams: ['apikey']
|
|
13164
13209
|
},
|
|
13165
13210
|
Firefly: {
|
|
13166
|
-
url:
|
|
13211
|
+
url: productionFileverseProxyUrl || stagingFileverseProxyUrl,
|
|
13167
13212
|
removeParams: ['apikey']
|
|
13168
13213
|
},
|
|
13169
13214
|
Neynar: {
|
|
13170
|
-
url:
|
|
13215
|
+
url: productionFileverseProxyUrl || stagingFileverseProxyUrl,
|
|
13171
13216
|
removeParams: ['api_key']
|
|
13172
13217
|
},
|
|
13173
13218
|
Safe: {
|
|
13174
|
-
url:
|
|
13219
|
+
url: productionFileverseProxyUrl || stagingFileverseProxyUrl,
|
|
13175
13220
|
removeParams: ['api_key']
|
|
13176
13221
|
},
|
|
13177
13222
|
Defillama: {
|
|
13178
|
-
url:
|
|
13223
|
+
url: productionFileverseProxyUrl || stagingFileverseProxyUrl,
|
|
13179
13224
|
removeParams: ['api_key']
|
|
13180
13225
|
},
|
|
13181
13226
|
GnosisPay: {
|
|
13182
|
-
url:
|
|
13227
|
+
url: productionFileverseProxyUrl || stagingFileverseProxyUrl,
|
|
13183
13228
|
removeParams: ['api_key']
|
|
13184
13229
|
},
|
|
13185
13230
|
// Add more services as needed. It can be direct url instead of ENV variable
|
|
@@ -13223,9 +13268,12 @@ function getUrlAndHeaders({ url, serviceName, headers = {} }) {
|
|
|
13223
13268
|
// Check if proxy URL exists for this service
|
|
13224
13269
|
const proxyConfig = PROXY_MAP[serviceName];
|
|
13225
13270
|
|
|
13271
|
+
if (!proxyConfig && SERVICES_API_KEY[serviceName] && (!apiKeyLS || apiKeyLS === '')) {
|
|
13272
|
+
throw new MissingApiKeyError(SERVICES_API_KEY[serviceName])
|
|
13273
|
+
}
|
|
13274
|
+
|
|
13226
13275
|
// If proxy mode is enabled AND proxy URL exists for this service
|
|
13227
|
-
if (isProxyModeEnabledValue
|
|
13228
|
-
console.log('isProxyModeEnabledValue', isProxyModeEnabledValue);
|
|
13276
|
+
if ((isProxyModeEnabledValue || !apiKeyLS || apiKeyLS === '') && proxyConfig) {
|
|
13229
13277
|
// Remove specified parameters from the target URL
|
|
13230
13278
|
const cleanedUrl = removeUrlParams(url, proxyConfig.removeParams);
|
|
13231
13279
|
|
|
@@ -13317,50 +13365,6 @@ var fromEnsNameToAddress$1 = {
|
|
|
13317
13365
|
fromEnsNameToAddress
|
|
13318
13366
|
};
|
|
13319
13367
|
|
|
13320
|
-
class ValidationError extends Error {
|
|
13321
|
-
constructor(message) {
|
|
13322
|
-
super(message);
|
|
13323
|
-
}
|
|
13324
|
-
}
|
|
13325
|
-
|
|
13326
|
-
|
|
13327
|
-
|
|
13328
|
-
class MissingApiKeyError extends Error {
|
|
13329
|
-
constructor(apiKeyName){
|
|
13330
|
-
super(`API key for ${apiKeyName} is missing`);
|
|
13331
|
-
}
|
|
13332
|
-
}
|
|
13333
|
-
|
|
13334
|
-
|
|
13335
|
-
class RateLimitError extends Error {
|
|
13336
|
-
constructor(apiKeyName){
|
|
13337
|
-
super( `You have reached the rate limit for ${apiKeyName}`);
|
|
13338
|
-
this.api = apiKeyName;
|
|
13339
|
-
}
|
|
13340
|
-
}
|
|
13341
|
-
|
|
13342
|
-
|
|
13343
|
-
class NetworkError extends Error {
|
|
13344
|
-
constructor(apiKeyName, status){
|
|
13345
|
-
super(status === 429 ? `You have reached the rate limit for ${apiKeyName}` : `${apiKeyName} API failed with status code: ${status}` );
|
|
13346
|
-
this.status = status;
|
|
13347
|
-
this.api = apiKeyName;
|
|
13348
|
-
}
|
|
13349
|
-
}
|
|
13350
|
-
|
|
13351
|
-
class EnsError extends Error {
|
|
13352
|
-
constructor(ensname) {
|
|
13353
|
-
super(`${ensname} is not a supported ens name`);
|
|
13354
|
-
}
|
|
13355
|
-
}
|
|
13356
|
-
|
|
13357
|
-
class InvalidApiKeyError extends Error {
|
|
13358
|
-
constructor(apiKeyName){
|
|
13359
|
-
super(`Api key is invalid for ${apiKeyName}`);
|
|
13360
|
-
this.api = apiKeyName;
|
|
13361
|
-
}
|
|
13362
|
-
}
|
|
13363
|
-
|
|
13364
13368
|
async function handleScanRequest({
|
|
13365
13369
|
type,
|
|
13366
13370
|
address,
|
|
@@ -17703,9 +17707,6 @@ async function FIREFLY() {
|
|
|
17703
17707
|
});
|
|
17704
17708
|
|
|
17705
17709
|
const apiKey = window.localStorage.getItem(SERVICES_API_KEY.Firefly);
|
|
17706
|
-
if (!apiKey) {
|
|
17707
|
-
throw new MissingApiKeyError(SERVICES_API_KEY.Firefly)
|
|
17708
|
-
}
|
|
17709
17710
|
|
|
17710
17711
|
const url = new URL('https://openapi.firefly.land/v1/fileverse/fetch');
|
|
17711
17712
|
url.searchParams
|
|
@@ -17765,9 +17766,6 @@ async function LENS() {
|
|
|
17765
17766
|
const apiKey = window.localStorage.getItem(
|
|
17766
17767
|
SERVICES_API_KEY.Firefly
|
|
17767
17768
|
);
|
|
17768
|
-
if (!apiKey) {
|
|
17769
|
-
throw new MissingApiKeyError(SERVICES_API_KEY.Firefly)
|
|
17770
|
-
}
|
|
17771
17769
|
|
|
17772
17770
|
const url = new URL(
|
|
17773
17771
|
'https://openapi.firefly.land/v1/fileverse/fetch'
|
|
@@ -17829,9 +17827,6 @@ async function FARCASTER() {
|
|
|
17829
17827
|
const apiKey = window.localStorage.getItem(
|
|
17830
17828
|
SERVICES_API_KEY.Firefly
|
|
17831
17829
|
);
|
|
17832
|
-
if (!apiKey) {
|
|
17833
|
-
throw new MissingApiKeyError(SERVICES_API_KEY.Firefly)
|
|
17834
|
-
}
|
|
17835
17830
|
|
|
17836
17831
|
const url = new URL(
|
|
17837
17832
|
'https://openapi.firefly.land/v1/fileverse/fetch'
|
|
@@ -17970,7 +17965,6 @@ async function BASE() {
|
|
|
17970
17965
|
const [type, address, startDate, endDate, page, limit] = argsToArray(arguments);
|
|
17971
17966
|
validateParams(baseParamsSchema, { type, address, startDate, endDate, page, limit });
|
|
17972
17967
|
const API_KEY = window.localStorage.getItem(SERVICES_API_KEY.Basescan);
|
|
17973
|
-
if (!API_KEY) throw new MissingApiKeyError(SERVICES_API_KEY.Basescan)
|
|
17974
17968
|
|
|
17975
17969
|
return await handleScanRequest({
|
|
17976
17970
|
type,
|
|
@@ -18006,7 +18000,6 @@ async function GNOSIS() {
|
|
|
18006
18000
|
const apiKey = window.localStorage.getItem(
|
|
18007
18001
|
SERVICES_API_KEY.Gnosisscan
|
|
18008
18002
|
);
|
|
18009
|
-
if (!apiKey) throw new MissingApiKeyError(SERVICES_API_KEY.Gnosisscan)
|
|
18010
18003
|
|
|
18011
18004
|
return await handleScanRequest({
|
|
18012
18005
|
type,
|
|
@@ -18036,7 +18029,6 @@ async function NEYNAR() {
|
|
|
18036
18029
|
validateParams(neynarParamsSchema, { username });
|
|
18037
18030
|
|
|
18038
18031
|
const apiKey = window.localStorage.getItem(SERVICES_API_KEY.Neynar);
|
|
18039
|
-
if (!apiKey) throw new MissingApiKeyError(SERVICES_API_KEY.Neynar)
|
|
18040
18032
|
|
|
18041
18033
|
const fid = await fromUsernameToFid$1.fromUsernameToFid(username, apiKey);
|
|
18042
18034
|
if (!fid) throw new ValidationError(`Invalid username: ${username}`)
|
|
@@ -18044,7 +18036,7 @@ async function NEYNAR() {
|
|
|
18044
18036
|
const url = `https://api.neynar.com/v2/farcaster/followers?fid=${fid}`;
|
|
18045
18037
|
|
|
18046
18038
|
const { URL: finalUrl, HEADERS } = getUrlAndHeaders({
|
|
18047
|
-
url: url.toString(), serviceName: '
|
|
18039
|
+
url: url.toString(), serviceName: 'Neynar',
|
|
18048
18040
|
headers: {
|
|
18049
18041
|
'x-api-key': apiKey,
|
|
18050
18042
|
'x-neynar-experimental': 'false'
|
|
@@ -18149,7 +18141,6 @@ async function ETHERSCAN() {
|
|
|
18149
18141
|
if (!chainId) throw new ValidationError(`Invalid chain: ${chain}`)
|
|
18150
18142
|
|
|
18151
18143
|
const apiKey = window.localStorage.getItem(SERVICES_API_KEY.Etherscan);
|
|
18152
|
-
if (!apiKey) throw new MissingApiKeyError(SERVICES_API_KEY.Etherscan)
|
|
18153
18144
|
|
|
18154
18145
|
return await handleScanRequest({
|
|
18155
18146
|
type,
|
|
@@ -18175,7 +18166,6 @@ async function COINGECKO() {
|
|
|
18175
18166
|
validateParams(coingeckoParamsSchema, { category, param1, param2 });
|
|
18176
18167
|
|
|
18177
18168
|
const apiKey = window.localStorage.getItem(SERVICES_API_KEY.Coingecko);
|
|
18178
|
-
if (!apiKey) throw new MissingApiKeyError(SERVICES_API_KEY.Coingecko)
|
|
18179
18169
|
|
|
18180
18170
|
const headers = {
|
|
18181
18171
|
accept: 'application/json',
|
|
@@ -18242,14 +18232,12 @@ async function COINGECKO() {
|
|
|
18242
18232
|
}
|
|
18243
18233
|
|
|
18244
18234
|
async function EOA() {
|
|
18245
|
-
console.log('EOA');
|
|
18246
18235
|
try {
|
|
18247
18236
|
const [addresses, category, chains, startTime, endTime, page = 1, offset = 10] =
|
|
18248
18237
|
argsToArray(arguments);
|
|
18249
18238
|
validateParams(eoaParamsSchema, { addresses, category, chains, startTime, endTime, page, offset });
|
|
18250
18239
|
|
|
18251
18240
|
const apiKey = window.localStorage.getItem(SERVICES_API_KEY.Etherscan);
|
|
18252
|
-
if (!apiKey) throw new MissingApiKeyError(SERVICES_API_KEY.Etherscan)
|
|
18253
18241
|
|
|
18254
18242
|
const INPUTS = addresses.split(',').map(s => s.trim()).filter(Boolean);
|
|
18255
18243
|
const CHAINS = chains.split(',').map(s => s.trim()).filter(Boolean);
|
|
@@ -18266,7 +18254,6 @@ async function EOA() {
|
|
|
18266
18254
|
}
|
|
18267
18255
|
}
|
|
18268
18256
|
const ADDRS = Object.keys(ADDRESS_MAP);
|
|
18269
|
-
console.log('ADDRS', ADDRS);
|
|
18270
18257
|
const out = [];
|
|
18271
18258
|
|
|
18272
18259
|
async function fetchJSON(url) {
|
|
@@ -18341,7 +18328,6 @@ async function SAFE() {
|
|
|
18341
18328
|
validateParams(safeParamsSchema, { address, utility, chain, limit, offset });
|
|
18342
18329
|
|
|
18343
18330
|
const apiKey = window.localStorage.getItem(SERVICES_API_KEY.Safe);
|
|
18344
|
-
if (!apiKey) throw new MissingApiKeyError(SERVICES_API_KEY.Safe)
|
|
18345
18331
|
|
|
18346
18332
|
const chainId = SAFE_CHAIN_MAP[chain];
|
|
18347
18333
|
if (!chainId) throw new ValidationError(`Invalid chain: ${chain}`)
|
|
@@ -18378,7 +18364,6 @@ async function DEFILLAMA() {
|
|
|
18378
18364
|
const [category] = argsToArray(arguments);
|
|
18379
18365
|
validateParams(defillamaParamsSchema, { category });
|
|
18380
18366
|
const apiKey = window.localStorage.getItem(SERVICES_API_KEY.Defillama);
|
|
18381
|
-
if (!apiKey) throw new MissingApiKeyError(SERVICES_API_KEY.Defillama)
|
|
18382
18367
|
const url = CATEGORY_URLS[category];
|
|
18383
18368
|
if (!url) throw new ValidationError(`Invalid category: ${category}`)
|
|
18384
18369
|
const res = await fetch(url);
|