From ea83c6bea78e51b0f5ca2247f4ca21fa0acad3ca Mon Sep 17 00:00:00 2001 From: Dan Notestein Date: Tue, 30 Dec 2025 17:56:02 -0500 Subject: [PATCH] Add CLAUDE.md for AI-assisted development --- CLAUDE.md | 87 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 CLAUDE.md diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..e4c7a6c --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,87 @@ +# hive-uri + +## Project Overview + +TypeScript library for encoding and decoding Hive blockchain URIs (`hive://` protocol). Facilitates signing of Hive transactions by enabling secure sharing of transaction data across applications and devices without exposing private keys. Designed for wallet applications implementing the Hive URI signing protocol. + +## Tech Stack + +- **Language:** TypeScript (compiled to ES5) +- **Runtime:** Node.js and browsers +- **Build:** Make + TypeScript compiler +- **Linting:** TSLint +- **Package Manager:** Yarn + +### Key Dependencies + +- `url-parse` - URL parsing (runtime) +- `@hiveio/dhive` - Hive types (dev only, for typings) +- `bytebuffer` - Binary encoding (dev) + +## Directory Structure + +``` +src/ # TypeScript source files + index.ts # Main library - all exports +lib/ # Compiled JavaScript output (generated) +``` + +## Development Commands + +```bash +# Install dependencies +yarn install +# or +make node_modules + +# Build library +make lib + +# Lint with auto-fix +make lint + +# Clean build artifacts +make clean + +# Full clean (including node_modules) +make distclean +``` + +## Key Files + +- `src/index.ts` - Single source file containing all library code +- `package.json` - NPM package configuration +- `tsconfig.json` - TypeScript compiler settings +- `tslint.json` - Linting rules +- `Makefile` - Build automation + +## API Overview + +### Encoding Functions +- `encodeTx(tx, params?)` - Encode full transaction +- `encodeOp(op, params?)` - Encode single operation +- `encodeOps(ops, params?)` - Encode multiple operations +- `encodeMsg(msg, params?)` - Encode arbitrary message + +### Decoding Functions +- `decode(hiveUrl)` - Parse `hive://` URI, returns `{tx, params}` +- `resolveTransaction(utx, params, options)` - Replace placeholders with actual values +- `resolveCallback(url, ctx)` - Resolve callback URL template + +### Placeholders +- `__signer` - Username of signer +- `__expiration` - Transaction expiration time +- `__ref_block_num` / `__ref_block_prefix` - Reference block info + +## Coding Conventions + +- 4-space indentation +- Single quotes for strings +- No semicolons +- No interface name prefix (e.g., `Parameters` not `IParameters`) +- Triple equals with null-check exceptions allowed +- URL-safe Base64 encoding (`+` → `-`, `/` → `_`, `=` → `.`) + +## CI/CD Notes + +No GitLab CI configuration present. Build and test locally using Make commands. -- GitLab