Skip to content

CAIP-2/10/19 interop projection layer (asCaip View + parsers) #9

@ignromanov

Description

@ignromanov

Part of #8 · Layer 2 (interop) · 🟢 P1 · Phase 3 (parallel, does NOT gate codec cutover)

What

Add @void-layer/interop TS package over the codec's decoded model (Hybrid C):

  • asCaip(invoice) → { chain: Caip2, account: Caip10, asset: Caip19 } View
  • fromCaip2() / fromCaip10() / fromCaip19() parsers

Core @void-layer/types stays raw (network_id + token_address) — CAIP is a projection, never a wire byte.

Why

  • CAIP-19 natively resolves cross-chain token disambiguation (e.g. WETH same address on Base/Optimism) that the wire token-dict only approximates — the chain prefix does the work.
  • CAIP-2 is Final (frozen since 2021, zero breaking changes); projection-only binding is safe.
  • Matches WalletConnect / MetaMask / SIWE which already speak CAIP.

Acceptance

  • asCaip / fromCaip* implemented, parity-tested against decoded model
  • native (slip44) vs ERC-20 (erc20:) handled; cross-chain WETH verified
  • no change to Rust wire hot-path
  • round-trip raw → CAIP → raw is lossless

wiki: concepts/caip-2-blockchain-id.md, concepts/caip-10-account-id.md, concepts/caip-19-asset-id.md, comparisons/caip-2-vs-dict-chain-encoding.md

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requeststandardsExternal-standard adoption (spec 087)

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions