cosmos / cosmjs

The Swiss Army knife to power JavaScript based client solutions ranging from Web apps/explorers over browser extensions to server-side clients like faucets/scrapers.
https://cosmos.github.io/cosmjs/
Apache License 2.0
652 stars 339 forks source link

Create new docs for using telescope generated message types #1313

Open webmaster128 opened 2 years ago

webmaster128 commented 2 years ago

Update of this page: https://github.com/cosmos/cosmjs/blob/main/packages/stargate/CUSTOM_PROTOBUF_CODECS.md

pyramation commented 2 years ago

maybe we do docs incrementally as well, so something like:

pyramation commented 2 years ago

for query client maybe we can keep initial docs the same, but add an additional link to how you can leverage the rpcClients option in telescope if you're not doing it manually https://github.com/osmosis-labs/telescope#rpc-clients

This allows for syntax like this for RPC:

import { osmosis } from './codegen';

const main = async () => {
  const client = await osmosis.ClientFactory.createRPCQueryClient({ rpcEndpoint });

  // now you can query the modules
  const pool = await client.osmosis.gamm.v1beta1.pool({ poolId: "1" });
  const balance = await client.cosmos.bank.v1beta1.allBalances({ address: 'osmo1addresshere' });
};
pyramation commented 2 years ago

and for instantiating signing clients we have this section we could point to, if folks use our amino converters https://github.com/osmosis-labs/telescope#manually-registering-types

pyramation commented 2 years ago

we also have generated signing clients https://github.com/osmosis-labs/telescope#stargate-clients