@fileverse-dev/formulajs 4.4.11-mod-60 → 4.4.11-mod-61
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 +269 -210
- package/lib/browser/formula.min.js +2 -2
- package/lib/browser/formula.min.js.map +1 -1
- package/lib/cjs/index.cjs +31 -5
- package/lib/esm/crypto-constants.mjs +4 -1
- package/lib/esm/index.mjs +31 -5
- package/package.json +1 -1
package/lib/cjs/index.cjs
CHANGED
|
@@ -13076,12 +13076,14 @@ const ERROR_MESSAGES_FLAG = {
|
|
|
13076
13076
|
INVALID_CHAIN: '_INVALID_CHAIN',
|
|
13077
13077
|
INVALID_TYPE: '_INVALID_TYPE',
|
|
13078
13078
|
INVALID_ADDRESS: '_INVALID_ADDRESS',
|
|
13079
|
-
INVALID_PARAM: '_INVALID_PARAM'
|
|
13079
|
+
INVALID_PARAM: '_INVALID_PARAM',
|
|
13080
|
+
MAX_PAGE_LIMIT: 'Max page limit is 250'
|
|
13080
13081
|
};
|
|
13081
13082
|
|
|
13082
13083
|
const UTILITY = {
|
|
13083
13084
|
ALCHEMY_API_KEY: 'ALCHEMY_API_KEY'
|
|
13084
13085
|
};
|
|
13086
|
+
const MAX_PAGE_LIMIT = 250;
|
|
13085
13087
|
|
|
13086
13088
|
const SERVICE_API_KEY = {
|
|
13087
13089
|
Etherscan: "ETHERSCAN_API_KEY",
|
|
@@ -13157,6 +13159,9 @@ async function handleScanRequest({
|
|
|
13157
13159
|
const API_KEY = window.localStorage.getItem(scanKey);
|
|
13158
13160
|
if (!API_KEY) return `${scanKey}${ERROR_MESSAGES_FLAG.MISSING_KEY}`;
|
|
13159
13161
|
if (API_KEY === 'xxxx') return `${scanKey}${ERROR_MESSAGES_FLAG.RATE_LIMIT}`;
|
|
13162
|
+
if(offset > MAX_PAGE_LIMIT){
|
|
13163
|
+
return ERROR_MESSAGES_FLAG.MAX_PAGE_LIMIT
|
|
13164
|
+
}
|
|
13160
13165
|
|
|
13161
13166
|
let chainId = CHAIN_ID_MAP[chain?.toLowerCase()];
|
|
13162
13167
|
if (!chainId) return `${scanKey}${ERROR_MESSAGES_FLAG.INVALID_CHAIN}`;
|
|
@@ -13226,7 +13231,7 @@ const fromUsernameToFid = async (username, apiKey) => {
|
|
|
13226
13231
|
}
|
|
13227
13232
|
});
|
|
13228
13233
|
const json = await res.json();
|
|
13229
|
-
const users = json.result
|
|
13234
|
+
const users = json.result ? json.result.users : [];
|
|
13230
13235
|
const user = users.find(user => user.username === username);
|
|
13231
13236
|
return user && user.fid || null;
|
|
13232
13237
|
};
|
|
@@ -13246,6 +13251,9 @@ const removeNestedStructure = (json) => {
|
|
|
13246
13251
|
|
|
13247
13252
|
async function FIREFLY() {
|
|
13248
13253
|
const [platform, contentType, identifier, start = 0, end = 10] = argsToArray(arguments);
|
|
13254
|
+
if(end > MAX_PAGE_LIMIT){
|
|
13255
|
+
return ERROR_MESSAGES_FLAG.MAX_PAGE_LIMIT
|
|
13256
|
+
}
|
|
13249
13257
|
const API_KEY = window.localStorage.getItem(SERVICE_API_KEY.Firefly);
|
|
13250
13258
|
if (!API_KEY) return `${SERVICE_API_KEY.Firefly}${ERROR_MESSAGES_FLAG.MISSING_KEY}`;
|
|
13251
13259
|
|
|
@@ -13308,6 +13316,10 @@ async function LENS() {
|
|
|
13308
13316
|
const API_KEY = window.localStorage.getItem(SERVICE_API_KEY.Firefly);
|
|
13309
13317
|
if (!API_KEY) return `${SERVICE_API_KEY.Firefly}${ERROR_MESSAGES_FLAG.MISSING_KEY}`;
|
|
13310
13318
|
|
|
13319
|
+
if(end > MAX_PAGE_LIMIT){
|
|
13320
|
+
return ERROR_MESSAGES_FLAG.MAX_PAGE_LIMIT
|
|
13321
|
+
}
|
|
13322
|
+
|
|
13311
13323
|
const baseUrl = "https://openapi.firefly.land/v1/fileverse/fetch";
|
|
13312
13324
|
const headers = { "x-api-key": API_KEY };
|
|
13313
13325
|
|
|
@@ -13359,7 +13371,9 @@ async function FARCASTER() {
|
|
|
13359
13371
|
const [contentType, identifier, start = 0, end = 10] = argsToArray(arguments);
|
|
13360
13372
|
const API_KEY = window.localStorage.getItem(SERVICE_API_KEY.Firefly);
|
|
13361
13373
|
if (!API_KEY) return `${SERVICE_API_KEY.Firefly}${ERROR_MESSAGES_FLAG.MISSING_KEY}`;
|
|
13362
|
-
|
|
13374
|
+
if(end > MAX_PAGE_LIMIT){
|
|
13375
|
+
return ERROR_MESSAGES_FLAG.MAX_PAGE_LIMIT
|
|
13376
|
+
}
|
|
13363
13377
|
const baseUrl = "https://openapi.firefly.land/v1/fileverse/fetch";
|
|
13364
13378
|
const headers = { "x-api-key": API_KEY };
|
|
13365
13379
|
|
|
@@ -13410,6 +13424,9 @@ async function FARCASTER() {
|
|
|
13410
13424
|
|
|
13411
13425
|
async function BLOCKSCOUT() {
|
|
13412
13426
|
let [address, type, chain, startTimestamp, endTimestamp, page, offset] = argsToArray(arguments);
|
|
13427
|
+
if(offset > MAX_PAGE_LIMIT){
|
|
13428
|
+
return ERROR_MESSAGES_FLAG.MAX_PAGE_LIMIT
|
|
13429
|
+
}
|
|
13413
13430
|
if (!chain) {
|
|
13414
13431
|
chain = 'ethereum';
|
|
13415
13432
|
}
|
|
@@ -13562,6 +13579,9 @@ async function GNOSISPAY({
|
|
|
13562
13579
|
const API_KEY = window.localStorage.getItem(apiKeyKey);
|
|
13563
13580
|
if (!API_KEY) return `${apiKeyKey}${ERROR_MESSAGES_FLAG.MISSING_KEY}`;
|
|
13564
13581
|
if (!cardId) return `${apiKeyKey}${ERROR_MESSAGES_FLAG.INVALID_PARAM}`;
|
|
13582
|
+
if(limit > MAX_PAGE_LIMIT){
|
|
13583
|
+
return ERROR_MESSAGES_FLAG.MAX_PAGE_LIMIT
|
|
13584
|
+
}
|
|
13565
13585
|
|
|
13566
13586
|
const url = new URL(`https://api.gnosispay.com/cards/${cardId}/transactions`);
|
|
13567
13587
|
url.searchParams.set('limit', limit.toString());
|
|
@@ -13779,6 +13799,9 @@ async function EOA() {
|
|
|
13779
13799
|
page = 1,
|
|
13780
13800
|
offset = 10,
|
|
13781
13801
|
] = argsToArray(arguments);
|
|
13802
|
+
if(offset > MAX_PAGE_LIMIT){
|
|
13803
|
+
return ERROR_MESSAGES_FLAG.MAX_PAGE_LIMIT
|
|
13804
|
+
}
|
|
13782
13805
|
const INPUTS = addresses.split(",").map(a => a.trim()).filter(Boolean);
|
|
13783
13806
|
const CHAINS = chains.split(",").map(c => c.trim()).filter(Boolean);
|
|
13784
13807
|
const out = [];
|
|
@@ -13881,11 +13904,14 @@ async function FLVURL(token, vs_currencies) {
|
|
|
13881
13904
|
|
|
13882
13905
|
async function SAFE() {
|
|
13883
13906
|
|
|
13884
|
-
let [address, utility, chain, limit, offset] = argsToArray(arguments);
|
|
13907
|
+
let [address, utility, chain, limit = 10, offset = 0] = argsToArray(arguments);
|
|
13885
13908
|
|
|
13886
13909
|
if (typeof limit !== 'number' || limit < 0) return 'INVALID_LIMIT';
|
|
13887
13910
|
if (typeof offset !== 'number' || offset < 0) return 'INVALID_OFFSET';
|
|
13888
13911
|
if (utility !== 'txns') return 'UTILITY IS NOT SUPPORTED';
|
|
13912
|
+
if(limit > MAX_PAGE_LIMIT){
|
|
13913
|
+
return ERROR_MESSAGES_FLAG.MAX_PAGE_LIMIT
|
|
13914
|
+
}
|
|
13889
13915
|
|
|
13890
13916
|
const apiKey = window.localStorage.getItem(SERVICE_API_KEY.Safe);
|
|
13891
13917
|
const chainIdentifier = SAFE_CHAIN_MAP[chain];
|
|
@@ -13926,7 +13952,7 @@ async function SAFE() {
|
|
|
13926
13952
|
async function DEFILLAMA() {
|
|
13927
13953
|
let [category] = argsToArray(arguments);
|
|
13928
13954
|
const apiKey = window.localStorage.getItem(SERVICE_API_KEY.Defillama);
|
|
13929
|
-
if (!apiKey) return `${SERVICE_API_KEY.Defillama}
|
|
13955
|
+
if (!apiKey) return `${SERVICE_API_KEY.Defillama}${ERROR_MESSAGES_FLAG.MISSING_KEY}`;
|
|
13930
13956
|
const categoryList = ['protocols', 'yields', 'dex', 'fees'];
|
|
13931
13957
|
const categoryMap = {
|
|
13932
13958
|
[categoryList[0]]: 'https://api.llama.fi/protocols',
|
|
@@ -24,11 +24,13 @@ var ERROR_MESSAGES_FLAG = {
|
|
|
24
24
|
INVALID_CHAIN: "_INVALID_CHAIN",
|
|
25
25
|
INVALID_TYPE: "_INVALID_TYPE",
|
|
26
26
|
INVALID_ADDRESS: "_INVALID_ADDRESS",
|
|
27
|
-
INVALID_PARAM: "_INVALID_PARAM"
|
|
27
|
+
INVALID_PARAM: "_INVALID_PARAM",
|
|
28
|
+
MAX_PAGE_LIMIT: "Max page limit is 250"
|
|
28
29
|
};
|
|
29
30
|
var UTILITY = {
|
|
30
31
|
ALCHEMY_API_KEY: "ALCHEMY_API_KEY"
|
|
31
32
|
};
|
|
33
|
+
var MAX_PAGE_LIMIT = 250;
|
|
32
34
|
|
|
33
35
|
// src/crypto-constants.js
|
|
34
36
|
var SERVICE_API_KEY = {
|
|
@@ -941,6 +943,7 @@ export {
|
|
|
941
943
|
CHAIN_ID_MAP,
|
|
942
944
|
ERROR_MESSAGES_FLAG,
|
|
943
945
|
FUNCTION_LOCALE,
|
|
946
|
+
MAX_PAGE_LIMIT,
|
|
944
947
|
SAFE_CHAIN_MAP,
|
|
945
948
|
SERVICE_API_KEY,
|
|
946
949
|
UTILITY
|
package/lib/esm/index.mjs
CHANGED
|
@@ -13074,12 +13074,14 @@ const ERROR_MESSAGES_FLAG = {
|
|
|
13074
13074
|
INVALID_CHAIN: '_INVALID_CHAIN',
|
|
13075
13075
|
INVALID_TYPE: '_INVALID_TYPE',
|
|
13076
13076
|
INVALID_ADDRESS: '_INVALID_ADDRESS',
|
|
13077
|
-
INVALID_PARAM: '_INVALID_PARAM'
|
|
13077
|
+
INVALID_PARAM: '_INVALID_PARAM',
|
|
13078
|
+
MAX_PAGE_LIMIT: 'Max page limit is 250'
|
|
13078
13079
|
};
|
|
13079
13080
|
|
|
13080
13081
|
const UTILITY = {
|
|
13081
13082
|
ALCHEMY_API_KEY: 'ALCHEMY_API_KEY'
|
|
13082
13083
|
};
|
|
13084
|
+
const MAX_PAGE_LIMIT = 250;
|
|
13083
13085
|
|
|
13084
13086
|
const SERVICE_API_KEY = {
|
|
13085
13087
|
Etherscan: "ETHERSCAN_API_KEY",
|
|
@@ -13155,6 +13157,9 @@ async function handleScanRequest({
|
|
|
13155
13157
|
const API_KEY = window.localStorage.getItem(scanKey);
|
|
13156
13158
|
if (!API_KEY) return `${scanKey}${ERROR_MESSAGES_FLAG.MISSING_KEY}`;
|
|
13157
13159
|
if (API_KEY === 'xxxx') return `${scanKey}${ERROR_MESSAGES_FLAG.RATE_LIMIT}`;
|
|
13160
|
+
if(offset > MAX_PAGE_LIMIT){
|
|
13161
|
+
return ERROR_MESSAGES_FLAG.MAX_PAGE_LIMIT
|
|
13162
|
+
}
|
|
13158
13163
|
|
|
13159
13164
|
let chainId = CHAIN_ID_MAP[chain?.toLowerCase()];
|
|
13160
13165
|
if (!chainId) return `${scanKey}${ERROR_MESSAGES_FLAG.INVALID_CHAIN}`;
|
|
@@ -13224,7 +13229,7 @@ const fromUsernameToFid = async (username, apiKey) => {
|
|
|
13224
13229
|
}
|
|
13225
13230
|
});
|
|
13226
13231
|
const json = await res.json();
|
|
13227
|
-
const users = json.result
|
|
13232
|
+
const users = json.result ? json.result.users : [];
|
|
13228
13233
|
const user = users.find(user => user.username === username);
|
|
13229
13234
|
return user && user.fid || null;
|
|
13230
13235
|
};
|
|
@@ -13244,6 +13249,9 @@ const removeNestedStructure = (json) => {
|
|
|
13244
13249
|
|
|
13245
13250
|
async function FIREFLY() {
|
|
13246
13251
|
const [platform, contentType, identifier, start = 0, end = 10] = argsToArray(arguments);
|
|
13252
|
+
if(end > MAX_PAGE_LIMIT){
|
|
13253
|
+
return ERROR_MESSAGES_FLAG.MAX_PAGE_LIMIT
|
|
13254
|
+
}
|
|
13247
13255
|
const API_KEY = window.localStorage.getItem(SERVICE_API_KEY.Firefly);
|
|
13248
13256
|
if (!API_KEY) return `${SERVICE_API_KEY.Firefly}${ERROR_MESSAGES_FLAG.MISSING_KEY}`;
|
|
13249
13257
|
|
|
@@ -13306,6 +13314,10 @@ async function LENS() {
|
|
|
13306
13314
|
const API_KEY = window.localStorage.getItem(SERVICE_API_KEY.Firefly);
|
|
13307
13315
|
if (!API_KEY) return `${SERVICE_API_KEY.Firefly}${ERROR_MESSAGES_FLAG.MISSING_KEY}`;
|
|
13308
13316
|
|
|
13317
|
+
if(end > MAX_PAGE_LIMIT){
|
|
13318
|
+
return ERROR_MESSAGES_FLAG.MAX_PAGE_LIMIT
|
|
13319
|
+
}
|
|
13320
|
+
|
|
13309
13321
|
const baseUrl = "https://openapi.firefly.land/v1/fileverse/fetch";
|
|
13310
13322
|
const headers = { "x-api-key": API_KEY };
|
|
13311
13323
|
|
|
@@ -13357,7 +13369,9 @@ async function FARCASTER() {
|
|
|
13357
13369
|
const [contentType, identifier, start = 0, end = 10] = argsToArray(arguments);
|
|
13358
13370
|
const API_KEY = window.localStorage.getItem(SERVICE_API_KEY.Firefly);
|
|
13359
13371
|
if (!API_KEY) return `${SERVICE_API_KEY.Firefly}${ERROR_MESSAGES_FLAG.MISSING_KEY}`;
|
|
13360
|
-
|
|
13372
|
+
if(end > MAX_PAGE_LIMIT){
|
|
13373
|
+
return ERROR_MESSAGES_FLAG.MAX_PAGE_LIMIT
|
|
13374
|
+
}
|
|
13361
13375
|
const baseUrl = "https://openapi.firefly.land/v1/fileverse/fetch";
|
|
13362
13376
|
const headers = { "x-api-key": API_KEY };
|
|
13363
13377
|
|
|
@@ -13408,6 +13422,9 @@ async function FARCASTER() {
|
|
|
13408
13422
|
|
|
13409
13423
|
async function BLOCKSCOUT() {
|
|
13410
13424
|
let [address, type, chain, startTimestamp, endTimestamp, page, offset] = argsToArray(arguments);
|
|
13425
|
+
if(offset > MAX_PAGE_LIMIT){
|
|
13426
|
+
return ERROR_MESSAGES_FLAG.MAX_PAGE_LIMIT
|
|
13427
|
+
}
|
|
13411
13428
|
if (!chain) {
|
|
13412
13429
|
chain = 'ethereum';
|
|
13413
13430
|
}
|
|
@@ -13560,6 +13577,9 @@ async function GNOSISPAY({
|
|
|
13560
13577
|
const API_KEY = window.localStorage.getItem(apiKeyKey);
|
|
13561
13578
|
if (!API_KEY) return `${apiKeyKey}${ERROR_MESSAGES_FLAG.MISSING_KEY}`;
|
|
13562
13579
|
if (!cardId) return `${apiKeyKey}${ERROR_MESSAGES_FLAG.INVALID_PARAM}`;
|
|
13580
|
+
if(limit > MAX_PAGE_LIMIT){
|
|
13581
|
+
return ERROR_MESSAGES_FLAG.MAX_PAGE_LIMIT
|
|
13582
|
+
}
|
|
13563
13583
|
|
|
13564
13584
|
const url = new URL(`https://api.gnosispay.com/cards/${cardId}/transactions`);
|
|
13565
13585
|
url.searchParams.set('limit', limit.toString());
|
|
@@ -13777,6 +13797,9 @@ async function EOA() {
|
|
|
13777
13797
|
page = 1,
|
|
13778
13798
|
offset = 10,
|
|
13779
13799
|
] = argsToArray(arguments);
|
|
13800
|
+
if(offset > MAX_PAGE_LIMIT){
|
|
13801
|
+
return ERROR_MESSAGES_FLAG.MAX_PAGE_LIMIT
|
|
13802
|
+
}
|
|
13780
13803
|
const INPUTS = addresses.split(",").map(a => a.trim()).filter(Boolean);
|
|
13781
13804
|
const CHAINS = chains.split(",").map(c => c.trim()).filter(Boolean);
|
|
13782
13805
|
const out = [];
|
|
@@ -13879,11 +13902,14 @@ async function FLVURL(token, vs_currencies) {
|
|
|
13879
13902
|
|
|
13880
13903
|
async function SAFE() {
|
|
13881
13904
|
|
|
13882
|
-
let [address, utility, chain, limit, offset] = argsToArray(arguments);
|
|
13905
|
+
let [address, utility, chain, limit = 10, offset = 0] = argsToArray(arguments);
|
|
13883
13906
|
|
|
13884
13907
|
if (typeof limit !== 'number' || limit < 0) return 'INVALID_LIMIT';
|
|
13885
13908
|
if (typeof offset !== 'number' || offset < 0) return 'INVALID_OFFSET';
|
|
13886
13909
|
if (utility !== 'txns') return 'UTILITY IS NOT SUPPORTED';
|
|
13910
|
+
if(limit > MAX_PAGE_LIMIT){
|
|
13911
|
+
return ERROR_MESSAGES_FLAG.MAX_PAGE_LIMIT
|
|
13912
|
+
}
|
|
13887
13913
|
|
|
13888
13914
|
const apiKey = window.localStorage.getItem(SERVICE_API_KEY.Safe);
|
|
13889
13915
|
const chainIdentifier = SAFE_CHAIN_MAP[chain];
|
|
@@ -13924,7 +13950,7 @@ async function SAFE() {
|
|
|
13924
13950
|
async function DEFILLAMA() {
|
|
13925
13951
|
let [category] = argsToArray(arguments);
|
|
13926
13952
|
const apiKey = window.localStorage.getItem(SERVICE_API_KEY.Defillama);
|
|
13927
|
-
if (!apiKey) return `${SERVICE_API_KEY.Defillama}
|
|
13953
|
+
if (!apiKey) return `${SERVICE_API_KEY.Defillama}${ERROR_MESSAGES_FLAG.MISSING_KEY}`;
|
|
13928
13954
|
const categoryList = ['protocols', 'yields', 'dex', 'fees'];
|
|
13929
13955
|
const categoryMap = {
|
|
13930
13956
|
[categoryList[0]]: 'https://api.llama.fi/protocols',
|