NEAR DevHub

Automate Generation of Swift RPC Client for NEAR Protocol

by NEAR DevHub

|
|
|
token icon
6,000USDC

Total Prizes

6,000

USDC

1st

suit case

...

Submissions

suit case

Remaining

Kamal's Submission#259

View Profile

Status: Reviewed

  • The sponsor action is required
  • The submission is locked and cannot be edited

Application Date

10 Sep 2025

Tweet Link

-

Are you submitting as an individual or a business entity?

Individual

I’ve read and agree to the Official Rules

I’ve read DevHub’s Code of Conduct and commit to honoring it.

Anything Else

Completed Deliverables ✅ :

1. Automated Code Generation (Sources/Generate/Generate.swift)

- Downloads NEAR OpenAPI spec

- Patches for JSON-RPC compatibility (single / endpoint)

- Automatic snake_case to camelCase conversion

- Post-processing for Swift conventions

2. Two Swift Packages

- NEARJSONRPCTypes: Type definitions only

- NEARJSONRPCClient: Full client with JSON-RPC wrapper

3. GitHub Actions Automation

- Daily spec updates (.github/workflows/generate.yml)

- Automated PR creation for changes

- release-please integration

- Cross-platform testing (.github/workflows/test.yml)

4. Comprehensive Testing

- Unit tests for types and client

- Mock-based integration tests

- Coverage reporting setup

5. Documentation

- README with quick start

- Usage guide with examples

- Contributing guidelines

- Architecture documentation

- Example application

Key Features:

- Path Patching: Handles the OpenAPI spec vs JSON-RPC implementation

mismatch

- Type Safety: Full Swift type safety with Codable

- Naming Conventions: Automatic conversion to Swift camelCase

- Async/Await: Modern Swift concurrency

- Error Handling: Comprehensive error types

- Developer Experience: Clean API with convenience methods


Project Structure:

near-swift-client/

├── Sources/

│ ├── NEARJSONRPCTypes/ # Type definitions

│ ├── NEARJSONRPCClient/ # Client implementation

│ └── Generate/ # Code generator

├── Tests/ # Unit & integration tests

├── Examples/ # Usage examples

├── docs/ # Documentation

├── scripts/ # Setup & publish scripts

└── .github/workflows/ # CI/CD automation

The implementation follows best practices from the existing Rust and

TypeScript clients while being idiomatic for Swift developers.

I have pushed this to a public github repo and waiting to have community review.

Threads

|

Filter by

SKILLS NEEDED

Backend

Mobile

CONTACT

Reach outif you have any questions about this listing