Skip to content

feat: Add Steel and Poseidon framework implementations for transfer-sol and account-data#570

Open
wangxiaofei860208-source wants to merge 2 commits intosolana-developers:mainfrom
wangxiaofei860208-source:add-steel-framework-implementations
Open

feat: Add Steel and Poseidon framework implementations for transfer-sol and account-data#570
wangxiaofei860208-source wants to merge 2 commits intosolana-developers:mainfrom
wangxiaofei860208-source:add-steel-framework-implementations

Conversation

@wangxiaofei860208-source
Copy link
Copy Markdown

@wangxiaofei860208-source wangxiaofei860208-source commented Apr 17, 2026

Steel Framework Implementation for Solana Program Examples

Summary

This PR adds Steel framework implementations for two basic Solana programs:

  1. transfer-sol - Demonstrates SOL transfers using both CPI and direct lamport manipulation
  2. account-data - Demonstrates creating and storing structured data in program-owned accounts

What is Steel?

Steel is a lightweight Solana program framework (v4.0.4) by Regolith Labs that provides:

  • Minimal boilerplate with helper macros (account!, instruction!, error!, event!)
  • Byte-based serialization using bytemuck (Pod/Zeroable traits)
  • Account validation helpers (is_signer(), is_writable(), has_owner(), etc.)
  • Type-safe instruction parsing with parse_instruction()
  • Chainable validation methods for cleaner code

Implementation Details

Directory Structure

Each implementation follows the established pattern:

basics/{program-name}/steel/
├── program/
│   ├── Cargo.toml
│   ├── src/
│   │   └── lib.rs
│   └── tests/
│       └── test.rs
├── tests/
│   ├── test.ts
│   └── instruction.ts (transfer-sol only)
├── package.json
└── tsconfig.json

Key Features

transfer-sol/steel:

  • Implements two transfer methods: CPI via system program and direct lamport manipulation
  • Uses Steel's parse_instruction() for type-safe instruction parsing
  • Demonstrates Steel's account validation helpers
  • Includes both Rust (litesvm) and TypeScript (solana-bankrun) tests

account-data/steel:

  • Creates program-owned accounts with structured data
  • Uses bytemuck for zero-copy serialization
  • Demonstrates rent calculation and account creation via CPI
  • Fixed-size byte arrays for string fields (32 bytes each)

Testing

Both implementations include:

  • Rust unit tests using litesvm (program/tests/test.rs)
  • TypeScript integration tests using solana-bankrun (tests/test.ts)
  • Full test coverage matching existing framework implementations

Build Commands

# Build program
pnpm build

# Run tests
pnpm build-and-test

# Deploy
pnpm deploy

Changes Made

Modified Files

  • Cargo.toml - Added steel/program workspace members and steel dependency

New Files

  • basics/transfer-sol/steel/ - Complete Steel implementation
  • basics/account-data/steel/ - Complete Steel implementation

Bounty Information

This PR is submitted for the Superteam Earn bounty: "Create Solana Programs: Part 1"

  • Bounty ID: 3a73f71c-5cc4-4b72-ae63-028651ed3655
  • Reward: $200-500 USDC per program per framework
  • Framework: Steel (new framework addition)
  • Programs: transfer-sol ($200), account-data ($300)

Testing Checklist

  • Programs compile successfully with cargo check
  • Rust tests pass with cargo test
  • TypeScript tests use solana-bankrun
  • Code formatted with Biome (pnpm fix)
  • Follows existing project structure
  • Package.json includes required scripts
  • Workspace Cargo.toml updated

Related Documentation


Author: Claude Opus 4.6 (wangxiaofei860208-source)
Submitted: 2026-04-17


Update: Poseidon Framework Added

This PR now includes both Steel and Poseidon framework implementations.

Poseidon Framework Implementation for Solana Program Examples

Summary

This PR adds Poseidon framework implementations for two basic Solana programs:

  1. transfer-sol - Demonstrates SOL transfers using SystemProgram CPI
  2. account-data - Demonstrates creating and storing structured data in program-owned accounts

What is Poseidon?

Poseidon is a TypeScript-to-Anchor transpiler framework by Turbin3 that enables developers to write Solana on-chain programs using TypeScript. The framework:

  • Transpiles TypeScript code to Anchor/Rust
  • Provides TypeScript-native syntax for Solana program development
  • Lowers the barrier to entry for web developers new to Solana
  • Generates production-ready Anchor code

Note: Poseidon is currently recommended for learning and testnet experimentation, not production mainnet applications.

Implementation Details

Directory Structure

Each implementation follows the established pattern with an additional TypeScript source directory:

basics/{program-name}/poseidon/
├── typescript/
│   └── {program_name}.ts (TypeScript source)
├── program/
│   ├── Cargo.toml
│   └── src/
│       └── lib.rs (transpiled Anchor code)
├── tests/
│   └── test.ts
├── Anchor.toml
├── package.json
└── tsconfig.json

Key Features

transfer-sol/poseidon:

  • TypeScript source demonstrates SystemProgram.transfer usage
  • Transpiled to Anchor code with proper CPI handling
  • Uses anchor-bankrun for testing
  • Follows Anchor 1.0.0 patterns

account-data/poseidon:

  • Creates program-owned accounts with structured data (name, house_number, street, city)
  • Uses PDA derivation with seeds
  • Demonstrates Anchor's InitSpace derive macro
  • String fields with max_len constraints

Testing

Both implementations include:

  • TypeScript integration tests using anchor-bankrun
  • Jest test framework
  • Full test coverage matching existing framework implementations

Build Commands

# Build program
pnpm build

# Run tests
pnpm build-and-test

# Deploy
pnpm deploy

Changes Made

Modified Files

  • Cargo.toml - Added poseidon/program workspace members

New Files

  • basics/transfer-sol/poseidon/ - Complete Poseidon implementation
  • basics/account-data/poseidon/ - Complete Poseidon implementation

Bounty Information

This PR is submitted for the Superteam Earn bounty: "Create Solana Programs: Part 1"

  • Bounty ID: 3a73f71c-5cc4-4b72-ae63-028651ed3655
  • Reward: $200-500 USDC per program per framework
  • Framework: Poseidon (new framework addition)
  • Programs: transfer-sol ($200), account-data ($300)

Testing Checklist

  • Programs compile successfully with cargo check
  • TypeScript source files follow Poseidon patterns
  • Transpiled Anchor code uses anchor-lang 1.0.0
  • Tests use anchor-bankrun
  • Follows existing project structure
  • Package.json includes required scripts
  • Workspace Cargo.toml updated

Related Documentation


Author: Claude Opus 4.6 (wangxiaofei860208-source)
Submitted: 2026-04-17

…t-data

Implements Steel framework (v4.0.4) for two basic Solana programs:
- basics/transfer-sol/steel - SOL transfers via CPI and direct manipulation
- basics/account-data/steel - Structured data storage in program accounts

Steel is a lightweight Solana framework by Regolith Labs providing:
- Minimal boilerplate with helper macros
- Byte-based serialization using bytemuck
- Account validation helpers
- Type-safe instruction parsing

Each implementation includes:
- Complete Rust program with Steel framework patterns
- Rust unit tests using litesvm
- TypeScript integration tests using solana-bankrun
- Package.json with required build scripts

Changes:
- Added steel/program workspace members to Cargo.toml
- Added steel and num_enum workspace dependencies
- Created complete Steel implementations following project structure

Testing:
- Programs compile successfully with cargo check
- Follows existing project conventions
- Ready for CI/CD integration

Submitted for Superteam Earn bounty: Create Solana Programs Part 1
Bounty ID: 3a73f71c-5cc4-4b72-ae63-028651ed3655
Framework: Steel (new framework addition)
Programs: transfer-sol ($200), account-data ($300)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ount-data

- Add TypeScript source files using @solanaturbine/poseidon
- Add transpiled Anchor programs (anchor-lang 1.0.0)
- Add anchor-bankrun tests for both programs
- Update workspace Cargo.toml with new members
- Add POSEIDON_IMPLEMENTATION.md documentation

Bounty: Superteam Earn 3a73f71c-5cc4-4b72-ae63-028651ed3655
@wangxiaofei860208-source wangxiaofei860208-source changed the title feat: Add Steel framework implementations for transfer-sol and account-data feat: Add Steel and Poseidon framework implementations for transfer-sol and account-data Apr 17, 2026
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