@fileverse-dev/formulajs 4.4.11-mod-81 → 4.4.11-mod-83
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 +47 -39
- package/lib/browser/formula.min.js +2 -2
- package/lib/browser/formula.min.js.map +1 -1
- package/lib/cjs/index.cjs +21 -12
- package/lib/esm/index.mjs +21 -12
- package/package.json +1 -1
package/lib/cjs/index.cjs
CHANGED
|
@@ -13189,47 +13189,55 @@ class InvalidApiKeyError extends Error {
|
|
|
13189
13189
|
}
|
|
13190
13190
|
}
|
|
13191
13191
|
|
|
13192
|
-
|
|
13193
|
-
|
|
13192
|
+
let PROXY_MAP;
|
|
13193
|
+
|
|
13194
|
+
function initializeProxyMap() {
|
|
13195
|
+
if (!PROXY_MAP) {
|
|
13196
|
+
const fileverseProxyUrl = `${window.NEXT_PUBLIC_PROXY_BASE_URL}/proxy`;
|
|
13197
|
+
|
|
13198
|
+
PROXY_MAP = {
|
|
13194
13199
|
Etherscan: {
|
|
13195
|
-
url:
|
|
13200
|
+
url: fileverseProxyUrl,
|
|
13196
13201
|
removeParams: ['apikey']
|
|
13197
13202
|
},
|
|
13198
13203
|
Basescan: {
|
|
13199
|
-
url:
|
|
13204
|
+
url: fileverseProxyUrl,
|
|
13200
13205
|
removeParams: ['apikey']
|
|
13201
13206
|
},
|
|
13202
13207
|
Gnosisscan: {
|
|
13203
|
-
url:
|
|
13208
|
+
url: fileverseProxyUrl,
|
|
13204
13209
|
removeParams: ['apikey']
|
|
13205
13210
|
},
|
|
13206
13211
|
Coingecko: {
|
|
13207
|
-
url:
|
|
13212
|
+
url: fileverseProxyUrl,
|
|
13208
13213
|
removeParams: ['apikey']
|
|
13209
13214
|
},
|
|
13210
13215
|
Firefly: {
|
|
13211
|
-
url:
|
|
13216
|
+
url: fileverseProxyUrl,
|
|
13212
13217
|
removeParams: ['apikey']
|
|
13213
13218
|
},
|
|
13214
13219
|
Neynar: {
|
|
13215
|
-
url:
|
|
13220
|
+
url: fileverseProxyUrl,
|
|
13216
13221
|
removeParams: ['api_key']
|
|
13217
13222
|
},
|
|
13218
13223
|
Safe: {
|
|
13219
|
-
url:
|
|
13224
|
+
url: fileverseProxyUrl,
|
|
13220
13225
|
removeParams: ['api_key']
|
|
13221
13226
|
},
|
|
13222
13227
|
Defillama: {
|
|
13223
|
-
url:
|
|
13228
|
+
url: fileverseProxyUrl,
|
|
13224
13229
|
removeParams: ['api_key']
|
|
13225
13230
|
},
|
|
13226
13231
|
GnosisPay: {
|
|
13227
|
-
url:
|
|
13232
|
+
url: fileverseProxyUrl,
|
|
13228
13233
|
removeParams: ['api_key']
|
|
13229
13234
|
},
|
|
13230
13235
|
// Add more services as needed. It can be direct url instead of ENV variable
|
|
13231
13236
|
// ANOTHER_SERVICE: "https://another-proxy-url.com"
|
|
13232
13237
|
};
|
|
13238
|
+
}
|
|
13239
|
+
return PROXY_MAP;
|
|
13240
|
+
}
|
|
13233
13241
|
|
|
13234
13242
|
/**
|
|
13235
13243
|
* Removes specified parameters from a URL
|
|
@@ -13261,12 +13269,13 @@ function removeUrlParams(url, paramsToRemove) {
|
|
|
13261
13269
|
* @returns {Object} Object containing URL and HEADERS for the fetch request
|
|
13262
13270
|
*/
|
|
13263
13271
|
function getUrlAndHeaders({ url, serviceName, headers = {} }) {
|
|
13272
|
+
const proxyMap = initializeProxyMap();
|
|
13264
13273
|
// Check if proxy is enabled in localStorage
|
|
13265
13274
|
const apiKeyLS = window.localStorage.getItem(SERVICES_API_KEY[serviceName]);
|
|
13266
13275
|
const isProxyModeEnabledValue = apiKeyLS === 'DEFAULT_PROXY_MODE';
|
|
13267
13276
|
|
|
13268
13277
|
// Check if proxy URL exists for this service
|
|
13269
|
-
const proxyConfig =
|
|
13278
|
+
const proxyConfig = proxyMap[serviceName];
|
|
13270
13279
|
|
|
13271
13280
|
if (!proxyConfig && SERVICES_API_KEY[serviceName] && (!apiKeyLS || apiKeyLS === '')) {
|
|
13272
13281
|
throw new MissingApiKeyError(SERVICES_API_KEY[serviceName])
|
package/lib/esm/index.mjs
CHANGED
|
@@ -13187,47 +13187,55 @@ class InvalidApiKeyError extends Error {
|
|
|
13187
13187
|
}
|
|
13188
13188
|
}
|
|
13189
13189
|
|
|
13190
|
-
|
|
13191
|
-
|
|
13190
|
+
let PROXY_MAP;
|
|
13191
|
+
|
|
13192
|
+
function initializeProxyMap() {
|
|
13193
|
+
if (!PROXY_MAP) {
|
|
13194
|
+
const fileverseProxyUrl = `${window.NEXT_PUBLIC_PROXY_BASE_URL}/proxy`;
|
|
13195
|
+
|
|
13196
|
+
PROXY_MAP = {
|
|
13192
13197
|
Etherscan: {
|
|
13193
|
-
url:
|
|
13198
|
+
url: fileverseProxyUrl,
|
|
13194
13199
|
removeParams: ['apikey']
|
|
13195
13200
|
},
|
|
13196
13201
|
Basescan: {
|
|
13197
|
-
url:
|
|
13202
|
+
url: fileverseProxyUrl,
|
|
13198
13203
|
removeParams: ['apikey']
|
|
13199
13204
|
},
|
|
13200
13205
|
Gnosisscan: {
|
|
13201
|
-
url:
|
|
13206
|
+
url: fileverseProxyUrl,
|
|
13202
13207
|
removeParams: ['apikey']
|
|
13203
13208
|
},
|
|
13204
13209
|
Coingecko: {
|
|
13205
|
-
url:
|
|
13210
|
+
url: fileverseProxyUrl,
|
|
13206
13211
|
removeParams: ['apikey']
|
|
13207
13212
|
},
|
|
13208
13213
|
Firefly: {
|
|
13209
|
-
url:
|
|
13214
|
+
url: fileverseProxyUrl,
|
|
13210
13215
|
removeParams: ['apikey']
|
|
13211
13216
|
},
|
|
13212
13217
|
Neynar: {
|
|
13213
|
-
url:
|
|
13218
|
+
url: fileverseProxyUrl,
|
|
13214
13219
|
removeParams: ['api_key']
|
|
13215
13220
|
},
|
|
13216
13221
|
Safe: {
|
|
13217
|
-
url:
|
|
13222
|
+
url: fileverseProxyUrl,
|
|
13218
13223
|
removeParams: ['api_key']
|
|
13219
13224
|
},
|
|
13220
13225
|
Defillama: {
|
|
13221
|
-
url:
|
|
13226
|
+
url: fileverseProxyUrl,
|
|
13222
13227
|
removeParams: ['api_key']
|
|
13223
13228
|
},
|
|
13224
13229
|
GnosisPay: {
|
|
13225
|
-
url:
|
|
13230
|
+
url: fileverseProxyUrl,
|
|
13226
13231
|
removeParams: ['api_key']
|
|
13227
13232
|
},
|
|
13228
13233
|
// Add more services as needed. It can be direct url instead of ENV variable
|
|
13229
13234
|
// ANOTHER_SERVICE: "https://another-proxy-url.com"
|
|
13230
13235
|
};
|
|
13236
|
+
}
|
|
13237
|
+
return PROXY_MAP;
|
|
13238
|
+
}
|
|
13231
13239
|
|
|
13232
13240
|
/**
|
|
13233
13241
|
* Removes specified parameters from a URL
|
|
@@ -13259,12 +13267,13 @@ function removeUrlParams(url, paramsToRemove) {
|
|
|
13259
13267
|
* @returns {Object} Object containing URL and HEADERS for the fetch request
|
|
13260
13268
|
*/
|
|
13261
13269
|
function getUrlAndHeaders({ url, serviceName, headers = {} }) {
|
|
13270
|
+
const proxyMap = initializeProxyMap();
|
|
13262
13271
|
// Check if proxy is enabled in localStorage
|
|
13263
13272
|
const apiKeyLS = window.localStorage.getItem(SERVICES_API_KEY[serviceName]);
|
|
13264
13273
|
const isProxyModeEnabledValue = apiKeyLS === 'DEFAULT_PROXY_MODE';
|
|
13265
13274
|
|
|
13266
13275
|
// Check if proxy URL exists for this service
|
|
13267
|
-
const proxyConfig =
|
|
13276
|
+
const proxyConfig = proxyMap[serviceName];
|
|
13268
13277
|
|
|
13269
13278
|
if (!proxyConfig && SERVICES_API_KEY[serviceName] && (!apiKeyLS || apiKeyLS === '')) {
|
|
13270
13279
|
throw new MissingApiKeyError(SERVICES_API_KEY[serviceName])
|