Skip to content

[BOUNTY] Create TypeScript SDK Package Structure and Core Utilities#214

Open
TeapoyY wants to merge 1 commit intoANAVHEOBA:mainfrom
TeapoyY:main
Open

[BOUNTY] Create TypeScript SDK Package Structure and Core Utilities#214
TeapoyY wants to merge 1 commit intoANAVHEOBA:mainfrom
TeapoyY:main

Conversation

@TeapoyY
Copy link
Copy Markdown

@TeapoyY TeapoyY commented Apr 4, 2026

Bounty: Create TypeScript SDK Package Structure and Core Utilities

Reward: Per bounty specification | Domain: SDK

Changes

Created the foundational TypeScript SDK package (@privacylayer/sdk) for PrivacyLayer with the following structure and implementations:

Package Structure

sdk/ ├── package.json # Package configuration with all dependencies ├── tsconfig.json # Strict TypeScript configuration ├── .eslintrc.js # ESLint with TypeScript support ├── .prettierrc # Code formatting rules ├── jest.config.js # Jest test configuration with coverage thresholds ├── README.md # Installation and usage documentation ├── src/ │ ├── index.ts # Main exports + PrivacyLayer client class │ ├── types.ts # Note, Denomination, DepositReceipt, NetworkConfig, etc. │ ├── constants.ts # NETWORKS config, MERKLE_TREE_DEPTH, FIELD_SIZE │ ├── utils/ │ │ ├── index.ts │ │ ├── crypto.ts # randomFieldElement, hashPair, computeCommitment, deriveNullifier │ │ ├── encoding.ts # bytesToHex, hexToBytes, hexToBase64, etc. │ │ └── validation.ts # validateAddress, validateAmount, validateFieldElement, etc. │ └── __tests__/ │ └── utils.test.ts # Comprehensive unit tests for all utilities └── dist/ # Build output (generated on npm run build)

Key Implementations

  • Core Types: Note, Denomination enum, DepositReceipt, NetworkConfig, MerkleProof, ValidationResult
  • Cryptographic Utils: Random field element generation, Pedersen-like hashing, commitment/nullifier derivation
  • Encoding Utils: Hex/bytes/base64 conversion, bigint serialization
  • Validation Utils: Stellar address validation, amount validation, field element validation, transaction hash validation
  • PrivacyLayer Client: Basic client class with network configuration

Build & Test

pm run build compiles TypeScript to dist/ with type declarations

pm test runs Jest with all utility tests

pm run coverage validates >80% coverage threshold

pm run lint validates TypeScript with ESLint

Files Changed

  • sdk/package.json - New package with dependencies
  • sdk/tsconfig.json - TypeScript strict configuration
  • sdk/.eslintrc.js - ESLint rules
  • sdk/.prettierrc - Prettier formatting
  • sdk/jest.config.js - Jest with 80% coverage threshold
  • sdk/README.md - Documentation
  • sdk/src/index.ts - Main SDK exports
  • sdk/src/types.ts - Type definitions
  • sdk/src/constants.ts - Constants and network configs
  • sdk/src/utils/crypto.ts - Cryptographic utilities
  • sdk/src/utils/encoding.ts - Encoding utilities
  • sdk/src/utils/validation.ts - Validation utilities
  • sdk/src/utils/index.ts - Utils barrel export
  • sdk/src/tests/utils.test.ts - Unit tests

Acceptance Criteria

  • Package structure created with all files
  • [x]
    pm install ready (dependencies specified)
  • [x]
    pm run build compiles TypeScript successfully
  • [x]
    pm test runs Jest tests
  • [x]
    pm run lint passes ESLint checks
  • Type definitions exported correctly
  • README with installation and basic usage
  • All utility functions have unit tests
  • Code coverage >80% (configured)

Closes #7

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 TypeScript SDK Package Structure and Core Utilities

1 participant