@fileverse-dev/formulajs 4.4.11-mod-73 → 4.4.11-mod-74
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 +178 -174
- package/lib/browser/formula.min.js +2 -2
- package/lib/browser/formula.min.js.map +1 -1
- package/lib/cjs/index.cjs +57 -54
- package/lib/esm/index.mjs +57 -54
- package/package.json +1 -1
package/lib/cjs/index.cjs
CHANGED
|
@@ -13144,44 +13144,88 @@ const SERVICES_API_KEY = {
|
|
|
13144
13144
|
Defillama: 'Defillama'
|
|
13145
13145
|
};
|
|
13146
13146
|
|
|
13147
|
-
|
|
13147
|
+
class ValidationError extends Error {
|
|
13148
|
+
constructor(message) {
|
|
13149
|
+
super(message);
|
|
13150
|
+
}
|
|
13151
|
+
}
|
|
13152
|
+
|
|
13153
|
+
|
|
13154
|
+
|
|
13155
|
+
class MissingApiKeyError extends Error {
|
|
13156
|
+
constructor(apiKeyName){
|
|
13157
|
+
super(`API key for ${apiKeyName} is missing`);
|
|
13158
|
+
}
|
|
13159
|
+
}
|
|
13160
|
+
|
|
13161
|
+
|
|
13162
|
+
class RateLimitError extends Error {
|
|
13163
|
+
constructor(apiKeyName){
|
|
13164
|
+
super( `You have reached the rate limit for ${apiKeyName}`);
|
|
13165
|
+
this.api = apiKeyName;
|
|
13166
|
+
}
|
|
13167
|
+
}
|
|
13168
|
+
|
|
13148
13169
|
|
|
13170
|
+
class NetworkError extends Error {
|
|
13171
|
+
constructor(apiKeyName, status){
|
|
13172
|
+
super(status === 429 ? `You have reached the rate limit for ${apiKeyName}` : `${apiKeyName} API failed with status code: ${status}` );
|
|
13173
|
+
this.status = status;
|
|
13174
|
+
this.api = apiKeyName;
|
|
13175
|
+
}
|
|
13176
|
+
}
|
|
13177
|
+
|
|
13178
|
+
class EnsError extends Error {
|
|
13179
|
+
constructor(ensname) {
|
|
13180
|
+
super(`${ensname} is not a supported ens name`);
|
|
13181
|
+
}
|
|
13182
|
+
}
|
|
13183
|
+
|
|
13184
|
+
class InvalidApiKeyError extends Error {
|
|
13185
|
+
constructor(apiKeyName){
|
|
13186
|
+
super(`Api key is invalid for ${apiKeyName}`);
|
|
13187
|
+
this.api = apiKeyName;
|
|
13188
|
+
}
|
|
13189
|
+
}
|
|
13190
|
+
|
|
13191
|
+
const stagingFileverseProxyUrl = "https://staging-api-proxy-ca4268d7d581.herokuapp.com/proxy";
|
|
13192
|
+
const productionFileverseProxyUrl = `${process.env.NEXT_PUBLIC_PROXY_BASE_URL}/proxy`;
|
|
13149
13193
|
// Proxy map configuration
|
|
13150
13194
|
const PROXY_MAP = {
|
|
13151
13195
|
Etherscan: {
|
|
13152
|
-
url:
|
|
13196
|
+
url: productionFileverseProxyUrl || stagingFileverseProxyUrl,
|
|
13153
13197
|
removeParams: ['apikey']
|
|
13154
13198
|
},
|
|
13155
13199
|
Basescan: {
|
|
13156
|
-
url:
|
|
13200
|
+
url: productionFileverseProxyUrl || stagingFileverseProxyUrl,
|
|
13157
13201
|
removeParams: ['apikey']
|
|
13158
13202
|
},
|
|
13159
13203
|
Gnosisscan: {
|
|
13160
|
-
url:
|
|
13204
|
+
url: productionFileverseProxyUrl || stagingFileverseProxyUrl,
|
|
13161
13205
|
removeParams: ['apikey']
|
|
13162
13206
|
},
|
|
13163
13207
|
Coingecko: {
|
|
13164
|
-
url:
|
|
13208
|
+
url: productionFileverseProxyUrl || stagingFileverseProxyUrl,
|
|
13165
13209
|
removeParams: ['apikey']
|
|
13166
13210
|
},
|
|
13167
13211
|
Firefly: {
|
|
13168
|
-
url:
|
|
13212
|
+
url: productionFileverseProxyUrl || stagingFileverseProxyUrl,
|
|
13169
13213
|
removeParams: ['apikey']
|
|
13170
13214
|
},
|
|
13171
13215
|
Neynar: {
|
|
13172
|
-
url:
|
|
13216
|
+
url: productionFileverseProxyUrl || stagingFileverseProxyUrl,
|
|
13173
13217
|
removeParams: ['api_key']
|
|
13174
13218
|
},
|
|
13175
13219
|
Safe: {
|
|
13176
|
-
url:
|
|
13220
|
+
url: productionFileverseProxyUrl || stagingFileverseProxyUrl,
|
|
13177
13221
|
removeParams: ['api_key']
|
|
13178
13222
|
},
|
|
13179
13223
|
Defillama: {
|
|
13180
|
-
url:
|
|
13224
|
+
url: productionFileverseProxyUrl || stagingFileverseProxyUrl,
|
|
13181
13225
|
removeParams: ['api_key']
|
|
13182
13226
|
},
|
|
13183
13227
|
GnosisPay: {
|
|
13184
|
-
url:
|
|
13228
|
+
url: productionFileverseProxyUrl || stagingFileverseProxyUrl,
|
|
13185
13229
|
removeParams: ['api_key']
|
|
13186
13230
|
},
|
|
13187
13231
|
// Add more services as needed. It can be direct url instead of ENV variable
|
|
@@ -13220,6 +13264,9 @@ function removeUrlParams(url, paramsToRemove) {
|
|
|
13220
13264
|
function getUrlAndHeaders({ url, serviceName, headers = {} }) {
|
|
13221
13265
|
// Check if proxy is enabled in localStorage
|
|
13222
13266
|
const apiKeyLS = window.localStorage.getItem(SERVICES_API_KEY[serviceName]);
|
|
13267
|
+
if(SERVICES_API_KEY[serviceName] && (!apiKeyLS || apiKeyLS === '')) {
|
|
13268
|
+
throw new MissingApiKeyError(SERVICES_API_KEY[serviceName])
|
|
13269
|
+
}
|
|
13223
13270
|
const isProxyModeEnabledValue = apiKeyLS === 'DEFAULT_PROXY_MODE';
|
|
13224
13271
|
|
|
13225
13272
|
// Check if proxy URL exists for this service
|
|
@@ -13319,50 +13366,6 @@ var fromEnsNameToAddress$1 = {
|
|
|
13319
13366
|
fromEnsNameToAddress
|
|
13320
13367
|
};
|
|
13321
13368
|
|
|
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
13369
|
async function handleScanRequest({
|
|
13367
13370
|
type,
|
|
13368
13371
|
address,
|
package/lib/esm/index.mjs
CHANGED
|
@@ -13142,44 +13142,88 @@ const SERVICES_API_KEY = {
|
|
|
13142
13142
|
Defillama: 'Defillama'
|
|
13143
13143
|
};
|
|
13144
13144
|
|
|
13145
|
-
|
|
13145
|
+
class ValidationError extends Error {
|
|
13146
|
+
constructor(message) {
|
|
13147
|
+
super(message);
|
|
13148
|
+
}
|
|
13149
|
+
}
|
|
13150
|
+
|
|
13151
|
+
|
|
13152
|
+
|
|
13153
|
+
class MissingApiKeyError extends Error {
|
|
13154
|
+
constructor(apiKeyName){
|
|
13155
|
+
super(`API key for ${apiKeyName} is missing`);
|
|
13156
|
+
}
|
|
13157
|
+
}
|
|
13158
|
+
|
|
13159
|
+
|
|
13160
|
+
class RateLimitError extends Error {
|
|
13161
|
+
constructor(apiKeyName){
|
|
13162
|
+
super( `You have reached the rate limit for ${apiKeyName}`);
|
|
13163
|
+
this.api = apiKeyName;
|
|
13164
|
+
}
|
|
13165
|
+
}
|
|
13166
|
+
|
|
13146
13167
|
|
|
13168
|
+
class NetworkError extends Error {
|
|
13169
|
+
constructor(apiKeyName, status){
|
|
13170
|
+
super(status === 429 ? `You have reached the rate limit for ${apiKeyName}` : `${apiKeyName} API failed with status code: ${status}` );
|
|
13171
|
+
this.status = status;
|
|
13172
|
+
this.api = apiKeyName;
|
|
13173
|
+
}
|
|
13174
|
+
}
|
|
13175
|
+
|
|
13176
|
+
class EnsError extends Error {
|
|
13177
|
+
constructor(ensname) {
|
|
13178
|
+
super(`${ensname} is not a supported ens name`);
|
|
13179
|
+
}
|
|
13180
|
+
}
|
|
13181
|
+
|
|
13182
|
+
class InvalidApiKeyError extends Error {
|
|
13183
|
+
constructor(apiKeyName){
|
|
13184
|
+
super(`Api key is invalid for ${apiKeyName}`);
|
|
13185
|
+
this.api = apiKeyName;
|
|
13186
|
+
}
|
|
13187
|
+
}
|
|
13188
|
+
|
|
13189
|
+
const stagingFileverseProxyUrl = "https://staging-api-proxy-ca4268d7d581.herokuapp.com/proxy";
|
|
13190
|
+
const productionFileverseProxyUrl = `${process.env.NEXT_PUBLIC_PROXY_BASE_URL}/proxy`;
|
|
13147
13191
|
// Proxy map configuration
|
|
13148
13192
|
const PROXY_MAP = {
|
|
13149
13193
|
Etherscan: {
|
|
13150
|
-
url:
|
|
13194
|
+
url: productionFileverseProxyUrl || stagingFileverseProxyUrl,
|
|
13151
13195
|
removeParams: ['apikey']
|
|
13152
13196
|
},
|
|
13153
13197
|
Basescan: {
|
|
13154
|
-
url:
|
|
13198
|
+
url: productionFileverseProxyUrl || stagingFileverseProxyUrl,
|
|
13155
13199
|
removeParams: ['apikey']
|
|
13156
13200
|
},
|
|
13157
13201
|
Gnosisscan: {
|
|
13158
|
-
url:
|
|
13202
|
+
url: productionFileverseProxyUrl || stagingFileverseProxyUrl,
|
|
13159
13203
|
removeParams: ['apikey']
|
|
13160
13204
|
},
|
|
13161
13205
|
Coingecko: {
|
|
13162
|
-
url:
|
|
13206
|
+
url: productionFileverseProxyUrl || stagingFileverseProxyUrl,
|
|
13163
13207
|
removeParams: ['apikey']
|
|
13164
13208
|
},
|
|
13165
13209
|
Firefly: {
|
|
13166
|
-
url:
|
|
13210
|
+
url: productionFileverseProxyUrl || stagingFileverseProxyUrl,
|
|
13167
13211
|
removeParams: ['apikey']
|
|
13168
13212
|
},
|
|
13169
13213
|
Neynar: {
|
|
13170
|
-
url:
|
|
13214
|
+
url: productionFileverseProxyUrl || stagingFileverseProxyUrl,
|
|
13171
13215
|
removeParams: ['api_key']
|
|
13172
13216
|
},
|
|
13173
13217
|
Safe: {
|
|
13174
|
-
url:
|
|
13218
|
+
url: productionFileverseProxyUrl || stagingFileverseProxyUrl,
|
|
13175
13219
|
removeParams: ['api_key']
|
|
13176
13220
|
},
|
|
13177
13221
|
Defillama: {
|
|
13178
|
-
url:
|
|
13222
|
+
url: productionFileverseProxyUrl || stagingFileverseProxyUrl,
|
|
13179
13223
|
removeParams: ['api_key']
|
|
13180
13224
|
},
|
|
13181
13225
|
GnosisPay: {
|
|
13182
|
-
url:
|
|
13226
|
+
url: productionFileverseProxyUrl || stagingFileverseProxyUrl,
|
|
13183
13227
|
removeParams: ['api_key']
|
|
13184
13228
|
},
|
|
13185
13229
|
// Add more services as needed. It can be direct url instead of ENV variable
|
|
@@ -13218,6 +13262,9 @@ function removeUrlParams(url, paramsToRemove) {
|
|
|
13218
13262
|
function getUrlAndHeaders({ url, serviceName, headers = {} }) {
|
|
13219
13263
|
// Check if proxy is enabled in localStorage
|
|
13220
13264
|
const apiKeyLS = window.localStorage.getItem(SERVICES_API_KEY[serviceName]);
|
|
13265
|
+
if(SERVICES_API_KEY[serviceName] && (!apiKeyLS || apiKeyLS === '')) {
|
|
13266
|
+
throw new MissingApiKeyError(SERVICES_API_KEY[serviceName])
|
|
13267
|
+
}
|
|
13221
13268
|
const isProxyModeEnabledValue = apiKeyLS === 'DEFAULT_PROXY_MODE';
|
|
13222
13269
|
|
|
13223
13270
|
// Check if proxy URL exists for this service
|
|
@@ -13317,50 +13364,6 @@ var fromEnsNameToAddress$1 = {
|
|
|
13317
13364
|
fromEnsNameToAddress
|
|
13318
13365
|
};
|
|
13319
13366
|
|
|
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
13367
|
async function handleScanRequest({
|
|
13365
13368
|
type,
|
|
13366
13369
|
address,
|