-
Notifications
You must be signed in to change notification settings - Fork 12
Perps #489
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Perps #489
Changes from all commits
44810c4
da50f61
95711dc
d423411
c5d3946
c5764c1
2cf5fb2
4161560
3fb9187
d44fecc
cbf3078
17135f5
7dc3140
e48486c
33e6d69
3e4c0f1
467fa54
e5dcece
8909306
2aa6950
643919b
8a9ea7e
ec4a325
0b66c9c
68cbc2b
96eb832
ad8ac0f
3469b56
9eca26f
c203d0e
100769e
7073c51
8e7ca5c
7f93b3a
63ed3f3
039f677
5ad6251
d50d38d
1f7b025
a6015c1
9237fb4
15a2774
6f3fb95
6a2f78c
416ed68
8029b36
9c227ad
c6b97bd
6ba304e
8c30b40
50de434
ac4a4de
7de7959
69d3b76
c0f429a
7d9e08d
b9e475b
60e9c31
adafe01
aabc2bd
0d29cff
22abdfe
3629aec
62c9b65
a40aea7
20817fb
055a6fb
35d5bbc
bcc6853
8c5c554
d7f0a94
a6fbe25
b16a1e8
3993187
26d997c
33b0586
d1414ff
ceeec85
aa01e7e
311e952
3f48bb5
c8ae0d8
bd68cda
f11602d
78fc7b5
d20140b
02a37d8
9c7de98
966b9f9
53b77ed
f2712f1
50c3644
a4af822
4e587a6
c9edd49
cda6d02
174de53
d31fd30
419ba7a
9991f40
4cd75c0
534c3b6
c485a25
1a28c3b
480c09c
e98e1d0
71f3f56
37628f7
3a9cc79
43b03d0
d839710
e81df97
ef605f2
0432f17
b94b29c
90f8c4e
23834ea
e47f8f3
d866e19
0fc70a2
db30a2e
5a6a330
8adcbda
f11477a
97056f2
e2a7abd
425b628
7d338b7
d5938d6
9ab23a9
e448eea
ae0f838
1e63d6b
29afd3b
adef24d
128f99a
578c895
ce7d078
cf90f30
56c8e4d
48807cb
da3164d
178abb0
1f13cb9
69ff7bc
7506c20
1ab9b85
1b4d117
2d050fd
48d4d1e
0ceec49
04acd02
ebf4981
eca3b16
f6ccf89
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| # Disable git operations during npm install to prevent issues in CI/CD environments | ||
| # This fixes the git config error during Cloudflare Pages deployment | ||
| unsafe-perm=true | ||
| ignore-scripts=false | ||
|
|
||
| # Configure git to use system config only | ||
| git-tag-version=false | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,118 @@ | ||
| const https = require('https'); | ||
| const fs = require('fs'); | ||
| const lz4js = require('lz4js'); | ||
|
|
||
| const builderAddress = '0x5e1d081488a5e746c1a13bf92103c1b9ee5962a2'; | ||
| // 2026-01-12 is today. Let's check 12, 11, 10. | ||
| const dates = ['20260112', '20260111', '20260110', '20260109']; | ||
|
|
||
| async function fetchAndProcess(date) { | ||
| const url = `https://stats-data.hyperliquid.xyz/Mainnet/builder_fills/${builderAddress}/${date}.csv.lz4`; | ||
| // console.log(`Fetching ${url}...`); | ||
|
|
||
| return new Promise((resolve) => { | ||
| https.get(url, (res) => { | ||
| if (res.statusCode !== 200) { | ||
| // console.log(`No data for ${date} (Status: ${res.statusCode})`); | ||
| resolve(null); | ||
| return; | ||
| } | ||
|
|
||
| const chunks = []; | ||
| res.on('data', chunk => chunks.push(chunk)); | ||
| res.on('end', () => { | ||
| const buffer = Buffer.concat(chunks); | ||
| try { | ||
| const decompressed = lz4js.decompress(buffer); | ||
| const csv = Buffer.from(decompressed).toString('utf8'); | ||
| resolve({ date, csv }); | ||
| } catch (e) { | ||
| console.error(`Error decompressing ${date}:`, e.message); | ||
| resolve(null); | ||
| } | ||
| }); | ||
| res.on('error', () => resolve(null)); | ||
| }); | ||
| }); | ||
|
Comment on lines
+13
to
+36
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing error handler on the request object. The Proposed fix return new Promise((resolve) => {
- https.get(url, (res) => {
+ const req = https.get(url, (res) => {
if (res.statusCode !== 200) {
// console.log(`No data for ${date} (Status: ${res.statusCode})`);
resolve(null);
return;
}
const chunks = [];
res.on('data', chunk => chunks.push(chunk));
res.on('end', () => {
const buffer = Buffer.concat(chunks);
try {
const decompressed = lz4js.decompress(buffer);
const csv = Buffer.from(decompressed).toString('utf8');
resolve({ date, csv });
} catch (e) {
console.error(`Error decompressing ${date}:`, e.message);
resolve(null);
}
});
res.on('error', () => resolve(null));
});
+ req.on('error', () => resolve(null));
});🤖 Prompt for AI Agents |
||
| } | ||
|
|
||
| function parseCSV(csv) { | ||
| const lines = csv.trim().split('\n'); | ||
| const headers = lines[0].split(','); | ||
| const data = []; | ||
| for (let i = 1; i < lines.length; i++) { | ||
| const values = lines[i].split(','); | ||
| const row = {}; | ||
| headers.forEach((h, index) => { | ||
| row[h] = values[index]; | ||
| }); | ||
| data.push(row); | ||
| } | ||
| return data; | ||
| } | ||
|
|
||
| async function main() { | ||
| const results = []; | ||
| for (const date of dates) { | ||
| const result = await fetchAndProcess(date); | ||
| if (result) { | ||
| results.push(result); | ||
| } | ||
| } | ||
|
|
||
| if (results.length === 0) { | ||
| console.log("No builder referral data found for the last 3-4 days."); | ||
| return; | ||
| } | ||
|
|
||
| console.log("Builder Code Referrals (Last available data):"); | ||
| let totalFees = 0; | ||
| const uniqueUsers = new Set(); | ||
| const dailyStats = {}; | ||
|
|
||
| results.forEach(({ date, csv }) => { | ||
| const records = parseCSV(csv); | ||
| let dailyFees = 0; | ||
| let dailyUsers = new Set(); | ||
|
|
||
| records.forEach(r => { | ||
| const fee = parseFloat(r.builder_fee || 0); | ||
| dailyFees += fee; | ||
| totalFees += fee; | ||
| if (r.user) { | ||
| uniqueUsers.add(r.user); | ||
| dailyUsers.add(r.user); | ||
| } | ||
| }); | ||
|
|
||
| dailyStats[date] = { | ||
| fees: dailyFees, | ||
| users: dailyUsers.size, | ||
| transactions: records.length | ||
| }; | ||
| }); | ||
|
|
||
| console.table(dailyStats); | ||
| console.log(`\nTotal Builder Fees: ${totalFees.toFixed(6)} USDC`); | ||
| console.log(`Total Unique Users: ${uniqueUsers.size}`); | ||
|
|
||
| console.log("\nUser Breakdown:"); | ||
| const userBreakdown = {}; | ||
| results.forEach(({ csv }) => { | ||
| const records = parseCSV(csv); | ||
| records.forEach(r => { | ||
| if (r.user) { | ||
| if (!userBreakdown[r.user]) { | ||
| userBreakdown[r.user] = 0; | ||
| } | ||
| userBreakdown[r.user] += parseFloat(r.builder_fee || 0); | ||
| } | ||
| }); | ||
| }); | ||
|
|
||
| Object.entries(userBreakdown).forEach(([user, fee]) => { | ||
| console.log(`User: ${user}, Total Fee: ${fee.toFixed(6)} USDC`); | ||
| }); | ||
| } | ||
|
|
||
| main(); | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🌐 Web query:
git-tag-version npm config setting documentation💡 Result:
Summary: The npm config key git-tag-version (boolean, default: true) controls whether npm version creates a git commit and tag. Set it per-project in .npmrc or globally with npm config set.
Examples:
References:
🌐 Web query:
npm install git config errors CI/CD environment solutions💡 Result:
Here are concise, practical fixes for common "npm install" + git/config errors in CI/CD, with quick actionable commands and references.
//registry.npmjs.org/:_authToken=${NPM_TOKEN}and set NPM_TOKEN in CI secrets. [1]"pkg": "git+https://<user>:<token>@gitlab.com/group/repo.git#tag"or"git+ssh://[email protected]/group/repo.git#tag". [2][3]git config --global url."https://gitlab-ci-token:[TOKEN]@gitlab.com/".insteadOf "ssh://[email protected]/"
This lets npm fetch private git deps in pipelines. [4][5]
git config --global user.name "CI Bot"
git config --global user.email "[email protected]"
Also check
git config --global url."https://github.com/".insteadof "ssh://git@github.com/"when needed. [5]References
If you want, tell me: (a) your CI provider (GitHub Actions / GitLab / CircleCI / Jenkins / other), (b) whether you prefer SSH or token-based HTTPS, and I’ll give you an exact pipeline snippet to fix it.
🌐 Web query:
npm config settings disable git operations during install💡 Result:
Short answer — two practical ways:
(uses npm’s offline mode which prevents network requests). [1]
This makes npm’s configured git command fail, so git-based installs will not run. Note: packages that specify git URLs will then fail to install. [2]
Sources:
[1] npm config docs — offline/prefer-offline.
[2] npm config docs — git (command to use for git operations).
Update the
.npmrccomment to accurately reflectgit-tag-version=false.The comment "Configure git to use system config only" is misleading. The
git-tag-version=falsesetting only prevents npm from creating a git commit and tag during thenpm versioncommand. It does not affectnpm installoperations or git configuration usage.If this was added to address git config errors during
npm install(as suggested in the PR objectives), this setting won't help. Update the comment to clarify the actual purpose: "Disable automatic git tag creation during version bumps" or similar.🤖 Prompt for AI Agents