hyperweb-io / hyperweb-io/telescope
allow customization of stargate clients with multiple modules/packages for one client (both amino/proto registries)
- Dominant language
- TypeScript
- Stars
- 154
- Forks
- 53
- PR merge metrics
- No merged PRs in 30d
Description
should be! with telescope you can pull the registry from the client generated files and make one massive stargate client
we should make a plugin option in telescope to make this easier, since each module currently gets bundled separately to avoid naming collisions (e.g. different version of governance can be in protos, so we had to make a sensible default)
## manual work around for now:
to manually do this, you’d find the registry/amino converters in the client of each package you want to combine, say osmosis and wasmd protos:
https://github.com/osmosis-labs/osmojs/blob/ad20842e5183a1182317f70509e66dc913b926be/packages/osmojs/src/codegen/osmosis/client.ts#L32-L48
https://github.com/osmosis-labs/osmojs/blob/main/packages/osmojs/src/codegen/cosmwasm/client.ts#L6-L9
merge the arrays
then
```js
import { GeneratedType, Registry, OfflineSigner } from "@cosmjs/proto-signing";
import { defaultRegistryTypes, AminoTypes, SigningStargateClient } from "@cosmjs/stargate";
const registry = new Registry([…myCombinedProtoRegistry]);
const aminoTypes = new AminoTypes({
…myCombinedAminoConverters
});
```
then make your client
```js
const client = await SigningStargateClient.connectWithSigner(rpcEndpoint, signer, {
registry: (registry as any),
aminoTypes
});
```
Now you have a single client that has everything you need!
## specs for TelescopeOptions
- [ ] generate a client file at the root, not in the module
- [ ] allow customization of the stargate client name
- [ ] allow for multiple clients, but this requires some thought around name configuration (maybe defaults to client1, client2 when there are more than 1)
- [ ] should we generate one client per it's own file? for tree-shaking?
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.