Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
94 commits
Select commit Hold shift + click to select a range
b76f6c4
YNU-814: App Registry (#597)
dimast-x Mar 3, 2026
a18d933
YNU-716: fix(ChannelHub): apply fixes to ensure home-chain unhappy pa…
nksazonov Mar 3, 2026
d99aede
YNU-813: introduce basic rate limits (#600)
philanton Mar 3, 2026
3819c03
YNU-812: Introduce Gated Actions (#601)
dimast-x Mar 4, 2026
c55bd7c
YNU-834: Rename erc7824 org to layer-3 & Remove erc7824 docs (#603)
dimast-x Mar 5, 2026
9e33604
YNU-833: Add New Metrics (#605)
dimast-x Mar 5, 2026
4164816
chore(gomod): bump the gomod-dependencies group with 3 updates
dependabot[bot] Mar 5, 2026
a8f7672
YNU-810: Integrate Locking Contracts, SDK fixes, Cerebro Updates, Exa…
dimast-x Mar 7, 2026
209b39f
YNU-776: Clearnet Sandbox Deployment V1 (#608)
nksazonov Mar 7, 2026
f3ebde0
feat(sdk/ts-compat): Reconcile compat SDK with v1.2.0 — locking, regi…
ihsraham Mar 8, 2026
5bc6a72
YNU-776: Clearnet Sandbox Chart Updates (#610)
philanton Mar 8, 2026
7e430a8
[Snyk] Upgrade viem from 2.45.1 to 2.46.0 (#611)
hongtao023 Mar 8, 2026
63acd91
YNU-829: Update Data Models and Communication Flows diagrams (#616)
dimast-x Mar 9, 2026
8333822
YNU-829: Add Repository Documentation Guidelines (#617)
dimast-x Mar 11, 2026
5e34bfd
YNU-827: test(contracts): non home chain challenge flows (#620)
nksazonov Mar 12, 2026
d8f7e4a
YNU-797: feat(contracts/ChannelHub): add NodeBalanceUpdated event (#621)
nksazonov Mar 13, 2026
c909bc3
YNU-827: Nitrolite Protocol Documentation (#619)
philanton Mar 16, 2026
cfc166e
chore(gomod): bump the gomod-dependencies group across 1 directory wi…
dependabot[bot] Mar 16, 2026
bbf309b
[Snyk] Upgrade lucide-react from 0.563.0 to 0.564.0 (#614)
hongtao023 Mar 16, 2026
08f5f4a
[Snyk] Upgrade viem from 2.45.1 to 2.46.1 (#613)
hongtao023 Mar 16, 2026
3761707
[Snyk] Upgrade tailwind-merge from 3.4.0 to 3.4.1 (#612)
hongtao023 Mar 16, 2026
e37f45f
feat: add Clearnode Helmfile (#630)
philanton Mar 25, 2026
a8c66b9
YNU-856: optional action gateway and app registry on clearnode (#642)
philanton Apr 1, 2026
32dfde0
fix(docs): use correct node net flow directions
nksazonov Apr 3, 2026
5af98a6
chore(gomod): bump the gomod-dependencies group across 1 directory wi…
dependabot[bot] Apr 7, 2026
87f90e4
fix(sdk): add .js extensions to all ESM imports for Node.js compatibi…
ihsraham Apr 7, 2026
b0b09a1
[Snyk] Upgrade viem from 2.45.1 to 2.46.2 (#624)
v-0-0 Apr 7, 2026
3a41c38
[Snyk] Upgrade tailwind-merge from 3.4.0 to 3.5.0 (#625)
hongtao023 Apr 7, 2026
11d17db
[Snyk] Upgrade lucide-react from 0.563.0 to 0.575.0 (#626)
hongtao023 Apr 7, 2026
11d7b1a
chore(npm): bump picomatch from 2.3.1 to 2.3.2 in /sdk/ts (#632)
dependabot[bot] Apr 7, 2026
ebf7343
chore(npm): bump handlebars from 4.7.8 to 4.7.9 in /sdk/ts (#633)
dependabot[bot] Apr 7, 2026
5f1e5ed
[Snyk] Upgrade jest-util from 30.2.0 to 30.3.0 (#638)
dpatsora Apr 7, 2026
66e4462
[Snyk] Upgrade lucide-react from 0.563.0 to 0.577.0 (#652)
dpatsora Apr 9, 2026
ea5bffa
[Snyk] Upgrade viem from 2.45.1 to 2.47.4 (#653)
dpatsora Apr 9, 2026
e9d9877
YNU-858: prepare clearnode stress environment (#646)
philanton Apr 9, 2026
ee624ff
fix: apply audit findings, round 1
nksazonov Mar 30, 2026
7d97727
YNU-794: fix app session withdrawal deadlock (#683)
philanton Apr 15, 2026
31a40f2
chore: add Claude Code config + custom SDK MCP server (#635)
ihsraham Apr 16, 2026
f72f57a
fix(clearnode): rebase errors
nksazonov Apr 16, 2026
a1c0c67
Update CODEOWNERS (#689)
alessio Apr 17, 2026
6c0a41d
YNU-899: remove obsolete files (#682)
philanton Apr 20, 2026
c33a8bd
chore(gomod): bump the gomod-dependencies group with 6 updates (#678)
dependabot[bot] Apr 20, 2026
34ad6eb
chore(deps): bump the npm_and_yarn group across 1 directory with 2 up…
dependabot[bot] Apr 20, 2026
94a99aa
chore(gomod): bump github.com/jackc/pgx/v5 from 5.8.0 to 5.9.0 (#690)
dependabot[bot] Apr 20, 2026
45d6f71
chore(npm): bump vite from 6.4.1 to 6.4.2 in /sdk/ts/examples/example…
dependabot[bot] Apr 20, 2026
911c932
chore(npm): bump flatted from 3.3.3 to 3.4.2 in /sdk/ts (#692)
dependabot[bot] Apr 20, 2026
bbc4f55
YNU-798: monitor node liquidity on-chain and off-chain (#676)
philanton Apr 20, 2026
90ece2d
Refine ts-compat tooling and compatibility positioning (#697)
ihsraham Apr 21, 2026
8681166
Fix TS SDK raw RPC drift and on-chain balance surface (#698)
ihsraham Apr 21, 2026
d715b5f
YNU-900: stamp application_id on writes and expose via SDKs (#696)
philanton Apr 22, 2026
1b70c80
feat(clearnode): adopt resource profiles for per-env clearnode sizing…
philanton Apr 24, 2026
b796651
YNU-905: feat: middle audit deploy (#694)
nksazonov Apr 28, 2026
04619fe
fix: audit findings round 2 (#713)
nksazonov Apr 28, 2026
c0a5850
YNU-898: refactor: rename clearnode to nitronode (#715)
philanton Apr 30, 2026
67cbff6
YNU-779: feat(nitronode/metrics): saturation + DB latency + label hyg…
philanton May 1, 2026
4d94fac
M3-L01: fix(nitronode): persist home channel challenge state (#720)
philanton May 4, 2026
4adaabe
YNU-869: Guard TS SDK drift and CI validation (#701)
ihsraham May 5, 2026
2705e5d
chore(gomod): bump github.com/jackc/pgx/v5 from 5.9.0 to 5.9.2 (#703)
dependabot[bot] May 5, 2026
85bfbff
chore(npm): bump postcss from 8.5.6 to 8.5.10 in /sdk/ts/examples/exa…
dependabot[bot] May 5, 2026
50b57bf
chore(gomod): bump the gomod-dependencies group across 1 directory wi…
dependabot[bot] May 5, 2026
ebb77e7
chore(sdk): set explicit rootDir for TS 6 compat (#721)
philanton May 5, 2026
2f02556
chore(npm): bump the npm-dependencies group across 2 directories with…
dependabot[bot] May 5, 2026
6d26207
YNU-869: Refine ts-compat runtime migration surface (#699)
ihsraham May 6, 2026
53fe65f
YNU-869: Add TS SDK protocol drift guards (#705)
ihsraham May 6, 2026
d585fbe
YNU-912: Package SDK MCP for npm publishing (#716)
ihsraham May 6, 2026
c5581cf
chore(gomod): bump Go toolchain to 1.25.9 (#725)
philanton May 7, 2026
b76fd48
Harden SDK MCP release workflow and deps (#736)
ihsraham May 8, 2026
8449372
Fix SDK acknowledgement before home channel creation (#734)
ihsraham May 12, 2026
80af194
YNU-941: apply final round audit findings (#758)
philanton May 13, 2026
df4e110
fix: audit findings round final 2 (#773)
nksazonov May 19, 2026
b983b23
YNU-915: return success on absent-resource GET endpoints (#748)
philanton May 19, 2026
5922d17
YNU-917: reset stale store gauges and seed bounded counters (#747)
philanton May 21, 2026
76cc8d2
YNU-922: deploy stress test v1.3.0 (#774)
nksazonov May 21, 2026
e07ad9c
YNU-918: treat past expires_at as session-key revocation (#775)
philanton May 21, 2026
b88d511
YNU-859: feat: deploy sandbox to eth sepolia, linea sepolia, amoy, ba…
nksazonov May 22, 2026
31b1395
YNU-859: feat: deploy v1 sandbox env (#785)
nksazonov May 25, 2026
5ce6458
YNU-859: feat: deploy v1 prod (#783)
nksazonov May 25, 2026
6c796fc
fix: audit findings round final 3 (#787)
philanton May 25, 2026
0820c29
fix: make fXRP token an XRP asset, add XRPL EVM USDT, fix Linea USTD …
nksazonov May 26, 2026
0c705e5
YNU-911: feat(playground): channel ops UI with session-key support (#…
philanton May 27, 2026
e3005c0
feat(faucet-app): migrate faucet-app into nitrolite repo (#776)
nksazonov May 27, 2026
cdb60ca
feat(sdk): add round-robin test example for Go and TS SDKs (#789)
philanton May 27, 2026
342a69b
chore(gomod): bump the gomod-dependencies group across 1 directory wi…
dependabot[bot] May 27, 2026
3ad3b3a
chore(deps): bump qs from 6.15.0 to 6.15.2 in /sdk/mcp in the npm_and…
dependabot[bot] May 27, 2026
3a46dfd
chore(npm): bump ws from 8.18.3 to 8.20.1 in /sdk/ts (#777)
dependabot[bot] May 27, 2026
8b5c8d7
chore(deps): bump esbuild and vite in /playground (#792)
dependabot[bot] May 27, 2026
c2af21b
chore(npm): bump the npm-dependencies group across 3 directories with…
dependabot[bot] May 27, 2026
84a7e81
Fix npm audit findings in TypeScript SDK packages (#781)
ihsraham May 27, 2026
b9931f1
feat(playground): session key management tab (#795)
nksazonov May 27, 2026
e0b5233
feat(faucet-app): toggle per-IP rate limit + move flood protection to…
philanton May 27, 2026
fa1c885
feat(playground): containerise and add Helm chart for deploy (#794)
philanton May 27, 2026
ff2f371
chore(release): v1.3.0
philanton May 28, 2026
2d44933
chore(sdk/mcp): bump server.json version to 1.3.0
philanton May 28, 2026
b63823b
chore(release): absorb stable into release/v1.3.0
philanton May 28, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
11 changes: 11 additions & 0 deletions .claude/rules/go.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
paths:
- "**/*.go"
---

- Follow standard Go conventions: `gofmt`, exported names have doc comments.
- Error handling: always check and return errors, never ignore with `_`.
- Use the functional options pattern for configuration (see `sdk/go/config.go`).
- Shared packages live in `pkg/` — check there before creating new utilities.
- Test files go in the same package with `_test.go` suffix.
- Run tests from repo root: `go test ./sdk/go/...` (scoped) or `go test ./...` (all).
12 changes: 12 additions & 0 deletions .claude/rules/solidity.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
paths:
- "contracts/**/*.sol"
---

- Foundry project — use `forge build`, `forge test`, `forge fmt`.
- NatSpec comments on all public/external functions.
- Security first: validate all inputs, check for reentrancy, use OpenZeppelin where applicable.
- Test files in `contracts/test/` with `.t.sol` extension.
- Gas optimization matters — avoid unnecessary storage writes.
- Style guide: https://github.com/layer-3/clearsync/blob/master/contracts/solidity-style-guide.md
- Development practices: https://github.com/layer-3/clearsync/blob/master/contracts/solidity-development-practices.md
13 changes: 13 additions & 0 deletions .claude/rules/typescript.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
paths:
- "sdk/**/*.ts"
- "sdk/**/*.tsx"
---

- Use `const` by default, `let` only when reassignment is needed. No `var`.
- Prefer `viem` over `ethers.js` for Ethereum interactions in production code.
- All public API functions must be exported through the barrel `index.ts`.
- Use strict TypeScript — no `any` unless absolutely unavoidable (e.g., RPC wire types).
- Async functions preferred over raw Promise chains.
- Test files use `.test.ts` extension (not `.spec.ts`).
- When modifying sdk-compat: never barrel re-export SDK classes (SSR risk). Only `export type` is safe.
35 changes: 35 additions & 0 deletions .claude/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"permissions": {
"allow": [
"Bash(npm test*)",
"Bash(npm run build*)",
"Bash(npm run typecheck*)",
"Bash(npm run lint*)",
"Bash(npm run clean*)",
"Bash(npx jest*)",
"Bash(npx prettier*)",
"Bash(npx tsx *)",
"Bash(go test *)",
"Bash(go build *)",
"Bash(go vet *)",
"Bash(go run *)",
"Bash(forge build*)",
"Bash(forge test*)",
"Bash(forge fmt*)",
"Bash(git status*)",
"Bash(git log*)",
"Bash(git diff*)",
"Bash(git branch*)",
"Bash(gh pr *)",
"Bash(gh issue *)",
"Bash(gh run *)"
],
"deny": [
"Bash(git push --force*)",
"Bash(git reset --hard*)",
"Bash(rm -rf *)",
"Bash(*>.env*)",
"Bash(npm publish*)"
]
}
}
21 changes: 21 additions & 0 deletions .claude/skills/build-sdk/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
name: build-sdk
description: Build SDK packages in the correct dependency order
allowed-tools: Bash, Read
---

Build SDK packages for: $ARGUMENTS

**Important:** sdk/ts-compat depends on sdk/ts via `"@yellow-org/sdk": "file:../ts"`. Always respect build order.

1. If $ARGUMENTS is "all" or empty, build everything in order:
- `cd sdk/ts && npm run build` (this runs tests then tsc)
- `cd sdk/ts-compat && npm run build`
- `go build ./sdk/go/...`

2. If $ARGUMENTS specifies a single package, build just that:
- "ts" -> `cd sdk/ts && npm run build`
- "ts-compat" or "compat" -> check sdk/ts/dist/ exists first; if not, build sdk/ts first, then `cd sdk/ts-compat && npm run build`
- "go" -> `go build ./sdk/go/...`

3. Report build success/failure for each package with any error details.
18 changes: 18 additions & 0 deletions .claude/skills/lint/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
name: lint
description: Run linters and formatters for the appropriate language
allowed-tools: Bash, Read
---

Lint and check formatting for: $ARGUMENTS

Route to the correct linter based on context:

- **sdk/ts/** -> `cd sdk/ts && npm run lint && npx prettier --check .`
- **sdk/ts-compat/** -> `cd sdk/ts-compat && npm run typecheck` (no dedicated lint script; typecheck is the closest)
- **contracts/** -> `cd contracts && forge fmt --check`
- **Go code** -> `go vet ./...` from repo root (or scope to specific path like `./sdk/go/...`)

If no arguments provided, run all applicable linters and report a summary.

Report any issues found. Suggest fixes but do not auto-apply unless the user asks.
27 changes: 27 additions & 0 deletions .claude/skills/review-pr/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
name: review-pr
description: Thorough code review of current changes or a specific PR
allowed-tools: Bash, Read, Grep, Glob
---

Review changes for: $ARGUMENTS

1. **Get the diff:**
- If $ARGUMENTS is a PR number: `gh pr diff $ARGUMENTS`
- If no arguments: `git diff` and `git diff --staged` for uncommitted changes

2. **For each changed file, check:**
- **Correctness:** Does the logic do what it claims? Any off-by-one errors, race conditions, or wrong assumptions?
- **Types:** Are TypeScript types accurate and strict? Are Go errors properly handled?
- **Security:** No exposed secrets, no injection vectors, no reentrancy (contracts), no XSS
- **Tests:** Are new functions tested? Are edge cases and error paths covered?
- **Exports:** If public API changed, is the barrel `index.ts` updated? (sdk-compat: no SSR-unsafe re-exports)
- **Docs:** If behavior changed, are README/CLAUDE.md/migration docs updated?
- **Style:** Consistent with existing patterns in the file and project conventions

3. **Categorize findings:**
- **CRITICAL:** Must fix before merge (bugs, security issues, data loss risk)
- **WARNING:** Should fix (missing tests, poor error handling, incomplete docs)
- **SUGGESTION:** Nice to have (naming improvements, minor refactors, style tweaks)

4. **Give an overall verdict:** APPROVE / REQUEST CHANGES / COMMENT
28 changes: 28 additions & 0 deletions .claude/skills/test/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
name: test
description: Run tests for a specific module or the whole project
allowed-tools: Bash, Read, Grep, Glob
---

Run tests for: $ARGUMENTS

Detect the target module and run the appropriate test command:

1. If $ARGUMENTS names a specific file or directory, use that to determine the module
2. If no arguments, detect from the current working directory or recently edited files

Route to the correct test runner:
- **sdk/ts/** -> `cd sdk/ts && npm test`
- **sdk/ts-compat/** -> `cd sdk/ts-compat && npm test`
- **sdk/go/** or Go files under sdk/go/ -> `go test ./sdk/go/... -v` (from repo root)
- **contracts/** or .sol files -> `cd contracts && forge test`
- **nitronode/** -> `go test ./nitronode/... -v` (from repo root)
- **test/integration/** -> `cd test/integration && npm test`
- **Repo root with no argument** -> run `go test ./...` (Go packages only — does NOT cover `sdk/ts`, `sdk/ts-compat`, `contracts`, or `test/integration`). Ask the user to specify a target for non-Go tests.

If a specific test file is given (e.g., `sdk/ts/test/unit/utils.test.ts`), run only that file:
- For Jest: `cd sdk/ts && npx jest test/unit/utils.test.ts`
- For Go: resolve the file's containing package, then run `go test ./sdk/go/<pkg> -run '^TestName$'`
- For Forge: `cd contracts && forge test --match-path test/MyTest.t.sol`

Report results: pass count, fail count, and any error details.
18 changes: 18 additions & 0 deletions .claude/skills/typecheck/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
name: typecheck
description: Run TypeScript type checking across SDK packages
allowed-tools: Bash, Read
---

Run typecheck for: $ARGUMENTS

1. If $ARGUMENTS specifies a package ("ts", "ts-compat", or "both"), check that package
2. If no arguments, check both TypeScript packages:

```bash
cd sdk/ts && npm run typecheck
cd sdk/ts-compat && npm run typecheck
```

3. Report any type errors with file paths and line numbers
4. If the user asks about Go type checking, suggest `go vet ./...` instead
82 changes: 82 additions & 0 deletions .cursorrules
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# Nitrolite — Cursor Rules

## What This Project Is

Nitrolite is a state channel protocol for Ethereum/EVM blockchains. Off-chain instant transactions with on-chain security. The repo contains: Solidity contracts (Foundry), a Go nitronode broker (renamed from clearnode), TypeScript + Go SDKs, and MCP servers for AI tooling.

## Architecture

- **Channels**: State containers between a User and a Node. Hold asset allocations, support off-chain state updates.
- **States**: Versioned allocations. Each new state = previous version + 1. Mutually signed states are enforceable on-chain.
- **Nitronode** (formerly Clearnode): Off-chain broker. WebSocket JSON-RPC. Wire format: `{ "req": [REQUEST_ID, METHOD, PARAMS, TIMESTAMP], "sig": ["SIGNATURE"] }`
- **App Sessions**: Multi-party extensions on channels with quorum-based governance (weight + threshold voting).

## TypeScript SDK Conventions

- `@yellow-org/sdk` = v1 protocol SDK (use for all new code)
- `@yellow-org/sdk-compat` = bridges 0.5.x API surface to v1 runtime (migration only, wraps Client with NitroliteClient)
- V1 API source of truth: `docs/api.yaml`. Do NOT reference `docs/legacy/API.md` for v1 methods (it has 0.5.x names)
- Use `const` by default, `let` only when reassignment is needed. No `var`.
- Prefer `viem` over `ethers.js` for Ethereum interactions.
- All public API functions exported through barrel `index.ts`.
- Strict TypeScript — no `any` unless unavoidable (e.g., RPC wire types).
- Async functions preferred over raw Promise chains.
- Tests: `.test.ts` extension, Jest. Run: `cd sdk/ts && npm test`
- sdk-compat: NEVER barrel re-export SDK classes (SSR risk). Only `export type` is safe.
- Build order: `sdk/ts` must build before `sdk/ts-compat`.

## Go SDK Conventions

- Module: `github.com/layer-3/nitrolite` (root go.mod, Go 1.25)
- Follow standard Go: `gofmt`, exported names have doc comments.
- Error handling: always check and return errors, never ignore with `_`.
- Functional options pattern for configuration (see `sdk/go/config.go`).
- Shared packages in `pkg/` — check there before creating new utilities.
- Tests: `_test.go` suffix, same package. Run from repo root: `go test ./sdk/go/...`
- Use `context.Context` for all async operations, `github.com/shopspring/decimal` for amounts.

## Solidity Conventions

- Foundry project: `forge build`, `forge test`, `forge fmt`.
- NatSpec comments on all public/external functions.
- Security first: validate inputs, check reentrancy, use OpenZeppelin.
- Tests in `contracts/test/` with `.t.sol` extension.
- Gas optimization matters — avoid unnecessary storage writes.
- Style guide: https://github.com/layer-3/clearsync/blob/master/contracts/solidity-style-guide.md
- Development practices: https://github.com/layer-3/clearsync/blob/master/contracts/solidity-development-practices.md

## Key SDK Methods (Both TS and Go)

- `Deposit(chainId, asset, amount)` — deposit funds, creates channel if needed
- `Transfer(recipient, asset, amount)` — off-chain instant transfer
- `Checkpoint(asset)` — submit co-signed state to blockchain (required after deposit, withdraw, close)
- `CloseHomeChannel(asset)` — prepare finalize state (follow with Checkpoint)
- `CreateAppSession(definition, sessionData, quorumSigs)` — create multi-party session
- `SubmitAppState(appStateUpdate, quorumSigs)` — submit app state (Operate, Withdraw, or Close intent)
- `GetChannels(wallet)`, `GetBalances(wallet)`, `GetConfig()` — queries

> No `CloseAppSession()` exists on the SDK Client. Close via `SubmitAppState` with Close intent.

## Key Reference Files

- Protocol description: `protocol-description.md`
- Smart contract invariants: `contracts/SECURITY.md`
- Main SC entrypoint: `contracts/src/ChannelHub.sol` (design: `contracts/suggested-contract-design.md`)
- Nitronode logic: `nitronode/README.md`, `docs/legacy/`
- Advanced protocol docs: `docs/protocol/`

## Commit Convention

```
feat|fix|chore|test|docs(scope): description
```
Examples: `feat(sdk/ts): add transfer batching`, `fix(sdk-compat): export missing type`

## Common Mistakes to Avoid

- Don't use `ethers.js` — use `viem` for Ethereum interactions
- Don't ignore Go errors with `_`
- Don't barrel re-export classes in sdk-compat (causes SSR failures)
- Don't run `npm test && npm run build` in sdk/ts (double-tests; build already runs tests)
- Don't edit `.env` files or commit secrets
- Don't create new utilities without checking `pkg/` first (Go)
14 changes: 5 additions & 9 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,21 +1,17 @@
.dockerignore
.gitignore
.gitmodules
docker-compose.yml
.git/
.github/
LICENSE
contracts/
docs/
sdk/ts/
test/

*.md

# clearnode
clearnode/Dockerfile
clearnode/.gitignore
clearnode/docs/
clearnode/chart/
clearnode/scripts/
clearnode/docker-compose.yml
# nitronode
nitronode/Dockerfile
nitronode/.gitignore
nitronode/docs/
nitronode/chart/
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# CODEOWNERS: https://help.github.com/articles/about-codeowners/

# Yellow Network - Research and Development
* @alessio @dimast-x @nksazonov @philanton @ihsraham
* @dimast-x @nksazonov @philanton @ihsraham
61 changes: 61 additions & 0 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Nitrolite Copilot Instructions

Nitrolite is a state channel protocol for Ethereum/EVM blockchains — off-chain instant transactions with on-chain security. Repo contains: Solidity contracts (Foundry), Go nitronode broker (renamed from clearnode), TypeScript + Go SDKs.

## Architecture

- Channels: state containers between User and Node, hold asset allocations
- States: versioned allocations, each version = previous + 1, mutually signed = enforceable on-chain
- Nitronode (formerly Clearnode): off-chain broker, WebSocket JSON-RPC wire format
- App Sessions: multi-party extensions with quorum-based governance

## TypeScript SDK (`@yellow-org/sdk`)

- `@yellow-org/sdk` = v1 protocol SDK. Use for all new code.
- `@yellow-org/sdk-compat` = bridges 0.5.x API to v1 runtime. Migration only. Wraps Client with NitroliteClient.
- V1 API source of truth: `docs/api.yaml`. `docs/legacy/API.md` has 0.5.x method names.
- Use `const` by default, `viem` over `ethers.js`, strict TypeScript (no `any`)
- All public API through barrel `index.ts`, async/await preferred
- Tests: `.test.ts`, Jest. Run: `cd sdk/ts && npm test`
- Build order: `sdk/ts` before `sdk/ts-compat`
- sdk-compat: NEVER barrel re-export classes (SSR risk), only `export type`

## Go SDK (`github.com/layer-3/nitrolite/sdk/go`)

- Root go.mod, Go 1.25. Standard Go: `gofmt`, doc comments on exports
- Always check errors, never ignore with `_`
- Functional options pattern (`sdk/go/config.go`), shared utils in `pkg/`
- Tests: `_test.go`, run from repo root: `go test ./sdk/go/...`
- Use `context.Context`, `github.com/shopspring/decimal` for amounts

## Solidity (`contracts/`)

- Foundry: `forge build`, `forge test`, `forge fmt`
- NatSpec on public/external functions, security-first, OpenZeppelin
- Tests: `.t.sol` in `contracts/test/`
- Style: https://github.com/layer-3/clearsync/blob/master/contracts/solidity-style-guide.md
- Practices: https://github.com/layer-3/clearsync/blob/master/contracts/solidity-development-practices.md

## Key SDK Methods (both TS and Go)

Deposit, Transfer, Checkpoint (required after deposit/withdraw/close), CloseHomeChannel (follow with Checkpoint), CreateAppSession (definition, sessionData, quorumSigs), SubmitAppState (appStateUpdate, quorumSigs — use Close intent to close sessions), GetChannels(wallet), GetBalances(wallet), GetConfig

> No CloseAppSession() on SDK Client. Close via SubmitAppState with Close intent.

## Key Reference Files

- Protocol description: `protocol-description.md`
- Smart contract invariants: `contracts/SECURITY.md`
- Main SC entrypoint: `contracts/src/ChannelHub.sol` (design: `contracts/suggested-contract-design.md`)
- Nitronode logic: `nitronode/README.md`, `docs/legacy/`
- Advanced protocol docs: `docs/protocol/`

## Commits

`feat|fix|chore|test|docs(scope): description`

## Avoid

- ethers.js (use viem), ignoring Go errors, barrel re-exporting classes in sdk-compat
- Running `npm test && npm run build` in sdk/ts (build already runs tests)
- Editing .env files, committing secrets
Loading
Loading