cosmology-tech / telescope

A TypeScript Transpiler for Cosmos Protobufs ⚛️
https://cosmology.zone/products/telescope
Apache License 2.0
145 stars 43 forks source link

[EPIC] simplify Amino/Protobuf hurdles, making it easy to craft transactions as a client-side developer. #11

Closed daniel-farina closed 2 years ago

daniel-farina commented 2 years ago

Sprint 1

In regards to the prototype https://github.com/pyramation/osmosis-protobufs when running files as the input, getting this error, so I instead created a for loop and am generating the types for each proto file individually. filed issue here https://github.com/osmosis-labs/osmosis/issues/1185

osmosis/gamm/v1beta1/tx.proto:9:9: "osmosis.gamm.v1beta1.Msg" is already defined in file "osmosis/gamm/pool-models/balancer/tx.proto"

some protobuf references version don’t exist (e.g. https://github.com/gogo/protobuf/issues/737 ) so I found them here https://github.com/regen-network/protobuf

https://github.com/cosmology-finance/cosmology/blob/master/packages/protobufs/src/proto/osmosis/gamm/v1beta1/tx.ts#L1560-L1563

https://github.com/cosmology-finance/cosmology/blob/master/packages/protobufs/bin/gen-proto.js

Backlog

daniel-farina commented 2 years ago

We will setup a call with @ValarDragon to discuss some issues related to chain/go.

pyramation commented 2 years ago

inspiration and research

protoc-gen-typescript

Upon more research I found a go repository to generate typescript https://pkg.go.dev/github.com/ocavue/protoc-gen-typescript — this may be what @Thunnini had originally used? It seems to use namespaces which is what ts-proto seems to be missing.

UPDATE keplr new proto

https://github.com/chainapsis/keplr-wallet/tree/proto-types/packages/proto-types/proto-types-gen

protobuf-ts

Another seemingly well-maintained protobuf to typescript repo in node: https://github.com/timostamm/protobuf-ts/tree/master/packages

cosmjs-types

I like how cosmjs-types uses git submodules to pull in the cosmos SDK protobufs: https://github.com/confio/cosmjs-types

other references we can learn from https://github.com/confio/cosmjs-types/blob/main/scripts/codegen.sh https://github.com/confio/cosmjs-types/blob/main/scripts/codegen-cosmos-sdk.sh

terra

Terra has a repo called terra.proto for generation, which also depends on ts-proto

https://github.com/terra-money/terra.proto

https://github.com/terra-money/terra.proto/blob/main/js/scripts/proto-gen.sh

tmc

https://github.com/tmc/protoc-gen-apidocs (for generating docs in markdown, interesting) https://github.com/tmc/grpcutil/tree/master/protoc-gen-tstypes

grpc tools

https://github.com/agreatfool/grpc_tools_node_protoc_ts#how-to-use

secret

looks like secret uses the grpc-web option in ts-proto — likely because secret needs to use http2

https://github.com/scrtlabs/secret.js/blob/master/src/protobuf_stuff/secret/registration/v1beta1/query.ts#L3

improbable-end/grpc-web

The same team that built the grpc client that secret uses built their own gen tool: https://github.com/improbable-eng/ts-protoc-gen

jonator commented 2 years ago

Yeah git submodules seems a fit solution for that kind of problem.