Add beginner Hello GenLayer example and README guide#19
Add beginner Hello GenLayer example and README guide#19vansham wants to merge 2 commits intogenlayerlabs:mainfrom
Conversation
Added a minimal GenLayer contract example and updated README to help beginners understand basic contract structure and deployment.
Added documentation explaining the new Hello GenLayer example contract and how beginners can use it.
📝 WalkthroughWalkthroughIntroduces a new beginner-friendly GenLayer contract example ( Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (3)
examples/hello_genlayer.py (1)
4-4: Star import is acceptable for GenLayer contracts, but explicit import improves IDE support.The Ruff warnings (F403, F405) about
glbeing undefined are false positives—glis exported from thegenlayerpackage. However, for better IDE autocompletion and static analysis, consider an explicit import.💡 Optional: Use explicit import
-from genlayer import * +import genlayer as glfrontend/README.md (2)
86-104: Consider moving this section to the repository's root README.This documentation describes a contract example in
examples/hello_genlayer.py, which isn't frontend-specific. Thefrontend/README.mdis focused on the Next.js application setup and features. For better discoverability and consistency:
- Move this section to the root
README.md, or- Create an
examples/README.mdfor example-specific documentationThis keeps the frontend README focused on frontend concerns and places the contract example documentation closer to the example itself.
90-91: Minor: Format the file path as inline code for consistency.📝 Suggested formatting
File: -examples/hello_genlayer.py +`examples/hello_genlayer.py`
📜 Review details
Configuration used: defaults
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
examples/hello_genlayer.pyfrontend/README.md
🧰 Additional context used
🧠 Learnings (5)
📓 Common learnings
Learnt from: CR
Repo: genlayerlabs/genlayer-project-boilerplate PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-10T12:30:13.640Z
Learning: Follow the development workflow: ensure GenLayer Studio is running, select network with `genlayer network`, deploy contract with `npm run deploy`, update frontend environment variable, and run frontend with `cd frontend && bun dev`
Learnt from: CR
Repo: genlayerlabs/genlayer-project-boilerplate PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-10T12:30:13.640Z
Learning: Applies to contracts/**/*.py : Contracts are Python files in `/contracts/` using the GenLayer SDK with Python class syntax
Learnt from: CR
Repo: genlayerlabs/genlayer-project-boilerplate PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-10T12:30:13.640Z
Learning: Applies to frontend/lib/genlayer/client.ts : Maintain GenLayer client initialization in `frontend/lib/genlayer/client.ts`
Learnt from: CR
Repo: genlayerlabs/genlayer-project-boilerplate PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-10T12:30:13.640Z
Learning: Reference the complete SDK API documentation at https://sdk.genlayer.com/main/_static/ai/api.txt when implementing contracts and integrations
📚 Learning: 2025-12-10T12:30:13.640Z
Learnt from: CR
Repo: genlayerlabs/genlayer-project-boilerplate PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-10T12:30:13.640Z
Learning: Applies to contracts/**/*.py : Contracts are Python files in `/contracts/` using the GenLayer SDK with Python class syntax
Applied to files:
examples/hello_genlayer.pyfrontend/README.md
📚 Learning: 2025-12-10T12:30:13.640Z
Learnt from: CR
Repo: genlayerlabs/genlayer-project-boilerplate PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-10T12:30:13.640Z
Learning: Applies to frontend/lib/genlayer/client.ts : Maintain GenLayer client initialization in `frontend/lib/genlayer/client.ts`
Applied to files:
frontend/README.md
📚 Learning: 2025-12-10T12:30:13.640Z
Learnt from: CR
Repo: genlayerlabs/genlayer-project-boilerplate PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-10T12:30:13.640Z
Learning: Follow the development workflow: ensure GenLayer Studio is running, select network with `genlayer network`, deploy contract with `npm run deploy`, update frontend environment variable, and run frontend with `cd frontend && bun dev`
Applied to files:
frontend/README.md
📚 Learning: 2025-12-10T12:30:13.640Z
Learnt from: CR
Repo: genlayerlabs/genlayer-project-boilerplate PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-10T12:30:13.640Z
Learning: Reference the complete SDK API documentation at https://sdk.genlayer.com/main/_static/ai/api.txt when implementing contracts and integrations
Applied to files:
frontend/README.md
🪛 Ruff (0.14.10)
examples/hello_genlayer.py
4-4: from genlayer import * used; unable to detect undefined names
(F403)
6-6: gl may be undefined, or defined from star imports
(F405)
12-12: gl may be undefined, or defined from star imports
(F405)
16-16: gl may be undefined, or defined from star imports
(F405)
🔇 Additional comments (1)
examples/hello_genlayer.py (1)
6-18: LGTM! Clean beginner-friendly contract example.The contract correctly demonstrates:
- State variable declaration with type annotation (
message: str)- Constructor initialization (
__init__)- Read method with
@gl.public.viewdecorator- Write method with
@gl.public.writedecoratorThis is a well-structured example that aligns with GenLayer SDK patterns. Based on learnings, contracts use Python class syntax with the GenLayer SDK.
|
Hi team, |
This PR adds a beginner-friendly Hello GenLayer contract example and improves the README with step-by-step usage instructions.
Changes:
This improves the GenLayer boilerplate by making onboarding easier for first-time builders.
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.