The wire

One package defines every read and every stream, and both the SDK and the API implement it — so the client and the server cannot drift apart without the build saying so.

@prophecy-dev/connect-wire is the contract. It holds the shared types and the read and stream definitions, and both sides implement it: the API serves what the wire declares, the SDK consumes what the wire declares.

That sounds like bookkeeping. It’s the reason a Connect integration is safe to build on.

What it buys you

In a normal HTTP integration, the server’s response shape and the client’s expectation of it are two independent beliefs that happen to agree today. They drift silently: a field is renamed, a nullable appears, a unit changes from wei to a decimal string — and the first thing that notices is a user looking at a wrong number.

Here there is one declaration. If a response shape changes, the wire changes; if the wire changes, the SDK that reads it changes in the same release. You are not depending on our API’s current behaviour, you’re depending on a published, versioned type.

What that means in practice

  • Upgrade the SDK and the types tell you what moved. A wire change surfaces as a type error at your build, not as a wrong number in production.
  • Pin deliberately. These are 0.x packages, so a caret pins to the minor. connect-sdk and connect-react declare the wire range they implement; keeping them in step is the supported path.
  • Don’t hand-roll the HTTP calls. You can — the endpoints are ordinary HTTP — but you’d be re-creating the second independent belief the wire exists to delete.

Where the numbers come from

The wire says what a response is. It doesn’t say what a price or a position means — that’s derive once, and it’s a separate guarantee.