@fileverse-dev/formulajs 4.4.11-mod-63 → 4.4.11-mod-64-patch-1
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 +1103 -795
- package/lib/browser/formula.min.js +2 -2
- package/lib/browser/formula.min.js.map +1 -1
- package/lib/cjs/index.cjs +688 -423
- package/lib/esm/crypto-constants.mjs +41 -51
- package/lib/esm/index.mjs +689 -423
- package/package.json +5 -3
- package/types/cjs/index.d.cts +11 -21
- package/types/esm/index.d.mts +11 -21
package/lib/esm/index.mjs
CHANGED
|
@@ -13096,15 +13096,19 @@ const SAFE_CHAIN_MAP = {
|
|
|
13096
13096
|
};
|
|
13097
13097
|
|
|
13098
13098
|
const ERROR_MESSAGES_FLAG = {
|
|
13099
|
-
INVALID_API_KEY: '
|
|
13100
|
-
RATE_LIMIT: '
|
|
13101
|
-
DEFAULT: '
|
|
13102
|
-
MISSING_KEY: '
|
|
13103
|
-
INVALID_CHAIN: '
|
|
13104
|
-
INVALID_TYPE: '
|
|
13105
|
-
INVALID_ADDRESS: '
|
|
13106
|
-
INVALID_PARAM: '
|
|
13107
|
-
MAX_PAGE_LIMIT: '
|
|
13099
|
+
INVALID_API_KEY: 'INVALID_API_KEY',
|
|
13100
|
+
RATE_LIMIT: 'RATE_LIMIT',
|
|
13101
|
+
DEFAULT: 'DEFAULT',
|
|
13102
|
+
MISSING_KEY: 'MISSING_KEY',
|
|
13103
|
+
INVALID_CHAIN: 'INVALID_CHAIN',
|
|
13104
|
+
INVALID_TYPE: 'INVALID_TYPE',
|
|
13105
|
+
INVALID_ADDRESS: 'INVALID_ADDRESS',
|
|
13106
|
+
INVALID_PARAM: 'INVALID_PARAM',
|
|
13107
|
+
MAX_PAGE_LIMIT: 'MAX_PAGE_LIMIT',
|
|
13108
|
+
NETWORK_ERROR: 'NETWORK_ERROR',
|
|
13109
|
+
ENS: 'ENS',
|
|
13110
|
+
CUSTOM: 'CUSTOM',
|
|
13111
|
+
MISSING_PARAM: 'MISSING_PARAM'
|
|
13108
13112
|
};
|
|
13109
13113
|
|
|
13110
13114
|
const UTILITY = {
|
|
@@ -13112,16 +13116,16 @@ const UTILITY = {
|
|
|
13112
13116
|
};
|
|
13113
13117
|
const MAX_PAGE_LIMIT = 250;
|
|
13114
13118
|
|
|
13115
|
-
const
|
|
13116
|
-
Etherscan:
|
|
13117
|
-
Coingecko:
|
|
13118
|
-
Safe:
|
|
13119
|
-
Basescan:
|
|
13120
|
-
Gnosisscan:
|
|
13121
|
-
Firefly:
|
|
13122
|
-
GnosisPay: '
|
|
13123
|
-
Neynar: '
|
|
13124
|
-
Defillama: '
|
|
13119
|
+
const SERVICES_API_KEY = {
|
|
13120
|
+
Etherscan: 'Etherscan',
|
|
13121
|
+
Coingecko: 'Coingecko',
|
|
13122
|
+
Safe: 'Safe',
|
|
13123
|
+
Basescan: 'Basescan',
|
|
13124
|
+
Gnosisscan: 'Gnosisscan',
|
|
13125
|
+
Firefly: 'Firefly',
|
|
13126
|
+
GnosisPay: 'GnosisPay',
|
|
13127
|
+
Neynar: 'Neynar',
|
|
13128
|
+
Defillama: 'Defillama'
|
|
13125
13129
|
};
|
|
13126
13130
|
|
|
13127
13131
|
const fromTimeStampToBlock = async (timestamp, chain, apiKey) => {
|
|
@@ -13134,6 +13138,10 @@ if(!timestamp || !chain || !apiKey) return
|
|
|
13134
13138
|
|
|
13135
13139
|
};
|
|
13136
13140
|
|
|
13141
|
+
var fromTimestampToBlock = {
|
|
13142
|
+
fromTimeStampToBlock
|
|
13143
|
+
};
|
|
13144
|
+
|
|
13137
13145
|
function toTimestamp(dateStr) {
|
|
13138
13146
|
// Expecting format: "DD/MM/YYYY"
|
|
13139
13147
|
const [day, month, year] = dateStr.split("/").map(Number);
|
|
@@ -13145,11 +13153,21 @@ const isAddress = (input) => {
|
|
|
13145
13153
|
return (/^0x[a-fA-F0-9]{40}$/.test(input))
|
|
13146
13154
|
};
|
|
13147
13155
|
|
|
13156
|
+
var isAddress$1 = {
|
|
13157
|
+
isAddress
|
|
13158
|
+
};
|
|
13159
|
+
|
|
13160
|
+
/* global document */
|
|
13161
|
+
/* global window */
|
|
13162
|
+
/* global ethers */
|
|
13163
|
+
|
|
13164
|
+
|
|
13165
|
+
|
|
13148
13166
|
async function fromEnsNameToAddress(name) {
|
|
13149
|
-
if (typeof ethers ===
|
|
13167
|
+
if (typeof ethers === 'undefined') {
|
|
13150
13168
|
await new Promise((resolve, reject) => {
|
|
13151
|
-
const script = document.createElement(
|
|
13152
|
-
script.src =
|
|
13169
|
+
const script = document.createElement('script');
|
|
13170
|
+
script.src = 'https://cdn.jsdelivr.net/npm/ethers@6.10.0/dist/ethers.umd.min.js';
|
|
13153
13171
|
script.onload = resolve;
|
|
13154
13172
|
script.onerror = reject;
|
|
13155
13173
|
document.head.appendChild(script);
|
|
@@ -13157,94 +13175,225 @@ async function fromEnsNameToAddress(name) {
|
|
|
13157
13175
|
}
|
|
13158
13176
|
|
|
13159
13177
|
const ALCHEMY_KEY = window.localStorage.getItem(UTILITY.ALCHEMY_API_KEY);
|
|
13160
|
-
if(!ALCHEMY_KEY){
|
|
13161
|
-
console.error(
|
|
13178
|
+
if (!ALCHEMY_KEY) {
|
|
13179
|
+
console.error('alchemy api key missing');
|
|
13162
13180
|
return null
|
|
13163
13181
|
}
|
|
13164
|
-
const provider = new ethers.AlchemyProvider(
|
|
13182
|
+
const provider = new ethers.AlchemyProvider('mainnet', ALCHEMY_KEY);
|
|
13165
13183
|
|
|
13166
13184
|
try {
|
|
13167
13185
|
const resolved = await provider.resolveName(name); // ENS ➝ address
|
|
13168
|
-
return resolved || null
|
|
13186
|
+
return resolved || null
|
|
13169
13187
|
} catch (err) {
|
|
13170
|
-
console.error(
|
|
13171
|
-
return null
|
|
13188
|
+
console.error('ENS resolution failed:', err.message);
|
|
13189
|
+
return null
|
|
13172
13190
|
}
|
|
13173
13191
|
}
|
|
13174
13192
|
|
|
13193
|
+
var fromEnsNameToAddress$1 = {
|
|
13194
|
+
fromEnsNameToAddress
|
|
13195
|
+
};
|
|
13196
|
+
|
|
13197
|
+
const errorMessageHandler = (errorFlag, input, functionName) => {
|
|
13198
|
+
if (!functionName) {
|
|
13199
|
+
const stack = new Error().stack?.split('\n')[2];
|
|
13200
|
+
const match = stack?.match(/at (\w+)/);
|
|
13201
|
+
functionName = match?.[1];
|
|
13202
|
+
}
|
|
13203
|
+
|
|
13204
|
+
switch (errorFlag) {
|
|
13205
|
+
case ERROR_MESSAGES_FLAG.INVALID_ADDRESS:
|
|
13206
|
+
return {
|
|
13207
|
+
message: `${input} is not a supported address`,
|
|
13208
|
+
functionName,
|
|
13209
|
+
type: errorFlag
|
|
13210
|
+
}
|
|
13211
|
+
|
|
13212
|
+
case ERROR_MESSAGES_FLAG.INVALID_PARAM: {
|
|
13213
|
+
const key = Object.keys(input)[0];
|
|
13214
|
+
const value = input[key];
|
|
13215
|
+
return {
|
|
13216
|
+
message: `${value} is an invalid value for ${key}`,
|
|
13217
|
+
functionName,
|
|
13218
|
+
type: errorFlag
|
|
13219
|
+
}
|
|
13220
|
+
}
|
|
13221
|
+
|
|
13222
|
+
case ERROR_MESSAGES_FLAG.INVALID_CHAIN:
|
|
13223
|
+
return {
|
|
13224
|
+
message: `${input} is not a supported chain for this function `,
|
|
13225
|
+
functionName,
|
|
13226
|
+
type: errorFlag
|
|
13227
|
+
}
|
|
13228
|
+
|
|
13229
|
+
case ERROR_MESSAGES_FLAG.RATE_LIMIT:
|
|
13230
|
+
return {
|
|
13231
|
+
message: `Rate limit for ${input || functionName || 'this api'} has been reached`,
|
|
13232
|
+
functionName,
|
|
13233
|
+
type: errorFlag
|
|
13234
|
+
}
|
|
13235
|
+
|
|
13236
|
+
case ERROR_MESSAGES_FLAG.MISSING_KEY:
|
|
13237
|
+
return {
|
|
13238
|
+
message: `Api key for ${input || functionName || 'this api'} is missing`,
|
|
13239
|
+
functionName,
|
|
13240
|
+
type: errorFlag
|
|
13241
|
+
}
|
|
13242
|
+
|
|
13243
|
+
case ERROR_MESSAGES_FLAG.NETWORK_ERROR:
|
|
13244
|
+
if (input === 429) {
|
|
13245
|
+
return {
|
|
13246
|
+
message: `Rate limit for ${functionName || 'this function'} has been reached`,
|
|
13247
|
+
functionName,
|
|
13248
|
+
type: ERROR_MESSAGES_FLAG.RATE_LIMIT
|
|
13249
|
+
}
|
|
13250
|
+
}
|
|
13251
|
+
return {
|
|
13252
|
+
message: `Api failed with status code ${input}`,
|
|
13253
|
+
functionName,
|
|
13254
|
+
type: errorFlag
|
|
13255
|
+
}
|
|
13256
|
+
|
|
13257
|
+
case ERROR_MESSAGES_FLAG.MISSING_PARAM:
|
|
13258
|
+
return {
|
|
13259
|
+
message: `Missing param: ${input}`,
|
|
13260
|
+
functionName,
|
|
13261
|
+
type: errorFlag
|
|
13262
|
+
}
|
|
13263
|
+
|
|
13264
|
+
case ERROR_MESSAGES_FLAG.ENS:
|
|
13265
|
+
return {
|
|
13266
|
+
message: `${input} is not a supported ens name`,
|
|
13267
|
+
functionName,
|
|
13268
|
+
type: errorFlag
|
|
13269
|
+
}
|
|
13270
|
+
|
|
13271
|
+
case ERROR_MESSAGES_FLAG.CUSTOM:
|
|
13272
|
+
return {
|
|
13273
|
+
message: input.message,
|
|
13274
|
+
functionName,
|
|
13275
|
+
type: errorFlag,
|
|
13276
|
+
reason: input.reason || input.message
|
|
13277
|
+
}
|
|
13278
|
+
|
|
13279
|
+
case ERROR_MESSAGES_FLAG.MAX_PAGE_LIMIT:
|
|
13280
|
+
return {
|
|
13281
|
+
message: `Max page limit is ${MAX_PAGE_LIMIT}`,
|
|
13282
|
+
functionName,
|
|
13283
|
+
type: errorFlag
|
|
13284
|
+
}
|
|
13285
|
+
|
|
13286
|
+
case ERROR_MESSAGES_FLAG.INVALID_API_KEY:
|
|
13287
|
+
return {
|
|
13288
|
+
message: `${input}: Invalid API key`,
|
|
13289
|
+
functionName,
|
|
13290
|
+
type: errorFlag
|
|
13291
|
+
}
|
|
13292
|
+
|
|
13293
|
+
default:
|
|
13294
|
+
return {
|
|
13295
|
+
message: 'An unexpected error occured',
|
|
13296
|
+
functionName,
|
|
13297
|
+
type: errorFlag,
|
|
13298
|
+
reason: input
|
|
13299
|
+
}
|
|
13300
|
+
}
|
|
13301
|
+
};
|
|
13302
|
+
|
|
13303
|
+
|
|
13304
|
+
|
|
13305
|
+
|
|
13306
|
+
|
|
13307
|
+
const checkRequiredParams = (inputMap) => {
|
|
13308
|
+
for (const key in inputMap) {
|
|
13309
|
+
if (!inputMap[key]) {
|
|
13310
|
+
const stack = new Error().stack?.split('\n')[2];
|
|
13311
|
+
const match = stack?.match(/at (\w+)/);
|
|
13312
|
+
const parentFunctionName = match?.[1];
|
|
13313
|
+
const paramName = key;
|
|
13314
|
+
return errorMessageHandler(ERROR_MESSAGES_FLAG.MISSING_PARAM, paramName, parentFunctionName)
|
|
13315
|
+
}
|
|
13316
|
+
}
|
|
13317
|
+
};
|
|
13318
|
+
|
|
13175
13319
|
async function handleScanRequest({
|
|
13176
|
-
scanKey,
|
|
13177
|
-
baseUrl,
|
|
13178
13320
|
type,
|
|
13179
|
-
chain,
|
|
13180
13321
|
address,
|
|
13181
13322
|
startDate,
|
|
13182
13323
|
endDate,
|
|
13183
13324
|
page = 1,
|
|
13184
13325
|
offset = 10,
|
|
13326
|
+
apiKey,
|
|
13327
|
+
functionName,
|
|
13328
|
+
chainId,
|
|
13329
|
+
network
|
|
13185
13330
|
}) {
|
|
13186
|
-
const
|
|
13187
|
-
|
|
13188
|
-
|
|
13189
|
-
|
|
13190
|
-
|
|
13191
|
-
}
|
|
13192
|
-
|
|
13193
|
-
let chainId = CHAIN_ID_MAP[chain?.toLowerCase()];
|
|
13194
|
-
if (!chainId) return `${scanKey}${ERROR_MESSAGES_FLAG.INVALID_CHAIN}`;
|
|
13331
|
+
const API_INFO_MAP = {
|
|
13332
|
+
BASE: { url: 'https://api.basescan.org/api', apiKeyName: SERVICES_API_KEY.Basescan },
|
|
13333
|
+
ETHERSCAN: { url: 'https://api.etherscan.io/v2/api', apiKeyName: SERVICES_API_KEY.Etherscan },
|
|
13334
|
+
GNOSIS: { url: 'https://api.gnosisscan.io/api', apiKeyName: SERVICES_API_KEY.Gnosisscan }
|
|
13335
|
+
};
|
|
13195
13336
|
|
|
13196
|
-
if(!isAddress(address)){
|
|
13197
|
-
|
|
13337
|
+
if (!isAddress$1.isAddress(address)) {
|
|
13338
|
+
const ensName = address;
|
|
13339
|
+
address = await fromEnsNameToAddress$1.fromEnsNameToAddress(address);
|
|
13340
|
+
if (!address) {
|
|
13341
|
+
return errorMessageHandler(ERROR_MESSAGES_FLAG.ENS, ensName, functionName)
|
|
13342
|
+
}
|
|
13198
13343
|
}
|
|
13199
13344
|
|
|
13200
|
-
|
|
13201
|
-
|
|
13345
|
+
const apiInfo = API_INFO_MAP[functionName];
|
|
13346
|
+
const baseUrl = apiInfo?.url;
|
|
13347
|
+
|
|
13348
|
+
if (!baseUrl) {
|
|
13349
|
+
return errorMessageHandler(ERROR_MESSAGES_FLAG.CUSTOM, {
|
|
13350
|
+
message: 'Api not found',
|
|
13351
|
+
reason: ` Api not found for: ${functionName}`
|
|
13352
|
+
}, functionName)
|
|
13202
13353
|
}
|
|
13203
13354
|
|
|
13204
13355
|
const ACTION_MAP = {
|
|
13205
13356
|
'all-txns': 'txlist',
|
|
13206
13357
|
'token-txns': 'tokentx',
|
|
13207
13358
|
'nft-txns': 'tokennfttx',
|
|
13208
|
-
|
|
13359
|
+
gas: 'gastracker'
|
|
13209
13360
|
};
|
|
13210
13361
|
|
|
13211
13362
|
const action = ACTION_MAP[type];
|
|
13212
|
-
if (!action) return
|
|
13213
|
-
|
|
13214
|
-
|
|
13215
|
-
if (scanKey === SERVICE_API_KEY.Basescan) chainId = 'base';
|
|
13216
|
-
if (scanKey === SERVICE_API_KEY.Gnosisscan) chainId = 'gnosis';
|
|
13363
|
+
if (!action) return errorMessageHandler(ERROR_MESSAGES_FLAG.INVALID_PARAM, { type }, functionName)
|
|
13217
13364
|
|
|
13218
|
-
let url = `${baseUrl}?chainid=${chainId}&module=account&action=${action}&apikey=${
|
|
13365
|
+
let url = `${baseUrl}?chainid=${chainId}&module=account&action=${action}&apikey=${apiKey}`;
|
|
13219
13366
|
|
|
13220
13367
|
if (['all-txns', 'token-txns', 'nft-txns'].includes(type)) {
|
|
13221
|
-
if (!address) return `${scanKey}${ERROR_MESSAGES_FLAG.INVALID_ADDRESS}`;
|
|
13222
13368
|
url += `&address=${address}&startblock=0&endblock=99999999&sort=asc`;
|
|
13223
13369
|
|
|
13224
13370
|
if (!isNaN(startDate) && !isNaN(endDate)) {
|
|
13225
13371
|
const [startBlock, endBlock] = await Promise.all([
|
|
13226
|
-
fromTimeStampToBlock(toTimestamp(startDate),
|
|
13227
|
-
fromTimeStampToBlock(toTimestamp(endDate),
|
|
13372
|
+
fromTimestampToBlock.fromTimeStampToBlock(toTimestamp(startDate), network, apiKey),
|
|
13373
|
+
fromTimestampToBlock.fromTimeStampToBlock(toTimestamp(endDate), network, apiKey)
|
|
13228
13374
|
]);
|
|
13229
|
-
url += `&startblock=${startBlock}&endblock=${endBlock}`;
|
|
13375
|
+
url += `&startblock=${startBlock || '0'}&endblock=${endBlock || '99999999'}`;
|
|
13230
13376
|
}
|
|
13231
13377
|
url += `&page=${page}&offset=${offset}`;
|
|
13232
13378
|
}
|
|
13233
13379
|
|
|
13234
13380
|
try {
|
|
13235
13381
|
const res = await fetch(url);
|
|
13236
|
-
if (!res.ok)
|
|
13382
|
+
if (!res.ok) {
|
|
13383
|
+
return errorMessageHandler(ERROR_MESSAGES_FLAG.NETWORK_ERROR, res.status, functionName)
|
|
13384
|
+
}
|
|
13237
13385
|
const json = await res.json();
|
|
13238
13386
|
|
|
13239
13387
|
if (typeof json.result === 'string') {
|
|
13240
|
-
if (json.result.includes('Invalid API Key'))
|
|
13241
|
-
|
|
13388
|
+
if (json.result.includes('Invalid API Key'))
|
|
13389
|
+
return errorMessageHandler(ERROR_MESSAGES_FLAG.INVALID_API_KEY, apiInfo.apiKeyName, functionName)
|
|
13390
|
+
if (json.result.includes('Max rate limit reached'))
|
|
13391
|
+
return errorMessageHandler(ERROR_MESSAGES_FLAG.RATE_LIMIT, apiInfo.apiKeyName, functionName)
|
|
13242
13392
|
}
|
|
13243
13393
|
|
|
13244
|
-
return json.result
|
|
13394
|
+
return json.result
|
|
13245
13395
|
} catch (err) {
|
|
13246
|
-
|
|
13247
|
-
return ERROR_MESSAGES_FLAG.DEFAULT;
|
|
13396
|
+
return errorMessageHandler(ERROR_MESSAGES_FLAG.DEFAULT, err, functionName)
|
|
13248
13397
|
}
|
|
13249
13398
|
}
|
|
13250
13399
|
|
|
@@ -13262,6 +13411,9 @@ const fromUsernameToFid = async (username, apiKey) => {
|
|
|
13262
13411
|
const user = users.find(user => user.username === username);
|
|
13263
13412
|
return user && user.fid || null;
|
|
13264
13413
|
};
|
|
13414
|
+
var fromUsernameToFid$1 = {
|
|
13415
|
+
fromUsernameToFid
|
|
13416
|
+
};
|
|
13265
13417
|
|
|
13266
13418
|
// remove nested structure from the response
|
|
13267
13419
|
const removeNestedStructure = (json) => {
|
|
@@ -13276,217 +13428,237 @@ const removeNestedStructure = (json) => {
|
|
|
13276
13428
|
});
|
|
13277
13429
|
};
|
|
13278
13430
|
|
|
13431
|
+
/* global window */
|
|
13432
|
+
|
|
13279
13433
|
async function FIREFLY() {
|
|
13280
13434
|
const [platform, contentType, identifier, start = 0, end = 10] = argsToArray(arguments);
|
|
13281
|
-
|
|
13282
|
-
|
|
13435
|
+
const missingParamsError = checkRequiredParams({ platform, contentType, identifier });
|
|
13436
|
+
|
|
13437
|
+
if (missingParamsError) {
|
|
13438
|
+
return missingParamsError
|
|
13439
|
+
}
|
|
13440
|
+
|
|
13441
|
+
if (end > MAX_PAGE_LIMIT) {
|
|
13442
|
+
return errorMessageHandler(ERROR_MESSAGES_FLAG.MAX_PAGE_LIMIT)
|
|
13283
13443
|
}
|
|
13284
|
-
const API_KEY = window.localStorage.getItem(SERVICE_API_KEY.Firefly);
|
|
13285
|
-
if (!API_KEY) return `${SERVICE_API_KEY.Firefly}${ERROR_MESSAGES_FLAG.MISSING_KEY}`;
|
|
13286
13444
|
|
|
13287
|
-
const
|
|
13288
|
-
|
|
13445
|
+
const API_KEY = window.localStorage.getItem(SERVICES_API_KEY.Firefly);
|
|
13446
|
+
if (!API_KEY) return errorMessageHandler(ERROR_MESSAGES_FLAG.MISSING_KEY, SERVICES_API_KEY.Firefly)
|
|
13447
|
+
|
|
13448
|
+
const baseUrl = 'https://openapi.firefly.land/v1/fileverse/fetch';
|
|
13449
|
+
const headers = { 'x-api-key': API_KEY };
|
|
13289
13450
|
|
|
13290
13451
|
const typeMap = {
|
|
13291
13452
|
farcaster: {
|
|
13292
|
-
posts:
|
|
13293
|
-
replies:
|
|
13294
|
-
channels:
|
|
13453
|
+
posts: 'farcasterid',
|
|
13454
|
+
replies: 'farcasterpostid',
|
|
13455
|
+
channels: 'farcasterchannels'
|
|
13295
13456
|
},
|
|
13296
13457
|
lens: {
|
|
13297
|
-
posts:
|
|
13298
|
-
replies:
|
|
13458
|
+
posts: 'lensid',
|
|
13459
|
+
replies: 'lenspostid'
|
|
13299
13460
|
}
|
|
13300
13461
|
};
|
|
13301
|
-
|
|
13302
|
-
|
|
13303
|
-
|
|
13304
|
-
|
|
13462
|
+
const platformType = typeMap[platform];
|
|
13463
|
+
if (!platformType) {
|
|
13464
|
+
return errorMessageHandler(ERROR_MESSAGES_FLAG.INVALID_PARAM, { platform })
|
|
13465
|
+
}
|
|
13466
|
+
const platformContentType = platformType[contentType];
|
|
13467
|
+
if (!platformContentType) {
|
|
13468
|
+
return errorMessageHandler(ERROR_MESSAGES_FLAG.INVALID_PARAM, { contentType })
|
|
13469
|
+
}
|
|
13305
13470
|
const query = identifier
|
|
13306
|
-
.split(
|
|
13307
|
-
.map(s => s.trim())
|
|
13471
|
+
.split(',')
|
|
13472
|
+
.map((s) => s.trim())
|
|
13308
13473
|
.filter(Boolean)
|
|
13309
|
-
.join(
|
|
13474
|
+
.join(',');
|
|
13310
13475
|
|
|
13311
13476
|
const url = new URL(baseUrl);
|
|
13312
|
-
url.searchParams.set(
|
|
13313
|
-
url.searchParams.set(
|
|
13314
|
-
url.searchParams.set(
|
|
13315
|
-
url.searchParams.set(
|
|
13477
|
+
url.searchParams.set('query', query);
|
|
13478
|
+
url.searchParams.set('type', platformType);
|
|
13479
|
+
url.searchParams.set('start', String(start));
|
|
13480
|
+
url.searchParams.set('end', String(end));
|
|
13316
13481
|
|
|
13317
13482
|
try {
|
|
13318
13483
|
const res = await fetch(url.toString(), { headers });
|
|
13319
|
-
if (!res.ok)
|
|
13484
|
+
if (!res.ok) return errorMessageHandler(ERROR_MESSAGES_FLAG.NETWORK_ERROR, res.status)
|
|
13320
13485
|
|
|
13321
13486
|
const json = await res.json();
|
|
13322
|
-
if (!Array.isArray(json?.data)) return []
|
|
13487
|
+
if (!Array.isArray(json?.data)) return []
|
|
13323
13488
|
|
|
13324
|
-
return json.data.map(item => {
|
|
13489
|
+
return json.data.map((item) => {
|
|
13325
13490
|
const flat = {};
|
|
13326
13491
|
for (const [key, value] of Object.entries(item)) {
|
|
13327
|
-
if (typeof value !==
|
|
13492
|
+
if (typeof value !== 'object' || value === null) {
|
|
13328
13493
|
flat[key] = value;
|
|
13329
13494
|
}
|
|
13330
13495
|
}
|
|
13331
13496
|
flat.platform = platform;
|
|
13332
|
-
return flat
|
|
13333
|
-
})
|
|
13334
|
-
|
|
13497
|
+
return flat
|
|
13498
|
+
})
|
|
13335
13499
|
} catch (err) {
|
|
13336
|
-
|
|
13337
|
-
return ERROR_MESSAGES_FLAG.DEFAULT;
|
|
13500
|
+
return errorMessageHandler(ERROR_MESSAGES_FLAG.DEFAULT, err)
|
|
13338
13501
|
}
|
|
13339
13502
|
}
|
|
13340
13503
|
|
|
13341
13504
|
async function LENS() {
|
|
13342
13505
|
const [contentType, identifier, start = 0, end = 10] = argsToArray(arguments);
|
|
13343
|
-
const
|
|
13344
|
-
if (
|
|
13345
|
-
|
|
13346
|
-
|
|
13347
|
-
|
|
13506
|
+
const missingParamsError = checkRequiredParams({ contentType, identifier });
|
|
13507
|
+
if (missingParamsError) {
|
|
13508
|
+
return missingParamsError
|
|
13509
|
+
}
|
|
13510
|
+
if (end > MAX_PAGE_LIMIT) {
|
|
13511
|
+
return errorMessageHandler(ERROR_MESSAGES_FLAG.MAX_PAGE_LIMIT)
|
|
13348
13512
|
}
|
|
13513
|
+
const API_KEY = window.localStorage.getItem(SERVICES_API_KEY.Firefly);
|
|
13514
|
+
if (!API_KEY) return errorMessageHandler(ERROR_MESSAGES_FLAG.MISSING_KEY, SERVICES_API_KEY.Firefly)
|
|
13349
13515
|
|
|
13350
|
-
const baseUrl =
|
|
13351
|
-
const headers = {
|
|
13516
|
+
const baseUrl = 'https://openapi.firefly.land/v1/fileverse/fetch';
|
|
13517
|
+
const headers = { 'x-api-key': API_KEY };
|
|
13352
13518
|
|
|
13353
13519
|
const typeMap = {
|
|
13354
|
-
posts:
|
|
13355
|
-
replies:
|
|
13520
|
+
posts: 'lensid',
|
|
13521
|
+
replies: 'lenspostid'
|
|
13356
13522
|
};
|
|
13357
|
-
|
|
13358
|
-
|
|
13359
|
-
|
|
13360
|
-
|
|
13523
|
+
const platformContentType = typeMap[contentType];
|
|
13524
|
+
if (!platformContentType) {
|
|
13525
|
+
return errorMessageHandler(ERROR_MESSAGES_FLAG.INVALID_PARAM, { contentType })
|
|
13526
|
+
}
|
|
13361
13527
|
const query = identifier
|
|
13362
|
-
.split(
|
|
13363
|
-
.map(s => s.trim())
|
|
13528
|
+
.split(',')
|
|
13529
|
+
.map((s) => s.trim())
|
|
13364
13530
|
.filter(Boolean)
|
|
13365
|
-
.join(
|
|
13531
|
+
.join(',');
|
|
13366
13532
|
|
|
13367
13533
|
const url = new URL(baseUrl);
|
|
13368
|
-
url.searchParams.set(
|
|
13369
|
-
url.searchParams.set(
|
|
13370
|
-
url.searchParams.set(
|
|
13371
|
-
url.searchParams.set(
|
|
13534
|
+
url.searchParams.set('query', query);
|
|
13535
|
+
url.searchParams.set('type', platformContentType);
|
|
13536
|
+
url.searchParams.set('start', String(start));
|
|
13537
|
+
url.searchParams.set('end', String(end));
|
|
13372
13538
|
|
|
13373
13539
|
try {
|
|
13374
13540
|
const res = await fetch(url.toString(), { headers });
|
|
13375
|
-
if (!res.ok)
|
|
13541
|
+
if (!res.ok) {
|
|
13542
|
+
return errorMessageHandler(ERROR_MESSAGES_FLAG.NETWORK_ERROR, res.status)
|
|
13543
|
+
}
|
|
13376
13544
|
|
|
13377
13545
|
const json = await res.json();
|
|
13378
|
-
if (!Array.isArray(json?.data)) return []
|
|
13546
|
+
if (!Array.isArray(json?.data)) return []
|
|
13379
13547
|
|
|
13380
|
-
return json.data.map(item => {
|
|
13548
|
+
return json.data.map((item) => {
|
|
13381
13549
|
const flat = {};
|
|
13382
13550
|
for (const [key, value] of Object.entries(item)) {
|
|
13383
|
-
if (typeof value !==
|
|
13551
|
+
if (typeof value !== 'object' || value === null) {
|
|
13384
13552
|
flat[key] = value;
|
|
13385
13553
|
}
|
|
13386
13554
|
}
|
|
13387
13555
|
flat.platform = 'lens';
|
|
13388
|
-
return flat
|
|
13389
|
-
})
|
|
13390
|
-
|
|
13556
|
+
return flat
|
|
13557
|
+
})
|
|
13391
13558
|
} catch (err) {
|
|
13392
|
-
|
|
13393
|
-
return ERROR_MESSAGES_FLAG.DEFAULT;
|
|
13559
|
+
return errorMessageHandler(ERROR_MESSAGES_FLAG.DEFAULT, err)
|
|
13394
13560
|
}
|
|
13395
13561
|
}
|
|
13396
13562
|
|
|
13397
13563
|
async function FARCASTER() {
|
|
13398
13564
|
const [contentType, identifier, start = 0, end = 10] = argsToArray(arguments);
|
|
13399
|
-
const
|
|
13400
|
-
if (
|
|
13401
|
-
|
|
13402
|
-
return ERROR_MESSAGES_FLAG.MAX_PAGE_LIMIT
|
|
13565
|
+
const missingParamsError = checkRequiredParams({ contentType, identifier });
|
|
13566
|
+
if (missingParamsError) {
|
|
13567
|
+
return missingParamsError
|
|
13403
13568
|
}
|
|
13404
|
-
|
|
13405
|
-
|
|
13569
|
+
if (end > MAX_PAGE_LIMIT) {
|
|
13570
|
+
return errorMessageHandler(ERROR_MESSAGES_FLAG.MAX_PAGE_LIMIT)
|
|
13571
|
+
}
|
|
13572
|
+
const API_KEY = window.localStorage.getItem(SERVICES_API_KEY.Firefly);
|
|
13573
|
+
if (!API_KEY) return errorMessageHandler(ERROR_MESSAGES_FLAG.MISSING_KEY, SERVICES_API_KEY.Firefly)
|
|
13574
|
+
const baseUrl = 'https://openapi.firefly.land/v1/fileverse/fetch';
|
|
13575
|
+
const headers = { 'x-api-key': API_KEY };
|
|
13406
13576
|
|
|
13407
13577
|
const typeMap = {
|
|
13408
|
-
posts:
|
|
13409
|
-
replies:
|
|
13410
|
-
channels:
|
|
13578
|
+
posts: 'farcasterid',
|
|
13579
|
+
replies: 'farcasterpostid',
|
|
13580
|
+
channels: 'farcasterchannels'
|
|
13411
13581
|
};
|
|
13412
13582
|
|
|
13413
|
-
const
|
|
13414
|
-
if (!
|
|
13415
|
-
|
|
13583
|
+
const platformContentType = typeMap[contentType];
|
|
13584
|
+
if (!platformContentType) {
|
|
13585
|
+
return errorMessageHandler(ERROR_MESSAGES_FLAG.INVALID_PARAM, { contentType })
|
|
13586
|
+
}
|
|
13416
13587
|
const query = identifier
|
|
13417
|
-
.split(
|
|
13418
|
-
.map(s => s.trim())
|
|
13588
|
+
.split(',')
|
|
13589
|
+
.map((s) => s.trim())
|
|
13419
13590
|
.filter(Boolean)
|
|
13420
|
-
.join(
|
|
13591
|
+
.join(',');
|
|
13421
13592
|
|
|
13422
13593
|
const url = new URL(baseUrl);
|
|
13423
|
-
url.searchParams.set(
|
|
13424
|
-
url.searchParams.set(
|
|
13425
|
-
url.searchParams.set(
|
|
13426
|
-
url.searchParams.set(
|
|
13594
|
+
url.searchParams.set('query', query);
|
|
13595
|
+
url.searchParams.set('type', platformContentType);
|
|
13596
|
+
url.searchParams.set('start', String(start));
|
|
13597
|
+
url.searchParams.set('end', String(end));
|
|
13427
13598
|
|
|
13428
13599
|
try {
|
|
13429
13600
|
const res = await fetch(url.toString(), { headers });
|
|
13430
|
-
if (!res.ok)
|
|
13601
|
+
if (!res.ok) return errorMessageHandler(ERROR_MESSAGES_FLAG.NETWORK_ERROR, res.status)
|
|
13431
13602
|
|
|
13432
13603
|
const json = await res.json();
|
|
13433
|
-
if (!Array.isArray(json?.data)) return []
|
|
13604
|
+
if (!Array.isArray(json?.data)) return []
|
|
13434
13605
|
|
|
13435
|
-
return json.data.map(item => {
|
|
13606
|
+
return json.data.map((item) => {
|
|
13436
13607
|
const flat = {};
|
|
13437
13608
|
for (const [key, value] of Object.entries(item)) {
|
|
13438
|
-
if (typeof value !==
|
|
13609
|
+
if (typeof value !== 'object' || value === null) {
|
|
13439
13610
|
flat[key] = value;
|
|
13440
13611
|
}
|
|
13441
13612
|
}
|
|
13442
|
-
flat.platform =
|
|
13443
|
-
return flat
|
|
13444
|
-
})
|
|
13445
|
-
|
|
13613
|
+
flat.platform = 'farcaster';
|
|
13614
|
+
return flat
|
|
13615
|
+
})
|
|
13446
13616
|
} catch (err) {
|
|
13447
|
-
|
|
13448
|
-
return ERROR_MESSAGES_FLAG.DEFAULT;
|
|
13617
|
+
return errorMessageHandler(ERROR_MESSAGES_FLAG.DEFAULT, err)
|
|
13449
13618
|
}
|
|
13450
13619
|
}
|
|
13451
13620
|
|
|
13452
13621
|
async function BLOCKSCOUT() {
|
|
13453
|
-
|
|
13454
|
-
|
|
13455
|
-
|
|
13622
|
+
let [address, type, chain, startTimestamp, endTimestamp, page = 1, offset = 10] = argsToArray(arguments);
|
|
13623
|
+
const missingParamsError = checkRequiredParams({ address, type });
|
|
13624
|
+
|
|
13625
|
+
if (missingParamsError) {
|
|
13626
|
+
return missingParamsError
|
|
13627
|
+
}
|
|
13628
|
+
if (offset > MAX_PAGE_LIMIT) {
|
|
13629
|
+
return errorMessageHandler(ERROR_MESSAGES_FLAG.MAX_PAGE_LIMIT)
|
|
13456
13630
|
}
|
|
13457
13631
|
if (!chain) {
|
|
13458
13632
|
chain = 'ethereum';
|
|
13459
13633
|
}
|
|
13460
13634
|
|
|
13461
|
-
if (!type) {
|
|
13462
|
-
return 'TYPE_MISSING'
|
|
13463
|
-
}
|
|
13464
|
-
|
|
13465
13635
|
if (!startTimestamp) {
|
|
13466
13636
|
const currentTimestamp = Date.now();
|
|
13467
13637
|
startTimestamp = currentTimestamp - 30 * 24 * 60 * 60 * 1000;
|
|
13468
13638
|
startTimestamp = Math.floor(startTimestamp / 1000);
|
|
13469
13639
|
}
|
|
13470
13640
|
|
|
13471
|
-
if(isNaN(startTimestamp)){
|
|
13641
|
+
if (isNaN(startTimestamp)) {
|
|
13472
13642
|
startTimestamp = toTimestamp(startTimestamp);
|
|
13473
13643
|
}
|
|
13474
13644
|
|
|
13475
|
-
|
|
13476
|
-
if(isNaN(endTimestamp) && endTimestamp){
|
|
13645
|
+
if (isNaN(endTimestamp) && endTimestamp) {
|
|
13477
13646
|
endTimestamp = toTimestamp(endTimestamp);
|
|
13478
13647
|
}
|
|
13479
13648
|
|
|
13480
|
-
if(!isAddress(address)){
|
|
13481
|
-
|
|
13649
|
+
if (!isAddress$1.isAddress(address)) {
|
|
13650
|
+
const ensName = address;
|
|
13651
|
+
address = await fromEnsNameToAddress$1.fromEnsNameToAddress(address);
|
|
13652
|
+
if (!address) {
|
|
13653
|
+
return errorMessageHandler(ERROR_MESSAGES_FLAG.ENS, ensName)
|
|
13654
|
+
}
|
|
13482
13655
|
}
|
|
13656
|
+
const hostname = BLOCKSCOUT_CHAINS_MAP[chain];
|
|
13483
13657
|
|
|
13484
|
-
if(!
|
|
13485
|
-
return
|
|
13658
|
+
if (!hostname) {
|
|
13659
|
+
return errorMessageHandler(ERROR_MESSAGES_FLAG.INVALID_CHAIN, chain)
|
|
13486
13660
|
}
|
|
13487
13661
|
|
|
13488
|
-
const hostname = BLOCKSCOUT_CHAINS_MAP[chain];
|
|
13489
|
-
|
|
13490
13662
|
let requestUrl;
|
|
13491
13663
|
|
|
13492
13664
|
switch (type) {
|
|
@@ -13500,22 +13672,26 @@ async function BLOCKSCOUT() {
|
|
|
13500
13672
|
requestUrl = `${hostname}/api?module=account&action=tokenlist&address=${address}`;
|
|
13501
13673
|
break
|
|
13502
13674
|
default:
|
|
13503
|
-
return
|
|
13675
|
+
return errorMessageHandler(ERROR_MESSAGES_FLAG.INVALID_PARAM, { type })
|
|
13504
13676
|
}
|
|
13505
13677
|
try {
|
|
13506
13678
|
const response = await fetch(requestUrl);
|
|
13507
13679
|
|
|
13508
13680
|
if (!response.ok) {
|
|
13509
|
-
|
|
13681
|
+
return errorMessageHandler(ERROR_MESSAGES_FLAG.NETWORK_ERROR, response.status)
|
|
13510
13682
|
}
|
|
13511
13683
|
const json = await response.json();
|
|
13512
|
-
|
|
13513
|
-
console.log(json);
|
|
13514
13684
|
if (json?.result?.includes('Invalid parameter(s)')) {
|
|
13515
|
-
return
|
|
13685
|
+
return errorMessageHandler(ERROR_MESSAGES_FLAG.CUSTOM, {
|
|
13686
|
+
message: 'Invalid parameters',
|
|
13687
|
+
reason: json.result
|
|
13688
|
+
})
|
|
13516
13689
|
}
|
|
13517
13690
|
if (json?.result?.includes('Not found')) {
|
|
13518
|
-
return
|
|
13691
|
+
return errorMessageHandler(ERROR_MESSAGES_FLAG.CUSTOM, {
|
|
13692
|
+
message: 'Address information not found',
|
|
13693
|
+
reason: json.result
|
|
13694
|
+
})
|
|
13519
13695
|
}
|
|
13520
13696
|
|
|
13521
13697
|
if (type === 'stat') {
|
|
@@ -13535,54 +13711,75 @@ async function BLOCKSCOUT() {
|
|
|
13535
13711
|
*/
|
|
13536
13712
|
return json.result
|
|
13537
13713
|
} catch (error) {
|
|
13538
|
-
return
|
|
13714
|
+
return errorMessageHandler(ERROR_MESSAGES_FLAG.DEFAULT, error)
|
|
13539
13715
|
}
|
|
13540
13716
|
}
|
|
13541
13717
|
|
|
13542
13718
|
async function BASE() {
|
|
13543
|
-
const [type,
|
|
13719
|
+
const [type, address, startDate, endDate, page, limit] = argsToArray(arguments);
|
|
13720
|
+
const missingParamsError = checkRequiredParams({ type, address });
|
|
13721
|
+
|
|
13722
|
+
if (missingParamsError) {
|
|
13723
|
+
return missingParamsError
|
|
13724
|
+
}
|
|
13725
|
+
const API_KEY = window.localStorage.getItem(SERVICES_API_KEY.Basescan);
|
|
13726
|
+
if (!API_KEY) return errorMessageHandler(ERROR_MESSAGES_FLAG.MISSING_KEY, SERVICES_API_KEY.Basescan)
|
|
13727
|
+
if (limit > MAX_PAGE_LIMIT) {
|
|
13728
|
+
return errorMessageHandler(ERROR_MESSAGES_FLAG.MAX_PAGE_LIMIT)
|
|
13729
|
+
}
|
|
13544
13730
|
return handleScanRequest({
|
|
13545
|
-
scanKey: SERVICE_API_KEY.Basescan,
|
|
13546
|
-
baseUrl: 'https://api.basescan.org/api',
|
|
13547
13731
|
type,
|
|
13548
|
-
chain,
|
|
13549
13732
|
address,
|
|
13550
13733
|
startDate,
|
|
13551
13734
|
endDate,
|
|
13552
13735
|
page,
|
|
13553
|
-
offset:limit
|
|
13554
|
-
|
|
13736
|
+
offset: limit,
|
|
13737
|
+
apiKey: API_KEY,
|
|
13738
|
+
functionName: 'BASE',
|
|
13739
|
+
chainId: CHAIN_ID_MAP.base,
|
|
13740
|
+
network: 'base'
|
|
13741
|
+
})
|
|
13555
13742
|
}
|
|
13556
13743
|
async function GNOSIS() {
|
|
13557
|
-
const [type,
|
|
13744
|
+
const [type, address, startDate, endDate, page, limit] = argsToArray(arguments);
|
|
13745
|
+
const missingParamsError = checkRequiredParams({ type, address });
|
|
13746
|
+
|
|
13747
|
+
if (missingParamsError) {
|
|
13748
|
+
return missingParamsError
|
|
13749
|
+
}
|
|
13750
|
+
const API_KEY = window.localStorage.getItem(SERVICES_API_KEY.Gnosisscan);
|
|
13751
|
+
if (!API_KEY) return errorMessageHandler(ERROR_MESSAGES_FLAG.MISSING_KEY, SERVICES_API_KEY.Gnosisscan)
|
|
13752
|
+
if (limit > MAX_PAGE_LIMIT) {
|
|
13753
|
+
return errorMessageHandler(ERROR_MESSAGES_FLAG.MAX_PAGE_LIMIT)
|
|
13754
|
+
}
|
|
13558
13755
|
return handleScanRequest({
|
|
13559
|
-
scanKey: SERVICE_API_KEY.Gnosisscan,
|
|
13560
|
-
baseUrl: 'https://api.gnosisscan.io/api',
|
|
13561
13756
|
type,
|
|
13562
|
-
|
|
13757
|
+
network: 'gnosis',
|
|
13563
13758
|
address,
|
|
13564
13759
|
startDate,
|
|
13565
13760
|
endDate,
|
|
13566
13761
|
page,
|
|
13567
|
-
|
|
13568
|
-
|
|
13762
|
+
apiKey: API_KEY,
|
|
13763
|
+
offset: limit,
|
|
13764
|
+
chainId: CHAIN_ID_MAP.gnosis,
|
|
13765
|
+
functionName: 'GNOSIS'
|
|
13766
|
+
})
|
|
13569
13767
|
}
|
|
13570
13768
|
|
|
13571
13769
|
async function NEYNAR() {
|
|
13572
|
-
const [
|
|
13573
|
-
|
|
13574
|
-
] = argsToArray(arguments);
|
|
13575
|
-
const API_KEY = window.localStorage.getItem(SERVICE_API_KEY.Neynar);
|
|
13576
|
-
if (!API_KEY) return `${SERVICE_API_KEY.Neynar}${ERROR_MESSAGES_FLAG.MISSING_KEY}`;
|
|
13770
|
+
const [username] = argsToArray(arguments);
|
|
13771
|
+
const missingParamsError = checkRequiredParams({ username });
|
|
13577
13772
|
|
|
13578
|
-
if(
|
|
13579
|
-
return
|
|
13773
|
+
if (missingParamsError) {
|
|
13774
|
+
return missingParamsError
|
|
13580
13775
|
}
|
|
13776
|
+
const API_KEY = window.localStorage.getItem(SERVICES_API_KEY.Neynar);
|
|
13777
|
+
if (!API_KEY) return errorMessageHandler(ERROR_MESSAGES_FLAG.MISSING_KEY, SERVICES_API_KEY.Neynar)
|
|
13581
13778
|
|
|
13582
|
-
const fid = await fromUsernameToFid(username, API_KEY);
|
|
13779
|
+
const fid = await fromUsernameToFid$1.fromUsernameToFid(username, API_KEY);
|
|
13583
13780
|
|
|
13584
|
-
if(!fid){
|
|
13585
|
-
return
|
|
13781
|
+
if (!fid) {
|
|
13782
|
+
return errorMessageHandler(ERROR_MESSAGES_FLAG.INVALID_PARAM, { username })
|
|
13586
13783
|
}
|
|
13587
13784
|
|
|
13588
13785
|
const url = `https://api.neynar.com/v2/farcaster/followers?fid=${fid}`;
|
|
@@ -13594,9 +13791,11 @@ async function NEYNAR() {
|
|
|
13594
13791
|
'x-neynar-experimental': 'false'
|
|
13595
13792
|
}
|
|
13596
13793
|
});
|
|
13597
|
-
if (!response.ok)
|
|
13794
|
+
if (!response.ok) {
|
|
13795
|
+
return errorMessageHandler(ERROR_MESSAGES_FLAG.NETWORK_ERROR, response.status)
|
|
13796
|
+
}
|
|
13598
13797
|
const json = await response.json();
|
|
13599
|
-
if (!json?.users?.length) return []
|
|
13798
|
+
if (!json?.users?.length) return []
|
|
13600
13799
|
|
|
13601
13800
|
return json.users.map(({ user }) => ({
|
|
13602
13801
|
username: user.username,
|
|
@@ -13604,98 +13803,114 @@ async function NEYNAR() {
|
|
|
13604
13803
|
follower_count: user.follower_count,
|
|
13605
13804
|
country: user.profile?.location?.address?.country || '',
|
|
13606
13805
|
city: user.profile?.location?.address?.city || ''
|
|
13607
|
-
}))
|
|
13806
|
+
}))
|
|
13608
13807
|
} catch (err) {
|
|
13609
|
-
|
|
13610
|
-
|
|
13611
|
-
|
|
13612
|
-
|
|
13613
|
-
|
|
13614
|
-
|
|
13615
|
-
|
|
13616
|
-
|
|
13617
|
-
|
|
13618
|
-
|
|
13619
|
-
|
|
13620
|
-
|
|
13621
|
-
|
|
13622
|
-
|
|
13623
|
-
|
|
13624
|
-
|
|
13625
|
-
|
|
13626
|
-
}
|
|
13627
|
-
|
|
13628
|
-
const url = new URL(`https://api.gnosispay.com/cards/${cardId}/transactions`);
|
|
13629
|
-
url.searchParams.set('limit', limit.toString());
|
|
13630
|
-
url.searchParams.set('offset', offset.toString());
|
|
13808
|
+
return errorMessageHandler(ERROR_MESSAGES_FLAG.DEFAULT, err)
|
|
13809
|
+
}
|
|
13810
|
+
}
|
|
13811
|
+
// export async function GNOSISPAY({
|
|
13812
|
+
// cardId,
|
|
13813
|
+
// startDate,
|
|
13814
|
+
// endDate,
|
|
13815
|
+
// limit = 20,
|
|
13816
|
+
// offset = 0,
|
|
13817
|
+
// }) {
|
|
13818
|
+
// const apiKeyKey = SERVICES_API_KEY.GnosisPay
|
|
13819
|
+
// const API_KEY = window.localStorage.getItem(apiKeyKey);
|
|
13820
|
+
// if (!API_KEY) return `${apiKeyKey}${ERROR_MESSAGES_FLAG.MISSING_KEY}`;
|
|
13821
|
+
// if (!cardId) return `${apiKeyKey}${ERROR_MESSAGES_FLAG.INVALID_PARAM}`;
|
|
13822
|
+
// if(limit > MAX_PAGE_LIMIT){
|
|
13823
|
+
// return ERROR_MESSAGES_FLAG.MAX_PAGE_LIMIT
|
|
13824
|
+
// }
|
|
13631
13825
|
|
|
13632
|
-
|
|
13633
|
-
|
|
13634
|
-
|
|
13826
|
+
// const url = new URL(`https://api.gnosispay.com/cards/${cardId}/transactions`);
|
|
13827
|
+
// url.searchParams.set('limit', limit.toString());
|
|
13828
|
+
// url.searchParams.set('offset', offset.toString());
|
|
13635
13829
|
|
|
13636
|
-
|
|
13637
|
-
|
|
13638
|
-
|
|
13830
|
+
// if (!isNaN(toTimestamp(startDate))) {
|
|
13831
|
+
// url.searchParams.set('startDate', new Date(startDate * 1000).toISOString());
|
|
13832
|
+
// }
|
|
13639
13833
|
|
|
13640
|
-
|
|
13641
|
-
|
|
13642
|
-
|
|
13643
|
-
Authorization: `Bearer ${API_KEY}`,
|
|
13644
|
-
'Content-Type': 'application/json',
|
|
13645
|
-
},
|
|
13646
|
-
});
|
|
13834
|
+
// if (!isNaN(toTimestamp(endDate))) {
|
|
13835
|
+
// url.searchParams.set('endDate', new Date(endDate * 1000).toISOString());
|
|
13836
|
+
// }
|
|
13647
13837
|
|
|
13648
|
-
|
|
13838
|
+
// try {
|
|
13839
|
+
// const res = await fetch(url.toString(), {
|
|
13840
|
+
// headers: {
|
|
13841
|
+
// Authorization: `Bearer ${API_KEY}`,
|
|
13842
|
+
// 'Content-Type': 'application/json',
|
|
13843
|
+
// },
|
|
13844
|
+
// });
|
|
13845
|
+
|
|
13846
|
+
// if (!res.ok) throw new Error(`HTTP error! Status: ${res.status}`);
|
|
13847
|
+
|
|
13848
|
+
// const json = await res.json();
|
|
13849
|
+
|
|
13850
|
+
// if (!Array.isArray(json)) return [];
|
|
13851
|
+
|
|
13852
|
+
// return json.map(tx => ({
|
|
13853
|
+
// createdAt: tx.createdAt,
|
|
13854
|
+
// clearedAt: tx.clearedAt,
|
|
13855
|
+
// country: tx.country,
|
|
13856
|
+
// merchant: tx.merchant,
|
|
13857
|
+
// billingAmount: tx.billingAmount,
|
|
13858
|
+
// billingCurrency: tx.billingCurrency,
|
|
13859
|
+
// transactionAmount: tx.transactionAmount,
|
|
13860
|
+
// transactionCurrency: tx.transactionCurrency,
|
|
13861
|
+
// transactionType: tx.transactionType,
|
|
13862
|
+
// kind: tx.kind,
|
|
13863
|
+
// status: tx.status || null,
|
|
13864
|
+
// mcc: tx.mcc,
|
|
13865
|
+
// }));
|
|
13866
|
+
// } catch (err) {
|
|
13867
|
+
// console.error('GNOSISPAY_CARD_TXNS error:', err);
|
|
13868
|
+
// return ERROR_MESSAGES_FLAG.DEFAULT;
|
|
13869
|
+
// }
|
|
13870
|
+
// }
|
|
13649
13871
|
|
|
13650
|
-
|
|
13872
|
+
async function ETHERSCAN(...args) {
|
|
13873
|
+
const [type, chain, address, startDate, endDate, page, limit] = args;
|
|
13874
|
+
const missingParamsError = checkRequiredParams({ type, address, chain });
|
|
13651
13875
|
|
|
13652
|
-
|
|
13653
|
-
|
|
13654
|
-
return json.map(tx => ({
|
|
13655
|
-
createdAt: tx.createdAt,
|
|
13656
|
-
clearedAt: tx.clearedAt,
|
|
13657
|
-
country: tx.country,
|
|
13658
|
-
merchant: tx.merchant,
|
|
13659
|
-
billingAmount: tx.billingAmount,
|
|
13660
|
-
billingCurrency: tx.billingCurrency,
|
|
13661
|
-
transactionAmount: tx.transactionAmount,
|
|
13662
|
-
transactionCurrency: tx.transactionCurrency,
|
|
13663
|
-
transactionType: tx.transactionType,
|
|
13664
|
-
kind: tx.kind,
|
|
13665
|
-
status: tx.status || null,
|
|
13666
|
-
mcc: tx.mcc,
|
|
13667
|
-
}));
|
|
13668
|
-
} catch (err) {
|
|
13669
|
-
console.error('GNOSISPAY_CARD_TXNS error:', err);
|
|
13670
|
-
return ERROR_MESSAGES_FLAG.DEFAULT;
|
|
13876
|
+
if (missingParamsError) {
|
|
13877
|
+
return missingParamsError
|
|
13671
13878
|
}
|
|
13672
|
-
}
|
|
13673
13879
|
|
|
13880
|
+
const chainId = CHAIN_ID_MAP[chain];
|
|
13674
13881
|
|
|
13675
|
-
|
|
13676
|
-
|
|
13677
|
-
|
|
13882
|
+
if (!chainId?.toString()) {
|
|
13883
|
+
return errorMessageHandler(ERROR_MESSAGES_FLAG.INVALID_CHAIN, chain)
|
|
13884
|
+
}
|
|
13885
|
+
const API_KEY = window.localStorage.getItem(SERVICES_API_KEY.Etherscan);
|
|
13886
|
+
if (!API_KEY) return errorMessageHandler(ERROR_MESSAGES_FLAG.MISSING_KEY, SERVICES_API_KEY.Etherscan)
|
|
13678
13887
|
return handleScanRequest({
|
|
13679
|
-
scanKey: SERVICE_API_KEY.Etherscan,
|
|
13680
|
-
baseUrl: 'https://api.etherscan.io/v2/api',
|
|
13681
13888
|
type,
|
|
13682
|
-
chain,
|
|
13683
13889
|
address,
|
|
13684
13890
|
startDate,
|
|
13685
13891
|
endDate,
|
|
13686
13892
|
page,
|
|
13687
|
-
offset:limit
|
|
13688
|
-
|
|
13893
|
+
offset: limit,
|
|
13894
|
+
chainId,
|
|
13895
|
+
network: chain,
|
|
13896
|
+
functionName: 'ETHERSCAN',
|
|
13897
|
+
apiKey: API_KEY
|
|
13898
|
+
})
|
|
13689
13899
|
}
|
|
13690
13900
|
|
|
13901
|
+
async function COINGECKO() {
|
|
13902
|
+
const [category, param1, param2] = argsToArray(arguments);
|
|
13903
|
+
const missingParamsError = checkRequiredParams({ category, param1 });
|
|
13691
13904
|
|
|
13692
|
-
|
|
13693
|
-
|
|
13694
|
-
|
|
13905
|
+
if (missingParamsError) {
|
|
13906
|
+
return missingParamsError
|
|
13907
|
+
}
|
|
13908
|
+
const API_KEY = window.localStorage.getItem(SERVICES_API_KEY.Coingecko);
|
|
13909
|
+
if (!API_KEY) return errorMessageHandler(ERROR_MESSAGES_FLAG.MISSING_KEY, SERVICES_API_KEY.Coingecko)
|
|
13695
13910
|
|
|
13696
13911
|
const headers = {
|
|
13697
13912
|
accept: 'application/json',
|
|
13698
|
-
'x-cg-demo-api-key': API_KEY
|
|
13913
|
+
'x-cg-demo-api-key': API_KEY
|
|
13699
13914
|
};
|
|
13700
13915
|
|
|
13701
13916
|
let url = '';
|
|
@@ -13706,10 +13921,10 @@ async function COINGECKO(category, param1, param2) {
|
|
|
13706
13921
|
const token = param1;
|
|
13707
13922
|
const vsCurrencies = param2;
|
|
13708
13923
|
if (!token) {
|
|
13709
|
-
return
|
|
13924
|
+
return errorMessageHandler(ERROR_MESSAGES_FLAG.INVALID_PARAM, { param1 })
|
|
13710
13925
|
}
|
|
13711
|
-
url = `https://api.coingecko.com/api/v3/simple/price?vs_currencies=${vsCurrencies ? vsCurrencies : 'usd'
|
|
13712
|
-
break
|
|
13926
|
+
url = `https://api.coingecko.com/api/v3/simple/price?vs_currencies=${vsCurrencies ? vsCurrencies : 'usd'}&symbols=${token}`;
|
|
13927
|
+
break
|
|
13713
13928
|
}
|
|
13714
13929
|
|
|
13715
13930
|
case 'market': {
|
|
@@ -13723,7 +13938,7 @@ async function COINGECKO(category, param1, param2) {
|
|
|
13723
13938
|
bitcoin: 'bitcoin-ecosystem',
|
|
13724
13939
|
pump: 'pump-ecosystem',
|
|
13725
13940
|
aiagents: 'ai-agents',
|
|
13726
|
-
meme: 'meme-token'
|
|
13941
|
+
meme: 'meme-token'
|
|
13727
13942
|
};
|
|
13728
13943
|
|
|
13729
13944
|
const key = param1?.toLowerCase();
|
|
@@ -13733,17 +13948,15 @@ async function COINGECKO(category, param1, param2) {
|
|
|
13733
13948
|
url = `https://api.coingecko.com/api/v3/coins/markets?vs_currency=usd&include_tokens=top&page=1&per_page=100`;
|
|
13734
13949
|
if (categoryVal) url += `&category=${categoryVal}`;
|
|
13735
13950
|
if (trend) url += trend;
|
|
13736
|
-
break
|
|
13951
|
+
break
|
|
13737
13952
|
}
|
|
13738
13953
|
|
|
13739
13954
|
case 'stablecoins': {
|
|
13740
|
-
const category = !param1 || param1.toLowerCase() === 'all'
|
|
13741
|
-
? 'stablecoins'
|
|
13742
|
-
: param1.toLowerCase();
|
|
13955
|
+
const category = !param1 || param1.toLowerCase() === 'all' ? 'stablecoins' : param1.toLowerCase();
|
|
13743
13956
|
|
|
13744
13957
|
const trend = param2 ? `&price_change_percentage=${param2}` : '';
|
|
13745
13958
|
url = `https://api.coingecko.com/api/v3/coins/markets?vs_currency=usd&category=${category}&order=market_cap_desc&page=1&per_page=100${trend}`;
|
|
13746
|
-
break
|
|
13959
|
+
break
|
|
13747
13960
|
}
|
|
13748
13961
|
|
|
13749
13962
|
case 'derivatives': {
|
|
@@ -13753,11 +13966,11 @@ async function COINGECKO(category, param1, param2) {
|
|
|
13753
13966
|
} else {
|
|
13754
13967
|
url = `https://api.coingecko.com/api/v3/derivatives/exchanges/${exchange}?include_tickers=all`;
|
|
13755
13968
|
}
|
|
13756
|
-
break
|
|
13969
|
+
break
|
|
13757
13970
|
}
|
|
13758
13971
|
|
|
13759
13972
|
default:
|
|
13760
|
-
return
|
|
13973
|
+
return errorMessageHandler(ERROR_MESSAGES_FLAG.INVALID_PARAM, { category })
|
|
13761
13974
|
}
|
|
13762
13975
|
|
|
13763
13976
|
try {
|
|
@@ -13766,12 +13979,10 @@ async function COINGECKO(category, param1, param2) {
|
|
|
13766
13979
|
|
|
13767
13980
|
if (!response.ok) {
|
|
13768
13981
|
const message = json?.status?.error_message || '';
|
|
13769
|
-
if (response.status === 429) {
|
|
13770
|
-
return `${SERVICE_API_KEY.Coingecko}${ERROR_MESSAGES_FLAG.RATE_LIMIT}`;
|
|
13771
|
-
}
|
|
13772
13982
|
if (message.includes('API Key Missing')) {
|
|
13773
|
-
return
|
|
13983
|
+
return errorMessageHandler(ERROR_MESSAGES_FLAG.INVALID_API_KEY, SERVICES_API_KEY.Coingecko)
|
|
13774
13984
|
}
|
|
13985
|
+
return errorMessageHandler(ERROR_MESSAGES_FLAG.NETWORK_ERROR, response.status)
|
|
13775
13986
|
}
|
|
13776
13987
|
|
|
13777
13988
|
if (lowerCategory === 'price') {
|
|
@@ -13782,7 +13993,7 @@ async function COINGECKO(category, param1, param2) {
|
|
|
13782
13993
|
output[key] = value;
|
|
13783
13994
|
}
|
|
13784
13995
|
}
|
|
13785
|
-
return [output]
|
|
13996
|
+
return [output]
|
|
13786
13997
|
}
|
|
13787
13998
|
|
|
13788
13999
|
let data = json;
|
|
@@ -13792,7 +14003,7 @@ async function COINGECKO(category, param1, param2) {
|
|
|
13792
14003
|
data = json.slice(0, 200);
|
|
13793
14004
|
}
|
|
13794
14005
|
|
|
13795
|
-
if(param1 !== 'all' && json && json.tickers){
|
|
14006
|
+
if (param1 !== 'all' && json && json.tickers) {
|
|
13796
14007
|
const exchangeDetails = {
|
|
13797
14008
|
exchange_id: param1,
|
|
13798
14009
|
exchange_name: json.name,
|
|
@@ -13801,94 +14012,107 @@ async function COINGECKO(category, param1, param2) {
|
|
|
13801
14012
|
exchange_trade_volume_24h_btc: json.trade_volume_24h_btc,
|
|
13802
14013
|
exchange_number_of_futures_pairs: json.number_of_futures_pairs,
|
|
13803
14014
|
exchange_number_of_perpetual_pairs: json.number_of_perpetual_pairs,
|
|
13804
|
-
exchange_open_interest_btc: json.open_interest_btc
|
|
14015
|
+
exchange_open_interest_btc: json.open_interest_btc
|
|
13805
14016
|
};
|
|
13806
|
-
data = json.tickers.slice(0, 200).map(item => {
|
|
14017
|
+
data = json.tickers.slice(0, 200).map((item) => {
|
|
13807
14018
|
return {
|
|
13808
14019
|
...item,
|
|
13809
14020
|
...exchangeDetails,
|
|
13810
|
-
usd_volume: item.converted_volume && item.converted_volume.usd
|
|
14021
|
+
usd_volume: item.converted_volume && item.converted_volume.usd
|
|
13811
14022
|
}
|
|
13812
14023
|
});
|
|
13813
14024
|
}
|
|
13814
14025
|
}
|
|
13815
14026
|
|
|
13816
14027
|
const flatArray = Array.isArray(data) ? data : [data];
|
|
13817
|
-
return flatArray.map(item => {
|
|
14028
|
+
return flatArray.map((item) => {
|
|
13818
14029
|
const flat = {};
|
|
13819
14030
|
for (const [key, value] of Object.entries(item)) {
|
|
13820
14031
|
if (typeof value !== 'object' || value === null) {
|
|
13821
14032
|
flat[key] = value;
|
|
13822
14033
|
}
|
|
13823
14034
|
}
|
|
13824
|
-
return flat
|
|
13825
|
-
})
|
|
14035
|
+
return flat
|
|
14036
|
+
})
|
|
13826
14037
|
} catch (error) {
|
|
13827
|
-
|
|
13828
|
-
return ERROR_MESSAGES_FLAG.DEFAULT;
|
|
14038
|
+
return errorMessageHandler(ERROR_MESSAGES_FLAG.DEFAULT, error)
|
|
13829
14039
|
}
|
|
13830
14040
|
}
|
|
13831
14041
|
|
|
13832
14042
|
async function EOA() {
|
|
13833
|
-
|
|
13834
|
-
|
|
13835
|
-
|
|
13836
|
-
|
|
13837
|
-
|
|
13838
|
-
|
|
13839
|
-
|
|
13840
|
-
|
|
13841
|
-
|
|
13842
|
-
|
|
13843
|
-
|
|
13844
|
-
|
|
13845
|
-
|
|
13846
|
-
|
|
13847
|
-
const
|
|
13848
|
-
|
|
14043
|
+
let [addresses, category, chains, startTime, endTime, page = 1, offset = 10] = argsToArray(arguments);
|
|
14044
|
+
|
|
14045
|
+
const optionalParams = category === 'balance' ? {} : {startTime, endTime};
|
|
14046
|
+
|
|
14047
|
+
const missingParamsError = checkRequiredParams({ addresses, category, chains, ...optionalParams });
|
|
14048
|
+
|
|
14049
|
+
if (missingParamsError) {
|
|
14050
|
+
return missingParamsError
|
|
14051
|
+
}
|
|
14052
|
+
|
|
14053
|
+
if (offset > MAX_PAGE_LIMIT) {
|
|
14054
|
+
return errorMessageHandler(ERROR_MESSAGES_FLAG.MAX_PAGE_LIMIT)
|
|
14055
|
+
}
|
|
14056
|
+
|
|
14057
|
+
const API_KEY = window.localStorage.getItem(SERVICES_API_KEY.Etherscan);
|
|
14058
|
+
if (!API_KEY) return errorMessageHandler(ERROR_MESSAGES_FLAG.MISSING_KEY, SERVICES_API_KEY.Etherscan)
|
|
14059
|
+
const INPUTS = addresses
|
|
14060
|
+
.split(',')
|
|
14061
|
+
.map((a) => a.trim())
|
|
14062
|
+
.filter(Boolean);
|
|
14063
|
+
const CHAINS = chains
|
|
14064
|
+
.split(',')
|
|
14065
|
+
.map((c) => c.trim())
|
|
14066
|
+
.filter(Boolean);
|
|
13849
14067
|
const out = [];
|
|
13850
14068
|
// Map: finalAddress => ENS name (if applicable)
|
|
13851
14069
|
const ADDRESS_MAP = {};
|
|
13852
14070
|
for (const input of INPUTS) {
|
|
13853
|
-
if (isAddress(input)) {
|
|
14071
|
+
if (isAddress$1.isAddress(input)) {
|
|
13854
14072
|
ADDRESS_MAP[input.toLowerCase()] = null; // it's a direct address
|
|
13855
14073
|
} else {
|
|
13856
14074
|
try {
|
|
13857
|
-
const resolved = await fromEnsNameToAddress(input); // ENS -> address
|
|
14075
|
+
const resolved = await fromEnsNameToAddress$1.fromEnsNameToAddress(input); // ENS -> address
|
|
13858
14076
|
if (resolved) ADDRESS_MAP[resolved.toLowerCase()] = input;
|
|
13859
14077
|
} catch {
|
|
13860
|
-
return
|
|
14078
|
+
return errorMessageHandler(ERROR_MESSAGES_FLAG.INVALID_PARAM, { addresses })
|
|
13861
14079
|
}
|
|
13862
14080
|
}
|
|
13863
14081
|
}
|
|
13864
14082
|
const ADDRS = Object.keys(ADDRESS_MAP);
|
|
13865
14083
|
for (const chain of CHAINS) {
|
|
13866
14084
|
const chainId = CHAIN_ID_MAP[chain];
|
|
13867
|
-
if (!chainId) return ERROR_MESSAGES_FLAG.
|
|
13868
|
-
if (category ===
|
|
14085
|
+
if (!chainId) return errorMessageHandler(ERROR_MESSAGES_FLAG.INVALID_CHAIN, chain)
|
|
14086
|
+
if (category === 'balance') {
|
|
13869
14087
|
for (let i = 0; i < ADDRS.length; i += 20) {
|
|
13870
|
-
const slice = ADDRS.slice(i, i + 20).join(
|
|
14088
|
+
const slice = ADDRS.slice(i, i + 20).join(',');
|
|
13871
14089
|
const action = 'addresstokenbalance';
|
|
13872
14090
|
const url =
|
|
13873
14091
|
`https://api.etherscan.io/v2/api?chainid=${chainId}` +
|
|
13874
14092
|
`&module=account&action=${action}&address=${slice}` +
|
|
13875
14093
|
`&page=${page}&offset=100&apikey=${API_KEY}`;
|
|
13876
14094
|
const data = await fetchJSON(url);
|
|
13877
|
-
if (
|
|
13878
|
-
data.forEach(tx =>
|
|
14095
|
+
if (!Array.isArray(data)) return data
|
|
14096
|
+
data.forEach((tx) =>
|
|
13879
14097
|
out.push({
|
|
13880
14098
|
chain,
|
|
13881
14099
|
address: ADDRS[i],
|
|
13882
14100
|
name: ADDRESS_MAP[ADDRS[i]],
|
|
13883
|
-
...tx
|
|
13884
|
-
})
|
|
14101
|
+
...tx
|
|
14102
|
+
})
|
|
13885
14103
|
);
|
|
13886
14104
|
}
|
|
13887
|
-
continue
|
|
14105
|
+
continue
|
|
13888
14106
|
}
|
|
13889
|
-
if (category ===
|
|
13890
|
-
const startBlock = await fromTimeStampToBlock(toTimestamp(startTime), chain, API_KEY);
|
|
13891
|
-
const endBlock = await fromTimeStampToBlock(toTimestamp(endTime), chain, API_KEY);
|
|
14107
|
+
if (category === 'txns') {
|
|
14108
|
+
const startBlock = await fromTimestampToBlock.fromTimeStampToBlock(toTimestamp(startTime), chain, API_KEY);
|
|
14109
|
+
const endBlock = await fromTimestampToBlock.fromTimeStampToBlock(toTimestamp(endTime), chain, API_KEY);
|
|
14110
|
+
if (!startBlock?.toString()) {
|
|
14111
|
+
return errorMessageHandler(ERROR_MESSAGES_FLAG.INVALID_PARAM, { startTime })
|
|
14112
|
+
}
|
|
14113
|
+
if (!endBlock?.toString()) {
|
|
14114
|
+
return errorMessageHandler(ERROR_MESSAGES_FLAG.INVALID_PARAM, { endTime })
|
|
14115
|
+
}
|
|
13892
14116
|
for (const addr of ADDRS) {
|
|
13893
14117
|
const url =
|
|
13894
14118
|
`https://api.etherscan.io/v2/api?chainid=${chainId}` +
|
|
@@ -13896,42 +14120,47 @@ async function EOA() {
|
|
|
13896
14120
|
`&startblock=${startBlock}&endblock=${endBlock}` +
|
|
13897
14121
|
`&page=${page}&offset=${offset}&sort=asc&apikey=${API_KEY}`;
|
|
13898
14122
|
const data = await fetchJSON(url);
|
|
13899
|
-
if (
|
|
13900
|
-
data.forEach(tx =>
|
|
14123
|
+
if (!Array.isArray(data)) return data
|
|
14124
|
+
data.forEach((tx) =>
|
|
13901
14125
|
out.push({
|
|
13902
14126
|
chain,
|
|
13903
14127
|
address: addr,
|
|
13904
14128
|
name: ADDRESS_MAP[addr],
|
|
13905
|
-
...tx
|
|
13906
|
-
})
|
|
14129
|
+
...tx
|
|
14130
|
+
})
|
|
13907
14131
|
);
|
|
13908
14132
|
}
|
|
13909
|
-
continue
|
|
14133
|
+
continue
|
|
13910
14134
|
}
|
|
13911
|
-
return ERROR_MESSAGES_FLAG.
|
|
14135
|
+
return errorMessageHandler(ERROR_MESSAGES_FLAG.INVALID_PARAM, { category })
|
|
13912
14136
|
}
|
|
13913
14137
|
|
|
13914
|
-
return out
|
|
14138
|
+
return out
|
|
13915
14139
|
|
|
13916
14140
|
async function fetchJSON(url) {
|
|
13917
14141
|
try {
|
|
13918
14142
|
const res = await fetch(url);
|
|
13919
|
-
if (!res.ok)
|
|
14143
|
+
if (!res.ok) {
|
|
14144
|
+
return errorMessageHandler(ERROR_MESSAGES_FLAG.NETWORK_ERROR, res.status)
|
|
14145
|
+
}
|
|
13920
14146
|
|
|
13921
14147
|
const json = await res.json();
|
|
13922
14148
|
|
|
13923
|
-
if (json.result?.includes?.(
|
|
13924
|
-
return
|
|
14149
|
+
if (json.result?.includes?.('Invalid API Key'))
|
|
14150
|
+
return errorMessageHandler(ERROR_MESSAGES_FLAG.INVALID_API_KEY, SERVICES_API_KEY.Etherscan)
|
|
13925
14151
|
|
|
13926
|
-
if (json.result?.includes?.(
|
|
13927
|
-
return
|
|
14152
|
+
if (json.result?.includes?.('Max rate limit reached'))
|
|
14153
|
+
return errorMessageHandler(ERROR_MESSAGES_FLAG.RATE_LIMIT, SERVICES_API_KEY.Etherscan)
|
|
13928
14154
|
|
|
13929
|
-
if (json.status ===
|
|
13930
|
-
return ERROR_MESSAGES_FLAG.
|
|
14155
|
+
if (json.status === '0' && json.message !== 'No transactions found')
|
|
14156
|
+
return errorMessageHandler(ERROR_MESSAGES_FLAG.CUSTOM, {
|
|
14157
|
+
message: json.message || 'Api Error',
|
|
14158
|
+
reason: json.message || 'json.status === "0" && json.message !== "No transactions found"'
|
|
14159
|
+
})
|
|
13931
14160
|
|
|
13932
|
-
return json.result
|
|
13933
|
-
} catch {
|
|
13934
|
-
return ERROR_MESSAGES_FLAG.DEFAULT
|
|
14161
|
+
return json.result
|
|
14162
|
+
} catch (err) {
|
|
14163
|
+
return errorMessageHandler(ERROR_MESSAGES_FLAG.DEFAULT, err)
|
|
13935
14164
|
}
|
|
13936
14165
|
}
|
|
13937
14166
|
}
|
|
@@ -13939,167 +14168,204 @@ async function EOA() {
|
|
|
13939
14168
|
async function FLVURL(token, vs_currencies) {
|
|
13940
14169
|
return new Promise((resolve) => {
|
|
13941
14170
|
setTimeout(() => {
|
|
13942
|
-
resolve([{
|
|
14171
|
+
resolve([{ Yoo: 'gotcha' }]);
|
|
13943
14172
|
}, 10000);
|
|
13944
|
-
})
|
|
14173
|
+
})
|
|
13945
14174
|
}
|
|
13946
14175
|
|
|
13947
14176
|
async function SAFE() {
|
|
13948
|
-
|
|
13949
14177
|
let [address, utility, chain, limit = 10, offset = 0] = argsToArray(arguments);
|
|
13950
14178
|
|
|
13951
|
-
|
|
13952
|
-
|
|
13953
|
-
if (
|
|
13954
|
-
|
|
13955
|
-
return ERROR_MESSAGES_FLAG.MAX_PAGE_LIMIT
|
|
14179
|
+
const missingParamsError = checkRequiredParams({ address, utility, chain });
|
|
14180
|
+
|
|
14181
|
+
if (missingParamsError) {
|
|
14182
|
+
return missingParamsError
|
|
13956
14183
|
}
|
|
13957
14184
|
|
|
13958
|
-
|
|
13959
|
-
|
|
14185
|
+
if (offset > MAX_PAGE_LIMIT) {
|
|
14186
|
+
return errorMessageHandler(ERROR_MESSAGES_FLAG.MAX_PAGE_LIMIT)
|
|
14187
|
+
}
|
|
14188
|
+
|
|
14189
|
+
const apiKey = window.localStorage.getItem(SERVICES_API_KEY.Safe);
|
|
13960
14190
|
|
|
13961
|
-
if (!apiKey) return
|
|
13962
|
-
if (!chainIdentifier) return 'CHAIN IS NOT SUPPORTED';
|
|
14191
|
+
if (!apiKey) return errorMessageHandler(ERROR_MESSAGES_FLAG.MISSING_KEY, SERVICES_API_KEY.Safe)
|
|
13963
14192
|
|
|
13964
|
-
if(
|
|
13965
|
-
|
|
14193
|
+
if (typeof limit !== 'number' || limit < 0) return errorMessageHandler(ERROR_MESSAGES_FLAG.INVALID_PARAM, { limit })
|
|
14194
|
+
if (typeof offset !== 'number' || offset < 0)
|
|
14195
|
+
return errorMessageHandler(ERROR_MESSAGES_FLAG.INVALID_PARAM, { offset })
|
|
14196
|
+
if (utility !== 'txns') return errorMessageHandler(ERROR_MESSAGES_FLAG.INVALID_PARAM, { utility })
|
|
14197
|
+
if (limit > MAX_PAGE_LIMIT) {
|
|
14198
|
+
return errorMessageHandler(ERROR_MESSAGES_FLAG.MAX_PAGE_LIMIT)
|
|
13966
14199
|
}
|
|
13967
14200
|
|
|
13968
|
-
|
|
13969
|
-
|
|
14201
|
+
const chainIdentifier = SAFE_CHAIN_MAP[chain];
|
|
14202
|
+
|
|
14203
|
+
if (!chainIdentifier) return errorMessageHandler(ERROR_MESSAGES_FLAG.INVALID_CHAIN, chain)
|
|
14204
|
+
|
|
14205
|
+
if (!isAddress$1.isAddress(address)) {
|
|
14206
|
+
const ensName = address;
|
|
14207
|
+
address = await fromEnsNameToAddress$1.fromEnsNameToAddress(address);
|
|
14208
|
+
if (!address) {
|
|
14209
|
+
return errorMessageHandler(ERROR_MESSAGES_FLAG.ENS, ensName)
|
|
14210
|
+
}
|
|
13970
14211
|
}
|
|
13971
14212
|
|
|
13972
14213
|
const url = `https://api.safe.global/tx-service/${chainIdentifier}/api/v2/safes/${address}/multisig-transactions?limit=${limit}&offset=${offset}`;
|
|
13973
14214
|
try {
|
|
13974
|
-
const response = await fetch(url,
|
|
13975
|
-
{
|
|
13976
|
-
|
|
13977
|
-
'Authorization': `Bearer ${apiKey}`,
|
|
13978
|
-
},
|
|
14215
|
+
const response = await fetch(url, {
|
|
14216
|
+
headers: {
|
|
14217
|
+
Authorization: `Bearer ${apiKey}`
|
|
13979
14218
|
}
|
|
13980
|
-
);
|
|
13981
|
-
if (!response.ok)
|
|
14219
|
+
});
|
|
14220
|
+
if (!response.ok) {
|
|
14221
|
+
return errorMessageHandler(ERROR_MESSAGES_FLAG.NETWORK_ERROR, response.status)
|
|
14222
|
+
}
|
|
13982
14223
|
const json = await response.json();
|
|
13983
14224
|
if (!Array.isArray(json.results)) {
|
|
13984
|
-
return
|
|
14225
|
+
return errorMessageHandler(ERROR_MESSAGES_FLAG.CUSTOM, { message: 'Invalid API response' })
|
|
13985
14226
|
}
|
|
13986
14227
|
// remove nested structure from the response
|
|
13987
|
-
return json.results.map(({ confirmations, dataDecoded, ...rest }) => rest)
|
|
14228
|
+
return json.results.map(({ confirmations, dataDecoded, ...rest }) => rest)
|
|
13988
14229
|
} catch (e) {
|
|
13989
|
-
|
|
13990
|
-
return "ERROR IN FETCHING";
|
|
14230
|
+
return errorMessageHandler(ERROR_MESSAGES_FLAG.DEFAULT, e)
|
|
13991
14231
|
}
|
|
13992
14232
|
}
|
|
13993
14233
|
|
|
13994
14234
|
async function DEFILLAMA() {
|
|
13995
14235
|
let [category] = argsToArray(arguments);
|
|
13996
|
-
const
|
|
13997
|
-
|
|
14236
|
+
const missingParamsError = checkRequiredParams({ category });
|
|
14237
|
+
|
|
14238
|
+
if (missingParamsError) {
|
|
14239
|
+
return missingParamsError
|
|
14240
|
+
}
|
|
14241
|
+
const apiKey = window.localStorage.getItem(SERVICES_API_KEY.Defillama);
|
|
14242
|
+
if (!apiKey) return errorMessageHandler(ERROR_MESSAGES_FLAG.MISSING_KEY, SERVICES_API_KEY.Defillama)
|
|
13998
14243
|
const categoryList = ['protocols', 'yields', 'dex', 'fees'];
|
|
13999
14244
|
const categoryMap = {
|
|
14000
14245
|
[categoryList[0]]: 'https://api.llama.fi/protocols',
|
|
14001
14246
|
[categoryList[1]]: 'https://yields.llama.fi/pools',
|
|
14002
|
-
[categoryList[2]]:
|
|
14003
|
-
|
|
14247
|
+
[categoryList[2]]:
|
|
14248
|
+
'https://api.llama.fi/overview/dexs?excludeTotalDataChart=true&excludeTotalDataChartBreakdown=true',
|
|
14249
|
+
[categoryList[3]]:
|
|
14250
|
+
'https://api.llama.fi/overview/fees?excludeTotalDataChart=true&excludeTotalDataChartBreakdown=true&dataType=dailyFees'
|
|
14004
14251
|
};
|
|
14005
14252
|
let url = categoryMap[category];
|
|
14006
14253
|
|
|
14254
|
+
if (!url) {
|
|
14255
|
+
return errorMessageHandler(ERROR_MESSAGES_FLAG.INVALID_PARAM, { category })
|
|
14256
|
+
}
|
|
14257
|
+
|
|
14007
14258
|
try {
|
|
14008
14259
|
const response = await fetch(url);
|
|
14009
|
-
if (!response.ok)
|
|
14260
|
+
if (!response.ok) return errorMessageHandler(ERROR_MESSAGES_FLAG.NETWORK_ERROR, response.status)
|
|
14010
14261
|
let json = await response.json();
|
|
14011
|
-
switch(category){
|
|
14262
|
+
switch (category) {
|
|
14012
14263
|
case categoryList[0]: {
|
|
14013
|
-
if(json.length > 500){
|
|
14264
|
+
if (json.length > 500) {
|
|
14014
14265
|
json = json.slice(0, 500);
|
|
14015
14266
|
}
|
|
14016
|
-
break
|
|
14267
|
+
break
|
|
14017
14268
|
}
|
|
14018
14269
|
case categoryList[1]: {
|
|
14019
14270
|
json = json.data.slice(0, 500);
|
|
14020
|
-
break
|
|
14271
|
+
break
|
|
14021
14272
|
}
|
|
14022
14273
|
case categoryList[2]: {
|
|
14023
14274
|
json = json.protocols.slice(0, 500);
|
|
14024
|
-
break
|
|
14275
|
+
break
|
|
14025
14276
|
}
|
|
14026
14277
|
case categoryList[3]: {
|
|
14027
14278
|
json = json.protocols.slice(0, 500);
|
|
14028
|
-
break
|
|
14279
|
+
break
|
|
14029
14280
|
}
|
|
14030
14281
|
}
|
|
14031
14282
|
|
|
14032
|
-
return removeNestedStructure(Array.isArray(json) ? json : [json])
|
|
14283
|
+
return removeNestedStructure(Array.isArray(json) ? json : [json])
|
|
14033
14284
|
} catch (e) {
|
|
14034
|
-
|
|
14035
|
-
return "ERROR IN FETCHING";
|
|
14285
|
+
return errorMessageHandler(ERROR_MESSAGES_FLAG.DEFAULT, e)
|
|
14036
14286
|
}
|
|
14037
14287
|
}
|
|
14038
14288
|
|
|
14039
14289
|
async function UNISWAP() {
|
|
14040
14290
|
const [graphType, category, param1, param2] = argsToArray(arguments);
|
|
14041
|
-
const
|
|
14291
|
+
const missingParamsError = checkRequiredParams({ graphType, category, param1 });
|
|
14292
|
+
|
|
14293
|
+
if (missingParamsError) {
|
|
14294
|
+
return missingParamsError
|
|
14295
|
+
}
|
|
14296
|
+
const baseUrl = 'https://onchain-proxy.fileverse.io/third-party';
|
|
14042
14297
|
try {
|
|
14043
14298
|
const url = `${baseUrl}?service=uniswap&graphType=${graphType}&category=${category}&input1=${param1}&input2=${param2}`;
|
|
14044
14299
|
const res = await fetch(url);
|
|
14045
|
-
if (!res.ok)
|
|
14300
|
+
if (!res.ok) {
|
|
14301
|
+
return errorMessageHandler(ERROR_MESSAGES_FLAG.NETWORK_ERROR, res.status)
|
|
14302
|
+
}
|
|
14046
14303
|
const json = await res.json();
|
|
14047
|
-
|
|
14304
|
+
if(Array.isArray(json)){
|
|
14305
|
+
return removeNestedStructure(json)
|
|
14306
|
+
} else {
|
|
14307
|
+
return json
|
|
14308
|
+
}
|
|
14309
|
+
|
|
14048
14310
|
} catch (err) {
|
|
14049
|
-
|
|
14050
|
-
return ERROR_MESSAGES_FLAG.DEFAULT;
|
|
14311
|
+
return errorMessageHandler(ERROR_MESSAGES_FLAG.DEFAULT, err)
|
|
14051
14312
|
}
|
|
14052
14313
|
}
|
|
14053
14314
|
|
|
14054
14315
|
async function AAVE() {
|
|
14055
14316
|
const [graphType, category, param1, param2] = argsToArray(arguments);
|
|
14056
|
-
const
|
|
14317
|
+
const missingParamsError = checkRequiredParams({ graphType, category, param1 });
|
|
14318
|
+
|
|
14319
|
+
if (missingParamsError) {
|
|
14320
|
+
return missingParamsError
|
|
14321
|
+
}
|
|
14322
|
+
const baseUrl = 'https://onchain-proxy.fileverse.io/third-party';
|
|
14057
14323
|
try {
|
|
14058
14324
|
const url = `${baseUrl}?service=aave&graphType=${graphType}&category=${category}&input1=${param1}&input2=${param2}`;
|
|
14059
14325
|
const res = await fetch(url);
|
|
14060
|
-
if (!res.ok)
|
|
14326
|
+
if (!res.ok) {
|
|
14327
|
+
return errorMessageHandler(ERROR_MESSAGES_FLAG.NETWORK_ERROR, res.status)
|
|
14328
|
+
}
|
|
14061
14329
|
const json = await res.json();
|
|
14062
|
-
|
|
14330
|
+
if(Array.isArray(json)){
|
|
14331
|
+
return removeNestedStructure(json)
|
|
14332
|
+
} else {
|
|
14333
|
+
return json
|
|
14334
|
+
}
|
|
14335
|
+
|
|
14063
14336
|
} catch (err) {
|
|
14064
|
-
|
|
14065
|
-
return ERROR_MESSAGES_FLAG.DEFAULT;
|
|
14337
|
+
return errorMessageHandler(ERROR_MESSAGES_FLAG.DEFAULT, err)
|
|
14066
14338
|
}
|
|
14067
14339
|
}
|
|
14068
14340
|
|
|
14069
|
-
|
|
14070
14341
|
function POLYMARKET() {
|
|
14071
|
-
return
|
|
14072
|
-
|
|
14073
|
-
|
|
14074
|
-
|
|
14075
|
-
|
|
14076
|
-
|
|
14077
|
-
|
|
14078
|
-
|
|
14079
|
-
|
|
14080
|
-
|
|
14081
|
-
|
|
14082
|
-
|
|
14083
|
-
|
|
14084
|
-
|
|
14085
|
-
|
|
14086
|
-
|
|
14087
|
-
|
|
14088
|
-
|
|
14089
|
-
|
|
14090
|
-
|
|
14091
|
-
return
|
|
14092
|
-
|
|
14093
|
-
|
|
14094
|
-
|
|
14095
|
-
|
|
14096
|
-
|
|
14097
|
-
}
|
|
14098
|
-
|
|
14099
|
-
function MYANIMELIST() {
|
|
14100
|
-
return "Coming Soon"
|
|
14101
|
-
}
|
|
14342
|
+
return 'Coming Soon'
|
|
14343
|
+
}
|
|
14344
|
+
|
|
14345
|
+
function PRIVACYPOOL() {
|
|
14346
|
+
return 'Coming Soon'
|
|
14347
|
+
}
|
|
14348
|
+
|
|
14349
|
+
function ROTKI() {
|
|
14350
|
+
return 'Coming Soon'
|
|
14351
|
+
}
|
|
14352
|
+
|
|
14353
|
+
function MEERKAT() {
|
|
14354
|
+
return 'Coming Soon'
|
|
14355
|
+
}
|
|
14356
|
+
|
|
14357
|
+
function ARTEMIS() {
|
|
14358
|
+
return 'Coming Soon'
|
|
14359
|
+
}
|
|
14360
|
+
|
|
14361
|
+
function TALLY() {
|
|
14362
|
+
return 'Coming Soon'
|
|
14363
|
+
}
|
|
14364
|
+
|
|
14365
|
+
function MYANIMELIST() {
|
|
14366
|
+
return 'Coming Soon'
|
|
14367
|
+
}
|
|
14102
14368
|
|
|
14103
14369
|
const utils = { errors, symbols, date };
|
|
14104
14370
|
|
|
14105
|
-
export { AAVE, ABS, ACCRINT, ACOS, ACOSH, ACOT, ACOTH, AGGREGATE, AND, ARABIC, ARTEMIS, ASIN, ASINH, ATAN, ATAN2, ATANH, AVEDEV, AVERAGE, AVERAGEA, AVERAGEIF, AVERAGEIFS, BASE, BESSELI, BESSELJ, BESSELK, BESSELY, BETA, BETADIST, BETAINV, BIN2DEC, BIN2HEX, BIN2OCT, BINOM, BINOMDIST, BITAND, BITLSHIFT, BITOR, BITRSHIFT, BITXOR, BLOCKSCOUT, CEILING, CEILINGMATH, CEILINGPRECISE, CHAR, CHIDIST, CHIDISTRT, CHIINV, CHIINVRT, CHISQ, CHITEST, CHOOSE, CLEAN, CODE, COINGECKO, COLUMN, COLUMNS, COMBIN, COMBINA, COMPLEX, CONCAT, CONCATENATE, CONFIDENCE, CONVERT, CORREL, COS, COSH, COT, COTH, COUNT, COUNTA, COUNTBLANK, COUNTIF, COUNTIFS, COUPDAYS, COVAR, COVARIANCE, COVARIANCEP, COVARIANCES, CRITBINOM, CSC, CSCH, CUMIPMT, CUMPRINC, DATE, DATEDIF, DATEVALUE, DAVERAGE, DAY, DAYS, DAYS360, DB, DCOUNT, DCOUNTA, DDB, DEC2BIN, DEC2HEX, DEC2OCT, DECIMAL, DEFILLAMA, DEGREES, DELTA, DEVSQ, DGET, DISC, DMAX, DMIN, DOLLAR, DOLLARDE, DOLLARFR, DPRODUCT, DSTDEV, DSTDEVP, DSUM, DVAR, DVARP, EDATE, EFFECT, EOA, EOMONTH, ERF, ERFC, ERFCPRECISE, ERFPRECISE, ERROR, ETHERSCAN, EVEN, EXACT, EXP, EXPON, EXPONDIST, F, FACT, FACTDOUBLE, FALSE, FARCASTER, FDIST, FDISTRT, FIND, FINV, FINVRT, FIREFLY, FISHER, FISHERINV, FIXED, FLOOR, FLOORMATH, FLOORPRECISE, FLVURL, FORECAST, FREQUENCY, FTEST, FV, FVSCHEDULE, GAMMA, GAMMADIST, GAMMAINV, GAMMALN, GAMMALNPRECISE, GAUSS, GCD, GEOMEAN, GESTEP, GNOSIS,
|
|
14371
|
+
export { AAVE, ABS, ACCRINT, ACOS, ACOSH, ACOT, ACOTH, AGGREGATE, AND, ARABIC, ARTEMIS, ASIN, ASINH, ATAN, ATAN2, ATANH, AVEDEV, AVERAGE, AVERAGEA, AVERAGEIF, AVERAGEIFS, BASE, BESSELI, BESSELJ, BESSELK, BESSELY, BETA, BETADIST, BETAINV, BIN2DEC, BIN2HEX, BIN2OCT, BINOM, BINOMDIST, BITAND, BITLSHIFT, BITOR, BITRSHIFT, BITXOR, BLOCKSCOUT, CEILING, CEILINGMATH, CEILINGPRECISE, CHAR, CHIDIST, CHIDISTRT, CHIINV, CHIINVRT, CHISQ, CHITEST, CHOOSE, CLEAN, CODE, COINGECKO, COLUMN, COLUMNS, COMBIN, COMBINA, COMPLEX, CONCAT, CONCATENATE, CONFIDENCE, CONVERT, CORREL, COS, COSH, COT, COTH, COUNT, COUNTA, COUNTBLANK, COUNTIF, COUNTIFS, COUPDAYS, COVAR, COVARIANCE, COVARIANCEP, COVARIANCES, CRITBINOM, CSC, CSCH, CUMIPMT, CUMPRINC, DATE, DATEDIF, DATEVALUE, DAVERAGE, DAY, DAYS, DAYS360, DB, DCOUNT, DCOUNTA, DDB, DEC2BIN, DEC2HEX, DEC2OCT, DECIMAL, DEFILLAMA, DEGREES, DELTA, DEVSQ, DGET, DISC, DMAX, DMIN, DOLLAR, DOLLARDE, DOLLARFR, DPRODUCT, DSTDEV, DSTDEVP, DSUM, DVAR, DVARP, EDATE, EFFECT, EOA, EOMONTH, ERF, ERFC, ERFCPRECISE, ERFPRECISE, ERROR, ETHERSCAN, EVEN, EXACT, EXP, EXPON, EXPONDIST, F, FACT, FACTDOUBLE, FALSE, FARCASTER, FDIST, FDISTRT, FIND, FINV, FINVRT, FIREFLY, FISHER, FISHERINV, FIXED, FLOOR, FLOORMATH, FLOORPRECISE, FLVURL, FORECAST, FREQUENCY, FTEST, FV, FVSCHEDULE, GAMMA, GAMMADIST, GAMMAINV, GAMMALN, GAMMALNPRECISE, GAUSS, GCD, GEOMEAN, GESTEP, GNOSIS, GROWTH, HARMEAN, HEX2BIN, HEX2DEC, HEX2OCT, HLOOKUP, HOUR, HYPGEOM, HYPGEOMDIST, IF, IFERROR, IFNA, IFS, IMABS, IMAGINARY, IMARGUMENT, IMCONJUGATE, IMCOS, IMCOSH, IMCOT, IMCSC, IMCSCH, IMDIV, IMEXP, IMLN, IMLOG10, IMLOG2, IMPOWER, IMPRODUCT, IMREAL, IMSEC, IMSECH, IMSIN, IMSINH, IMSQRT, IMSUB, IMSUM, IMTAN, INDEX, INT, INTERCEPT, IPMT, IRR, ISBLANK, ISDATE, ISERR, ISERROR, ISEVEN, ISLOGICAL, ISNA, ISNONTEXT, ISNUMBER, ISO, ISODD, ISOWEEKNUM, ISPMT, ISTEXT, KURT, LARGE, LCM, LEFT, LEN, LENS, LINEST, LN, LOG, LOG10, LOGEST, LOGINV, LOGNORM, LOGNORMDIST, LOGNORMINV, LOOKUP, LOWER, MATCH, MAX, MAXA, MAXIFS, MEDIAN, MEERKAT, MID, MIN, MINA, MINIFS, MINUTE, MIRR, MMULT, MOD, MODE, MODEMULT, MODESNGL, MONTH, MROUND, MULTINOMIAL, MUNIT, MYANIMELIST, N, NA, NEGBINOM, NEGBINOMDIST, NETWORKDAYS, NETWORKDAYSINTL, NETWORKDAYS_INTL, NEYNAR, NOMINAL, NORM, NORMDIST, NORMINV, NORMSDIST, NORMSINV, NOT, NOW, NPER, NPV, NUMBERVALUE, OCT2BIN, OCT2DEC, OCT2HEX, ODD, OR, PDURATION, PEARSON, PERCENTILE, PERCENTILEEXC, PERCENTILEINC, PERCENTRANK, PERCENTRANKEXC, PERCENTRANKINC, PERMUT, PERMUTATIONA, PHI, PI, PMT, PNL, POISSON, POISSONDIST, POLYMARKET, POWER, PPMT, PRICEDISC, PRIVACYPOOL, PROB, PRODUCT, PROPER, PV, QUARTILE, QUARTILEEXC, QUARTILEINC, QUOTIENT, RADIANS, RAND, RANDBETWEEN, RANK, RANKAVG, RANKEQ, RATE, REPLACE, REPT, RIGHT, ROMAN, ROTKI, ROUND, ROUNDDOWN, ROUNDUP, ROW, ROWS, RRI, RSQ, SAFE, SEARCH, SEC, SECH, SECOND, SERIESSUM, SIGN, SIN, SINH, SKEW, SKEWP, SLN, SLOPE, SMALL, SORT, SQRT, SQRTPI, STANDARDIZE, STDEV, STDEVA, STDEVP, STDEVPA, STDEVS, STEYX, SUBSTITUTE, SUBTOTAL, SUM, SUMIF, SUMIFS, SUMPRODUCT, SUMSQ, SUMX2MY2, SUMX2PY2, SUMXMY2, SWITCH, SYD, T, TALLY, TAN, TANH, TBILLEQ, TBILLPRICE, TBILLYIELD, TDIST, TDISTRT, TEXT, TEXTJOIN, TIME, TIMEVALUE, TINV, TODAY, TRANSPOSE, TREND, TRIM, TRIMMEAN, TRUE, TRUNC, TTEST, TYPE, UNICHAR, UNICODE, UNIQUE, UNISWAP, UPPER, VALUE, VAR, VARA, VARP, VARPA, VARS, VLOOKUP, WEEKDAY, WEEKNUM, WEIBULL, WEIBULLDIST, WORKDAY, WORKDAYINTL, WORKDAY_INTL, XIRR, XNPV, XOR, YEAR, YEARFRAC, Z, ZTEST, utils };
|