Skip to main content
Adding a protocol touches three files and edits no existing protocol’s code path. If your change required editing another protocol, the design was circumvented — reconsider it.

1. Implement the contract

Start from examples/minimal-adapter/MemoAdapter.ts — the complete IProtocolAdapter contract against an in-memory wallet, in about 170 dependency-free lines. It is the smallest thing that satisfies the contract and is meant to be copied.
Declaring the capability groups you support (& IRgbOperations) gives you required rather than optional methods, so the compiler catches a half-implemented group.
No SDK types cross the contract. Translate your SDK’s shapes into the domain types in src/types/. SDK objects may be read loosely inside your adapter, but only domain types may leave it.

2. Describe it in the manifest

Add one entry to PROTOCOL_CAPABILITIES in src/capabilities/index.ts, and one to PROTOCOL_OPERATIONS in operations.ts.
This is the step that does the work. The router, the UI and lite aggregation read these flags — they never ask “which protocol is this?”
When you find yourself wanting a new method on IProtocolAdapter for your protocol alone, you want a capability flag here instead.

3. Teach the classifier your address format

If your protocol introduces a destination format the engine can’t recognise, add it to src/router/destination.ts with the protocols capable of paying it:
candidates is the possible set. Whether a candidate is a direct route is then verified against the manifest, so a protocol never claims it can settle something its flags say it can’t.

4. Register it

Or add it to createWdkRegistry if it is WDK-backed.

What you get for free

Once those three files are in place, with no further changes:
  • CrossProtocolRouter considers your protocol for every compatible destination, and ranks it against the others by the user’s route preference.
  • buildUnifiedReceiveURI can carry your rail in the same QR as the rest.
  • aggregateForLite folds your BTC balance into the single lite “BTC” figure.
  • Every screen in a consuming wallet renders your protocol using the manifest flags.

Verify it

The tour is the fastest check that your manifest entry behaves: it prints the capability table, routes several destinations and shows which protocols were considered.
Pure modules — router, disclosure, receive, capabilities — must stay fully covered by tests. See CONTRIBUTING.md and AGENTS.md, the latter being the invariant list for coding agents working in the repo.