Skip to content

feat(swift): add Swift SDK implementation#685

Closed
sammccord wants to merge 1 commit intomainfrom
sammccord/swift-sdk
Closed

feat(swift): add Swift SDK implementation#685
sammccord wants to merge 1 commit intomainfrom
sammccord/swift-sdk

Conversation

@sammccord
Copy link
Copy Markdown
Contributor

Description

Add a complete Swift SDK for the Coinbase Developer Platform (CDP). This introduces a new swift/ directory with full EVM and Solana client support, following the same patterns as the existing TypeScript, Python, Go, and Rust SDKs.

Key additions:

  • CDPAuth module — JWT-based authentication with EC key parsing and token generation
  • CDPSDK moduleCdpClient with EvmClient and SolanaClient for account management, signing, and transactions
  • OpenAPI integration — Uses swift-openapi-generator for type-safe API client generation
  • Auth middleware — Automatically injects JWT auth and correlation headers
  • Error handling — Structured CdpError and APIError types
  • Examples — 19 runnable examples covering account creation, signing, transactions, and faucet requests for both EVM and Solana
  • CI workflows — Lint (swift-format), test, and publish (SPM tag-based) workflows
  • Documentation — README, CONTRIBUTING.md, and updated root CONTRIBUTING.md with Swift dev setup and release instructions

Tests

Unit tests added for:

  • JWT generation and validation (CDPAuthTests/JWTTests.swift)
  • EC key parsing — PEM, hex, and raw formats (CDPAuthTests/KeyParsingTests.swift)
  • Auth middleware header injection (CDPSDKTests/AuthMiddlewareTests.swift)
  • CdpClient initialization and configuration (CDPSDKTests/CdpClientTests.swift)
  • EVM client operations — create, get, list accounts, sign, send (CDPSDKTests/EvmClientTests.swift)
  • Solana client operations — create, get, list accounts, sign, send (CDPSDKTests/SolanaClientTests.swift)
Method: swift build + swift test
Platform: macOS (Swift 5.9+)

Output:
Build complete!
Test Suite 'All tests' passed.

Checklist

  • Updated the typescript README if relevant
  • Updated the python README if relevant
  • Added a changelog entry
  • Added e2e tests if introducing new functionality

Add complete Swift SDK with:
- CDPAuth module for JWT-based authentication
- CDPSDK module with EVM and Solana client support
- OpenAPI-generated client via swift-openapi-generator
- Auth middleware, error handling, and analytics correlation
- Unit tests for auth, client, EVM, and Solana modules
- CI workflows for lint, test, and publish
- Examples covering account creation, signing, and transactions
- Updated CONTRIBUTING.md with Swift dev setup and release instructions
@cb-heimdall
Copy link
Copy Markdown

🟡 Heimdall Review Status

Requirement Status More Info
Reviews 🟡 0/1
Denominator calculation
Show calculation
1 if user is bot 0
1 if user is external 0
2 if repo is sensitive 0
From .codeflow.yml 1
Additional review requirements
Show calculation
Max 0
0
From CODEOWNERS 0
Global minimum 0
Max 1
1
1 if commit is unverified 0
Sum 1

@sammccord
Copy link
Copy Markdown
Contributor Author

closing to extract to separate repo

@sammccord sammccord closed this May 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants