Search code examples
cosmos-sdkstarport

How do I set the root url when moving from sdk-version launchpad to starport of the Cosmos SDK?


I ran through the tutorials at https://tutorials.cosmos.network/, which was fun. Some use Cosmos SDK 0.40, which have a different code generation approach than Cosmos SDK 0.39. I decided to do the first tutorial over using the new SDK and it looks like my module URL for the REST API - http://localhost:1317 is coming in as undefined. Here is the network tab from the browser: XHR GET http://0.0.0.0:1317/undefined/poll. My application is called voter, so perhaps I need to set a variable voter somewhere?

I didn't really change too much so it just has the basic app scaffolding with the poll type.


Solution

  • As of this moment, the "Voter" tutorial hasn't been updated to Cosmos SDK Stargate. You get an error because the form component in the component library has changed and instead of making a request to the "REST" API, makes a request to the gRPC HTTP gateway endpoint.

    To get a list of polls from the frontend in the Stargate version of this tutorial, you can make a request to either :1317/voter/polls or :1317/alice/voter/voter/poll.