-
Notifications
You must be signed in to change notification settings - Fork 54
feat(sdk): add version/build information display to web interface #2708
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
Changes from all commits
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 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -791,7 +791,12 @@ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <body> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <div class="header"> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <h1>Dash Platform WASM JS SDK</h1> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <div> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <h1>Dash Platform WASM JS SDK</h1> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <div id="versionInfo" style="font-size: 0.8em; color: #b0b0b0; margin-top: -5px;"> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Loading version info... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </div> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </div> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <nav class="header-nav"> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <a href="docs.html">Documentation</a> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <a href="AI_REFERENCE.md">AI Reference</a> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -3279,6 +3284,19 @@ <h2>Results</h2> | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| console.log(`Initialized ${network} SDK (${modeStr} mode):`, sdk); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| updateStatus(`WASM SDK successfully loaded on ${network.toUpperCase()} (${modeStr} mode)`, 'success'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Display version information in header | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| try { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const gitCommit = sdk.gitCommit(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const gitBranch = sdk.gitBranch(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const versionText = `Built from branch: ${gitBranch} (${gitCommit})`; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| document.getElementById('versionInfo').textContent = versionText; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| document.getElementById('versionInfo').title = `Branch: ${gitBranch}\nCommit: ${gitCommit}`; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } catch (error) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| console.warn('Failed to get version info:', error); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| document.getElementById('versionInfo').textContent = 'Version info unavailable'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+3287
to
+3299
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. 🛠️ Refactor suggestion Expose all available build metadata & improve formatting/fallbacks. Only branch/commit are surfaced; -const gitCommit = sdk.gitCommit();
-const gitBranch = sdk.gitBranch();
-
-const versionText = `Built from branch: ${gitBranch} (${gitCommit})`;
-document.getElementById('versionInfo').textContent = versionText;
-document.getElementById('versionInfo').title = `Branch: ${gitBranch}\nCommit: ${gitCommit}`;
+const gitCommit = sdk.gitCommit?.() ?? '';
+const gitBranch = sdk.gitBranch?.() ?? '';
+const pkgVer = sdk.packageVersion?.() ?? '';
+const buildTime = sdk.buildTime?.() ?? '';
+
+// keep first 9 chars of hash for compactness
+const shortCommit = gitCommit.slice(0, 9);
+
+let header = [];
+if (pkgVer) header.push(`v${pkgVer}`);
+if (shortCommit) header.push(shortCommit + (gitBranch ? `@${gitBranch}` : ''));
+if (buildTime) header.push(`• Built ${buildTime}`);
+
+const versionText = header.join(' ');
+
+const tooltip = `Package: ${pkgVer || 'unknown'}\nBranch: ${gitBranch || 'unknown'}\nCommit: ${gitCommit || 'unknown'}\nBuilt: ${buildTime || 'unknown'}`;
+
+const versionElem = document.getElementById('versionInfo');
+versionElem.textContent = versionText || 'Version info unavailable';
+versionElem.title = tooltip;Benefits:
📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Proof support is available for all queries - internally all queries use proof verification | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // When the proof toggle is ON (checked), queries return verified data WITH proof information displayed | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // When the proof toggle is OFF (unchecked), queries return verified data WITHOUT proof information displayed | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
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.
🛠️ Refactor suggestion
Preserve existing
RUSTFLAGSinstead of clobbering itexport RUSTFLAGS="-C lto=off --cfg=env_vars_set"overwrites any flags a caller might have set (e.g.-C target-cpu=native). Safer to append:This keeps the new switches while respecting upstream configuration.
📝 Committable suggestion
🤖 Prompt for AI Agents