Skip to content

[BOUNTY] Create API Documentation with OpenAPI#154

Open
HuiNeng6 wants to merge 1 commit intoANAVHEOBA:mainfrom
HuiNeng6:feature/api-documentation
Open

[BOUNTY] Create API Documentation with OpenAPI#154
HuiNeng6 wants to merge 1 commit intoANAVHEOBA:mainfrom
HuiNeng6:feature/api-documentation

Conversation

@HuiNeng6
Copy link

Summary

This PR implements comprehensive API documentation for the PrivacyLayer contract as requested in issue #62.

Deliverables

1. OpenAPI Specification (docs/api/openapi.yaml)

  • Complete OpenAPI 3.0.3 specification
  • All contract endpoints documented:
    • Core Operations: deposit, withdraw
    • View Functions: get_root, deposit_count, is_known_root, is_spent, get_config
    • Admin Functions: initialize, pause, unpause, set_verifying_key
  • Request/response schemas
  • Error codes and descriptions
  • Authentication requirements
  • Rate limiting information

2. Contract ABI Documentation (docs/api/CONTRACT_ABI.md)

  • All function signatures and parameters
  • Data type definitions (Denomination, VerifyingKey, Proof, PublicInputs, PoolConfig)
  • Event definitions (DepositEvent, WithdrawEvent, PauseEvent)
  • Error codes table
  • Gas estimates for each function
  • Security considerations
  • Integration guide

3. Code Examples

  • TypeScript (docs/api/examples/typescript.ts)

    • Full client implementation
    • Deposit and withdraw flows
    • Note management
    • Pool state queries
  • Python (docs/api/examples/python.py)

    • Async client implementation
    • All contract interactions
    • Note handling and storage

4. Postman Collection (docs/api/postman_collection.json)

  • All API endpoints as request templates
  • Environment variables for testnet/mainnet
  • Pre-configured examples
  • Ready for import and testing

5. Swagger UI (docs/api/swagger-ui.html)

  • Interactive API documentation
  • Try-it-out functionality
  • Custom header with project branding
  • Syntax highlighting

Files Changed

  • \docs/api/openapi.yaml\ - OpenAPI specification (650+ lines)
  • \docs/api/CONTRACT_ABI.md\ - Contract ABI docs (400+ lines)
  • \docs/api/examples/typescript.ts\ - TypeScript examples (350+ lines)
  • \docs/api/examples/python.py\ - Python examples (500+ lines)
  • \docs/api/postman_collection.json\ - Postman collection (550+ lines)
  • \docs/api/swagger-ui.html\ - Swagger UI setup

Testing

  • OpenAPI spec validates against OpenAPI 3.0.3 schema
  • Code examples follow best practices
  • Postman collection imports successfully

Related

Payment Address

  • USDC (Solana): \9xsvaaYbVrRuMu6JbXq5wVY9tDAz5S6BFzmjBkUaM865\

Submitted by HuiNeng6

- OpenAPI 3.0.3 specification for all contract endpoints
- Contract ABI documentation with all functions, types, and events
- TypeScript/JavaScript code examples
- Python SDK examples
- Postman collection for API testing
- Swagger UI for interactive documentation

Closes ANAVHEOBA#62

Bounty: API Documentation with OpenAPI
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.

[BOUNTY] Create API Documentation with OpenAPI

1 participant