Skip to content

Commit df3974a

Browse files
Write Coingecko ID Update Code + Bulk Update of coingecko_ids (#5941)
* write coingecko id updatecode * bulk update of cgids
1 parent efd596e commit df3974a

File tree

60 files changed

+2151
-417
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+2151
-417
lines changed

.github/workflows/utility/coingecko_data.mjs

+9-3
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export const traceTypesCoingeckoId = [
1818
];
1919

2020
export const api_response = {};
21-
export const state = {
21+
export let state = {
2222
coingecko_id_groups: []
2323
};
2424

@@ -45,7 +45,8 @@ export async function fetchCoingeckoData(endpoint = coingeckoEndpoints.coins_lis
4545
export async function loadCoingeckoState() {
4646
try {
4747
const data = await fs.readFile(COINGECKO_JSON_PATH, 'utf8');
48-
return JSON.parse(data);
48+
state = JSON.parse(data);
49+
return;
4950
} catch (error) {
5051
if (error.code === 'ENOENT') {
5152
return { coingecko_data: [] }; // Return empty structure if file doesn't exist
@@ -55,7 +56,12 @@ export async function loadCoingeckoState() {
5556
}
5657

5758
export async function saveCoingeckoState() {
58-
await fs.writeFile(COINGECKO_JSON_PATH, JSON.stringify(state, null, 2));
59+
try {
60+
await fs.writeFile(COINGECKO_JSON_PATH, JSON.stringify(state, null, 2));
61+
console.log(`Successfully saved Coingecko state to ${COINGECKO_JSON_PATH}`);
62+
} catch (error) {
63+
console.error(`Failed to save Coingecko state:`, error);
64+
}
5965
}
6066

6167
export function createCoingeckoIdGroup(coingeckoId, chainName, baseDenom) {

0 commit comments

Comments
 (0)