-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gRPC wasm Clients #102
Comments
thanks @liangping ! will be integrating this into our gRPC client class. Appreciate the help! |
Awesome! If so i would like to use this instead of the current LCD endpoint on ping.pub. |
gRPCFTW |
@sascha1337 @liangping does this look like a good reference implementation? It looks like they were actually using this? https://github.com/confio/cosmjs-types/blob/main/src/cosmos/bank/v1beta1/query.ts#L1079 I think we can improve it a bit? Some ideas:
Any feedback or thoughts you may have on how we should implement this? |
On protobuf, It's good reference. It might be almost same, except this one: const rpc = createProtobufRpcClient(base); gRPC client need Http2(almost all web explorer(chrome, firefox) don't support it so far), we need implement it with WASM. |
look at export function createProtobufRpcClient(base: QueryClient): ProtobufRpcClient {
return {
request: (service: string, method: string, data: Uint8Array): Promise<Uint8Array> => {
const path = `/${service}/${method}`;
return base.queryUnverified(path, data);
},
};
} seems that we can just simply re-implement this method. public async queryUnverified(path: string, request: Uint8Array): Promise<Uint8Array> {
const response = await this.tmClient.abciQuery({
path: path,
data: request,
prove: false,
});
if (response.code) {
throw new Error(`Query failed with (${response.code}): ${response.log}`);
}
return response.value;
} |
I confirm that tmclient is implemented based on http, not http2 |
thank you @liangping 🙌🏻 this is great to have all the information we need for this issue in one place.
I think secret.js uses this for http2 https://github.com/improbable-eng/grpc-web Should we look at what secret is doing? https://github.com/scrtlabs/secret.js/blob/master/src/secret_network_client.ts#L636-L723 |
I think we are almost there. Secret did amazing works. |
Looking at more clients out there, found this one: |
Sometimes GitHub ui sucks, using mobile GitHub app now, i see meantion and comments that completely were kinda hidden on desktop 🤦♂️ I've worked a lot on grpc / introspection methods and solutions lately, if combined with cosmology repo // chain registry api's, this is really powerful stuff, need and built this for myself, so time to get that wrapped and packed to npm sers. |
Also check efficiency // references here on bottom |
NOTE: This might not strongly related to telescope.
Currently, most of web apps have to use Javascript/Typescript to connect with light client server, since most web explorers don’t support gRPC and http2.
It's very useful to build a gRPC client with Web assembly and http2. Once it is built, developers can easily invoke gRPC services underlying the Rest services. and it is smaller, faster, laser resources consumed.
With Telescope, This could be much earlier.
List all services
List Methods of a service:
invoke gRPC calls:
Call
cosmos.base.tendermint.v1beta1.Service.GetLatestBlock
return proto message.Therefore, We can call all services directly via gRPC
The text was updated successfully, but these errors were encountered: