This repository is part of the Tether WDK (Wallet Development Kit) ecosystem. It follows strict coding conventions and tooling standards to ensure consistency, reliability, and cross-platform compatibility (Node.js and Bare runtime).
- Architecture: Modular architecture with clear separation between Core, Wallet managers, and Protocols.
- Runtime: Supports both Node.js and Bare runtime.
- Language: JavaScript (ES2015+).
- Module System: ES Modules (
"type": "module"in package.json). - Type Checking: TypeScript is used purely for generating type declarations (
.d.ts). The source code remains JavaScript.- Command:
npm run build:types
- Command:
- Linting:
standard(JavaScript Standard Style).- Command:
npm run lint/npm run lint:fix
- Command:
- Testing:
jest(configured withexperimental-vm-modulesfor ESM support).- Command:
npm test
- Command:
- Dependencies:
cross-envis consistently used for environment variable management in scripts.
- File Naming: Kebab-case (e.g.,
wallet-manager.js). - Class Naming: PascalCase (e.g.,
WdkManager). - Private Members: Prefixed with
_(underscore) and explicitly documented with@private. - Imports: Explicit file extensions are mandatory (e.g.,
import ... from './file.js'). - Copyright: All source files must include the standard Tether copyright header.
Source code must be strictly typed using JSDoc comments to support the build:types process.
- Types: Use
@typedefto define or import types. - Methods: Use
@param,@returns,@throws. - Generics: Use
@template.
- Install:
npm install - Lint:
npm run lint - Test:
npm test - Build Types:
npm run build:types
index.js: Main entry point.bare.js: Entry point for Bare runtime optimization.src/: Core logic.types/: Generated type definitions (do not edit manually).
- Domain: Core Orchestrator.
- Role: Central entry point for the WDK. Manages lifecycle of multiple wallet instances and protocols.
- Key Pattern: Dependency Injection (registerWallet, registerProtocol).
- Architecture:
WdkManagerclass manages a collection ofWalletManagerinstances.