Skip to content

Comments

docs: add BitGoWasm API design conventions#176

Draft
lcovar wants to merge 1 commit intomasterfrom
conventions
Draft

docs: add BitGoWasm API design conventions#176
lcovar wants to merge 1 commit intomasterfrom
conventions

Conversation

@lcovar
Copy link
Contributor

@lcovar lcovar commented Feb 23, 2026

documents 7 architectural patterns enforced in code reviews across wasm-utxo, wasm-solana, and wasm-dot.

these are design decisions that could reasonably be made differently but we've standardized on:

  1. uint8array everywhere - no hex/base64 on transaction api
  2. bigint for amounts - never number or string for monetary values
  3. enums not magic strings - type safety for transaction types, instruction types
  4. return transaction objects from builders - not raw bytes
  5. parsing separate from transaction - standalone parseTransaction() function, not .parse() method
  6. follow wasm-utxo conventions - fromBytes, toBytes, get wasm(), getId
  7. typed wrappers - keypair/pubkey classes, not string-encoded keys

distilled from otto's recurring review comments. prevents review churn by making the patterns explicit.

ref: wasm-dot PR #145 discussion about parse convention alignment

@lcovar lcovar requested a review from a team as a code owner February 23, 2026 23:48
@lcovar lcovar marked this pull request as draft February 23, 2026 23:49
@lcovar lcovar marked this pull request as draft February 23, 2026 23:49
@lcovar lcovar changed the title Add BitGoWasm API design conventions docs: add BitGoWasm API design conventions Feb 23, 2026
Document 7 core architectural patterns enforced in code reviews:
- Uint8Array for binary data (no hex on Transaction)
- bigint for monetary amounts
- Enums over magic strings
- Builders return Transaction objects
- Parsing separate from Transaction
- Consistent wrapper API (fromBytes, toBytes, get wasm)
- Typed wrappers over string-encoded data

These conventions prevent review churn by defining how WASM wrapper
APIs should be structured. Distilled from recurring patterns in
wasm-utxo, wasm-solana, and wasm-dot reviews.
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.

1 participant