Skip to content

YNU-864: Build front door rewrite#147

Open
ihsraham wants to merge 2 commits intodocs/reorg-for-v1from
feat/ynu-864-build-front-door-rewrite
Open

YNU-864: Build front door rewrite#147
ihsraham wants to merge 2 commits intodocs/reorg-for-v1from
feat/ynu-864-build-front-door-rewrite

Conversation

@ihsraham
Copy link
Copy Markdown
Collaborator

@ihsraham ihsraham commented May 7, 2026

Summary

This updates the Nitrolite Build entrypoint so new builders land on the native v1 @yellow-org/sdk path instead of the older 0.5.x quickstart.

What Changed

  • Rewrote the Quickstart, Prerequisites, and Key Terms pages around @yellow-org/sdk@1.2.1, Node 20, Client.create(), createSigners(), Decimal, and Nitronode terminology.
  • Added a self-contained runnable native v1 lifecycle example at examples/nitrolite-v1-lifecycle.
  • The lifecycle example covers user/app signer connection, home-channel preparation, app-session create, app-session deposit, operate, withdraw, and close.
  • Kept home-channel closure as explicit opt-in with CLOSE_HOME_CHANNEL=true; the default run closes the app session but leaves the home channel open.
  • Removed the duplicate legacy build/quick-start page.
  • Updated Build navigation and existing Build links to point to build/getting-started/quickstart.
  • Rewired Learn links that would otherwise point at the deleted Build quickstart; the Learn page content itself is not being rewritten in this branch.
  • Kept faucet setup out of the runnable path until the canonical public faucet surface is finalized.
  • Kept migration guidance for builders coming from 0.5.x so they do not accidentally start with the native v1 quickstart.

Why

The previous Build front door looked like v1 documentation but still taught the older 0.5.x package, APIs, endpoint names, and mental model. A new builder following it would hit stale imports and outdated setup steps.

This PR makes the first Build path match the current SDK and gives migrating users an explicit off-ramp before they move to native v1 APIs. It also backs the quickstart with code that was actually run against the v1 SDK and live Nitronode flow before being documented.

Scope Notes

  • docs/nitrolite/learn/index.mdx and docs/nitrolite/learn/introduction/supported-chains.mdx are included only for link rewires caused by deleting the old Build quickstart.
  • The fact-based supported-chains content rewrite, including deployment verification against contracts/deployments, belongs with the Learn introduction refresh and is not part of this Build front-door change.

Docs Pages To Review

Build front door:

  • docs/nitrolite/build/getting-started/quickstart.mdx
  • docs/nitrolite/build/getting-started/prerequisites.mdx
  • docs/nitrolite/build/getting-started/key-terms.mdx
  • docusaurus.config.ts

Runnable example:

  • examples/nitrolite-v1-lifecycle/README.md
  • examples/nitrolite-v1-lifecycle/src/index.ts

Link-only ripple:

  • docs/nitrolite/learn/index.mdx
  • docs/nitrolite/learn/introduction/supported-chains.mdx

Validation

  • git diff --check
  • npm run build
  • cd examples/nitrolite-v1-lifecycle && npm install
  • cd examples/nitrolite-v1-lifecycle && npm run build
  • Live lifecycle run with native @yellow-org/sdk@1.2.1 on Sepolia yellow: home-channel prepare, app-session create, deposit, operate, withdraw, and app-session close all completed successfully.

The docs build still reports existing warnings from versioned 0.5.x and Clearnet contract docs, but this PR does not add new broken-link or broken-anchor warnings.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 7, 2026

Review Change Stack

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 9f173706-7775-46a1-af96-5ce3b26509c3

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

This PR completes the Nitrolite v1 documentation migration: replaces v0.5.x terminology with v1 concepts, rewrites prerequisites and quickstart guides, adds a comprehensive runnable lifecycle example, and updates site navigation accordingly.

Changes

Nitrolite v1 Documentation & Lifecycle Example

Layer / File(s) Summary
v1 Vocabulary & Concepts
docs/nitrolite/build/getting-started/key-terms.mdx
v1 terminology table with Channel, App Session, Asset, Vault, Decimal, Checkpoint, Challenge, and Transition types; includes channel status values, v1-specific mental models for preventing bugs (states-first settlement, exact ledger accounting, app sessions as commit/release), removing legacy v0.5.x term maps.
Prerequisites & System Setup
docs/nitrolite/build/getting-started/prerequisites.mdx
Node.js 20+ requirements; project creation and @yellow-org/sdk installation; updated tsconfig.json (include globs for src/*/* and scripts/**), package.json scripts (build, start); v1 .env template with USER_PRIVATE_KEY, APP_PRIVATE_KEY, NITRONODE_WS_URL, RPC_URL, CHAIN_ID; wallet setup using Client.create and conditional Nitronode connection.
Quickstart Guide: v1 Flow
docs/nitrolite/build/getting-started/quickstart.mdx
Quickstart rewritten for v1 native SDK: cloning examples/nitrolite-v1-lifecycle, home-channel preparation (approve/deposit/checkpoint), app-session creation with packed requests and dual signatures, sequential AppStateUpdate calls (Deposit/Operate/Withdraw/Close), expected output, and v1-specific next steps.
Legacy v0.5.x Reference
docs/nitrolite/build/quick-start/index.md
Preserved legacy quick-start guide for websocket-based MetaMask flows, session creation via createAppSessionMessage, instant payments, SimplePaymentApp class example, and message handlers.
Lifecycle Example Project
examples/nitrolite-v1-lifecycle/{.env.example, .gitignore, README.md, package.json, tsconfig.json}
New example project setup: environment template for test wallets, network config (Sepolia + Nitronode), deposit/operate/withdraw amounts, .gitignore for env/dist/node_modules, README documenting lifecycle steps, package.json with @yellow-org/sdk v1.2.1 and dev dependencies (TypeScript, Node types), TypeScript config targeting ES2022 with strict checks.
Lifecycle Example Implementation
examples/nitrolite-v1-lifecycle/src/index.ts
Complete ~544-line TypeScript example: loads and validates environment config (private keys, chain/asset, RPC/WS URLs, deposit amounts); connects user and app clients with signers; inspects node for chain/asset support; prepares home channel (acknowledge/approve/deposit/checkpoint); creates and funds app session; runs sequential Deposit/Operate/Withdraw/Close lifecycle updates with dual participant signatures; optionally closes and checkpoints home channel; cleanup in finally block.
Navigation & Routing Updates
docusaurus.config.ts, src/pages/nitrolite.tsx, docs/nitrolite/learn/index.mdx, docs/nitrolite/learn/introduction/supported-chains.mdx
Updated navbar "Build" item from doc-based route to direct path /nitrolite/build/getting-started/quickstart; footer "Nitrolite" → "Build" link retargeted; feature card and learn-page "Next Steps" Build links updated; "See Also" Quick Start link retargeted; activeBasePath set to /nitrolite/build.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • layer-3/docs#120: Implements overlapping v1 docs rework (SDK & protocol flows) and site navigation/versioning updates.
  • layer-3/docs#145: Shares reorganization of Nitrolite docs structure, routing, and docusaurus config changes.
  • layer-3/docs#132: Related migration of Getting Started/Quickstart/Prerequisites docs and Nitrolite v1 site navigation updates.

Suggested reviewers

  • dpatsora
  • nksazonov
  • philanton

Poem

🐰 Hops into v1 with joy and care,
Terms consolidated, examples everywhere,
From setup to state, a lifecycle so clear,
The docs now shine bright, no more legacy tear!
TypeScript and Sepolia, test wallets galore,
Migration complete—let's build and explore!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title 'YNU-864: Build front door rewrite' directly describes the main change—rewriting the Nitrolite Build entrypoint documentation and quickstart around the v1 SDK, which is the primary focus across all modified files.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/ynu-864-build-front-door-rewrite

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.

@ihsraham ihsraham force-pushed the feat/ynu-864-build-front-door-rewrite branch from 09b8a89 to 69b0bbc Compare May 7, 2026 06:11
@ihsraham ihsraham marked this pull request as ready for review May 7, 2026 10:20
@ihsraham ihsraham requested a review from dpatsora as a code owner May 7, 2026 10:20
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

🧹 Nitpick comments (5)
examples/nitrolite-v1-lifecycle/package.json (1)

8-9: ⚡ Quick win

Align Node typings with the declared runtime floor.

With engines.node at >=20.0.0, using @types/node 24 can allow Node 24–specific APIs to type-check successfully on the Node 20 runtime. Prefer @types/node@^20 to match the minimum supported version (or raise engines.node if Node 24 is the intent).

Suggested change
   "devDependencies": {
-    "@types/node": "^24.12.2",
+    "@types/node": "^20.17.0",
     "typescript": "~6.0.2"
   }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@examples/nitrolite-v1-lifecycle/package.json` around lines 8 - 9, The
engines.node entry is set to ">=20.0.0" but the package should not pull
`@types/node` that target newer Node major versions; update package.json to pin
the devDependency "@types/node" to a ^20 range (or alternatively raise
"engines.node" to ^24 if Node 24 is intended) so type definitions align with the
declared runtime floor—look for the "engines.node" field and the "@types/node"
entry in package.json to make this change.
docs/nitrolite/build/getting-started/quickstart.mdx (1)

117-130: 💤 Low value

Hardcoded version: 2n may confuse readers.

The snippet uses version: 2n literally, while the runnable example computes the next version with nextVersion(session). Readers copying this fragment without referring back to the example may submit a stale version after the first iteration. Consider replacing with nextVersion(session) (or session.version + 1n) and a brief note that allocations must reflect the previous session version.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/nitrolite/build/getting-started/quickstart.mdx` around lines 117 - 130,
Replace the hardcoded version value in the AppStateUpdateV1 object with a
computed next version (e.g., use nextVersion(session) or session.version + 1n)
so the update uses the correct incremented version; update the example where the
update object (named update) is created and submitted via
client.submitAppSessionDeposit to compute version dynamically and ensure the
allocations array reflects the balances from the previous session version as
noted.
examples/nitrolite-v1-lifecycle/src/index.ts (2)

73-80: 💤 Low value

CHANNEL_DEPOSIT_AMOUNT=0 passes validation but is semantically invalid.

decimalEnv accepts non-negative values, so CHANNEL_DEPOSIT_AMOUNT=0 would pass loadConfig. In prepareHomeChannel, depositAmount = max(channelDepositAmount, deficit) would then fall back to deficit, which is fine when there is a deficit but produces a 0 deposit when the home channel already has enough — currently harmless, but easy to regress later. Adding a > 0 invariant for CHANNEL_DEPOSIT_AMOUNT (mirroring APP_DEPOSIT_AMOUNT) makes the contract explicit.

♻️ Suggested validation
   const appDepositAmount = decimalEnv('APP_DEPOSIT_AMOUNT', '0.005');
   const operateAmount = decimalEnv('OPERATE_AMOUNT', '0.001');
   const withdrawAmount = decimalEnv('WITHDRAW_AMOUNT', '0.002');
+  const channelDepositAmount = decimalEnv('CHANNEL_DEPOSIT_AMOUNT', '0.01');

   if (!appDepositAmount.isPositive()) {
     throw new Error('APP_DEPOSIT_AMOUNT must be greater than zero');
   }
+  if (!channelDepositAmount.isPositive()) {
+    throw new Error('CHANNEL_DEPOSIT_AMOUNT must be greater than zero');
+  }
   if (operateAmount.plus(withdrawAmount).greaterThan(appDepositAmount)) {
     throw new Error('OPERATE_AMOUNT + WITHDRAW_AMOUNT must be <= APP_DEPOSIT_AMOUNT');
   }

   return {
     userPrivateKey,
     appPrivateKey,
     wsURL: requireEnv('NITRONODE_WS_URL'),
     rpcURL: requireEnv('RPC_URL'),
     chainId,
     asset,
-    channelDepositAmount: decimalEnv('CHANNEL_DEPOSIT_AMOUNT', '0.01'),
+    channelDepositAmount,
     appDepositAmount,

Also applies to: 110-110

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@examples/nitrolite-v1-lifecycle/src/index.ts` around lines 73 - 80, The
decimalEnv function currently allows zero which makes CHANNEL_DEPOSIT_AMOUNT=0
pass; update validation so decimalEnv enforces a strictly positive value (>0)
for deposit amounts used for CHANNEL_DEPOSIT_AMOUNT (and mirror the same check
applied to APP_DEPOSIT_AMOUNT at the other site), i.e., after creating amount in
decimalEnv (or a new helper), reject values that are zero or negative by
throwing an Error like `${name} must be a positive decimal amount` so callers
such as prepareHomeChannel never receive a zero depositAmount.

142-145: 💤 Low value

String-matched error handling is fragile across SDK versions.

Several recovery paths key off substrings of error.message (allowance|approval|approve, home blockchain is already set, already acknowledged, apps.v1 group is disabled, does not require a blockchain operation). If the SDK localizes, refactors, or capitalizes any of these strings, the example will start re-throwing on previously-handled paths. Consider:

  • Preferring typed errors / error codes from @yellow-org/sdk if exposed.
  • Adding a brief comment noting the SDK version this was validated against (1.2.1) so readers know to revisit on upgrade.

Also applies to: 243-251, 269-276, 371-378

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@examples/nitrolite-v1-lifecycle/src/index.ts` around lines 142 - 145, The
current error handling in isAllowanceError (and other message-regex checks
around the repo) relies on fragile substring matching of Error.message; replace
these with checks for SDK-specific error classes or error codes exposed by
`@yellow-org/sdk` (e.g., inspect error.name, a code property, or use instanceof
<SDKErrorClass> if available) and fallback to the existing regex only if
typed/code checks are absent; also add a single-line comment near
isAllowanceError noting the SDK version validated (1.2.1) so future upgraders
revisit these guards.
docs/nitrolite/build/getting-started/prerequisites.mdx (1)

180-184: 💤 Low value

Faucet link freshness.

sepoliafaucet.com (operated by Alchemy) has historically rotated/required signup; consider listing the Google Cloud Sepolia faucet or PoW Sepolia faucet as a backup so readers without an Alchemy account aren't blocked. Optional.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/nitrolite/build/getting-started/prerequisites.mdx` around lines 180 -
184, Update the "Sepolia" table row that currently points to
https://sepoliafaucet.com/ (the Sepolia faucet) to include one or two
alternative backup faucets so users who must sign up with Alchemy aren't
blocked; e.g., append or add links for the Google Cloud Sepolia faucet and the
PoW Sepolia faucet alongside the existing Alchemy link in the Sepolia row so all
three are shown (keep the existing link, add the new URLs and brief labels).
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@examples/nitrolite-v1-lifecycle/src/index.ts`:
- Around line 197-221: The function enableNodeLocalAccountTransactions currently
silently returns when the internal createEVMClients factory is missing; update
it to log a visible warning instead of silently returning: inside
enableNodeLocalAccountTransactions, where originalFactory is checked (the
early-return branch), emit a console.warn with a clear message that
createEVMClients could not be patched and LocalAccount preservation may not work
(use the suggested message text), then return; keep all other behavior (the
double-cast to ClientWithEVMFactory, the wrapping of createEVMClients, and the
writeContract override) unchanged.

---

Nitpick comments:
In `@docs/nitrolite/build/getting-started/prerequisites.mdx`:
- Around line 180-184: Update the "Sepolia" table row that currently points to
https://sepoliafaucet.com/ (the Sepolia faucet) to include one or two
alternative backup faucets so users who must sign up with Alchemy aren't
blocked; e.g., append or add links for the Google Cloud Sepolia faucet and the
PoW Sepolia faucet alongside the existing Alchemy link in the Sepolia row so all
three are shown (keep the existing link, add the new URLs and brief labels).

In `@docs/nitrolite/build/getting-started/quickstart.mdx`:
- Around line 117-130: Replace the hardcoded version value in the
AppStateUpdateV1 object with a computed next version (e.g., use
nextVersion(session) or session.version + 1n) so the update uses the correct
incremented version; update the example where the update object (named update)
is created and submitted via client.submitAppSessionDeposit to compute version
dynamically and ensure the allocations array reflects the balances from the
previous session version as noted.

In `@examples/nitrolite-v1-lifecycle/package.json`:
- Around line 8-9: The engines.node entry is set to ">=20.0.0" but the package
should not pull `@types/node` that target newer Node major versions; update
package.json to pin the devDependency "@types/node" to a ^20 range (or
alternatively raise "engines.node" to ^24 if Node 24 is intended) so type
definitions align with the declared runtime floor—look for the "engines.node"
field and the "@types/node" entry in package.json to make this change.

In `@examples/nitrolite-v1-lifecycle/src/index.ts`:
- Around line 73-80: The decimalEnv function currently allows zero which makes
CHANNEL_DEPOSIT_AMOUNT=0 pass; update validation so decimalEnv enforces a
strictly positive value (>0) for deposit amounts used for CHANNEL_DEPOSIT_AMOUNT
(and mirror the same check applied to APP_DEPOSIT_AMOUNT at the other site),
i.e., after creating amount in decimalEnv (or a new helper), reject values that
are zero or negative by throwing an Error like `${name} must be a positive
decimal amount` so callers such as prepareHomeChannel never receive a zero
depositAmount.
- Around line 142-145: The current error handling in isAllowanceError (and other
message-regex checks around the repo) relies on fragile substring matching of
Error.message; replace these with checks for SDK-specific error classes or error
codes exposed by `@yellow-org/sdk` (e.g., inspect error.name, a code property, or
use instanceof <SDKErrorClass> if available) and fallback to the existing regex
only if typed/code checks are absent; also add a single-line comment near
isAllowanceError noting the SDK version validated (1.2.1) so future upgraders
revisit these guards.
🪄 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: defaults

Review profile: CHILL

Plan: Pro

Run ID: bb08eef3-5a82-471f-b44c-ccfca0f141f8

📥 Commits

Reviewing files that changed from the base of the PR and between aaa62cd and e3e3706.

⛔ Files ignored due to path filters (1)
  • examples/nitrolite-v1-lifecycle/package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (14)
  • docs/nitrolite/build/getting-started/key-terms.mdx
  • docs/nitrolite/build/getting-started/prerequisites.mdx
  • docs/nitrolite/build/getting-started/quickstart.mdx
  • docs/nitrolite/build/quick-start/index.md
  • docs/nitrolite/learn/index.mdx
  • docs/nitrolite/learn/introduction/supported-chains.mdx
  • docusaurus.config.ts
  • examples/nitrolite-v1-lifecycle/.env.example
  • examples/nitrolite-v1-lifecycle/.gitignore
  • examples/nitrolite-v1-lifecycle/README.md
  • examples/nitrolite-v1-lifecycle/package.json
  • examples/nitrolite-v1-lifecycle/src/index.ts
  • examples/nitrolite-v1-lifecycle/tsconfig.json
  • src/pages/nitrolite.tsx
💤 Files with no reviewable changes (1)
  • docs/nitrolite/build/quick-start/index.md

Comment on lines +197 to +221
function enableNodeLocalAccountTransactions(client: Client): void {
const sdkClient = client as unknown as ClientWithEVMFactory;
const originalFactory = sdkClient.createEVMClients?.bind(client);
if (!originalFactory) {
return;
}

sdkClient.createEVMClients = (chainId: bigint, rpcURL: string): EVMClientFactoryResult => {
const result = originalFactory(chainId, rpcURL);
const walletClient = result.walletClient;
if (!walletClient?.account || !walletClient.writeContract) {
return result;
}

// Node.js public RPCs need the LocalAccount object when viem sends writes.
// Keep using SDK methods, but preserve the local account after simulation.
const localAccount = walletClient.account;
const originalWriteContract = walletClient.writeContract.bind(walletClient);
walletClient.writeContract = (request: Record<string, unknown>): Promise<Hex> => {
return originalWriteContract({ ...request, account: localAccount });
};

return result;
};
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🌐 Web query:

@yellow-org/sdk 1.2.1 Client createEVMClients public API documentation

💡 Result:

No public documentation found for a createEVMClients public API method in @yellow-org/sdk version 1.2.1. The official Yellow Network documentation at docs.yellow.org references the package '@yellow-org/sdk' in examples, but the primary client creation uses Client.create(endpoint, stateSigner, txSigner, ...) as shown in the TypeScript examples [1][2]. The API reference page exists but lacks detailed method listings for Client constructors in the available snippets [3]. No mentions of createEVMClients appear across searches of docs, npm, GitHub, or related sources. Version 1.2.1 specifics or changelog not found; docs indicate "Version: 1.x" generally [3]. Example usage for Client creation [1]: import { Client, createSigners, withBlockchainRPC } from '@yellow-org/sdk'; const { stateSigner, txSigner } = createSigners(process.env.PRIVATE_KEY!); const client = await Client.create( 'wss://clearnet-sandbox.yellow.com/ws', stateSigner, txSigner, withBlockchainRPC(80002n, process.env.RPC_URL!) ); Official docs: https://docs.yellow.org/docs/api-reference/ [3], examples: https://docs.yellow.org/docs/build/sdk/typescript/examples/ [1]. If this is an internal or unreleased method, check private repos or contact Yellow Network support.

Citations:


🏁 Script executed:

cat -n examples/nitrolite-v1-lifecycle/src/index.ts | sed -n '39,50p;197,221p'

Repository: layer-3/docs

Length of output: 1667


🏁 Script executed:

# Also check the ClientWithEVMFactory type definition more broadly
rg -A 10 "ClientWithEVMFactory" examples/nitrolite-v1-lifecycle/src/index.ts

Repository: layer-3/docs

Length of output: 824


🏁 Script executed:

# Check where enableNodeLocalAccountTransactions is called
rg -n "enableNodeLocalAccountTransactions" examples/nitrolite-v1-lifecycle/src/index.ts

# Check if there's any logging in the function or surrounding area
cat -n examples/nitrolite-v1-lifecycle/src/index.ts | sed -n '195,225p'

Repository: layer-3/docs

Length of output: 1671


🏁 Script executed:

# Check imports to see if console logging or logger is available
head -30 examples/nitrolite-v1-lifecycle/src/index.ts

Repository: layer-3/docs

Length of output: 735


Monkey-patching createEVMClients is fragile and silently fails.

enableNodeLocalAccountTransactions mutates an undocumented internal of Client (createEVMClients). The double cast through unknown as ClientWithEVMFactory bypasses TypeScript, already indicating this bypasses the public surface. The method is not listed in @yellow-org/sdk's official documentation.

The current implementation silently returns early if the factory is missing (line 200–202) with no warning. Any SDK refactor—rename, return-shape change, or upstream account-propagation fix—will cause this example to fail silently, with no indication that the patch is no longer working.

Add a warning when the patch fails to apply, so regressions surface in the example output:

if (!originalFactory) {
  console.warn(
    'Warning: enableNodeLocalAccountTransactions could not patch createEVMClients. ' +
    'The SDK shape may have changed. LocalAccount preservation may not work on Node.js public RPCs.'
  );
  return;
}

Additionally, consider opening an upstream issue with the SDK to fix this in @yellow-org/sdk itself, so the account preservation is handled upstream and this workaround is no longer needed.

[recommend_refactoring]

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@examples/nitrolite-v1-lifecycle/src/index.ts` around lines 197 - 221, The
function enableNodeLocalAccountTransactions currently silently returns when the
internal createEVMClients factory is missing; update it to log a visible warning
instead of silently returning: inside enableNodeLocalAccountTransactions, where
originalFactory is checked (the early-return branch), emit a console.warn with a
clear message that createEVMClients could not be patched and LocalAccount
preservation may not work (use the suggested message text), then return; keep
all other behavior (the double-cast to ClientWithEVMFactory, the wrapping of
createEVMClients, and the writeContract override) unchanged.

ihsraham added 2 commits May 8, 2026 12:27
Rewrite the Nitrolite Build entrypoint around the current v1 TypeScript SDK.

- Replace the old quickstart, prerequisites, and key terms pages with v1 setup guidance for @yellow-org/sdk.
- Remove the duplicate legacy quick-start route.
- Retarget Build navigation and existing Build links to the new getting-started quickstart.
- Keep the sandbox WebSocket URL as a clear placeholder until the public endpoint is finalized.
- Preserve faucet examples as hidden comments so they can be restored when the endpoint is ready.

This makes the first Build path match the current SDK while giving 0.5.x users a clear pointer to the compat package.
@ihsraham ihsraham force-pushed the feat/ynu-864-build-front-door-rewrite branch from e3e3706 to bd7a17d Compare May 8, 2026 07:43
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