Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/update-supply.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
16 changes: 8 additions & 8 deletions assets/js/updatesupply.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
Empty file added circulating.txt
Empty file.
Empty file added max.txt
Empty file.
Empty file added total.txt
Empty file.