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
33 changes: 33 additions & 0 deletions .github/workflows/update-supply.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Update Supply Data

on:
schedule:
- cron: '0 * * * *' # Runs every hour
workflow_dispatch:

jobs:
update:
runs-on: ubuntu-latest

steps:
- name: Checkout repo
uses: actions/checkout@v3

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '18'

- name: Install dependencies
run: npm install

- name: Run supply update script
run: node js/updateSupply.js

- name: Commit updated supply.json
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 push
30 changes: 30 additions & 0 deletions assets/js/updatesupply.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
const fs = require('fs');
const https = require('https');

const url = 'https://api.coingecko.com/api/v3/coins/solana/contract/GsKuLQsKCEnfQxuk4icTEQjc11Av8WiqW31CxZqZpump';

https.get(url, (res) => {
let data = '';

res.on('data', chunk => data += chunk);
res.on('end', () => {
try {
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()
};

fs.writeFileSync('supply.json', JSON.stringify(supplyData, null, 2));
console.log('✅ supply.json updated');
} catch (err) {
console.error('❌ Error parsing CoinGecko response:', err);
}
});
}).on('error', err => {
console.error('❌ Request failed:', err);
});
5 changes: 5 additions & 0 deletions supply.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"circulating_supply": 605320738,
"total_supply": 999473006,
"max_supply": 1000000000
}