Skip to content

Commit

Permalink
Merge branch 'main' into patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
Anmol1696 authored Nov 4, 2024
2 parents 4dfd6af + 22aabf2 commit 38263f6
Show file tree
Hide file tree
Showing 197 changed files with 25,616 additions and 0 deletions.
89 changes: 89 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: Build templates

on:
workflow_dispatch:
pull_request:
types: [opened, reopened, synchronize]

jobs:
setup:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Get examples from directories
id: get-matrix
env:
DIRS: '["templates"]' # Add more dirs here if needed
run: |
# Get examples from each directory
all_examples=$(for dir in $(echo $DIRS | jq -r '.[]'); do
for example in $(ls ./$dir/); do
echo "{\"example\": \"$example\", \"path\": \"$dir\"}"
done
done | jq -s -c '.')
echo "matrix=$all_examples" >> $GITHUB_OUTPUT
outputs:
matrix: ${{ steps.get-matrix.outputs.matrix }}

build:
needs: [setup]
runs-on: ubuntu-latest
strategy:
max-parallel: 4
fail-fast: true
matrix:
include: ${{fromJson(needs.setup.outputs.matrix)}}
env:
EXAMPLE_DIR: ${{ github.workspace }}/dest/${{ matrix.example }}
YARN_ENABLE_IMMUTABLE_INSTALLS: false

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 20

- name: Set up Yarn
uses: threeal/[email protected]

- name: Cache dependencies
uses: actions/cache@v4
with:
path: |
${{ env.EXAMPLE_DIR }}/node_modules
key: ${{ runner.os }}-modules-${{ matrix.example }}-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-modules-${{ matrix.example }}-
- name: Cache NextJS
uses: actions/cache@v4
with:
path: |
${{ env.EXAMPLE_DIR }}/.next/cache
key: ${{ runner.os }}-nextjs-${{ matrix.example }}-${{ hashFiles(
'${{ env.EXAMPLE_DIR }}/**/*.{js,jsx,ts,tsx}',
'!${{ env.EXAMPLE_DIR }}/node_modules/**',
'!${{ env.EXAMPLE_DIR }}/.next/**',
'!${{ env.EXAMPLE_DIR }}/.yarn/**'
) }}
restore-keys: |
${{ runner.os }}-nextjs-${{ matrix.example }}-
- name: Build example
run: |
echo "Building example: ${{ matrix.example }} from /${{ matrix.path }}"
mkdir -p ${{ env.EXAMPLE_DIR }}
cp -r ./${{ matrix.path }}/${{ matrix.example }}/* ${{ env.EXAMPLE_DIR }}/
cd ${{ env.EXAMPLE_DIR }}
ls -la
yarn install
yarn build
39 changes: 39 additions & 0 deletions .github/workflows/prod-tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Run Tests Prod

on:
push:
branches:
- main
workflow_dispatch:

jobs:
run-tests:
runs-on: ubuntu-latest

steps:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20

- name: Set up Yarn
uses: threeal/[email protected]
with:
cache: false

- name: Install Dependencies
run: |
echo "YARN_ENABLE_IMMUTABLE_INSTALLS=false" >> $GITHUB_ENV
npm install -g create-hyperweb-app
- name: hyperweb
run: |
cha --template hyperweb --name hyperweb
cd hyperweb
yarn build
- name: chain-admin
run: |
cha --template chain-admin --name chain-admin
cd chain-admin
yarn build
6 changes: 6 additions & 0 deletions templates/chain-admin/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"extends": "next/core-web-vitals",
"rules": {
"react-hooks/exhaustive-deps": "off"
}
}
36 changes: 36 additions & 0 deletions templates/chain-admin/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.pnpm-debug.log*

# local env files
.env*.local

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts
4 changes: 4 additions & 0 deletions templates/chain-admin/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Change Log

All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
4 changes: 4 additions & 0 deletions templates/chain-admin/CREDITS.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
CREDITS
-------
The CosmWasm dashboard of this project was inspired by the design of https://github.com/alleslabs/celatone-frontend
No code from the original project was used in this project.
94 changes: 94 additions & 0 deletions templates/chain-admin/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
This is a Cosmos App project bootstrapped with [`create-hyperweb-app`](https://github.com/hyperweb-io/create-hyperweb-app).

## Getting Started

First, install the packages and run the development server:

```bash
yarn && yarn dev
```

Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.

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

## How to connect to Starship chains

1. Follow the official guide to set up Starship: https://docs.cosmology.zone/starship/get-started/step-1
2. Run `yarn starship start` and wait until Starship is up and running
3. Open a new terminal and run `yarn dev`
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
5. Go to "Faucet" to get some test tokens and enjoy!

## Learn More

### Chain Registry

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

- https://github.com/cosmology-tech/chain-registry

### Cosmology Videos

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

- https://cosmology.zone/learn

### Cosmos Kit

A wallet connector for the Cosmos ⚛️

- https://github.com/cosmology-tech/cosmos-kit

### Telescope

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.

- https://github.com/cosmology-tech/telescope

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

### CosmWasm TS Codegen

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.

- https://github.com/CosmWasm/ts-codegen

🎥 [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`!

## Learn More about Next.js

To learn more about Next.js, take a look at the following resources:

- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.

You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!

## Deploy on Vercel

The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.

Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.

## Related

Checkout these related projects:

- [@cosmology/telescope](https://github.com/cosmology-tech/telescope) Your Frontend Companion for Building with TypeScript with Cosmos SDK Modules.
- [@cosmwasm/ts-codegen](https://github.com/CosmWasm/ts-codegen) Convert your CosmWasm smart contracts into dev-friendly TypeScript classes.
- [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.
- [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.
- [create-cosmos-app](https://github.com/cosmology-tech/create-cosmos-app) Set up a modern Cosmos app by running one command.
- [interchain-ui](https://github.com/cosmology-tech/interchain-ui) The Interchain Design System, empowering developers with a flexible, easy-to-use UI kit.
- [starship](https://github.com/cosmology-tech/starship) Unified Testing and Development for the Interchain.

## Credits

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

## Disclaimer

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

No developer or entity involved in creating this software will be liable for any claims or damages whatsoever associated with your use, inability to use, or your interaction with other users of the code, including any direct, indirect, incidental, special, exemplary, punitive or consequential damages, or loss of profits, cryptocurrencies, tokens, or anything else of value.
56 changes: 56 additions & 0 deletions templates/chain-admin/components/asset-list/AssetListSection.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import React from 'react';
import { Text, Box } from '@interchain-ui/react';
import AssetsOverview from './AssetsOverview';
import { useChain } from '@cosmos-kit/react';
import { useAssets } from '@/hooks';
import { ChainName } from 'cosmos-kit';

interface AssetListSectionProps {
chainName: ChainName;
children?: React.ReactNode;
}

export const AssetListSection = ({ chainName }: AssetListSectionProps) => {
const { isWalletConnected } = useChain(chainName);
const { data, isLoading, refetch } = useAssets(chainName);

if (!isWalletConnected) {
return (
<Box maxWidth="768px" marginX="auto" marginBottom="60px">
<Text
fontSize="$xl"
fontWeight="$semibold"
attributes={{ marginBottom: '$10' }}
>
My assets
</Text>

<Box
height="160px"
bg="$cardBg"
borderRadius="$md"
p="$6"
display="flex"
justifyContent="center"
alignItems="center"
>
<Text fontSize="$md" color="$textSecondary">
Connect the wallet to see the assets
</Text>
</Box>
</Box>
);
}

return (
<Box maxWidth="$containerMd" marginX="auto" marginBottom="$17">
<AssetsOverview
isLoading={isLoading || !data}
assets={data?.assets ?? []}
prices={data?.prices ?? {}}
selectedChainName={chainName}
refetch={refetch}
/>
</Box>
);
};
Loading

0 comments on commit 38263f6

Please sign in to comment.