Skip to content

Commit

Permalink
document client (#999)
Browse files Browse the repository at this point in the history
  • Loading branch information
turbocrime committed Apr 27, 2024
1 parent 5b21ff1 commit 757201a
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions docs/extension-services.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,20 +38,33 @@ import { ViewService } from '@buf/penumbra-zone_penumbra.connectrpc_es/penumbra/
const viewClient = createPraxClient(ViewService);
```

### Connection to other Penumbra wallets
An incredibly simple use might be something like this.

Other providers may be available.
```ts
import { bech32mAddress } from '@penumbra-zone/bech32m/penumbra';

const { address } = await viewClient.addressByIndex({});
console.log(bech32mAddress(address));
```

### More control

Other providers may be available, and you can configure the transport however
you'd like. Use of the client is identical.

```ts
import { getAnyPenumbraPort } from '@penumbra-zone/client';
import { ViewService } from '@buf/penumbra-zone_penumbra.connectrpc_es/penumbra/view/v1/view_connect';
import { bech32mAddress } from '@penumbra-zone/bech32m/penumbra';

const channelTransport = createChannelTransport({
getPort: getAnyPenumbraPort,
jsonOptions: { typeRegistry: createRegistry(ViewService) },
});

const viewClient = createPromiseClient(ViewService, channelTransport);
const { address } = await viewClient.addressByIndex({});
console.log(bech32mAddress(address));
```

### The actual interface
Expand Down

0 comments on commit 757201a

Please sign in to comment.