@bennyblader/ddk-ts
v0.3.32
Published
dlcdevkit typescript bindings
Downloads
386
Maintainers
Readme
@bennyblader/ddk-ts
TypeScript/Node.js bindings for the DLC Dev Kit (DDK) - NAPI-RS based native bindings for Node.js applications.
Installation
npm install @bennyblader/ddk-ts
# or
pnpm add @bennyblader/ddk-tsThe package includes prebuilt binaries for:
- macOS ARM64 (Apple Silicon)
- Linux x64 (glibc)
Quick Start
import { version, createFundTxLockingScript } from '@bennyblader/ddk-ts'
console.log(`DDK Version: ${version()}`)For complete API documentation, see the main README.
Development
Prerequisites
- Node.js >= 14
- Rust >= 1.70
- pnpm
- NAPI-RS CLI:
npm install -g @napi-rs/cli
Building from Source
# Install dependencies
pnpm install
# Build for current platform
pnpm build
# Build for all supported platforms (Darwin ARM64 and Linux x64)
pnpm build:allJust Commands
# Build TypeScript bindings for current platform
just ts-build
# Build for all supported platforms
just ts-build-all
# Run example
just ts-example
# Run tests
just ts-test
# Development setup (build + example setup)
just ts-dev
# Release new version to npm
just ts-release <version>Project Structure
ddk-ts/
├── src-napi/ # Rust NAPI-RS source code
│ ├── lib.rs # Main library wrapper functions
│ ├── types.rs # Type definitions matching UDL
│ └── conversions.rs # Type conversions between Rust and JS
├── src/ # Generated TypeScript/JavaScript files
│ ├── index.js # Main entry point (generated)
│ └── index.d.ts # TypeScript definitions (generated)
├── npm/ # Platform-specific packages
│ ├── darwin-arm64/ # macOS ARM64 package
│ └── linux-x64-gnu/ # Linux x64 package
├── example/ # Example TypeScript application
├── __test__/ # Test files
└── scripts/ # Build and verification scripts
└── verify-parity.cjs # Ensures API compatibility with UDLTesting
# Run all tests
pnpm test
# Run verification scripts
pnpm verify # Run all verification checks
pnpm verify:parity # Check API parity with UDL definitions
pnpm verify:types # Verify TypeScript typesPlatform Support
| Platform | Architecture | Status | | -------- | --------------------- | --------------- | | macOS | ARM64 (Apple Silicon) | ✅ Supported | | Linux | x64 (glibc) | ✅ Supported | | macOS | x64 (Intel) | ❌ Not included | | Windows | x64 | ❌ Not included | | Linux | ARM64 | ❌ Not included |
Release Process
To release a new version:
just ts-release 0.2.0This will:
- Check working directory is clean
- Update version in package.json
- Build for all supported platforms
- Run tests
- Commit and tag as
ddk-ts-v0.2.0 - Push to GitHub
- Publish to npm
API Compatibility
The TypeScript bindings maintain 100% API compatibility with the UniFFI definitions. The verify-parity.cjs script ensures that all functions defined in the UDL file are properly exposed in the TypeScript bindings.
Troubleshooting
Missing Binary
If you get an error about missing binaries, ensure your platform is supported or build from source:
pnpm buildBigInt Support
All 64-bit integers are represented as JavaScript BigInt. Make sure your Node.js version supports BigInt (Node.js 10.4.0+).
License
MIT
