@fileverse-dev/formulajs 4.4.11-mod-21-patch-2 → 4.4.11-mod-21-patch-4
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 +65 -10
- package/lib/browser/formula.min.js +2 -2
- package/lib/browser/formula.min.js.map +1 -1
- package/lib/cjs/index.cjs +38 -30
- package/lib/esm/crypto-constants.mjs +20 -0
- package/lib/esm/index.mjs +38 -30
- package/package.json +1 -1
- package/types/cjs/index.d.cts +1 -1
- package/types/esm/index.d.mts +1 -1
package/lib/cjs/index.cjs
CHANGED
|
@@ -13077,12 +13077,6 @@ function SWITCH() {
|
|
|
13077
13077
|
return result
|
|
13078
13078
|
}
|
|
13079
13079
|
|
|
13080
|
-
const SERVICE_API_KEY = {
|
|
13081
|
-
Etherscan: "ETHERSCAN_API_KEY",
|
|
13082
|
-
Coingecko: "COINGECKO_API_KEY",
|
|
13083
|
-
Safe: "SAFE_API_KEY",
|
|
13084
|
-
};
|
|
13085
|
-
|
|
13086
13080
|
const CHAIN_ID_MAP = {
|
|
13087
13081
|
ethereum: 1,
|
|
13088
13082
|
gnosis: 100,
|
|
@@ -13095,9 +13089,16 @@ const SAFE_CHAIN_MAP = {
|
|
|
13095
13089
|
};
|
|
13096
13090
|
|
|
13097
13091
|
const ERROR_MESSAGES_FLAG = {
|
|
13098
|
-
INVALID_API_KEY: '
|
|
13092
|
+
INVALID_API_KEY: '_INVALID_KEY',
|
|
13099
13093
|
RATE_LIMIT: '_RATE_LIMIT_REACHED',
|
|
13100
|
-
DEFAULT: 'FETCH_ERROR'
|
|
13094
|
+
DEFAULT: 'FETCH_ERROR',
|
|
13095
|
+
MISSING_KEY: '_MISSING'
|
|
13096
|
+
};
|
|
13097
|
+
|
|
13098
|
+
const SERVICE_API_KEY = {
|
|
13099
|
+
Etherscan: "ETHERSCAN_API_KEY",
|
|
13100
|
+
Coingecko: "COINGECKO_API_KEY",
|
|
13101
|
+
Safe: "SAFE_API_KEY",
|
|
13101
13102
|
};
|
|
13102
13103
|
|
|
13103
13104
|
const fromTimeStampToBlock = async (timestamp, chain, apiKey) => {
|
|
@@ -13111,29 +13112,36 @@ if(!timestamp || !chain || !apiKey) return
|
|
|
13111
13112
|
};
|
|
13112
13113
|
|
|
13113
13114
|
async function ETHERSCAN(address, page, offset) {
|
|
13115
|
+
|
|
13116
|
+
|
|
13117
|
+
const API_KEY = window.localStorage.getItem(SERVICE_API_KEY.Etherscan);
|
|
13118
|
+
if(!API_KEY){
|
|
13119
|
+
return `${SERVICE_API_KEY.Etherscan}${ERROR_MESSAGES_FLAG.MISSING_KEY}`
|
|
13120
|
+
}
|
|
13121
|
+
if(API_KEY === 'xxxx'){
|
|
13114
13122
|
return `${SERVICE_API_KEY.Etherscan}${ERROR_MESSAGES_FLAG.RATE_LIMIT}`
|
|
13115
|
-
|
|
13116
|
-
|
|
13117
|
-
|
|
13118
|
-
|
|
13119
|
-
|
|
13120
|
-
|
|
13121
|
-
|
|
13122
|
-
|
|
13123
|
-
|
|
13124
|
-
|
|
13125
|
-
|
|
13126
|
-
|
|
13127
|
-
|
|
13128
|
-
|
|
13129
|
-
|
|
13130
|
-
|
|
13131
|
-
|
|
13132
|
-
|
|
13133
|
-
|
|
13134
|
-
|
|
13135
|
-
|
|
13136
|
-
|
|
13123
|
+
}
|
|
13124
|
+
const url = `https://api.etherscan.io/v2/api?chainid=1&module=account&action=txlist&address=${address}&startblock=0&endblock=99999999&page=${page || 1}&offset=${offset || 10}&sort=asc&apikey=${API_KEY}`;
|
|
13125
|
+
|
|
13126
|
+
try {
|
|
13127
|
+
const response = await fetch(url);
|
|
13128
|
+
if (!response.ok) {
|
|
13129
|
+
throw new Error(`HTTP error! Status: ${response.status}`)
|
|
13130
|
+
}
|
|
13131
|
+
const json = await response.json();
|
|
13132
|
+
if (json.result.includes("Invalid API Key")) {
|
|
13133
|
+
return `${SERVICE_API_KEY.Etherscan}${ERROR_MESSAGES_FLAG.INVALID_API_KEY}`
|
|
13134
|
+
}
|
|
13135
|
+
if(json.result.includes('Max rate limit reached')){
|
|
13136
|
+
return `${SERVICE_API_KEY.Etherscan}${ERROR_MESSAGES_FLAG.RATE_LIMIT}`
|
|
13137
|
+
}
|
|
13138
|
+
/*
|
|
13139
|
+
[{blockNumber: '0x1d3d1', timeStamp: '0x5f7e4f', hash: '0x3c3c3c3c', nonce: '0x1',}]
|
|
13140
|
+
*/
|
|
13141
|
+
return json.result;
|
|
13142
|
+
} catch (error) {
|
|
13143
|
+
return ERROR_MESSAGES_FLAG.DEFAULT
|
|
13144
|
+
}
|
|
13137
13145
|
}
|
|
13138
13146
|
|
|
13139
13147
|
async function COINGECKO(token, vs_currencies) {
|
|
@@ -1,3 +1,20 @@
|
|
|
1
|
+
// src/utils/constants.js
|
|
2
|
+
var CHAIN_ID_MAP = {
|
|
3
|
+
ethereum: 1,
|
|
4
|
+
gnosis: 100,
|
|
5
|
+
base: 8453
|
|
6
|
+
};
|
|
7
|
+
var SAFE_CHAIN_MAP = {
|
|
8
|
+
ethereum: "eth",
|
|
9
|
+
gnosis: "gno"
|
|
10
|
+
};
|
|
11
|
+
var ERROR_MESSAGES_FLAG = {
|
|
12
|
+
INVALID_API_KEY: "_INVALID_KEY",
|
|
13
|
+
RATE_LIMIT: "_RATE_LIMIT_REACHED",
|
|
14
|
+
DEFAULT: "FETCH_ERROR",
|
|
15
|
+
MISSING_KEY: "_MISSING"
|
|
16
|
+
};
|
|
17
|
+
|
|
1
18
|
// src/crypto-constants.js
|
|
2
19
|
var SERVICE_API_KEY = {
|
|
3
20
|
Etherscan: "ETHERSCAN_API_KEY",
|
|
@@ -190,6 +207,9 @@ var FUNCTION_LOCALE = [
|
|
|
190
207
|
}
|
|
191
208
|
];
|
|
192
209
|
export {
|
|
210
|
+
CHAIN_ID_MAP,
|
|
211
|
+
ERROR_MESSAGES_FLAG,
|
|
193
212
|
FUNCTION_LOCALE,
|
|
213
|
+
SAFE_CHAIN_MAP,
|
|
194
214
|
SERVICE_API_KEY
|
|
195
215
|
};
|
package/lib/esm/index.mjs
CHANGED
|
@@ -13075,12 +13075,6 @@ function SWITCH() {
|
|
|
13075
13075
|
return result
|
|
13076
13076
|
}
|
|
13077
13077
|
|
|
13078
|
-
const SERVICE_API_KEY = {
|
|
13079
|
-
Etherscan: "ETHERSCAN_API_KEY",
|
|
13080
|
-
Coingecko: "COINGECKO_API_KEY",
|
|
13081
|
-
Safe: "SAFE_API_KEY",
|
|
13082
|
-
};
|
|
13083
|
-
|
|
13084
13078
|
const CHAIN_ID_MAP = {
|
|
13085
13079
|
ethereum: 1,
|
|
13086
13080
|
gnosis: 100,
|
|
@@ -13093,9 +13087,16 @@ const SAFE_CHAIN_MAP = {
|
|
|
13093
13087
|
};
|
|
13094
13088
|
|
|
13095
13089
|
const ERROR_MESSAGES_FLAG = {
|
|
13096
|
-
INVALID_API_KEY: '
|
|
13090
|
+
INVALID_API_KEY: '_INVALID_KEY',
|
|
13097
13091
|
RATE_LIMIT: '_RATE_LIMIT_REACHED',
|
|
13098
|
-
DEFAULT: 'FETCH_ERROR'
|
|
13092
|
+
DEFAULT: 'FETCH_ERROR',
|
|
13093
|
+
MISSING_KEY: '_MISSING'
|
|
13094
|
+
};
|
|
13095
|
+
|
|
13096
|
+
const SERVICE_API_KEY = {
|
|
13097
|
+
Etherscan: "ETHERSCAN_API_KEY",
|
|
13098
|
+
Coingecko: "COINGECKO_API_KEY",
|
|
13099
|
+
Safe: "SAFE_API_KEY",
|
|
13099
13100
|
};
|
|
13100
13101
|
|
|
13101
13102
|
const fromTimeStampToBlock = async (timestamp, chain, apiKey) => {
|
|
@@ -13109,29 +13110,36 @@ if(!timestamp || !chain || !apiKey) return
|
|
|
13109
13110
|
};
|
|
13110
13111
|
|
|
13111
13112
|
async function ETHERSCAN(address, page, offset) {
|
|
13113
|
+
|
|
13114
|
+
|
|
13115
|
+
const API_KEY = window.localStorage.getItem(SERVICE_API_KEY.Etherscan);
|
|
13116
|
+
if(!API_KEY){
|
|
13117
|
+
return `${SERVICE_API_KEY.Etherscan}${ERROR_MESSAGES_FLAG.MISSING_KEY}`
|
|
13118
|
+
}
|
|
13119
|
+
if(API_KEY === 'xxxx'){
|
|
13112
13120
|
return `${SERVICE_API_KEY.Etherscan}${ERROR_MESSAGES_FLAG.RATE_LIMIT}`
|
|
13113
|
-
|
|
13114
|
-
|
|
13115
|
-
|
|
13116
|
-
|
|
13117
|
-
|
|
13118
|
-
|
|
13119
|
-
|
|
13120
|
-
|
|
13121
|
-
|
|
13122
|
-
|
|
13123
|
-
|
|
13124
|
-
|
|
13125
|
-
|
|
13126
|
-
|
|
13127
|
-
|
|
13128
|
-
|
|
13129
|
-
|
|
13130
|
-
|
|
13131
|
-
|
|
13132
|
-
|
|
13133
|
-
|
|
13134
|
-
|
|
13121
|
+
}
|
|
13122
|
+
const url = `https://api.etherscan.io/v2/api?chainid=1&module=account&action=txlist&address=${address}&startblock=0&endblock=99999999&page=${page || 1}&offset=${offset || 10}&sort=asc&apikey=${API_KEY}`;
|
|
13123
|
+
|
|
13124
|
+
try {
|
|
13125
|
+
const response = await fetch(url);
|
|
13126
|
+
if (!response.ok) {
|
|
13127
|
+
throw new Error(`HTTP error! Status: ${response.status}`)
|
|
13128
|
+
}
|
|
13129
|
+
const json = await response.json();
|
|
13130
|
+
if (json.result.includes("Invalid API Key")) {
|
|
13131
|
+
return `${SERVICE_API_KEY.Etherscan}${ERROR_MESSAGES_FLAG.INVALID_API_KEY}`
|
|
13132
|
+
}
|
|
13133
|
+
if(json.result.includes('Max rate limit reached')){
|
|
13134
|
+
return `${SERVICE_API_KEY.Etherscan}${ERROR_MESSAGES_FLAG.RATE_LIMIT}`
|
|
13135
|
+
}
|
|
13136
|
+
/*
|
|
13137
|
+
[{blockNumber: '0x1d3d1', timeStamp: '0x5f7e4f', hash: '0x3c3c3c3c', nonce: '0x1',}]
|
|
13138
|
+
*/
|
|
13139
|
+
return json.result;
|
|
13140
|
+
} catch (error) {
|
|
13141
|
+
return ERROR_MESSAGES_FLAG.DEFAULT
|
|
13142
|
+
}
|
|
13135
13143
|
}
|
|
13136
13144
|
|
|
13137
13145
|
async function COINGECKO(token, vs_currencies) {
|
package/package.json
CHANGED
package/types/cjs/index.d.cts
CHANGED
|
@@ -1329,7 +1329,7 @@ export const ERFPRECISE: any;
|
|
|
1329
1329
|
export namespace ERROR {
|
|
1330
1330
|
function TYPE(error_val: any): Error | 1 | 2 | 3 | 4 | 8 | 5 | 6 | 7;
|
|
1331
1331
|
}
|
|
1332
|
-
export function ETHERSCAN(address: any, page: any, offset: any): Promise<
|
|
1332
|
+
export function ETHERSCAN(address: any, page: any, offset: any): Promise<any>;
|
|
1333
1333
|
/**
|
|
1334
1334
|
* Rounds a number up to the nearest even integer.
|
|
1335
1335
|
*
|
package/types/esm/index.d.mts
CHANGED
|
@@ -1329,7 +1329,7 @@ export const ERFPRECISE: any;
|
|
|
1329
1329
|
export namespace ERROR {
|
|
1330
1330
|
function TYPE(error_val: any): Error | 1 | 2 | 3 | 4 | 8 | 5 | 6 | 7;
|
|
1331
1331
|
}
|
|
1332
|
-
export function ETHERSCAN(address: any, page: any, offset: any): Promise<
|
|
1332
|
+
export function ETHERSCAN(address: any, page: any, offset: any): Promise<any>;
|
|
1333
1333
|
/**
|
|
1334
1334
|
* Rounds a number up to the nearest even integer.
|
|
1335
1335
|
*
|