cosmjs icon indicating copy to clipboard operation
cosmjs copied to clipboard

Create new docs for using telescope generated message types

Open webmaster128 opened this issue 3 years ago • 4 comments

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

webmaster128 avatar Oct 27 '22 07:10 webmaster128

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

  • Step 1: Acquire the definition files (keep same)
  • Step 2: Generate codec files (Replace with telescope)
  • Step 3a: Instantiate a signing client using your custom message types (keep same, potentially add a link)
  • Step 3b: Instantiate a query client using your custom query service (keep same, potentially add a link)

pyramation avatar Oct 27 '22 09:10 pyramation

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 avatar Oct 27 '22 09:10 pyramation

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 avatar Oct 27 '22 09:10 pyramation

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

pyramation avatar Oct 27 '22 09:10 pyramation