Skip to content

Commit 803661d

Browse files
committed
doc: add "connect to starship chains" guide
1 parent 06e716d commit 803661d

File tree

4 files changed

+88
-53
lines changed

4 files changed

+88
-53
lines changed

examples/chain-template-spawn/components/voting/Voting.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,9 @@ export function Voting({ chainName }: VotingProps) {
107107
alignItems="center"
108108
justifyContent="center"
109109
>
110-
<Text fontSize="$lg">No proposals found</Text>
110+
<Text fontSize="$md" color="$textSecondary" fontWeight="500">
111+
No proposals found
112+
</Text>
111113
</Box>
112114
);
113115

examples/chain-template/README.md

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,43 +12,50 @@ Open [http://localhost:3000](http://localhost:3000) with your browser to see the
1212

1313
You can start editing the page by modifying `pages/index.tsx`. The page auto-updates as you edit the file.
1414

15-
## Learn More
15+
## How to connect to Starship chains
16+
17+
1. Follow the official guide to set up Starship: https://docs.cosmology.zone/starship/get-started/step-1
18+
2. Run `yarn starship start` and wait until Starship is up and running
19+
3. Open a new terminal and run `yarn dev`
20+
4. Open http://localhost:3000, select "Osmosis Devnet" or "Cosmos Hub Devnet" from the chain dropdown in the top right corner then click "Connect Wallet" in the left sidebar to connect to the chain
21+
5. Go to "Faucet" to get some test tokens and enjoy!
22+
23+
## Learn More
1624

1725
### Chain Registry
1826

1927
The npm package for the Official Cosmos chain registry. Get chain and token data for you application.
2028

21-
* https://github.com/cosmology-tech/chain-registry
29+
- https://github.com/cosmology-tech/chain-registry
2230

2331
### Cosmology Videos
2432

2533
Checkout more videos for how to use various frontend tooling in the Cosmos!
2634

27-
* https://cosmology.zone/learn
35+
- https://cosmology.zone/learn
2836

2937
### Cosmos Kit
3038

3139
A wallet connector for the Cosmos ⚛️
3240

33-
* https://github.com/cosmology-tech/cosmos-kit
41+
- https://github.com/cosmology-tech/cosmos-kit
3442

3543
### Telescope
3644

3745
A "babel for the Cosmos", Telescope is a TypeScript Transpiler for Cosmos Protobufs. Telescope is used to generate libraries for Cosmos blockchains. Simply point to your protobuffer files and create developer-friendly Typescript libraries for teams to build on your blockchain.
3846

39-
* https://github.com/cosmology-tech/telescope
47+
- https://github.com/cosmology-tech/telescope
4048

4149
🎥 [Checkout the Telescope video playlist](https://www.youtube.com/watch?v=n82MsLe82mk&list=PL-lMkVv7GZwyQaK6bp6kMdOS5mzosxytC) to learn how to use `telescope`!
4250

4351
### CosmWasm TS Codegen
4452

4553
The quickest and easiest way to interact with CosmWasm Contracts. @cosmwasm/ts-codegen converts your CosmWasm smart contracts into dev-friendly TypeScript classes so you can focus on shipping code.
4654

47-
* https://github.com/CosmWasm/ts-codegen
55+
- https://github.com/CosmWasm/ts-codegen
4856

4957
🎥 [Checkout the CosmWasm/ts-codegen video playlist](https://www.youtube.com/watch?v=D_A5V2PfNLA&list=PL-lMkVv7GZwz1KO3jANwr5W4MoziruXwK) to learn how to use `ts-codegen`!
5058

51-
5259
## Learn More about Next.js
5360

5461
To learn more about Next.js, take a look at the following resources:
@@ -68,19 +75,18 @@ Check out our [Next.js deployment documentation](https://nextjs.org/docs/deploym
6875

6976
Checkout these related projects:
7077

71-
* [@cosmology/telescope](https://github.com/cosmology-tech/telescope) Your Frontend Companion for Building with TypeScript with Cosmos SDK Modules.
72-
* [@cosmwasm/ts-codegen](https://github.com/CosmWasm/ts-codegen) Convert your CosmWasm smart contracts into dev-friendly TypeScript classes.
73-
* [chain-registry](https://github.com/cosmology-tech/chain-registry) Everything from token symbols, logos, and IBC denominations for all assets you want to support in your application.
74-
* [cosmos-kit](https://github.com/cosmology-tech/cosmos-kit) Experience the convenience of connecting with a variety of web3 wallets through a single, streamlined interface.
75-
* [create-cosmos-app](https://github.com/cosmology-tech/create-cosmos-app) Set up a modern Cosmos app by running one command.
76-
* [interchain-ui](https://github.com/cosmology-tech/interchain-ui) The Interchain Design System, empowering developers with a flexible, easy-to-use UI kit.
77-
* [starship](https://github.com/cosmology-tech/starship) Unified Testing and Development for the Interchain.
78+
- [@cosmology/telescope](https://github.com/cosmology-tech/telescope) Your Frontend Companion for Building with TypeScript with Cosmos SDK Modules.
79+
- [@cosmwasm/ts-codegen](https://github.com/CosmWasm/ts-codegen) Convert your CosmWasm smart contracts into dev-friendly TypeScript classes.
80+
- [chain-registry](https://github.com/cosmology-tech/chain-registry) Everything from token symbols, logos, and IBC denominations for all assets you want to support in your application.
81+
- [cosmos-kit](https://github.com/cosmology-tech/cosmos-kit) Experience the convenience of connecting with a variety of web3 wallets through a single, streamlined interface.
82+
- [create-cosmos-app](https://github.com/cosmology-tech/create-cosmos-app) Set up a modern Cosmos app by running one command.
83+
- [interchain-ui](https://github.com/cosmology-tech/interchain-ui) The Interchain Design System, empowering developers with a flexible, easy-to-use UI kit.
84+
- [starship](https://github.com/cosmology-tech/starship) Unified Testing and Development for the Interchain.
7885

7986
## Credits
8087

8188
🛠 Built by Cosmology — if you like our tools, please consider delegating to [our validator ⚛️](https://cosmology.zone/validator)
8289

83-
8490
## Disclaimer
8591

8692
AS DESCRIBED IN THE LICENSES, THE SOFTWARE IS PROVIDED “AS IS”, AT YOUR OWN RISK, AND WITHOUT WARRANTIES OF ANY KIND.

examples/chain-template/components/staking/StakingSection.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { useEffect } from 'react';
12
import { useChain } from '@cosmos-kit/react';
23
import { ChainName } from 'cosmos-kit';
34
import { Box, Spinner, Text } from '@interchain-ui/react';
@@ -15,6 +16,10 @@ export const StakingSection = ({ chainName }: { chainName: ChainName }) => {
1516
data?.allValidators || [],
1617
);
1718

19+
useEffect(() => {
20+
refetch();
21+
}, []);
22+
1823
return (
1924
<Box my="$16" maxWidth="$containerMd" mx="auto">
2025
{!isWalletConnected ? (

examples/chain-template/components/voting/Voting.tsx

Lines changed: 59 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -98,52 +98,74 @@ export function Voting({ chainName }: VotingProps) {
9898
setTitle(`#${proposal.id?.toString()} ${proposal?.title}`);
9999
}
100100

101+
const empty = (
102+
<Box
103+
height="$24"
104+
display="flex"
105+
alignItems="center"
106+
justifyContent="center"
107+
>
108+
<Text fontSize="$md" color="$textSecondary" fontWeight="500">
109+
No proposals found
110+
</Text>
111+
</Box>
112+
);
113+
101114
const content = (
102115
<Box mt="$12">
103-
{data.proposals?.map((proposal, index) => {
104-
let tally = proposal.finalTallyResult;
105-
if (proposal.status === ProposalStatus.PROPOSAL_STATUS_VOTING_PERIOD) {
106-
tally = tallies[proposal.id.toString()];
107-
}
108-
return (
109-
<Box
110-
my="$8"
111-
key={proposal.id?.toString() || index}
112-
position="relative"
113-
attributes={{ onClick: () => onClickProposal(index) }}
114-
>
115-
{data.votes[proposal.id.toString()] ? (
116+
{data.proposals?.length === 0
117+
? empty
118+
: data.proposals?.map((proposal, index) => {
119+
let tally = proposal.finalTallyResult;
120+
if (
121+
proposal.status === ProposalStatus.PROPOSAL_STATUS_VOTING_PERIOD
122+
) {
123+
tally = tallies[proposal.id.toString()];
124+
}
125+
return (
116126
<Box
117-
position="absolute"
118-
px="$4"
119-
py="$2"
120-
top="$4"
121-
right="$6"
122-
borderRadius="$md"
123-
backgroundColor="$green400"
127+
my="$8"
128+
key={proposal.id?.toString() || index}
129+
position="relative"
130+
attributes={{ onClick: () => onClickProposal(index) }}
124131
>
125-
<Text color="$white" fontSize="$xs" fontWeight="$bold">
126-
Voted
127-
</Text>
132+
{data.votes[proposal.id.toString()] ? (
133+
<Box
134+
position="absolute"
135+
px="$4"
136+
py="$2"
137+
top="$4"
138+
right="$6"
139+
borderRadius="$md"
140+
backgroundColor="$green400"
141+
>
142+
<Text color="$white" fontSize="$xs" fontWeight="$bold">
143+
Voted
144+
</Text>
145+
</Box>
146+
) : null}
147+
<GovernanceProposalItem
148+
id={`# ${proposal.id?.toString()}`}
149+
key={proposal.submitTime?.getTime()}
150+
// @ts-ignore
151+
title={proposal.content?.title || proposal.title || ''}
152+
status={status(proposal.status)}
153+
votes={votes(tally!)}
154+
endTime={formatDate(proposal.votingEndTime)!}
155+
/>
128156
</Box>
129-
) : null}
130-
<GovernanceProposalItem
131-
id={`# ${proposal.id?.toString()}`}
132-
key={proposal.submitTime?.getTime()}
133-
// @ts-ignore
134-
title={proposal.content?.title || proposal.title || ''}
135-
status={status(proposal.status)}
136-
votes={votes(tally!)}
137-
endTime={formatDate(proposal.votingEndTime)!}
138-
/>
139-
</Box>
140-
);
141-
})}
157+
);
158+
})}
142159
</Box>
143160
);
144161

145162
const connect = (
146-
<Box mt="$8" display="flex" alignItems="center" justifyContent="center">
163+
<Box
164+
height="$24"
165+
display="flex"
166+
alignItems="center"
167+
justifyContent="center"
168+
>
147169
<Text fontSize="$lg">
148170
Please connect to your wallet to see the proposals.
149171
</Text>

0 commit comments

Comments
 (0)