From 6ad6a190826894033c19a6f7fe0d6cd2a6b3f8dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tokin=20=E2=AC=A2=20Cypher?= Date: Wed, 27 Aug 2025 20:33:49 -0700 Subject: [PATCH] Updated js to pull supply info in 3 separate categories amd generate .txt versions for CMC requirements. --- .github/workflows/update-supply.yml | 6 +++--- assets/js/updatesupply.js | 16 ++++++++-------- circulating.txt | 0 max.txt | 0 total.txt | 0 5 files changed, 11 insertions(+), 11 deletions(-) create mode 100644 circulating.txt create mode 100644 max.txt create mode 100644 total.txt diff --git a/.github/workflows/update-supply.yml b/.github/workflows/update-supply.yml index 6f6ac918..14b45263 100644 --- a/.github/workflows/update-supply.yml +++ b/.github/workflows/update-supply.yml @@ -24,10 +24,10 @@ jobs: - name: Run supply update script run: node js/updateSupply.js - - name: Commit updated supply.json + - name: Commit updated supply files run: | git config user.name "GitHub Actions" git config user.email "actions@github.com" - git add supply.json - git commit -m "Auto-update supply data" + git add total.txt circulating.txt max.txt + git commit -m "Auto-update supply values" git push \ No newline at end of file diff --git a/assets/js/updatesupply.js b/assets/js/updatesupply.js index e1bf3ed3..69ef0751 100644 --- a/assets/js/updatesupply.js +++ b/assets/js/updatesupply.js @@ -12,15 +12,15 @@ https.get(url, (res) => { const json = JSON.parse(data); const market = json.market_data; - const supplyData = { - circulating_supply: market.circulating_supply || 0, - total_supply: market.total_supply || 0, - max_supply: market.max_supply || 0, - last_updated: new Date().toISOString() - }; + const total = market.total_supply || 0; + const circulating = market.circulating_supply || 0; + const max = market.max_supply || 0; - fs.writeFileSync('supply.json', JSON.stringify(supplyData, null, 2)); - console.log('✅ supply.json updated'); + fs.writeFileSync('total.txt', total.toString()); + fs.writeFileSync('circulating.txt', circulating.toString()); + fs.writeFileSync('max.txt', max.toString()); + + console.log('✅ All supply files updated'); } catch (err) { console.error('❌ Error parsing CoinGecko response:', err); } diff --git a/circulating.txt b/circulating.txt new file mode 100644 index 00000000..e69de29b diff --git a/max.txt b/max.txt new file mode 100644 index 00000000..e69de29b diff --git a/total.txt b/total.txt new file mode 100644 index 00000000..e69de29b