Skip to content

feat: integrate generic gluon-ergo-sdk and remove local legacy copy#129

Open
sameezy667 wants to merge 3 commits intoStabilityNexus:mainfrom
sameezy667:feat/integrate-generic-sdk
Open

feat: integrate generic gluon-ergo-sdk and remove local legacy copy#129
sameezy667 wants to merge 3 commits intoStabilityNexus:mainfrom
sameezy667:feat/integrate-generic-sdk

Conversation

@sameezy667
Copy link
Copy Markdown
Contributor

@sameezy667 sameezy667 commented Mar 9, 2026

Addressed Issues:

Completes the mentor's requirement to decouple the frontend from the local lib/gluon-gold-sdk copy and prepares the application to use the generic npm package.

⚠️ DEPENDENCY NOTICE: This PR depends on the generic SDK refactor: StabilityNexus/Gluon-Ergo-SDK#17. Do not merge this UI PR until the new gluon-ergo-sdk package is published to npm.

Additional Notes:

  1. Package Configuration
  • Deleted the local lib/gluon-gold-sdk/ directory.
  • Updated package.json to remove local workspace bindings and build scripts (check:sdk, build:sdk).
  • Replaced the dependency with "gluon-ergo-sdk": "*". (Currently using bun link locally; ready to be switched to semantic versioning once the SDK PR is published).
  1. Refactored Imports & Method Calls
  • Updated all imports from gluon-gold-sdk to gluon-ergo-sdk.
  • Replaced all legacy "Gold" SDK methods with the new generic equivalents matching the SDK PR (e.g., getGoldOracleBox()getOracleBox(), transmuteToGoldForEip12()transmuteToNeutronForEip12()).

Checklist

  • My PR addresses a single issue, fixes a single bug or makes a single improvement.
  • My code follows the project's code style and conventions.
  • If applicable, I have made corresponding changes or additions to the documentation.
  • If applicable, I have made corresponding changes or additions to tests.
  • My changes generate no new warnings or errors.
  • I have joined the Stability Nexus's Discord server and I will share a link to this PR with the project maintainers there.
  • I have read the Contribution Guidelines.
  • Once I submit my PR, CodeRabbit AI will automatically review it and I will address CodeRabbit's comments.

AI Usage Disclosure

  • This PR does not contain AI-generated code at all.
  • This PR contains AI-generated code. I have tested the code locally and I am responsible for it.
    I have used the following AI models and tools: Claude

Summary by CodeRabbit

  • Refactor

    • Switched from a local SDK to an external published SDK for the Gluon integration.
    • Renamed transmutation operations for clarity: "transmute to gold" → "transmute to neutron" and "transmute from gold" → "transmute to proton."
  • Chores

    • Updated dependency and build setup to use the published SDK and simplified dev/build scripts.

- Remove local SDK copy (lib/gluon-gold-sdk)
- Update package.json to use gluon-ergo-sdk from npm
- Update all imports from gluon-gold-sdk to gluon-ergo-sdk
- Replace legacy method names:
  - getGoldOracleBox → getOracleBox
  - transmuteToGold* → transmuteToNeutron*
  - transmuteFromGold* → transmuteToProton*
- Update console logs and error messages
- Verified build: zero TypeScript errors
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 9, 2026

Walkthrough

This PR removes the local gluon-gold-sdk from the repo (source, build config, docs), replaces its local dependency with an external gluon-ergo-sdk, updates Next.js config, and migrates codepaths and handler names to the Ergo-based SDK and neutron/proton terminology. (50 words)

Changes

Cohort / File(s) Summary
SDK Config & Metadata
lib/gluon-gold-sdk/.gitignore, lib/gluon-gold-sdk/.npmignore, lib/gluon-gold-sdk/package.json, lib/gluon-gold-sdk/tsconfig.json, lib/gluon-gold-sdk/next.config.js, lib/gluon-gold-sdk/desktop.ini
Deleted local SDK ignore rules, npmignore entries, package metadata, TypeScript config, Next.js config, and desktop.ini.
SDK Source Code
lib/gluon-gold-sdk/src/... (gluon.ts, gluonBox.ts, goldOracleBox.ts, config.ts, consts.ts, nodeService.ts, serializer.ts, txUtils.ts, index.ts)
Entire SDK implementation removed: classes, exported constants, transaction/serialization/node helpers, and central export surface.
SDK Documentation
lib/gluon-gold-sdk/README.md, lib/gluon-gold-sdk/blog.md
Deleted SDK README and tutorial/blog documentation.
Monorepo & Package Changes
package.json
Removed workspace linkage to lib/*, removed SDK preflight/build scripts, replaced local "gluon-gold-sdk": "file:lib/gluon-gold-sdk" with external "gluon-ergo-sdk": "*", and simplified dev/build scripts.
Next.js Config Update
next.config.ts
Added transpilePackages: ['gluon-ergo-sdk'], experimental.externalDir, async headers CSP, enabled symlinks and asyncWebAssembly, and adjusted build targets.
Frontend SDK Import Migration
src/lib/components/... (ReactorSwap.tsx, GluonStats.tsx, MyStats.tsx, VolumeChart.tsx)
Switched dynamic imports from gluon-gold-sdk to gluon-ergo-sdk and replaced getGoldOracleBox() calls with getOracleBox().
Handler Renames & Logic Alignment
src/lib/functions/reactor/... (handleFission.ts, handleFusion.ts, handleTransmutation.ts)
Renamed transmutation handlers (ToGold → ToNeutron, FromGold → ToProton), updated internal SDK method names and log/messages, and replaced oracle box access with getOracleBox().

Sequence Diagram(s)

(omitted)

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Suggested labels

Typescript Lang, Documentation

Suggested reviewers

  • Zahnentferner
  • ceilican

Poem

🐰 I hopped through code, a tidy little sweep,
Cleared out the burrow where the old SDK sleep,
Swapped in Ergo, renamed Gold to Neutron and Proton,
New imports dancing — a fresh morning sun! ✨

🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title accurately reflects the main change: integrating a generic gluon-ergo-sdk and removing the local legacy SDK copy from lib/gluon-gold-sdk/.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/lib/components/blockchain/swap/ReactorSwap.tsx (1)

826-844: ⚠️ Potential issue | 🟠 Major

Align the transmutation action keys with the transaction listener.

These branches now execute the renamed neutron/proton transmutation flows, but calculateExpectedChanges() in this file still only handles transmute-to-gold and transmute-from-gold. saveUpTransaction() will therefore persist zero token deltas for both paths, which can leave pending-state and balance-refresh handling blind after a transmutation.

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/lib/functions/reactor/handleTransmutation.ts`:
- Around line 257-264: handleTransactionError's INSUFFICIENT_BALANCE branch
doesn't recognize the new action labels "transmute to neutron" and "transmute to
proton" used by handleTransactionSuccess/handleTransactionError, so
insufficient-balance transmutation errors show a generic message; either extend
the switch in handleTransactionError (INSUFFICIENT_BALANCE case) to treat
"transmute to neutron" and "transmute to proton" the same as
"transmutation"/"fission"/"fusion", or change callers
(handleTransactionSuccess/handleTransactionError invocations) to pass a
canonical actionType like "transmutation" instead of the verbose labels—update
all occurrences (e.g., the calls passing "transmute to neutron"/"transmute to
proton") and the switch matching logic in handleTransactionError to ensure the
specialized "Insufficient token balance for transmutation." message is used.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 1603b466-cdad-484f-84ce-ddfe2dd6744d

📥 Commits

Reviewing files that changed from the base of the PR and between 57aba3e and 2059299.

⛔ Files ignored due to path filters (1)
  • lib/gluon-gold-sdk/package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (25)
  • lib/gluon-gold-sdk/.gitignore
  • lib/gluon-gold-sdk/.npmignore
  • lib/gluon-gold-sdk/README.md
  • lib/gluon-gold-sdk/blog.md
  • lib/gluon-gold-sdk/desktop.ini
  • lib/gluon-gold-sdk/next.config.js
  • lib/gluon-gold-sdk/package.json
  • lib/gluon-gold-sdk/src/config.ts
  • lib/gluon-gold-sdk/src/consts.ts
  • lib/gluon-gold-sdk/src/gluon.ts
  • lib/gluon-gold-sdk/src/gluonBox.ts
  • lib/gluon-gold-sdk/src/goldOracleBox.ts
  • lib/gluon-gold-sdk/src/index.ts
  • lib/gluon-gold-sdk/src/nodeService.ts
  • lib/gluon-gold-sdk/src/serializer.ts
  • lib/gluon-gold-sdk/src/txUtils.ts
  • lib/gluon-gold-sdk/tsconfig.json
  • package.json
  • src/lib/components/blockchain/swap/ReactorSwap.tsx
  • src/lib/components/blocks/dashboard/GluonStats.tsx
  • src/lib/components/blocks/dashboard/MyStats.tsx
  • src/lib/components/blocks/dashboard/VolumeChart.tsx
  • src/lib/functions/reactor/handleFission.ts
  • src/lib/functions/reactor/handleFusion.ts
  • src/lib/functions/reactor/handleTransmutation.ts
💤 Files with no reviewable changes (17)
  • lib/gluon-gold-sdk/README.md
  • lib/gluon-gold-sdk/package.json
  • lib/gluon-gold-sdk/blog.md
  • lib/gluon-gold-sdk/src/gluon.ts
  • lib/gluon-gold-sdk/src/index.ts
  • lib/gluon-gold-sdk/src/txUtils.ts
  • lib/gluon-gold-sdk/src/goldOracleBox.ts
  • lib/gluon-gold-sdk/.gitignore
  • lib/gluon-gold-sdk/src/config.ts
  • lib/gluon-gold-sdk/desktop.ini
  • lib/gluon-gold-sdk/src/serializer.ts
  • lib/gluon-gold-sdk/next.config.js
  • lib/gluon-gold-sdk/tsconfig.json
  • lib/gluon-gold-sdk/.npmignore
  • lib/gluon-gold-sdk/src/gluonBox.ts
  • lib/gluon-gold-sdk/src/nodeService.ts
  • lib/gluon-gold-sdk/src/consts.ts

Comment on lines +257 to +264
handleTransactionSuccess(txHash, "transmute to neutron");

return { txHash };
} catch (error) {
console.error("TransmuteToGold failed:", error);
console.error("TransmuteToNeutron failed:", error);

// Use the error handler for proper classification and toast notification
const errorDetails = handleTransactionError(error, "transmute to gold");
const errorDetails = handleTransactionError(error, "transmute to neutron");
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "# error-handler implementation"
fd 'error-handler\.ts$' src | while read -r file; do
  echo "## $file"
  sed -n '1,240p' "$file"
done

echo
echo "# relevant action-label usages"
rg -n -C3 'handleTransactionSuccess|handleTransactionError|transmute to neutron|transmute to proton|transmute-to-gold|transmute-from-gold|volatile-to-stable|stable-to-volatile' src

Repository: StabilityNexus/Gluon-Ergo-UI

Length of output: 27164


Update the shared error handler to recognize the new transmutation action labels.

handleTransactionError() and handleTransactionSuccess() now receive "transmute to neutron" and "transmute to proton", but the error handler's INSUFFICIENT_BALANCE customization only checks for "fission", "fusion", and "transmutation" (line 209–218 of error-handler.ts). For insufficient balance errors during transmutation, users will see the generic "Insufficient balance for this transaction." instead of "Insufficient token balance for transmutation." Add cases in the switch statement to handle the new action labels, or standardize on a canonical actionType string like "transmutation" across all calls.

Also applies to: lines 353–360

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/lib/functions/reactor/handleTransmutation.ts` around lines 257 - 264,
handleTransactionError's INSUFFICIENT_BALANCE branch doesn't recognize the new
action labels "transmute to neutron" and "transmute to proton" used by
handleTransactionSuccess/handleTransactionError, so insufficient-balance
transmutation errors show a generic message; either extend the switch in
handleTransactionError (INSUFFICIENT_BALANCE case) to treat "transmute to
neutron" and "transmute to proton" the same as
"transmutation"/"fission"/"fusion", or change callers
(handleTransactionSuccess/handleTransactionError invocations) to pass a
canonical actionType like "transmutation" instead of the verbose labels—update
all occurrences (e.g., the calls passing "transmute to neutron"/"transmute to
proton") and the switch matching logic in handleTransactionError to ensure the
specialized "Insufficient token balance for transmutation." message is used.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@next.config.ts`:
- Around line 6-8: Remove the now-stale experimental.externalDir setting from
next.config.ts: delete the experimental: { externalDir: true } block and rely on
transpilePackages for the registry dependency (e.g., transpilePackages including
"gluon-ergo-sdk"); if you actually still import modules from outside the repo
root, keep the flag but add a comment explaining that externalDir is required
and why, otherwise remove it to avoid using an unnecessary experimental flag.
- Around line 11-23: The Content-Security-Policy set in the headers() function
currently includes 'unsafe-eval' unconditionally; update headers() so the CSP
value conditionally drops 'unsafe-eval' in production and instead includes
'wasm-unsafe-eval' to permit WebAssembly while keeping strict CSP: build the CSP
string used for the Content-Security-Policy header in headers() (refer to the
headers() function and the Content-Security-Policy header value) so that in
production (e.g. process.env.NODE_ENV === 'production') you do not include
'unsafe-eval' but do include 'wasm-unsafe-eval', whereas in development you may
keep 'unsafe-eval' for tooling; ensure the header value still contains
"script-src 'self' 'unsafe-inline'; object-src 'none';" plus the appropriate
eval token per environment.

In `@package.json`:
- Line 8: The package.json "build" script currently runs "next build" which
defaults to Turbopack in Next.js 16 and will fail when a custom webpack config
exists; update the "build" script to append the --webpack flag (i.e., change the
script referenced by the "build" key) so Next uses webpack, and likewise update
any other build-related npm scripts (e.g., "build:ci" or similar) that call
"next build" to include --webpack; ensure you only alter the script strings and
do not modify other fields.
- Line 37: Replace the wildcard dependency "gluon-ergo-sdk": "*" in package.json
with a concrete published version or a safe semver range (for example
"gluon-ergo-sdk": "^X.Y.Z"); update the dependency entry for "gluon-ergo-sdk"
accordingly, run your package manager (npm install or yarn) to update lockfile,
run the test suite to confirm no regressions, and commit the updated
package.json and lockfile.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 0e92ea7c-5931-447d-8f24-7a3cd2c1803c

📥 Commits

Reviewing files that changed from the base of the PR and between 2059299 and 894be56.

⛔ Files ignored due to path filters (1)
  • bun.lockb is excluded by !**/bun.lockb
📒 Files selected for processing (2)
  • next.config.ts
  • package.json

Comment thread next.config.ts
Comment on lines +6 to +8
experimental: {
externalDir: true,
},
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick | 🔵 Trivial

externalDir looks stale after moving the SDK to npm.

transpilePackages already supports external dependencies from node_modules. Since this PR switches gluon-ergo-sdk from a workspace/local package to a registry dependency, keeping experimental.externalDir enabled looks like leftover workspace-era config rather than a current requirement. That's an inference, but I'd remove the experimental flag unless you still resolve imports from outside the repo root. (nextjs.org)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@next.config.ts` around lines 6 - 8, Remove the now-stale
experimental.externalDir setting from next.config.ts: delete the experimental: {
externalDir: true } block and rely on transpilePackages for the registry
dependency (e.g., transpilePackages including "gluon-ergo-sdk"); if you actually
still import modules from outside the repo root, keep the flag but add a comment
explaining that externalDir is required and why, otherwise remove it to avoid
using an unnecessary experimental flag.

Comment thread next.config.ts
Comment on lines +11 to +23
async headers() {
return [
{
source: '/:path*',
headers: [
{
key: 'Content-Security-Policy',
value: "script-src 'self' 'unsafe-eval' 'unsafe-inline'; object-src 'none';",
},
],
},
];
},
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

# Find and examine next.config.ts
find . -name "next.config.*" -type f

Repository: StabilityNexus/Gluon-Ergo-UI

Length of output: 88


🏁 Script executed:

# Search for ergo-lib-wasm usage in the codebase
rg "ergo-lib-wasm" --type ts --type tsx --type js --type jsx

Repository: StabilityNexus/Gluon-Ergo-UI

Length of output: 99


🏁 Script executed:

# Check package.json for dependencies
cat package.json | grep -A 50 "dependencies\|devDependencies" | head -100

Repository: StabilityNexus/Gluon-Ergo-UI

Length of output: 2035


🏁 Script executed:

# Look for asyncWebAssembly configuration in next.config
rg "asyncWebAssembly" -A 2 -B 2

Repository: StabilityNexus/Gluon-Ergo-UI

Length of output: 244


🏁 Script executed:

# Read the next.config.ts file to see the full CSP implementation
cat -n next.config.ts

Repository: StabilityNexus/Gluon-Ergo-UI

Length of output: 1349


🌐 Web query:

Next.js Content Security Policy guide WebAssembly wasm-unsafe-eval

💡 Result:

To allow WebAssembly under a strict CSP in Next.js, add 'wasm-unsafe-eval' to your script-src directive (instead of broad **'unsafe-eval'). Next.js explicitly calls this out as the fix for WebAssembly-related CSP violations. [1]

Example (Next.js next.config.js via headers())

// next.config.js
const isDev = process.env.NODE_ENV !== 'production'

const csp = [
  "default-src 'self'",
  "script-src 'self' 'wasm-unsafe-eval'" + (isDev ? " 'unsafe-eval'" : ""),
  "style-src 'self' 'unsafe-inline'",
  "img-src 'self' blob: data:",
  "font-src 'self'",
  "object-src 'none'",
  "base-uri 'self'",
  "form-action 'self'",
  "frame-ancestors 'none'",
  "upgrade-insecure-requests",
].join('; ')

module.exports = {
  async headers() {
    return [{ source: '/(.*)', headers: [{ key: 'Content-Security-Policy', value: csp }] }]
  },
}

Next.js supports setting headers like this using the headers key in next.config.js. [2]

What wasm-unsafe-eval is

'wasm-unsafe-eval' is a CSP keyword defined in CSP Level 3 and is specifically intended to permit WebAssembly compilation/instantiation that would otherwise be blocked when eval-like behaviors are disallowed. [3][4]

Sources: Next.js CSP guide [1], Next.js headers() config docs [2], W3C CSP Level 3 spec [3], MDN note on requiring 'wasm-unsafe-eval' for WebAssembly under CSP [4].


Fix CSP to remove production 'unsafe-eval' and add 'wasm-unsafe-eval' for WebAssembly support.

The current CSP header includes 'unsafe-eval' unconditionally, which weakens XSS protection in production. With ergo-lib-wasm-browser and ergo-lib-wasm-nodejs as dependencies and asyncWebAssembly enabled, the CSP must also include 'wasm-unsafe-eval' to support WebAssembly initialization in strict CSP environments.

Suggested change
   async headers() {
+    const isDev = process.env.NODE_ENV === 'development';
+    const cspHeader = [
+      "default-src 'self'",
+      `script-src 'self' 'unsafe-inline' 'wasm-unsafe-eval'${isDev ? " 'unsafe-eval'" : ''}`,
+      "object-src 'none'",
+    ].join('; ');
+
     return [
       {
         source: '/:path*',
         headers: [
           {
             key: 'Content-Security-Policy',
-            value: "script-src 'self' 'unsafe-eval' 'unsafe-inline'; object-src 'none';",
+            value: cspHeader,
           },
         ],
       },
     ];
   },
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
async headers() {
return [
{
source: '/:path*',
headers: [
{
key: 'Content-Security-Policy',
value: "script-src 'self' 'unsafe-eval' 'unsafe-inline'; object-src 'none';",
},
],
},
];
},
async headers() {
const isDev = process.env.NODE_ENV === 'development';
const cspHeader = [
"default-src 'self'",
`script-src 'self' 'unsafe-inline' 'wasm-unsafe-eval'${isDev ? " 'unsafe-eval'" : ''}`,
"object-src 'none'",
].join('; ');
return [
{
source: '/:path*',
headers: [
{
key: 'Content-Security-Policy',
value: cspHeader,
},
],
},
];
},
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@next.config.ts` around lines 11 - 23, The Content-Security-Policy set in the
headers() function currently includes 'unsafe-eval' unconditionally; update
headers() so the CSP value conditionally drops 'unsafe-eval' in production and
instead includes 'wasm-unsafe-eval' to permit WebAssembly while keeping strict
CSP: build the CSP string used for the Content-Security-Policy header in
headers() (refer to the headers() function and the Content-Security-Policy
header value) so that in production (e.g. process.env.NODE_ENV === 'production')
you do not include 'unsafe-eval' but do include 'wasm-unsafe-eval', whereas in
development you may keep 'unsafe-eval' for tooling; ensure the header value
still contains "script-src 'self' 'unsafe-inline'; object-src 'none';" plus the
appropriate eval token per environment.

Comment thread package.json
"dev": "next dev --webpack",
"buildtest": "next build",
"build": "bun run build:sdk && next build",
"build": "next build",
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

# First, let's look at the package.json to see lines 7-8 and line 37
cat -n package.json | head -40

Repository: StabilityNexus/Gluon-Ergo-UI

Length of output: 1573


🏁 Script executed:

# Check if next.config.ts exists and what webpack config it contains
find . -name "next.config.*" -type f | head -5

Repository: StabilityNexus/Gluon-Ergo-UI

Length of output: 88


🏁 Script executed:

# If next.config.ts exists, let's see its content
if [ -f "next.config.ts" ]; then cat -n next.config.ts; elif [ -f "next.config.js" ]; then cat -n next.config.js; fi

Repository: StabilityNexus/Gluon-Ergo-UI

Length of output: 1349


🌐 Web query:

Next.js 16 Turbopack default webpack config build failure --webpack flag

💡 Result:

In Next.js 16, Turbopack is the default bundler for next build. If your project has a custom webpack config in next.config.js, Next.js 16 will fail the build on purpose (to avoid silently ignoring/misapplying webpack-only settings under Turbopack). (nextjs.org)

Fix options:

  1. Opt out and build with Webpack
next build --webpack
# (also available for dev)
next dev --webpack

This keeps your existing webpack(config) { ... } customization working. (nextjs.org)

  1. Migrate off webpack-only config
    Move what you can to the turbopack config in next.config.js (note: experimental.turbo is being removed in v16). (nextjs.org)

Typical package.json workaround:

{
  "scripts": {
    "build": "next build --webpack"
  }
}

Citations:


Add --webpack flag to build scripts.

Next.js 16 uses Turbopack by default, which fails when a custom webpack config is present. This project has webpack configuration in next.config.ts (for symlink support and WebAssembly), so both build scripts need the --webpack flag to avoid build failures. The dev script on line 6 already has this flag.

Suggested changes
-    "buildtest": "next build",
+    "buildtest": "next build --webpack",
-    "build": "next build",
+    "build": "next build --webpack",
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"build": "next build",
"build": "next build --webpack",
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@package.json` at line 8, The package.json "build" script currently runs "next
build" which defaults to Turbopack in Next.js 16 and will fail when a custom
webpack config exists; update the "build" script to append the --webpack flag
(i.e., change the script referenced by the "build" key) so Next uses webpack,
and likewise update any other build-related npm scripts (e.g., "build:ci" or
similar) that call "next build" to include --webpack; ensure you only alter the
script strings and do not modify other fields.

Comment thread package.json
"ergo-lib-wasm-nodejs": "^0.28.0",
"framer-motion": "^11.17.0",
"gluon-gold-sdk": "file:lib/gluon-gold-sdk",
"gluon-ergo-sdk": "*",
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

cat -n package.json | head -50

Repository: StabilityNexus/Gluon-Ergo-UI

Length of output: 1930


🌐 Web query:

gluon-ergo-sdk npm package latest version

💡 Result:

I couldn’t find any public npm package named gluon-ergo-sdk (no listing showed up in npm-related indexes/search results).

The closest matching published packages I could verify are:

  • gluon-gold-sdk — latest published version shown: 1.0.0. [1]
  • @patternglobal/ergo-sdk — latest published version shown: 1.0.0. [1]

Source(s): [1]


Pin gluon-ergo-sdk to a specific version before merging.

The wildcard version specifier * breaks reproducibility and allows any future release to be installed, potentially causing silent breaking changes. Once the npm package is published, replace * with the published version number or a bounded version range (e.g., ^X.Y.Z).

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@package.json` at line 37, Replace the wildcard dependency "gluon-ergo-sdk":
"*" in package.json with a concrete published version or a safe semver range
(for example "gluon-ergo-sdk": "^X.Y.Z"); update the dependency entry for
"gluon-ergo-sdk" accordingly, run your package manager (npm install or yarn) to
update lockfile, run the test suite to confirm no regressions, and commit the
updated package.json and lockfile.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant