@fileverse-dev/formulajs 4.4.11-mod-68-patch-9 → 4.4.11-mod-72
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 +94 -109
- package/lib/browser/formula.min.js +2 -2
- package/lib/browser/formula.min.js.map +1 -1
- package/lib/cjs/index.cjs +0 -15
- package/lib/esm/index.mjs +0 -15
- package/package.json +1 -1
package/lib/cjs/index.cjs
CHANGED
|
@@ -13216,7 +13216,6 @@ function removeUrlParams(url, paramsToRemove) {
|
|
|
13216
13216
|
* @returns {Object} Object containing URL and HEADERS for the fetch request
|
|
13217
13217
|
*/
|
|
13218
13218
|
function getUrlAndHeaders({ url, serviceName, headers = {} }) {
|
|
13219
|
-
console.log('getUrlAndHeaders new modified function from formulajs', url, serviceName);
|
|
13220
13219
|
// Check if proxy is enabled in localStorage
|
|
13221
13220
|
const apiKeyLS = window.localStorage.getItem(SERVICES_API_KEY[serviceName]);
|
|
13222
13221
|
const isProxyModeEnabledValue = apiKeyLS === 'DEFAULT_PROXY_MODE';
|
|
@@ -13245,25 +13244,19 @@ function getUrlAndHeaders({ url, serviceName, headers = {} }) {
|
|
|
13245
13244
|
URL: url,
|
|
13246
13245
|
HEADERS: {
|
|
13247
13246
|
...headers,
|
|
13248
|
-
method: 'GET',
|
|
13249
13247
|
}
|
|
13250
13248
|
};
|
|
13251
13249
|
}
|
|
13252
13250
|
|
|
13253
13251
|
const fromTimeStampToBlock = async (timestamp, chain, apiKey) => {
|
|
13254
|
-
console.log('fromTimeStampToBlock', timestamp, chain, apiKey);
|
|
13255
13252
|
if (!timestamp || !chain || !apiKey) return
|
|
13256
13253
|
const chainId = CHAIN_ID_MAP[chain];
|
|
13257
|
-
console.log('chainId', chainId);
|
|
13258
13254
|
const url = `https://api.etherscan.io/v2/api?module=block&action=getblocknobytime×tamp=${timestamp}&closest=before&apikey=${apiKey}&chainId=${chainId}`;
|
|
13259
|
-
console.log('url', url, getUrlAndHeaders);
|
|
13260
13255
|
const { URL: finalUrl, HEADERS } = getUrlAndHeaders({ url, serviceName: 'Etherscan', headers: {} });
|
|
13261
|
-
console.log('finalUrl', finalUrl, HEADERS);
|
|
13262
13256
|
const res = await fetch(finalUrl, {
|
|
13263
13257
|
method: 'GET',
|
|
13264
13258
|
headers: HEADERS,
|
|
13265
13259
|
});
|
|
13266
|
-
console.log('res', res, finalUrl, HEADERS);
|
|
13267
13260
|
const json = await res.json();
|
|
13268
13261
|
return parseInt(json.result);
|
|
13269
13262
|
|
|
@@ -18257,7 +18250,6 @@ async function EOA() {
|
|
|
18257
18250
|
validateParams(eoaParamsSchema, { addresses, category, chains, startTime, endTime, page, offset });
|
|
18258
18251
|
|
|
18259
18252
|
const apiKey = window.localStorage.getItem(SERVICES_API_KEY.Etherscan);
|
|
18260
|
-
console.log('apiKey', apiKey);
|
|
18261
18253
|
if (!apiKey) throw new MissingApiKeyError(SERVICES_API_KEY.Etherscan)
|
|
18262
18254
|
|
|
18263
18255
|
const INPUTS = addresses.split(',').map(s => s.trim()).filter(Boolean);
|
|
@@ -18280,7 +18272,6 @@ async function EOA() {
|
|
|
18280
18272
|
|
|
18281
18273
|
async function fetchJSON(url) {
|
|
18282
18274
|
const { URL: finalUrl, HEADERS } = getUrlAndHeaders({ url, serviceName: 'Etherscan', headers: {} });
|
|
18283
|
-
console.log('finalUrl', finalUrl, HEADERS);
|
|
18284
18275
|
const res = await fetch(finalUrl, {
|
|
18285
18276
|
method: 'GET',
|
|
18286
18277
|
headers: HEADERS,
|
|
@@ -18297,14 +18288,10 @@ async function EOA() {
|
|
|
18297
18288
|
|
|
18298
18289
|
|
|
18299
18290
|
for (const chain of CHAINS) {
|
|
18300
|
-
console.log('chain', chain);
|
|
18301
18291
|
const chainId = CHAIN_ID_MAP[chain];
|
|
18302
18292
|
if (!chainId) throw new ValidationError(`Invalid chain: ${chain}`)
|
|
18303
|
-
console.log('chain', chain);
|
|
18304
|
-
|
|
18305
18293
|
|
|
18306
18294
|
if (category === 'balance') {
|
|
18307
|
-
console.log('balance');
|
|
18308
18295
|
// chunk 20
|
|
18309
18296
|
for (let i = 0; i < ADDRS.length; i += 20) {
|
|
18310
18297
|
const slice = ADDRS.slice(i, i + 20).join(',');
|
|
@@ -18318,10 +18305,8 @@ async function EOA() {
|
|
|
18318
18305
|
}
|
|
18319
18306
|
} else {
|
|
18320
18307
|
// txns
|
|
18321
|
-
console.log('startTime', startTime, 'endTime', endTime, chain, apiKey);
|
|
18322
18308
|
const sb = await fromTimestampToBlock.fromTimeStampToBlock(toTimestamp(startTime), chain, apiKey);
|
|
18323
18309
|
const eb = await fromTimestampToBlock.fromTimeStampToBlock(toTimestamp(endTime), chain, apiKey);
|
|
18324
|
-
console.log('sb', sb, 'eb', eb);
|
|
18325
18310
|
if (!sb) throw new ValidationError(`Invalid startTime: ${startTime}`)
|
|
18326
18311
|
if (!eb) throw new ValidationError(`Invalid endTime: ${endTime}`)
|
|
18327
18312
|
for (const addr of ADDRS) {
|
package/lib/esm/index.mjs
CHANGED
|
@@ -13214,7 +13214,6 @@ function removeUrlParams(url, paramsToRemove) {
|
|
|
13214
13214
|
* @returns {Object} Object containing URL and HEADERS for the fetch request
|
|
13215
13215
|
*/
|
|
13216
13216
|
function getUrlAndHeaders({ url, serviceName, headers = {} }) {
|
|
13217
|
-
console.log('getUrlAndHeaders new modified function from formulajs', url, serviceName);
|
|
13218
13217
|
// Check if proxy is enabled in localStorage
|
|
13219
13218
|
const apiKeyLS = window.localStorage.getItem(SERVICES_API_KEY[serviceName]);
|
|
13220
13219
|
const isProxyModeEnabledValue = apiKeyLS === 'DEFAULT_PROXY_MODE';
|
|
@@ -13243,25 +13242,19 @@ function getUrlAndHeaders({ url, serviceName, headers = {} }) {
|
|
|
13243
13242
|
URL: url,
|
|
13244
13243
|
HEADERS: {
|
|
13245
13244
|
...headers,
|
|
13246
|
-
method: 'GET',
|
|
13247
13245
|
}
|
|
13248
13246
|
};
|
|
13249
13247
|
}
|
|
13250
13248
|
|
|
13251
13249
|
const fromTimeStampToBlock = async (timestamp, chain, apiKey) => {
|
|
13252
|
-
console.log('fromTimeStampToBlock', timestamp, chain, apiKey);
|
|
13253
13250
|
if (!timestamp || !chain || !apiKey) return
|
|
13254
13251
|
const chainId = CHAIN_ID_MAP[chain];
|
|
13255
|
-
console.log('chainId', chainId);
|
|
13256
13252
|
const url = `https://api.etherscan.io/v2/api?module=block&action=getblocknobytime×tamp=${timestamp}&closest=before&apikey=${apiKey}&chainId=${chainId}`;
|
|
13257
|
-
console.log('url', url, getUrlAndHeaders);
|
|
13258
13253
|
const { URL: finalUrl, HEADERS } = getUrlAndHeaders({ url, serviceName: 'Etherscan', headers: {} });
|
|
13259
|
-
console.log('finalUrl', finalUrl, HEADERS);
|
|
13260
13254
|
const res = await fetch(finalUrl, {
|
|
13261
13255
|
method: 'GET',
|
|
13262
13256
|
headers: HEADERS,
|
|
13263
13257
|
});
|
|
13264
|
-
console.log('res', res, finalUrl, HEADERS);
|
|
13265
13258
|
const json = await res.json();
|
|
13266
13259
|
return parseInt(json.result);
|
|
13267
13260
|
|
|
@@ -18255,7 +18248,6 @@ async function EOA() {
|
|
|
18255
18248
|
validateParams(eoaParamsSchema, { addresses, category, chains, startTime, endTime, page, offset });
|
|
18256
18249
|
|
|
18257
18250
|
const apiKey = window.localStorage.getItem(SERVICES_API_KEY.Etherscan);
|
|
18258
|
-
console.log('apiKey', apiKey);
|
|
18259
18251
|
if (!apiKey) throw new MissingApiKeyError(SERVICES_API_KEY.Etherscan)
|
|
18260
18252
|
|
|
18261
18253
|
const INPUTS = addresses.split(',').map(s => s.trim()).filter(Boolean);
|
|
@@ -18278,7 +18270,6 @@ async function EOA() {
|
|
|
18278
18270
|
|
|
18279
18271
|
async function fetchJSON(url) {
|
|
18280
18272
|
const { URL: finalUrl, HEADERS } = getUrlAndHeaders({ url, serviceName: 'Etherscan', headers: {} });
|
|
18281
|
-
console.log('finalUrl', finalUrl, HEADERS);
|
|
18282
18273
|
const res = await fetch(finalUrl, {
|
|
18283
18274
|
method: 'GET',
|
|
18284
18275
|
headers: HEADERS,
|
|
@@ -18295,14 +18286,10 @@ async function EOA() {
|
|
|
18295
18286
|
|
|
18296
18287
|
|
|
18297
18288
|
for (const chain of CHAINS) {
|
|
18298
|
-
console.log('chain', chain);
|
|
18299
18289
|
const chainId = CHAIN_ID_MAP[chain];
|
|
18300
18290
|
if (!chainId) throw new ValidationError(`Invalid chain: ${chain}`)
|
|
18301
|
-
console.log('chain', chain);
|
|
18302
|
-
|
|
18303
18291
|
|
|
18304
18292
|
if (category === 'balance') {
|
|
18305
|
-
console.log('balance');
|
|
18306
18293
|
// chunk 20
|
|
18307
18294
|
for (let i = 0; i < ADDRS.length; i += 20) {
|
|
18308
18295
|
const slice = ADDRS.slice(i, i + 20).join(',');
|
|
@@ -18316,10 +18303,8 @@ async function EOA() {
|
|
|
18316
18303
|
}
|
|
18317
18304
|
} else {
|
|
18318
18305
|
// txns
|
|
18319
|
-
console.log('startTime', startTime, 'endTime', endTime, chain, apiKey);
|
|
18320
18306
|
const sb = await fromTimestampToBlock.fromTimeStampToBlock(toTimestamp(startTime), chain, apiKey);
|
|
18321
18307
|
const eb = await fromTimestampToBlock.fromTimeStampToBlock(toTimestamp(endTime), chain, apiKey);
|
|
18322
|
-
console.log('sb', sb, 'eb', eb);
|
|
18323
18308
|
if (!sb) throw new ValidationError(`Invalid startTime: ${startTime}`)
|
|
18324
18309
|
if (!eb) throw new ValidationError(`Invalid endTime: ${endTime}`)
|
|
18325
18310
|
for (const addr of ADDRS) {
|
package/package.json
CHANGED