5.0.1 • Published 1 year ago
@penumbra-zone-test/protobuf v5.0.1
@penumbra-zone-test/protobuf
If you are looking for a Penumbra extension client
You should install @penumbra-zone-test/client. This package is provided for
developers interested in lower-level work or more detailed configuration.
This package collects types and some configuration intended for use with
@penumbra-zone-test/transport-dom.
To use this package, you need to enable the Buf Schema Registry:
echo "@buf:registry=https://buf.build/gen/npm/v1/" >> .npmrcExports
This package exports a typeRegistry (and jsonOptions including said
registry) for use with createChannelTransport or any @connectrpc transport.
All types necessary for a to serialize/deserialize communication with Prax or any other Penumbra extension are included.
Service definitions for all relevant services are also re-exported.
A Simple example
import { jsonOptions } from '@penumbra-zone-test/protobuf';
import { createChannelTransport } from '@penumbra-zone-test/transport-dom';
// naively get first available provider
const provider = Object.values(window[Symbol.for('penumbra')])[0];
void provider.request();
// establish a transport
const transport = createChannelTransport({ jsonOptions, getPort: provider.connect });
// export function to create client
export const createPenumbraClient = serviceType => createPromiseClient(serviceType, transport);